Getters and setters

Developer
2008-12-16
2013-05-20
  • Hi i am rewriting a project so that it uses getters and setters to reference the TiXmlElement *'s
    However i quickly run into problems that seem to be related to debug mode:

    ecxerpt from my class's header:

    void setDocument (TiXmlDocument doc) { this->_document = doc; }
    void setRootElement (TiXmlElement * element) { this->_rootElement = element; }
    void setDialogsElement (TiXmlElement * element) { this->_dialogsElement = element; }

    TiXmlDocument getDocument () { return this->_document; }
    TiXmlElement* getRootElement () { return this->_rootElement; }
    TiXmlElement* getDialogsElement () { return this->_dialogsElement; }

    except from class constructor:

    DCXML::DCXML(const char *dialogMark,const char *dialogName,TiXmlDocument doc) {
    ...
    this->setDocument(doc);
    this->setRootElement(this->getDocument().FirstChildElement("dcxml"));
    this->setDialogsElement(this->getRootElement()->FirstChildElement("dialogs"));

    except from initiation the class:
    TiXmlDocument doc(input.gettok(2,"\"").to_chr());
    bool dcxmlFile = doc.LoadFile();
    ...
    DCXML *dcxml = new DCXML(input.gettok(2).to_chr(),input.gettok(3).to_chr(),doc);

    Now for the weird part this works up untill
    this->setDialogsElement(this->getRootElement()->FirstChildElement("dialogs"));
    in the constructor.

    ->FirstChildElement("dialogs") throws an "CXX0039: Error: symbol is ambiguous" error in VS2008 when in debug mode.

    When in release mode it just fails silently to get the dialogs element.

    has anyone experienced this behaviour and/or know what i am doing wrong ? Or if you have succesfully implement getter setter wrappers let me know how i can as well!.

    For complete reference here's an except from the XML:
    <?xml version="1.0" encoding="utf-8"?>
    <dcxml>
        <dialogs>
            <dialog name="mediaplayer" center="" w="300" h="400" caption="Mamp 4.0 BETA" border="btmnzy">

    Feedback would be much appreciated as i am at a dead end :)

     
    • forgot the declarations in the header from the class:

          TiXmlElement *_rootElement;
          TiXmlElement *_dialogsElement;
          TiXmlElement *_dialogElement;
          TiXmlDocument _document;