Menu

A Contribution

Developer
2006-01-01
2013-05-20
  • twoeyedhuman

    twoeyedhuman - 2006-01-01

    I had a problem because the TinyXmlHandle didn't have a default constructor.  I created one.

    This code can be pasted in on line 1453 of tinyxml.h:

    TiXmlHandle() {}
    bool Initialize(TiXmlNode * _node) { this->node = _node; return true; }

    Essentially, the other constructor's code has been moved to the Initialize function.

    It's just that I had this class that had one private member of type TiXmlHandle and of course, when a class is constructed, the default constructor is called for private variables, and so I had to create a default constructor.

     
    • Ellers

      Ellers - 2006-01-01

      A default constructor seems reasonable. Make sure this->node gets set to 0 though.

      Off topic: if I'm understanding you correctly, you could have got around the no-default-constructor problem using the ':' syntax, like this:

      class Foo {
      private:
        TiXmlHandle m_handle;

      public:
        Foo()
        : m_handle(0)
        {
        }
      };

       
    • twoeyedhuman

      twoeyedhuman - 2006-01-02

      UNNNHH!!?!?!?!? ':' Syntax?, oh yeah, thats right.

      Oh well, now my source code is modified and so I don't exactly have to do that.  That helps though...

       
    • Lee Thomason

      Lee Thomason - 2006-01-06

      Interesting...does it make sense to have a TiXmlHandle that rerferences nothing? Or should we hide the default constructor by making it private?

      Not a big deal, but worth taking a look at.

      lee

       
    • Ronald Fenner Jr

      If i remember right it's pointless to set a TiXMLHandle to Null since there is no way to give the handle a new node except when you construct the handle. If it's a pointer then you just create a new one and go.

      If someone knows something I may be forgetting on how to change the value of a handle after it's constructed then it might be a good thing to include in the docs for the TiXmlHanldle.

      If not it'd sure be nice to have a function to change the node your checking/walking

       

Log in to post a comment.

MongoDB Logo MongoDB