Ignore:
Timestamp:
Sep 16, 2009, 2:22:36 PM (15 years ago)
Author:
dkearney
Message:

adding configure/dump functions to plot object, creating simple test case for dumping xml
all objects should have "run" as their parent path if no parent path is provided.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/objects/RpNumber.cc

    r1568 r1569  
    2828    // FIXME: empty names should be autoname'd
    2929    this->name("");
    30     this->path("");
     30    this->path("run");
    3131    this->label("");
    3232    this->desc("");
     
    4848
    4949    this->name(name);
    50     this->path("");
     50    this->path("run");
    5151    this->label("");
    5252    this->desc("");
     
    7474
    7575    this->name(name);
    76     this->path("");
     76    this->path("run");
    7777    this->label(label);
    7878    this->desc(desc);
     
    301301
    302302/**********************************************************************/
    303 // METHOD: configure(Rp_ParserXml *p)
     303// METHOD: configure(ClientData c)
    304304/// construct a number object from the provided tree
    305305/**
     
    308308
    309309void
    310 Number::configure(size_t as, void *p)
     310Number::configure(size_t as, ClientData c)
    311311{
    312312    if (as == RPCONFIG_XML) {
    313         __configureFromXml((const char *)p);
     313        __configureFromXml(c);
    314314    } else if (as == RPCONFIG_TREE) {
    315         __configureFromTree((Rp_ParserXml *)p);
     315        __configureFromTree(c);
    316316    }
    317317}
     
    325325
    326326void
    327 Number::__configureFromXml(const char *xmltext)
    328 {
     327Number::__configureFromXml(ClientData c)
     328{
     329    const char *xmltext = (const char *)c;
    329330    if (xmltext == NULL) {
    330331        // FIXME: setup error
     
    340341
    341342void
    342 Number::__configureFromTree(Rp_ParserXml *p)
    343 {
     343Number::__configureFromTree(ClientData c)
     344{
     345    Rp_ParserXml *p = (Rp_ParserXml *)c;
    344346    if (p == NULL) {
    345347        // FIXME: setup error
     
    353355    path(pathObj.parent());
    354356    name(Rp_ParserXmlNodeId(p,node));
    355     label(Rp_ParserXmlGet(p,"about.label"));
    356     desc(Rp_ParserXmlGet(p,"about.description"));
     357
     358    pathObj.clear();
     359    pathObj.add("about");
     360    pathObj.add("label");
     361    label(Rp_ParserXmlGet(p,pathObj.path()));
     362    pathObj.type("description");
     363    desc(Rp_ParserXmlGet(p,pathObj.path()));
    357364    units(Rp_ParserXmlGet(p,"units"));
    358365    minFromStr(Rp_ParserXmlGet(p,"min"));
     
    418425    }
    419426
     427    ClientDataXml *d = (ClientDataXml *)c;
    420428    Rp_ParserXml *parser = Rp_ParserXmlCreate();
    421429    __dumpToTree(parser);
    422     const char *xmltext = Rp_ParserXmlXml(parser);
    423     _tmpBuf.appendf("%s",xmltext);
     430    _tmpBuf.appendf("%s",Rp_ParserXmlXml(parser));
     431    d->retStr = _tmpBuf.bytes();
    424432    Rp_ParserXmlDestroy(&parser);
    425433}
Note: See TracChangeset for help on using the changeset viewer.