Show
Ignore:
Timestamp:
01/11/10 18:36:03 (4 years ago)
Author:
robert
Message:

From Jean-Sebastien Guay, "OK, so here are new changes.

1. The node type will be set to ATOM on read of <tag prop="..." ... /> type tags.
2. GROUP and NODE are now written using the same code (and not just duplicated code). Also NODE will not be written as an ATOM if it has no children or contents, so you need to set the type to ATOM if you want the <tag ... /> style.
3. You had put the write of "/>" for ATOM after the "return true", so it had no effect... Moved to before the return.
4. ATOM did not write its properties correctly, fixed.
5. As an added bonus, I made the write() method indent the output so it's more readable. It brings a small public interface change but the indent argument has a default value so client code doesn't need to change (if there even is any).
6. Another added bonus, I've simplified the write() method a bit by factoring out the write for children and properties into protected methods."

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/include/osgDB/XmlParser

    r10534 r10943  
    133133        bool read(Input& input); 
    134134 
    135         bool write(std::ostream& fout) const; 
     135        bool write(std::ostream& fout, const std::string& indent = "") const; 
    136136        bool writeString(std::ostream& fout, const std::string& str) const; 
    137137 
     138    protected: 
     139 
     140        bool writeChildren(std::ostream& fout, const std::string& indent) const; 
     141        bool writeProperties(std::ostream& fout) const; 
    138142}; 
    139143