Menu

Attribute(const string& name, double* d) ??

Developer
2004-05-04
2004-06-27
  • John-Philip Leonard Johansson

    Hi!

    I noticed that the std::string versions of Attribute just call the const char* versions. And that's all nice and good. My only question is, why isn't there a double* version of Attribute() using std::string? There's an int version so... I mean, it's only

    const char* Attribute( const std::string& name, double* d ) const  { return Attribute( name.c_str(), d ); }

    and it's done... Why isn't there one already? The int version looks exactly the same.

     
    • Lee Thomason

      Lee Thomason - 2004-05-10

      The development code has a "double" form. It will be available in the next release.

      int/double overloading is a pain to use, so the method is:

      GetDoubleAttribute()

      lee

       
    • John-Philip Leonard Johansson

      I've checked out the latest code from the CVS and I don't see either GetDoubleAttribute() nor a Attribute( const std::string& name, double* d ). Where did they go? =/

       
    • Lee Thomason

      Lee Thomason - 2004-06-23

      I was very worried there for a minute...but they are there. I pulled this out of CVSWEB, so it is checked in.

      All members of the TiXmlElement class:

      const char* Attribute( const char* name ) const;
      const char* Attribute( const char* name, int* i ) const;
      const char* Attribute( const char* name, double* d ) const;
      int QueryIntAttribute( const char* name, int* value ) const;
      int QueryDoubleAttribute( const char* name, double* value ) const;

      lee

       
    • John-Philip Leonard Johansson

      what I meant was the std::string version for double =) rechecked, the ones you said are there. that's why it should be easy to make a Attribute that takes a std::string and a double, as in my original post.

      JP

       
    • Lee Thomason

      Lee Thomason - 2004-06-27

      Sorry! missed that point in a panic that I may have whacked some methods out of source.

      Added bug.

      lee

       

Log in to post a comment.

MongoDB Logo MongoDB