Difference between revisions of "Creating a new SPObject"

From Inkscape Wiki
Jump to navigation Jump to search
(add changes for c++ified SPObject)
 
(68 intermediate revisions by 8 users not shown)
Line 1: Line 1:
http://valium911.uni.cc/ valium <a href="http://valium911.uni.cc/">valium</a> [http://valium911.uni.cc/ valium] http://didrex911.uni.cc/ didrex <a href="http://didrex911.uni.cc/">didrex</a> [http://didrex911.uni.cc/ didrex] http://diazepam911.uni.cc/ diazepam <a href="http://diazepam911.uni.cc/">diazepam</a>
Create two new files in your source tree, sp-customobject.cpp and sp-customobject.h.
http://100storyes.lilxxx.net
http://girls4u.lilxxx.net
http://lolitas.lilxxx.net
http://peepparty.lilxxx.net
http://sexy69girls.lilxxx.net
http://wemen4u.lilxxx.net
http://xxx69u.lilxxx.net
http://xxxu.lilxxx.net
http://buy-cialis.edfirstaid.com
http://buy-lunesta.edfirstaid.com
http://buy-tadalafil-cialis.edfirstaid.com
[http://diazepam911.uni.cc/ diazepam] http://xanax911.uni.cc/ xanax <a href="http://xanax911.uni.cc/">xanax</a> [http://xanax911.uni.cc/ xanax] http://phentermine911.uni.cc/ phentermine <a href="http://phentermine911.uni.cc/">phentermine</a> [http://phentermine911.uni.cc/ phentermine] http://lortab911.uni.cc/ lortab <a href="http://lortab911.uni.cc/">lortab</a> [http://lortab911.uni.cc/ lortab] http://hydrocodone911.uni.cc/ hydrocodone <a href="http://hydrocodone911.uni.cc/">hydrocodone</a> [http://hydrocodone911.uni.cc/ hydrocodone] http://vicodin911.uni.cc/ vicodin <a href="http://vicodin911.uni.cc/">vicodin</a> [http://vicodin911.uni.cc/ vicodin] http://adipex911.uni.cc/ adipex <a href="http://adipex911.uni.cc/">adipex</a> [http://adipex911.uni.cc/ adipex] http://celebrex911.uni.cc/ celebrex <a href="http://celebrex911.uni.cc/">celebrex</a> [http://celebrex911.uni.cc/ celebrex] http://viagra911.uni.cc/ viagra <a href="http://viagra911.uni.cc/">viagra</a> [http://viagra911.uni.cc/ viagra] http://xenical911.uni.cc/ xenical <a href="http://xenical911.uni.cc/">xenical</a> [http://xenical911.uni.cc/ xenical] http://cialis911.uni.cc/ cialis <a href="http://cialis911.uni.cc/">cialis</a> [http://cialis911.uni.cc/ cialis] http://alprazolam911.uni.cc/ alprazolam <a href="http://alprazolam911.uni.cc/">alprazolam</a> [http://alprazolam911.uni.cc/ alpazolam] http://lorazepam911.uni.cc/ lorazepam <a href="http://lorazepam911.uni.cc/">lorazepam</a> [http://lorazepam911.uni.cc/ lorazepam] http://carisoprodol911.uni.cc/ carisoprodol <a href="http://carisoprodol911.uni.cc/">carisoprodol</a> [http://carisoprodol911.uni.cc/ carisoprodol] http://codeine911.uni.cc/ codeine <a href="http://codeine911.uni.cc/">codeine</a> [http://codeine911.uni.cc/ codeine] http://vioxx911.uni.cc/ vioxx <a href="http://vioxx911.uni.cc/">vioxx</a> [http://vioxx911.uni.cc/ vioxx] http://wellbutrin911.uni.cc/ wellbutrin <a href="http://wellbutrin911.uni.cc/">wellbutrin</a> [http://wellbutrin911.uni.cc/ wellbutrin] http://oxycodone911.uni.cc/ oxycodone <a href="http://oxycodone911.uni.cc/">oxycodone</a> [http://oxycodone911.uni.cc/ oxycodone] http://tramadol911.uni.cc/ tramadol <a href="http://tramadol911.uni.cc/">tramadol</a> [http://tramadol911.uni.cc/ tramadol] http://ambien911.uni.cc/ ambien <a href="http://ambien911.uni.cc/">ambien</a> [http://ambien911.uni.cc/ ambien] http://aldara911.uni.cc/ aldara <a href="http://aldara911.uni.cc/">aldara</a> [http://aldara911.uni.cc/ aldara] http://bontril911.uni.cc/ bontril <a href="http://bontril911.uni.cc/">bontril</a> [http://bontril911.uni.cc/ bontril] http://viagrawiki.uni.cc/ viagra wiki <a href="http://viagrawiki.uni.cc/">viagra wiki</a> [http://viagrawiki.uni.cc/ viagra wiki] http://adipex.uni.cc http://adipex-online.6x.to http://adipex-online-order.6x.to http://butalbital.uni.cc http://buy-alprazolam.uni.cc http://buy-carisoprodol.uni.cc http://buy-cheap-accupril.uni.cc http://buy-cheap-aciphex.uni.cc http://buy-cheap-actonel.uni.cc http://buy-cheap-actos.uni.cc http://buy-cheap-adipex.uni.cc http://buy-cheap-aldara.uni.cc http://buy-cheap-alprazolam.uni.cc http://buy-cheap-altace.uni.cc http://buy-cheap-amaryl.uni.cc http://buy-cheap-ambien.uni.cc http://buy-cheap-amoxil.uni.cc http://buy-cheap-androgel.uni.cc http://buy-cheap-atenolol.uni.cc http://buy-cheap-ativan.uni.cc http://buy-cheap-avandia.uni.cc http://buy-cheap-avapro.uni.cc http://buy-cheap-bextra.uni.cc http://buy-cheap-biaxin.uni.cc http://buy-cheap-bontril.uni.cc http://buy-cheap-buspar.uni.cc http://buy-cheap-captopril.uni.cc http://buy-cheap-cartia.uni.cc http://buy-cheap-cefzil.uni.cc http://buy-cheap-celebrex.uni.cc http://buy-cheap-celexa.uni.cc http://buy-cheap-cialis.uni.cc http://buy-cheap-cipro.uni.cc http://buy-cheap-claritin-d.uni.cc http://buy-cheap-clonazepam.uni.cc http://buy-cheap-clonidine.uni.cc http://buy-cheap-codeine.uni.cc http://buy-cheap-coreg.uni.cc http://buy-cheap-cozaar.uni.cc http://buy-cheap-denavir.uni.cc http://buy-cheap-diazepam.6x.to http://buy-cheap-diazepam.uni.cc http://buy-cheap-didrex.uni.cc http://buy-cheap-diflucan.uni.cc http://buy-cheap-effexor.uni.cc http://buy-cheap-estradiol.uni.cc http://buy-cheap-evista.uni.cc http://buy-cheap-fioricet.uni.cc http://buy-cheap-fiorinal.uni.cc http://buy-cheap-flexeril.uni.cc http://buy-cheap-flonase.uni.cc http://buy-cheap-fosamax.uni.cc http://buy-cheap-furosemide.uni.cc http://buy-cheap-ibuprofen.uni.cc http://buy-cheap-imitrex.uni.cc http://buy-cheap-ionamin.uni.cc http://buy-cheap-levaquin.qn.com http://buy-cheap-levitra.uni.cc http://buy-cheap-lexapro.uni.cc http://buy-cheap-lisinopril.qn.com http://buy-cheap-lorazepam.uni.cc http://buy-cheap-lorcet.uni.cc http://buy-cheap-lortab.boom.ru http://buy-cheap-lortab.uni.cc http://buy-cheap-lotensin.qn.com http://buy-cheap-meclizine.qn.com http://buy-cheap-meridia.uni.cc http://buy-cheap-metformin.qn.com http://buy-cheap-metoprolol.qn.com http://buy-cheap-minocycline.qn.com http://buy-cheap-mobic.uni.cc http://buy-cheap-monopril.qn.com http://buy-cheap-motrin.uni.cc http://buy-cheap-naproxen.qn.com http://buy-cheap-nasacort.uni.cc http://buy-cheap-nasonex.uni.cc http://buy-cheap-neurontin.uni.cc http://buy-cheap-nexium.uni.cc http://buy-cheap-nifedipine.qn.com http://buy-cheap-norflex.uni.cc http://buy-cheap-norvasc.qn.com http://buy-cheap-ortho-evra.uni.cc http://buy-cheap-paxil.uni.cc http://buy-cheap-phentermine.6x.to http://buy-cheap-plavix.qn.com http://buy-cheap-pravachol.fromru.com http://buy-cheap-prilosec.uni.cc http://buy-cheap-prinivil.uni.cc http://buy-cheap-propecia.uni.cc http://buy-cheap-protonix.uni.cc http://buy-cheap-prozac.uni.cc http://buy-cheap-remeron.uni.cc http://buy-cheap-renova.uni.cc http://buy-cheap-restoril.uni.cc http://buy-cheap-retin-a.uni.cc http://buy-cheap-seroquel.uni.cc http://buy-cheap-skelaxin.uni.cc http://buy-cheap-soma.uni.cc http://buy-cheap-sonata.uni.cc http://buy-cheap-temazepam.uni.cc http://buy-cheap-tenuate.uni.cc http://buy-cheap-terazosin.uni.cc http://buy-cheap-tiazac.uni.cc http://buy-cheap-tramadol.uni.cc http://buy-cheap-trazodone.uni.cc http://buy-cheap-tricyclen.uni.cc http://buy-cheap-trimox.uni.cc http://buy-cheap-ultram.6x.to http://buy-cheap-ultram.uni.cc http://buy-cheap-valium.uni.cc http://buy-cheap-valtrex.uni.cc http://buy-cheap-vaniqa.uni.cc http://buy-cheap-viagra.uni.cc http://buy-cheap-vicodin.6x.to http://buy-cheap-vicodin.uni.cc http://buy-cheap-vicoprofen.uni.cc http://buy-cheap-vioxx.uni.cc http://buy-cheap-wellbutrin.uni.cc http://buy-cheap-xanax.6x.to http://buy-cheap-xanax.uni.cc http://buy-cheap-xenical.uni.cc http://buy-cheap-yasmin.uni.cc http://buy-cheap-zanaflex.uni.cc http://buy-


<a href="http://buy-wine-online.uni.cc/">buy-wine-online</a> <a href="http://watch.uni.cc/">watch</a> <a href="http://dental-care.uni.cc/">dental care</a> <a href="http://hair-care.uni.cc/">hair care</a> <a href="http://skin-care.uni.cc/">skin care</a> <a href="http://murray-hotel.uni.cc/">murray hotel</a> <a href="http://adipex.uni.cc/">adipex</a> <a href="http://adipex-online.6x.to/">adipex online</a> <a href="http://adipex-online-order.6x.to/">adipex online order</a> <a href="http://butalbital.uni.cc/">butalbital</a> <a href="http://buy-alprazolam.uni.cc">buy alprazolam</a> <a href="http://buy-carisoprodol.uni.cc">buy carisoprodol</a> <a href="http://buy-cheap-accupril.uni.cc">buy cheap accupril</a> <a href="http://buy-cheap-aciphex.uni.cc">buy cheap aciphex</a> <a href="http://buy-cheap-actonel.uni.cc">buy cheap actonel</a> <a href="http://buy-cheap-actos.uni.cc">buy cheap actos</a> <a href="http://buy-cheap-adipex.uni.cc">buy cheap adipex</a> <a href="http://buy-cheap-aldara.uni.cc">buy cheap aldara</a> <a href="http://buy-cheap-alprazolam.uni.cc">buy cheap alprazolam</a> <a href="http://buy-cheap-altace.uni.cc">buy cheap altace</a> <a href="http://buy-cheap-amaryl.uni.cc">buy cheap amaryl</a> <a href="http://buy-cheap-ambien.uni.cc">buy cheap ambien</a> <a href="http://buy-cheap-amoxil.uni.cc">buy cheap amoxil</a> <a href="http://buy-cheap-androgel.uni.cc">buy cheap androgel</a> <a href="http://buy-cheap-atenolol.uni.cc">buy cheap atenolol</a> <a href="http://buy-cheap-ativan.uni.cc">buy cheap ativan</a> <a href="http://buy-cheap-avandia.uni.cc">buy cheap avandia</a> <a href="http://buy-cheap-avapro.uni.cc">buy cheap avapro</a> <a href="http://buy-cheap-bextra.uni.cc">buy cheap bextra</a> <a href="http://buy-cheap-biaxin.uni.cc">buy cheap biaxin</a> <a href="http://buy-cheap-bontril.uni.cc">buy cheap bontril</a> http://buy-cheap-buspar.uni.cc http://buy-cheap-captopril.uni.cc http://buy-cheap-cartia.uni.cc http://buy-cheap-cefzil.uni.cc http://buy-cheap-celebrex.uni.cc http://buy-cheap-celexa.uni.cc http://buy-cheap-cialis.uni.cc http://buy-cheap-cipro.uni.cc http://buy-cheap-claritin-d.uni.cc http://buy-cheap-clonazepam.uni.cc http://buy-cheap-clonidine.uni.cc http://buy-cheap-codeine.uni.cc http://buy-cheap-coreg.uni.cc http://buy-cheap-cozaar.uni.cc http://buy-cheap-denavir.uni.cc http://buy-cheap-diazepam.6x.to http://buy-cheap-diazepam.uni.cc http://buy-cheap-didrex.uni.cc http://buy-cheap-diflucan.uni.cc http://buy-cheap-effexor.uni.cc http://buy-cheap-estradiol.uni.cc http://buy-cheap-evista.uni.cc http://buy-cheap-fioricet.uni.cc http://buy-cheap-fiorinal.uni.cc http://buy-cheap-flexeril.uni.cc http://buy-cheap-flonase.uni.cc http://buy-cheap-fosamax.uni.cc http://buy-cheap-furosemide.uni.cc http://buy-cheap-ibuprofen.uni.cc http://buy-cheap-imitrex.uni.cc http://buy-cheap-ionamin.uni.cc http://buy-cheap-levaquin.qn.com http://buy-cheap-levitra.uni.cc http://buy-cheap-lexapro.uni.cc http://buy-cheap-lisinopril.qn.com http://buy-cheap-lorazepam.uni.cc http://buy-cheap-lorcet.uni.cc http://buy-cheap-lortab.boom.ru http://buy-cheap-lortab.uni.cc http://buy-cheap-lotensin.qn.com http://buy-cheap-meclizine.qn.com http://buy-cheap-meridia.uni.cc http://buy-cheap-metformin.qn.com http://buy-cheap-metoprolol.qn.com http://buy-cheap-minocycline.qn.com http://buy-cheap-mobic.uni.cc http://buy-cheap-monopril.qn.com http://buy-cheap-motrin.uni.cc http://buy-cheap-naproxen.qn.com http://buy-cheap-nasacort.uni.cc http://buy-cheap-nasonex.uni.cc http://buy-cheap-neurontin.uni.cc http://buy-cheap-nexium.uni.cc http://buy-cheap-nifedipine.qn.com http://buy-cheap-norflex.uni.cc http://buy-cheap-norvasc.qn.com http://buy-cheap-ortho-evra.uni.cc http://buy-cheap-paxil.uni.cc http://buy-cheap-phentermine.6x.to http://buy-cheap-plavix.qn.com http://buy-cheap-pravachol.fromru.com http://buy-cheap-prilosec.uni.cc http://buy-cheap-prinivil.uni.cc http://buy-cheap-propecia.uni.cc http://buy-cheap-protonix.uni.cc http://buy-cheap-prozac.uni.cc http://buy-cheap-remeron.uni.cc http://buy-cheap-renova.uni.cc http://buy-cheap-restoril.uni.cc http://buy-cheap-retin-a.uni.cc http://buy-cheap-seroquel.uni.cc http://buy-cheap-skelaxin.uni.cc http://buy-cheap-soma.uni.cc http://buy-cheap-sonata.uni.cc http://buy-cheap-temazepam.uni.cc http://buy-cheap-tenuate.uni.cc http://buy-cheap-terazosin.uni.cc http://buy-cheap-tiazac.uni.cc http://buy-cheap-tramadol.uni.cc http://buy-cheap-trazodone.uni.cc http://buy-cheap-tricyclen.uni.cc http://buy-cheap-trimox.uni.cc http://buy-cheap-ultram.6x.to http://buy-cheap-ultram.uni.cc http://buy-cheap-valium.uni.cc http://buy-cheap-valtrex.uni.cc http://buy-cheap-vaniqa.uni.cc http://buy-cheap-viagra.uni.cc http://buy-cheap-vicodin.6x.to http://buy-cheap-vicodin.uni.cc http://buy-cheap-vicoprofen.uni.cc http://buy-cheap-vioxx.uni.cc http://buy-cheap-wellbutrin.uni.cc http://buy-cheap-xanax.6x.to http://buy-cheap-xanax.uni.cc http://buy-cheap-xenical.uni.cc http://buy-cheap-yasmin.uni.cc http://buy-cheap-zanaflex.uni.cc http://buy-cheap-zestoretic.uni.cc http://buy-cheap-zestril.uni.cc http://buy-cheap-zithromax.uni.cc http://buy-cheap-zoloft.uni.cc http://buy-cheap-zovirax.uni.cc http://buy-cheap-zyban.uni.cc http://buy-cheap-zydone.uni.cc http://buy-cheap-zyprexa.uni.cc http://buy-cheap-zyrtec.uni.cc http://buy-hydrocodone.6x.to http://buy-hydrocodone.uni.cc http://buy-imitrex-oral.uni.cc http://buy-lorazepam.uni.cc http://buy-nortriptyline.qn.com http://buy-penicillin-vk.qn.com http://buy-phendimetrazine.uni.cc http://buy-phentermine.uni.cc http://buy-tramadol.6x.to http://buy-ultram.6x.to http://cheap-acetaminophen.uni.cc http://cheap-adipex.6x.to http://cheap-alprazolam.6x.to http://cheap-celebrex.6x.to http://cheap-diazepam.uni.cc http://cheap-hydrocodone.6x.to http://cheap-hydrocodone.uni.cc http://cheap-lortab.6x.to http://cheap-lortab.fromru.com http://cheap-oxycontin.6x.to http://cheap-prevacid.boom.ru http://cheap-promethazine.uni.cc http://cheap-propoxyphene.uni.cc http://cheap-propranolol.uni.cc http://cheap-spironolactone.uni.cc http://cheap-talwin-nx.uni.cc http://cheap-tetracycline.uni.cc http://cheap-tramadol.6x.to http://cheap-ultram.6x.to http://cheap-valium.6x.to http://cheap-valium.uni.cc http://cheap-vicodin.6x.to http://cheap-vicodin.uni.cc http://cheap-vicodin-online.6x.to http://cheap-xanax.uni.cc http://cheap-zolpidem.6x.to http://darvocet-n-100.uni.cc http://diazepam.uni.cc http://discount-phentermine.6x.to http://fioricet.uni.cc http://hydrocodone.uni.cc http://hydrocodone-online.6x.to http://online-cheap-diazepam.6x.to http://online-valium.6x.to http://order-phentermine.6x.to http://order-tramadol.6x.to http://order-ultram.6x.to http://order-vicodin.6x.to http://oxycontin.uni.cc http://phentermine.uni.cc http://purchase-phentermine.6x.to http://tramadol-online.6x.to http://ultram.uni.cc http://valium.uni.cc http://valium-tablet.6x.to http://vicodin.uni.cc http://vicodin-online.6x.to http://xanax.uni.cc http://xanax-tablet.6x.to Copy sp-skeleton.cpp and sp-skeleton.h to your files, and rename everything from /skeleton/i to your name.
sp-customobject.h
#ifndef SP_CUSTOMOBJECT_H_SEEN
#define SP_CUSTOMOBJECT_H_SEEN
/** \file
  * Your custom object implementation
  *
  * Authors:
  *  You
  *
  * Copyright (C) You 2???
  * Released under GNU GPL, read the file 'COPYING' for more information
  */
#include "sp-object.h"
/* Skeleton base class */
#define SP_CUSTOM_OBJECT(o) (dynamic_cast<SPCustomObject*>(o))
#define SP_IS_CUSTOM_OBJECT(o) (dynamic_cast<SPCustomObject*>(o) != NULL)
 
class SPCustomObject : public SPObject {
  public:
    SPCustomObject() {}
    virtual ~SPCustomObject() {}
    // to do anything useful with your new object, you need to override the following methods:
    virtual void build(SPDocument * doc, Inkscape::XML::Node *repr);
    virtual void set(unsigned key, const gchar* value);
    virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags);
};
#endif /* !SP_CUSTOMOBJECT_H_SEEN */


Add your object name to the list in sp-object-repr.cpp's repr_name_entries, and add the new .h file to the include list at the top. This will let your new SPObject have it's functions get called when a Repr appears in the tree.
 
Add this code into your .cpp file, which will register your SP object with the XML tree:
namespace {
    SPObject* createCustomObject() {
        return new SPCustomObject();
    }
    bool customObjectsRegistered = SPFactory::instance().registerObject("name_in_svg", createCustomObject);
  }
(If your SPObject doesn't have a useful XML representation, you can skip this call.)
 
When you override build, set, or write, you need to include a call to the base class method:
 
void
SPCustomObject::build(SPDocument* doc, Inkscape::XML::Node* repr) {
    // read in attributes from repr
    readAttr( "inkscape:not-an-attribute" ); // this propogates up to SPObject, which calls the virtual set() method, finally calling back here
    SPObject::build(doc, repr);
    // maybe do some more stuff here
}
 
Inkscape::XML::Node*
SPCustomObject::write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags) {
    // write our attributes to XML
   
    // the repr doesn't exist, we need to create it
    if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
        repr = doc->createElement("name_in_svg");
    }
    if (flags & SP_OBJECT_WRITE_EXT) {
        // write Inkscape-only objects here, not copied to plain SVG dump.
        repr->setAttribute("inkscape:not-an-attribute");
    }
    SPObject::write(doc, repr, flags);
    // and possibly do anything else here
    return repr;
}
 
void
SPCustomObject::set(unsigned int key, gchar const* value) {
    // set an object from its value
    switch (key) {
        case SP_ATTR_INKSCAPE_CUSTOM:
            if ((value && *value) && !strcmp(value, "true")) {
                val = true;
            }
            break;
        default:
            SPObject::set(key, value);
            break;
    }
}

Latest revision as of 20:40, 14 May 2014

Create two new files in your source tree, sp-customobject.cpp and sp-customobject.h.

sp-customobject.h

#ifndef SP_CUSTOMOBJECT_H_SEEN
#define SP_CUSTOMOBJECT_H_SEEN

/** \file
 * Your custom object implementation
 * 
 * Authors:
 *   You
 *
 * Copyright (C) You 2???
 * Released under GNU GPL, read the file 'COPYING' for more information
 */

#include "sp-object.h"

/* Skeleton base class */

#define SP_CUSTOM_OBJECT(o) (dynamic_cast<SPCustomObject*>(o))
#define SP_IS_CUSTOM_OBJECT(o) (dynamic_cast<SPCustomObject*>(o) != NULL)
 
class SPCustomObject : public SPObject {
public:
    SPCustomObject() {}
    virtual ~SPCustomObject() {}

    // to do anything useful with your new object, you need to override the following methods:
    virtual void build(SPDocument * doc, Inkscape::XML::Node *repr);
    virtual void set(unsigned key, const gchar* value);
    virtual Inkscape::XML::Node* write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags);
};


#endif /* !SP_CUSTOMOBJECT_H_SEEN */


Add this code into your .cpp file, which will register your SP object with the XML tree:

namespace {
    SPObject* createCustomObject() {
        return new SPCustomObject();
    }
    bool customObjectsRegistered = SPFactory::instance().registerObject("name_in_svg", createCustomObject);
}

(If your SPObject doesn't have a useful XML representation, you can skip this call.)

When you override build, set, or write, you need to include a call to the base class method:

void
SPCustomObject::build(SPDocument* doc, Inkscape::XML::Node* repr) {
    // read in attributes from repr
    readAttr( "inkscape:not-an-attribute" ); // this propogates up to SPObject, which calls the virtual set() method, finally calling back here
    SPObject::build(doc, repr);

    // maybe do some more stuff here
}
Inkscape::XML::Node*
SPCustomObject::write(Inkscape::XML::Document* doc, Inkscape::XML::Node* repr, guint flags) {
    // write our attributes to XML
    
    // the repr doesn't exist, we need to create it
    if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
        repr = doc->createElement("name_in_svg");
    }

    if (flags & SP_OBJECT_WRITE_EXT) {
        // write Inkscape-only objects here, not copied to plain SVG dump.
        repr->setAttribute("inkscape:not-an-attribute");
    }
    SPObject::write(doc, repr, flags);
    // and possibly do anything else here
    return repr;
}
void
SPCustomObject::set(unsigned int key, gchar const* value) {
    // set an object from its value
    switch (key) {
        case SP_ATTR_INKSCAPE_CUSTOM:
            if ((value && *value) && !strcmp(value, "true")) {
                val = true;
            }
            break;
        default:
            SPObject::set(key, value);
            break;
    }
}