TinyXML is a simple, small, C++ XML parser that can be easily integrated into other programs.
-In brief, TinyXML parses an XML document, and builds from that a Document Object Model (DOM) that can be read, modified, and saved.
-XML stands for "eXtensible Markup Language." It allows you to create your own document markups. Where HTML does a very good job of marking documents for browsers, XML allows you to define any kind of document markup, for example a document that describes a "to do" list for an organizer application. XML is a very structured and convenient format. All those random file formats created to store application data can all be replaced with XML. One parser for everything.
-There are different ways to access and interact with XML data. TinyXML uses a Document Object Model (DOM), meaning the XML data is parsed into a C++ objects that can be browsed and manipulated, and then written to disk or another output stream. You can also construct an XML document from scratch with C++ objects and write this to disk or another output stream.
-TinyXML is designed to be easy and fast to learn. It is two headers and four cpp files. Simply add these to your project and off you go. There is an example file - xmltest.cpp - to get you started.
-TinyXML is released under the ZLib license, so you can use it in open source or commercial code. The details of the license are at the top of every source file.
-TinyXML attempts to be a flexible parser, but with truly correct and compliant XML output. TinyXML should compile on any reasonably C++ compliant system. It does not rely on exceptions or RTTI. It can be compiled with or without STL support. TinyXML fully supports the UTF-8 encoding, and the first 64k character entities.
In brief, TinyXML parses an XML document, and builds from that a Document Object Model (DOM) that can be read, modified, and saved.
XML stands for "eXtensible Markup Language." It allows you to create your own document markups. Where HTML does a very good job of marking documents for browsers, XML allows you to define any kind of document markup, for example a document that describes a "to do" list for an organizer application. XML is a very structured and convenient format. All those random file formats created to store application data can all be replaced with XML. One parser for everything.
There are different ways to access and interact with XML data. TinyXML uses a Document Object Model (DOM), meaning the XML data is parsed into a C++ objects that can be browsed and manipulated, and then written to disk or another output stream. You can also construct an XML document from scratch with C++ objects and write this to disk or another output stream.
TinyXML is designed to be easy and fast to learn. It is two headers and four cpp files. Simply add these to your project and off you go. There is an example file - xmltest.cpp - to get you started.
TinyXML is released under the ZLib license, so you can use it in open source or commercial code. The details of the license are at the top of every source file.
TinyXML attempts to be a flexible parser, but with truly correct and compliant XML output. TinyXML should compile on any reasonably C++ compliant system. It does not rely on exceptions or RTTI. It can be compiled with or without STL support. TinyXML fully supports the UTF-8 encoding, and the first 64k character entities.
-TinyXML doesn't parse or use DTDs (Document Type Definitions) or XSLs (eXtensible Stylesheet Language.) There are other parsers out there (check out www.sourceforge.org, search for XML) that are much more fully featured. But they are also much bigger, take longer to set up in your project, have a higher learning curve, and often have a more restrictive license. If you are working with browsers or have more complete XML needs, TinyXML is not the parser for you.
because TinyXML sees this as a !DOCTYPE node with an illegally embedded !ELEMENT node. This may be addressed in the future.
-For the impatient, here is a tutorial to get you going. A great way to get started, but it is worth your time to read this (very short) manual completely.
For the impatient, here is a tutorial to get you going. A great way to get started, but it is worth your time to read this (very short) manual completely.
-TinyXML is mature, tested code. It is very stable. If you find bugs, please file a bug report on the sourceforge web site (www.sourceforge.net/projects/tinyxml). We'll get them straightened out as soon as possible.
-There are some areas of improvement; please check sourceforge if you are interested in working on TinyXML.
TinyXML is mature, tested code. It is very stable. If you find bugs, please file a bug report on the sourceforge web site (www.sourceforge.net/projects/tinyxml). We'll get them straightened out as soon as possible.
There are some areas of improvement; please check sourceforge if you are interested in working on TinyXML.
-TinyXML can be compiled to use or not use STL. When using STL, TinyXML uses the std::string class, and fully supports std::istream, std::ostream, operator<<, and operator>>. Many API methods have both 'const char*' and 'const std::string&' forms.
-When STL support is compiled out, no STL files are included whatsoever. All the string classes are implemented by TinyXML itself. API methods all use the 'const char*' form for input.
-to compile one version or the other. This can be passed by the compiler, or set as the first line of "tinyxml.h".
-Note: If compiling the test code in Linux, setting the environment variable TINYXML_USE_STL=YES/NO will control STL compilation. In the Windows project file, STL and non STL targets are provided. In your project, It's probably easiest to add the line "#define TIXML_USE_STL" as the first line of tinyxml.h .
TinyXML can be compiled to use or not use STL. When using STL, TinyXML uses the std::string class, and fully supports std::istream, std::ostream, operator<<, and operator>>. Many API methods have both 'const char*' and 'const std::string&' forms.
When STL support is compiled out, no STL files are included whatsoever. All the string classes are implemented by TinyXML itself. API methods all use the 'const char*' form for input.
to compile one version or the other. This can be passed by the compiler, or set as the first line of "tinyxml.h".
Note: If compiling the test code in Linux, setting the environment variable TINYXML_USE_STL=YES/NO will control STL compilation. In the Windows project file, STL and non STL targets are provided. In your project, It's probably easiest to add the line "#define TIXML_USE_STL" as the first line of tinyxml.h .
-TinyXML supports UTF-8 allowing to manipulate XML files in any language. TinyXML also supports "legacy mode" - the encoding used before UTF-8 support and probably best described as "extended ascii".
-Normally, TinyXML will try to detect the correct encoding and use it. However, by setting the value of TIXML_DEFAULT_ENCODING in the header file, TinyXML can be forced to always use one encoding.
+TinyXML supports UTF-8 allowing to manipulate XML files in any language. TinyXML also supports "legacy mode" - the encoding used before UTF-8 support and probably best described as "extended ascii".
+Normally, TinyXML will try to detect the correct encoding and use it. However, by setting the value of TIXML_DEFAULT_ENCODING in the header file, TinyXML can be forced to always use one encoding.
+TinyXML will assume Legacy Mode until one of the following occurs:
+
If the non-standard but common "UTF-8 lead bytes" (0xef 0xbb 0xbf) begin the file or data stream, TinyXML will read it as UTF-8.
@@ -81,75 +77,86 @@ If the declaration tag is read, and it has an encoding="something else", then Ti
Until one of the above criteria is met, TinyXML runs in Legacy Mode.
-
-What happens if the encoding is incorrectly set or detected? TinyXML will try to read and pass through text seen as improperly encoded. You may get some strange results or mangled characters. You may want to force TinyXML to the correct mode.
-You may force TinyXML to Legacy Mode by using LoadFile( TIXML_ENCODING_LEGACY ) or LoadFile( filename, TIXML_ENCODING_LEGACY ). You may force it to use legacy mode all the time by setting TIXML_DEFAULT_ENCODING = TIXML_ENCODING_LEGACY. Likewise, you may force it to TIXML_ENCODING_UTF8 with the same technique.
-For English users, using English XML, UTF-8 is the same as low-ASCII. You don't need to be aware of UTF-8 or change your code in any way. You can think of UTF-8 as a "superset" of ASCII.
-UTF-8 is not a double byte format - but it is a standard encoding of Unicode! TinyXML does not use or directly support wchar, TCHAR, or Microsoft's _UNICODE at this time. It is common to see the term "Unicode" improperly refer to UTF-16, a wide byte encoding of unicode. This is a source of confusion.
-For "high-ascii" languages - everything not English, pretty much - TinyXML can handle all languages, at the same time, as long as the XML is encoded in UTF-8. That can be a little tricky, older programs and operating systems tend to use the "default" or "traditional" code page. Many apps (and almost all modern ones) can output UTF-8, but older or stubborn (or just broken) ones still output text in the default code page.
-For example, Japanese systems traditionally use SHIFT-JIS encoding. Text encoded as SHIFT-JIS can not be read by TinyXML. A good text editor can import SHIFT-JIS and then save as UTF-8.
-The Skew.org link does a great job covering the encoding issue.
-The test file "utf8test.xml" is an XML containing English, Spanish, Russian, and Simplified Chinese. (Hopefully they are translated correctly). The file "utf8test.gif" is a screen capture of the XML file, rendered in IE. Note that if you don't have the correct fonts (Simplified Chinese or Russian) on your system, you won't see output that matches the GIF file even if you can parse it correctly. Also note that (at least on my Windows machine) console output is in a Western code page, so that Print() or printf() cannot correctly display the file. This is not a bug in TinyXML - just an OS issue. No data is lost or destroyed by TinyXML. The console just doesn't render UTF-8.
+
What happens if the encoding is incorrectly set or detected? TinyXML will try to read and pass through text seen as improperly encoded. You may get some strange results or mangled characters. You may want to force TinyXML to the correct mode.
+You may force TinyXML to Legacy Mode by using LoadFile( TIXML_ENCODING_LEGACY ) or LoadFile( filename, TIXML_ENCODING_LEGACY ). You may force it to use legacy mode all the time by setting TIXML_DEFAULT_ENCODING = TIXML_ENCODING_LEGACY. Likewise, you may force it to TIXML_ENCODING_UTF8 with the same technique.
+For English users, using English XML, UTF-8 is the same as low-ASCII. You don't need to be aware of UTF-8 or change your code in any way. You can think of UTF-8 as a "superset" of ASCII.
+UTF-8 is not a double byte format - but it is a standard encoding of Unicode! TinyXML does not use or directly support wchar, TCHAR, or Microsoft's _UNICODE at this time. It is common to see the term "Unicode" improperly refer to UTF-16, a wide byte encoding of unicode. This is a source of confusion.
+For "high-ascii" languages - everything not English, pretty much - TinyXML can handle all languages, at the same time, as long as the XML is encoded in UTF-8. That can be a little tricky, older programs and operating systems tend to use the "default" or "traditional" code page. Many apps (and almost all modern ones) can output UTF-8, but older or stubborn (or just broken) ones still output text in the default code page.
+For example, Japanese systems traditionally use SHIFT-JIS encoding. Text encoded as SHIFT-JIS can not be read by TinyXML. A good text editor can import SHIFT-JIS and then save as UTF-8.
+The Skew.org link does a great job covering the encoding issue.
+The test file "utf8test.xml" is an XML containing English, Spanish, Russian, and Simplified Chinese. (Hopefully they are translated correctly). The file "utf8test.gif" is a screen capture of the XML file, rendered in IE. Note that if you don't have the correct fonts (Simplified Chinese or Russian) on your system, you won't see output that matches the GIF file even if you can parse it correctly. Also note that (at least on my Windows machine) console output is in a Western code page, so that Print() or printf() cannot correctly display the file. This is not a bug in TinyXML - just an OS issue. No data is lost or destroyed by TinyXML. The console just doesn't render UTF-8.
Entities
-
-TinyXML recognizes the pre-defined "character entities", meaning special characters. Namely:
-
& &
+TinyXML recognizes the pre-defined "character entities", meaning special characters. Namely:
+
+ & &
< <
> >
" "
' '
-
-These are recognized when the XML document is read, and translated to there UTF-8 equivalents. For instance, text with the XML of:
-
-will have the Value() of "Far & Away" when queried from the TiXmlText object, and will be written back to the XML stream/file as an ampersand. Older versions of TinyXML "preserved" character entities, but the newer versions will translate them into characters.
-Additionally, any character can be specified by its Unicode code point: The syntax " " or " " are both to the non-breaking space characher.
+
These are recognized when the XML document is read, and translated to there UTF-8 equivalents. For instance, text with the XML of:
+will have the Value() of "Far & Away" when queried from the TiXmlText object, and will be written back to the XML stream/file as an ampersand. Older versions of TinyXML "preserved" character entities, but the newer versions will translate them into characters.
+Additionally, any character can be specified by its Unicode code point: The syntax " " or " " are both to the non-breaking space characher.
Printing
-
-TinyXML can print output in several different ways that all have strengths and limitations.
+
TinyXML can print output in several different ways that all have strengths and limitations.
Print( FILE* ). Output to a std-C stream, which includes all C files as well as stdout.
-"Pretty prints", but you don't have control over printing options. The output is streamed directly to the FILE object, so there is no memory overhead in the TinyXML code. used by Print() and SaveFile()
-
-
+
"Pretty prints", but you don't have control over printing options.
+The output is streamed directly to the FILE object, so there is no memory overhead in the TinyXML code.
+used by Print() and SaveFile()
+
+
+
operator<<. Output to a c++ stream.
-Integrates with standart C++ iostreams. Outputs in "network printing" mode without line breaks. Good for network transmission and moving XML between C++ objects, but hard for a human to read.
-
-
+
Integrates with standart C++ iostreams.
+Outputs in "network printing" mode without line breaks. Good for network transmission and moving XML between C++ objects, but hard for a human to read.
+
+
+
-TiXmlPrinter . Output to a std::string or memory buffer.
-API is less concise Future printing options will be put here. Printing may change slightly in future versions as it is refined and expanded.
-
-
+
TiXmlPrinter . Output to a std::string or memory buffer.
+API is less concise
+Future printing options will be put here.
+Printing may change slightly in future versions as it is refined and expanded.
+
+
+
Streams
-
-With TIXML_USE_STL on TinyXML supports C++ streams (operator <<,>>) streams as well as C (FILE*) streams. There are some differences that you may need to be aware of.
-C style output:
-based on FILE* the Print() and SaveFile() methods
-
-Generates formatted output, with plenty of white space, intended to be as human-readable as possible. They are very fast, and tolerant of ill formed XML documents. For example, an XML document that contains 2 root elements and 2 declarations, will still print.
-C style input:
-based on FILE* the Parse() and LoadFile() methods
-
-A fast, tolerant read. Use whenever you don't need the C++ streams.
-C++ style output:
-based on std::ostream operator<<
-
-Generates condensed output, intended for network transmission rather than readability. Depending on your system's implementation of the ostream class, these may be somewhat slower. (Or may not.) Not tolerant of ill formed XML: a document should contain the correct one root element. Additional root level elements will not be streamed out.
-C++ style input:
-based on std::istream operator>>
-
-Reads XML from a stream, making it useful for network transmission. The tricky part is knowing when the XML document is complete, since there will almost certainly be other data in the stream. TinyXML will assume the XML data is complete after it reads the root element. Put another way, documents that are ill-constructed with more than one root element will not read correctly. Also note that operator>> is somewhat slower than Parse, due to both implementation of the STL and limitations of TinyXML.
+
With TIXML_USE_STL on TinyXML supports C++ streams (operator <<,>>) streams as well as C (FILE*) streams. There are some differences that you may need to be aware of.
+C style output:
+
+based on FILE*
+the Print() and SaveFile() methods
+
+Generates formatted output, with plenty of white space, intended to be as human-readable as possible. They are very fast, and tolerant of ill formed XML documents. For example, an XML document that contains 2 root elements and 2 declarations, will still print.
+C style input:
+
+based on FILE*
+the Parse() and LoadFile() methods
+
+A fast, tolerant read. Use whenever you don't need the C++ streams.
+C++ style output:
+
+based on std::ostream
+operator<<
+
+Generates condensed output, intended for network transmission rather than readability. Depending on your system's implementation of the ostream class, these may be somewhat slower. (Or may not.) Not tolerant of ill formed XML: a document should contain the correct one root element. Additional root level elements will not be streamed out.
+C++ style input:
+
+based on std::istream
+operator>>
+
+Reads XML from a stream, making it useful for network transmission. The tricky part is knowing when the XML document is complete, since there will almost certainly be other data in the stream. TinyXML will assume the XML data is complete after it reads the root element. Put another way, documents that are ill-constructed with more than one root element will not read correctly. Also note that operator>> is somewhat slower than Parse, due to both implementation of the STL and limitations of TinyXML.
White space
-
-The world simply does not agree on whether white space should be kept, or condensed. For example, pretend the '_' is a space, and look at "Hello____world". HTML, and at least some XML parsers, will interpret this as "Hello_world". They condense white space. Some XML parsers do not, and will leave it as "Hello____world". (Remember to keep pretending the _ is a space.) Others suggest that __Hello___world__ should become Hello___world.
-It's an issue that hasn't been resolved to my satisfaction. TinyXML supports the first 2 approaches. Call TiXmlBase::SetCondenseWhiteSpace( bool ) to set the desired behavior. The default is to condense white space.
-If you change the default, you should call TiXmlBase::SetCondenseWhiteSpace( bool ) before making any calls to Parse XML data, and I don't recommend changing it after it has been set.
+
The world simply does not agree on whether white space should be kept, or condensed. For example, pretend the '_' is a space, and look at "Hello____world". HTML, and at least some XML parsers, will interpret this as "Hello_world". They condense white space. Some XML parsers do not, and will leave it as "Hello____world". (Remember to keep pretending the _ is a space.) Others suggest that __Hello___world__ should become Hello___world.
+It's an issue that hasn't been resolved to my satisfaction. TinyXML supports the first 2 approaches. Call TiXmlBase::SetCondenseWhiteSpace( bool ) to set the desired behavior. The default is to condense white space.
+If you change the default, you should call TiXmlBase::SetCondenseWhiteSpace( bool ) before making any calls to Parse XML data, and I don't recommend changing it after it has been set.
Handles
-
-Where browsing an XML document in a robust way, it is important to check for null returns from method calls. An error safe implementation can generate a lot of code like:
-
TiXmlElement* root = document.FirstChildElement( "Document" );
+Where browsing an XML document in a robust way, it is important to check for null returns from method calls. An error safe implementation can generate a lot of code like:
+
+TiXmlElement* root = document.FirstChildElement( "Document" );
if ( root )
{
TiXmlElement* element = root->FirstChildElement( "Element" );
@@ -162,26 +169,22 @@ if ( root )
if ( child2 )
{
// Finally do something useful.
-
-Handles have been introduced to clean this up. Using the TiXmlHandle class, the previous code reduces to:
-
TiXmlHandle docHandle( &document );
+ Handles have been introduced to clean this up. Using the TiXmlHandle class, the previous code reduces to:
+
+TiXmlHandle docHandle( &document );
TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).ToElement();
if ( child2 )
{
// do something useful
-
-Which is much easier to deal with. See TiXmlHandle for more information.
+
Which is much easier to deal with. See TiXmlHandle for more information.
Row and Column tracking
-
-Being able to track nodes and attributes back to their origin location in source files can be very important for some applications. Additionally, knowing where parsing errors occured in the original source can be very time saving.
-TinyXML can tracks the row and column origin of all nodes and attributes in a text file. The TiXmlBase::Row() and TiXmlBase::Column() methods return the origin of the node in the source text. The correct tabs can be configured in TiXmlDocument::SetTabSize() .
+
Being able to track nodes and attributes back to their origin location in source files can be very important for some applications. Additionally, knowing where parsing errors occured in the original source can be very time saving.
+TinyXML can tracks the row and column origin of all nodes and attributes in a text file. The TiXmlBase::Row() and TiXmlBase::Column() methods return the origin of the node in the source text. The correct tabs can be configured in TiXmlDocument::SetTabSize() .
Using and Installing
-
-To Compile and Run xmltest:
-A Linux Makefile and a Windows Visual C++ .dsw file is provided. Simply compile and run. It will write the file demotest.xml to your disk and generate output on the screen. It also tests walking the DOM by printing out the number of nodes found using different techniques.
-The Linux makefile is very generic and runs on many systems - it is currently tested on mingw and MacOSX. You do not need to run 'make depend'. The dependecies have been hard coded.
+
To Compile and Run xmltest:
+A Linux Makefile and a Windows Visual C++ .dsw file is provided. Simply compile and run. It will write the file demotest.xml to your disk and generate output on the screen. It also tests walking the DOM by printing out the number of nodes found using different techniques.
+The Linux makefile is very generic and runs on many systems - it is currently tested on mingw and MacOSX. You do not need to run 'make depend'. The dependecies have been hard coded.
Windows project file for VC6
-
tinyxml: tinyxml library, non-STL
@@ -192,49 +195,49 @@ tinyXmlTest: test app, non-STL
tinyXmlTestSTL: test app, STL
-
Makefile
-
-At the top of the makefile you can set:
-PROFILE, DEBUG, and TINYXML_USE_STL. Details (such that they are) are in the makefile.
-In the tinyxml directory, type "make clean" then "make". The executable file 'xmltest' will be created.
+
At the top of the makefile you can set:
+PROFILE, DEBUG, and TINYXML_USE_STL. Details (such that they are) are in the makefile.
+In the tinyxml directory, type "make clean" then "make". The executable file 'xmltest' will be created.
To Use in an Application:
-
-Add tinyxml.cpp, tinyxml.h , tinyxmlerror.cpp, tinyxmlparser.cpp, tinystr.cpp, and tinystr.h to your project or make file. That's it! It should compile on any reasonably compliant C++ system. You do not need to enable exceptions or RTTI for TinyXML.
+
Add tinyxml.cpp, tinyxml.h , tinyxmlerror.cpp, tinyxmlparser.cpp, tinystr.cpp, and tinystr.h to your project or make file. That's it! It should compile on any reasonably compliant C++ system. You do not need to enable exceptions or RTTI for TinyXML.
How TinyXML works.
-
-An example is probably the best way to go. Take:
<?xml version="1.0" standalone=no>
+An example is probably the best way to go. Take:
+
+ <?xml version="1.0" standalone=no>
<!-- Our to do list data -->
<ToDo>
<Item priority="1"> Go to the <bold>Toy store!</bold></Item>
<Item priority="2"> Do bills</Item>
</ToDo>
-
-Its not much of a To Do list, but it will do. To read this file (say "demo.xml") you would create a document, and parse it in:
TiXmlDocument doc( "demo.xml" );
+ Its not much of a To Do list, but it will do. To read this file (say "demo.xml") you would create a document, and parse it in:
+
+ TiXmlDocument doc( "demo.xml" );
doc.LoadFile();
-
-And its ready to go. Now lets look at some lines and how they relate to the DOM.
-
<?xml version="1.0" standalone=no>
-
-The first line is a declaration, and gets turned into the TiXmlDeclaration class. It will be the first child of the document node.
-This is the only directive/special tag parsed by by TinyXML. Generally directive tags are stored in TiXmlUnknown so the commands wont be lost when it is saved back to disk.
-
<!-- Our to do list data -->
-
-A comment. Will become a TiXmlComment object.
-
-The "ToDo" tag defines a TiXmlElement object. This one does not have any attributes, but does contain 2 other elements.
-
-Creates another TiXmlElement which is a child of the "ToDo" element. This element has 1 attribute, with the name "priority" and the value "1".
-
-A TiXmlText . This is a leaf node and cannot contain other nodes. It is a child of the "Item" TiXmlElement .
-
-Another TiXmlElement , this one a child of the "Item" element.
-Etc.
-Looking at the entire object tree, you end up with:
TiXmlDocument "demo.xml"
+ And its ready to go. Now lets look at some lines and how they relate to the DOM.
+
+<?xml version="1.0" standalone=no>
+ The first line is a declaration, and gets turned into the TiXmlDeclaration class. It will be the first child of the document node.
+This is the only directive/special tag parsed by TinyXML. Generally directive tags are stored in TiXmlUnknown so the commands wont be lost when it is saved back to disk.
+
+<!-- Our to do list data -->
+ A comment. Will become a TiXmlComment object.
+The "ToDo" tag defines a TiXmlElement object. This one does not have any attributes, but does contain 2 other elements.
+Creates another TiXmlElement which is a child of the "ToDo" element. This element has 1 attribute, with the name "priority" and the value "1".
+A TiXmlText . This is a leaf node and cannot contain other nodes. It is a child of the "Item" TiXmlElement .
+Another TiXmlElement , this one a child of the "Item" element.
+Etc.
+Looking at the entire object tree, you end up with:
+
+TiXmlDocument "demo.xml"
TiXmlDeclaration "version='1.0'" "standalone=no"
TiXmlComment " Our to do list data"
TiXmlElement "ToDo"
@@ -244,32 +247,29 @@ Looking at the entire object tree, you end up with:
-
Documentation
-
-The documentation is build with Doxygen, using the 'dox' configuration file.
+
Documentation
+The documentation is build with Doxygen, using the 'dox' configuration file.
License
-
-TinyXML is released under the zlib license:
-This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
-1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
-2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
+
TinyXML is released under the zlib license:
+This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
+Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
+1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
+2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
References
-
-The World Wide Web Consortium is the definitive standard body for XML, and there web pages contain huge amounts of information.
-The definitive spec: http://www.w3.org/TR/2004/REC-xml-20040204/
-I also recommend "XML Pocket Reference" by Robert Eckstein and published by OReilly...the book that got the whole thing started.
+
The World Wide Web Consortium is the definitive standard body for XML, and their web pages contain huge amounts of information.
+The definitive spec: http://www.w3.org/TR/2004/REC-xml-20040204/
+I also recommend "XML Pocket Reference" by Robert Eckstein and published by OReilly...the book that got the whole thing started.
Contributors, Contacts, and a Brief History
-
-Thanks very much to everyone who sends suggestions, bugs, ideas, and encouragement. It all helps, and makes this project fun. A special thanks to the contributors on the web pages that keep it lively.
-So many people have sent in bugs and ideas, that rather than list here we try to give credit due in the "changes.txt" file.
-TinyXML was originally written by Lee Thomason. (Often the "I" still in the documentation.) Lee reviews changes and releases new versions, with the help of Yves Berquin, Andrew Ellerton, and the tinyXml community.
-We appreciate your suggestions, and would love to know if you use TinyXML. Hopefully you will enjoy it and find it useful. Please post questions, comments, file bugs, or contact us at:
-www.sourceforge.net/projects/tinyxml
-Lee Thomason, Yves Berquin, Andrew Ellerton
Generated on Sun May 6 15:41:22 2007 for TinyXml by
+ Thanks very much to everyone who sends suggestions, bugs, ideas, and encouragement. It all helps, and makes this project fun. A special thanks to the contributors on the web pages that keep it lively.
+So many people have sent in bugs and ideas, that rather than list here we try to give credit due in the "changes.txt" file.
+TinyXML was originally written by Lee Thomason. (Often the "I" still in the documentation.) Lee reviews changes and releases new versions, with the help of Yves Berquin, Andrew Ellerton, and the tinyXml community.
+We appreciate your suggestions, and would love to know if you use TinyXML. Hopefully you will enjoy it and find it useful. Please post questions, comments, file bugs, or contact us at:
+www.sourceforge.net/projects/tinyxml
+Lee Thomason, Yves Berquin, Andrew Ellerton
+
+Generated by
- 1.4.7
+ 1.6.2
diff --git a/Engine/lib/tinyxml/docs/pages.html b/Engine/lib/tinyxml/docs/pages.html
index b23a328b5..14a96596a 100644
--- a/Engine/lib/tinyxml/docs/pages.html
+++ b/Engine/lib/tinyxml/docs/pages.html
@@ -1,23 +1,31 @@
-
-
+
+
+
+
TinyXml: Page Index
-
-
-
-
-
-TinyXml Related Pages Here is a list of all related documentation pages:Generated by
- 1.4.7
+ 1.6.2
diff --git a/Engine/lib/tinyxml/docs/tabs.css b/Engine/lib/tinyxml/docs/tabs.css
index a61552a67..a44416341 100644
--- a/Engine/lib/tinyxml/docs/tabs.css
+++ b/Engine/lib/tinyxml/docs/tabs.css
@@ -32,7 +32,7 @@ DIV.tabs A
float : left;
background : url("tab_r.gif") no-repeat right top;
border-bottom : 1px solid #84B0C7;
- font-size : x-small;
+ font-size : 80%;
font-weight : bold;
text-decoration : none;
}
@@ -57,7 +57,7 @@ DIV.tabs SPAN
white-space : nowrap;
}
-DIV.tabs INPUT
+DIV.tabs #MSearchBox
{
float : right;
display : inline;
@@ -66,7 +66,7 @@ DIV.tabs INPUT
DIV.tabs TD
{
- font-size : x-small;
+ font-size : 80%;
font-weight : bold;
text-decoration : none;
}
@@ -82,21 +82,24 @@ DIV.tabs A:hover SPAN
background-position: 0% -150px;
}
-DIV.tabs LI#current A
+DIV.tabs LI.current A
{
background-position: 100% -150px;
border-width : 0px;
}
-DIV.tabs LI#current SPAN
+DIV.tabs LI.current SPAN
{
background-position: 0% -150px;
padding-bottom : 6px;
}
-DIV.nav
+DIV.navpath
{
background : none;
border : none;
border-bottom : 1px solid #84B0C7;
+ text-align : center;
+ margin : 2px;
+ padding : 2px;
}
diff --git a/Engine/lib/tinyxml/docs/tinystr_8h-source.html b/Engine/lib/tinyxml/docs/tinystr_8h-source.html
deleted file mode 100644
index 71408eed9..000000000
--- a/Engine/lib/tinyxml/docs/tinystr_8h-source.html
+++ /dev/null
@@ -1,338 +0,0 @@
-
-
-TinyXml: tinystr.h Source File
-
-
-
-
-
-tinystr.h 00001
- 00002
- 00003
- 00004
- 00005
- 00006
- 00007
- 00008
- 00009
- 00010
- 00011
- 00012
- 00013
- 00014
- 00015
- 00016
- 00017
- 00018
- 00019
- 00020
- 00021
- 00022
- 00023
- 00024
- 00025
- 00026
- 00027
- 00028
- 00029
- 00030
- 00031
- 00032
- 00033
- 00034
- 00035
- 00036
- 00037 #ifndef TIXML_USE_STL
- 00038
- 00039 #ifndef TIXML_STRING_INCLUDED
- 00040 #define TIXML_STRING_INCLUDED
- 00041
- 00042 #include <assert.h>
- 00043 #include <string.h>
- 00044
- 00045
- 00046
- 00047
- 00048
- 00049 #if defined(_MSC_VER) && (_MSC_VER >= 1200 )
- 00050
- 00051 #define TIXML_EXPLICIT explicit
- 00052 #elif defined(__GNUC__) && (__GNUC__ >= 3 )
- 00053
- 00054 #define TIXML_EXPLICIT explicit
- 00055 #else
- 00056 #define TIXML_EXPLICIT
- 00057 #endif
- 00058
- 00059
- 00060
- 00061
- 00062
- 00063
- 00064
- 00065
- 00066
- 00067 class TiXmlString
- 00068 {
- 00069 public :
- 00070
- 00071 typedef size_t size_type;
- 00072
- 00073
- 00074 static const size_type npos;
- 00075
- 00076
- 00077
- 00078 TiXmlString () : rep_(&nullrep_)
- 00079 {
- 00080 }
- 00081
- 00082
- 00083 TiXmlString ( const TiXmlString & copy) : rep_(0)
- 00084 {
- 00085 init(copy.length());
- 00086 memcpy(start(), copy.data(), length());
- 00087 }
- 00088
- 00089
- 00090 TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0)
- 00091 {
- 00092 init( static_cast<size_type>( strlen(copy) ));
- 00093 memcpy(start(), copy, length());
- 00094 }
- 00095
- 00096
- 00097 TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0)
- 00098 {
- 00099 init(len);
- 00100 memcpy(start(), str, len);
- 00101 }
- 00102
- 00103
- 00104 ~TiXmlString ()
- 00105 {
- 00106 quit();
- 00107 }
- 00108
- 00109
- 00110 TiXmlString& operator = (const char * copy)
- 00111 {
- 00112 return assign( copy, (size_type)strlen(copy));
- 00113 }
- 00114
- 00115
- 00116 TiXmlString& operator = (const TiXmlString & copy)
- 00117 {
- 00118 return assign(copy.start(), copy.length());
- 00119 }
- 00120
- 00121
- 00122
- 00123 TiXmlString& operator += (const char * suffix)
- 00124 {
- 00125 return append(suffix, static_cast<size_type>( strlen(suffix) ));
- 00126 }
- 00127
- 00128
- 00129 TiXmlString& operator += (char single)
- 00130 {
- 00131 return append(&single, 1);
- 00132 }
- 00133
- 00134
- 00135 TiXmlString& operator += (const TiXmlString & suffix)
- 00136 {
- 00137 return append(suffix.data(), suffix.length());
- 00138 }
- 00139
- 00140
- 00141
- 00142 const char * c_str () const { return rep_->str; }
- 00143
- 00144
- 00145 const char * data () const { return rep_->str; }
- 00146
- 00147
- 00148 size_type length () const { return rep_->size; }
- 00149
- 00150
- 00151 size_type size () const { return rep_->size; }
- 00152
- 00153
- 00154 bool empty () const { return rep_->size == 0; }
- 00155
- 00156
- 00157 size_type capacity () const { return rep_->capacity; }
- 00158
- 00159
- 00160
- 00161 const char & at (size_type index) const
- 00162 {
- 00163 assert( index < length() );
- 00164 return rep_->str[ index ];
- 00165 }
- 00166
- 00167
- 00168 char & operator [] (size_type index) const
- 00169 {
- 00170 assert( index < length() );
- 00171 return rep_->str[ index ];
- 00172 }
- 00173
- 00174
- 00175 size_type find (char lookup) const
- 00176 {
- 00177 return find(lookup, 0);
- 00178 }
- 00179
- 00180
- 00181 size_type find (char tofind, size_type offset) const
- 00182 {
- 00183 if (offset >= length()) return npos;
- 00184
- 00185 for (const char * p = c_str() + offset; *p != '\0' ; ++p)
- 00186 {
- 00187 if (*p == tofind) return static_cast< size_type >( p - c_str() );
- 00188 }
- 00189 return npos;
- 00190 }
- 00191
- 00192 void clear ()
- 00193 {
- 00194
- 00195
- 00196
- 00197
- 00198 quit();
- 00199 init(0,0);
- 00200 }
- 00201
- 00202
- 00203
- 00204
- 00205 void reserve (size_type cap);
- 00206
- 00207 TiXmlString& assign (const char * str, size_type len);
- 00208
- 00209 TiXmlString& append (const char * str, size_type len);
- 00210
- 00211 void swap (TiXmlString& other)
- 00212 {
- 00213 Rep* r = rep_;
- 00214 rep_ = other.rep_;
- 00215 other.rep_ = r;
- 00216 }
- 00217
- 00218 private :
- 00219
- 00220 void init(size_type sz) { init(sz, sz); }
- 00221 void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0' ; }
- 00222 char * start() const { return rep_->str; }
- 00223 char * finish() const { return rep_->str + rep_->size; }
- 00224
- 00225 struct Rep
- 00226 {
- 00227 size_type size, capacity;
- 00228 char str[1];
- 00229 };
- 00230
- 00231 void init(size_type sz, size_type cap)
- 00232 {
- 00233 if (cap)
- 00234 {
- 00235
- 00236
- 00237
- 00238
- 00239
- 00240 const size_type bytesNeeded = sizeof (Rep) + cap;
- 00241 const size_type intsNeeded = ( bytesNeeded + sizeof (int) - 1 ) / sizeof ( int );
- 00242 rep_ = reinterpret_cast<Rep*>( new int [ intsNeeded ] );
- 00243
- 00244 rep_->str[ rep_->size = sz ] = '\0' ;
- 00245 rep_->capacity = cap;
- 00246 }
- 00247 else
- 00248 {
- 00249 rep_ = &nullrep_;
- 00250 }
- 00251 }
- 00252
- 00253 void quit()
- 00254 {
- 00255 if (rep_ != &nullrep_)
- 00256 {
- 00257
- 00258
- 00259 delete [] ( reinterpret_cast<int*>( rep_ ) );
- 00260 }
- 00261 }
- 00262
- 00263 Rep * rep_;
- 00264 static Rep nullrep_;
- 00265
- 00266 } ;
- 00267
- 00268
- 00269 inline bool operator == (const TiXmlString & a, const TiXmlString & b)
- 00270 {
- 00271 return ( a.length() == b.length() )
- 00272 && ( strcmp(a.c_str(), b.c_str()) == 0 );
- 00273 }
- 00274 inline bool operator < (const TiXmlString & a, const TiXmlString & b)
- 00275 {
- 00276 return strcmp(a.c_str(), b.c_str()) < 0;
- 00277 }
- 00278
- 00279 inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); }
- 00280 inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; }
- 00281 inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); }
- 00282 inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); }
- 00283
- 00284 inline bool operator == (const TiXmlString & a, const char * b) { return strcmp(a.c_str(), b) == 0; }
- 00285 inline bool operator == (const char * a, const TiXmlString & b) { return b == a; }
- 00286 inline bool operator != (const TiXmlString & a, const char * b) { return !(a == b); }
- 00287 inline bool operator != (const char * a, const TiXmlString & b) { return !(b == a); }
- 00288
- 00289 TiXmlString operator + (const TiXmlString & a, const TiXmlString & b);
- 00290 TiXmlString operator + (const TiXmlString & a, const char * b);
- 00291 TiXmlString operator + (const char * a, const TiXmlString & b);
- 00292
- 00293
- 00294
- 00295
- 00296
- 00297
- 00298 class TiXmlOutStream : public TiXmlString
- 00299 {
- 00300 public :
- 00301
- 00302
- 00303 TiXmlOutStream & operator << (const TiXmlString & in)
- 00304 {
- 00305 *this += in;
- 00306 return *this ;
- 00307 }
- 00308
- 00309
- 00310 TiXmlOutStream & operator << (const char * in)
- 00311 {
- 00312 *this += in;
- 00313 return *this ;
- 00314 }
- 00315
- 00316 } ;
- 00317
- 00318 #endif // TIXML_STRING_INCLUDED
- 00319 #endif // TIXML_USE_STL
-Generated on Sun May 6 15:41:22 2007 for TinyXml by
-
- 1.4.7
-
-
diff --git a/Engine/lib/tinyxml/docs/tinystr_8h_source.html b/Engine/lib/tinyxml/docs/tinystr_8h_source.html
new file mode 100644
index 000000000..579a90e0e
--- /dev/null
+++ b/Engine/lib/tinyxml/docs/tinystr_8h_source.html
@@ -0,0 +1,335 @@
+
+
+
+
+TinyXml: tinystr.h Source File
+
+
+
+
+
+
+
+
+
tinystr.h 00001
+ 00002
+ 00003
+ 00004
+ 00005
+ 00006
+ 00007
+ 00008
+ 00009
+ 00010
+ 00011
+ 00012
+ 00013
+ 00014
+ 00015
+ 00016
+ 00017
+ 00018
+ 00019
+ 00020
+ 00021
+ 00022
+ 00023
+ 00024
+ 00025 #ifndef TIXML_USE_STL
+ 00026
+ 00027 #ifndef TIXML_STRING_INCLUDED
+ 00028 #define TIXML_STRING_INCLUDED
+ 00029
+ 00030 #include <assert.h>
+ 00031 #include <string.h>
+ 00032
+ 00033
+ 00034
+ 00035
+ 00036
+ 00037 #if defined(_MSC_VER) && (_MSC_VER >= 1200 )
+ 00038
+ 00039 #define TIXML_EXPLICIT explicit
+ 00040 #elif defined(__GNUC__) && (__GNUC__ >= 3 )
+ 00041
+ 00042 #define TIXML_EXPLICIT explicit
+ 00043 #else
+ 00044 #define TIXML_EXPLICIT
+ 00045 #endif
+ 00046
+ 00047
+ 00048
+ 00049
+ 00050
+ 00051
+ 00052
+ 00053
+ 00054
+ 00055 class TiXmlString
+ 00056 {
+ 00057 public :
+ 00058
+ 00059 typedef size_t size_type;
+ 00060
+ 00061
+ 00062 static const size_type npos;
+ 00063
+ 00064
+ 00065
+ 00066 TiXmlString () : rep_(&nullrep_)
+ 00067 {
+ 00068 }
+ 00069
+ 00070
+ 00071 TiXmlString ( const TiXmlString & copy) : rep_(0)
+ 00072 {
+ 00073 init(copy.length());
+ 00074 memcpy(start(), copy.data(), length());
+ 00075 }
+ 00076
+ 00077
+ 00078 TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0)
+ 00079 {
+ 00080 init( static_cast<size_type>( strlen(copy) ));
+ 00081 memcpy(start(), copy, length());
+ 00082 }
+ 00083
+ 00084
+ 00085 TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0)
+ 00086 {
+ 00087 init(len);
+ 00088 memcpy(start(), str, len);
+ 00089 }
+ 00090
+ 00091
+ 00092 ~TiXmlString ()
+ 00093 {
+ 00094 quit();
+ 00095 }
+ 00096
+ 00097 TiXmlString& operator = (const char * copy)
+ 00098 {
+ 00099 return assign( copy, (size_type)strlen(copy));
+ 00100 }
+ 00101
+ 00102 TiXmlString& operator = (const TiXmlString & copy)
+ 00103 {
+ 00104 return assign(copy.start(), copy.length());
+ 00105 }
+ 00106
+ 00107
+ 00108
+ 00109 TiXmlString& operator += (const char * suffix)
+ 00110 {
+ 00111 return append(suffix, static_cast<size_type>( strlen(suffix) ));
+ 00112 }
+ 00113
+ 00114
+ 00115 TiXmlString& operator += (char single)
+ 00116 {
+ 00117 return append(&single, 1);
+ 00118 }
+ 00119
+ 00120
+ 00121 TiXmlString& operator += (const TiXmlString & suffix)
+ 00122 {
+ 00123 return append(suffix.data(), suffix.length());
+ 00124 }
+ 00125
+ 00126
+ 00127
+ 00128 const char * c_str () const { return rep_->str; }
+ 00129
+ 00130
+ 00131 const char * data () const { return rep_->str; }
+ 00132
+ 00133
+ 00134 size_type length () const { return rep_->size; }
+ 00135
+ 00136
+ 00137 size_type size () const { return rep_->size; }
+ 00138
+ 00139
+ 00140 bool empty () const { return rep_->size == 0; }
+ 00141
+ 00142
+ 00143 size_type capacity () const { return rep_->capacity; }
+ 00144
+ 00145
+ 00146
+ 00147 const char & at (size_type index) const
+ 00148 {
+ 00149 assert( index < length() );
+ 00150 return rep_->str[ index ];
+ 00151 }
+ 00152
+ 00153
+ 00154 char & operator [] (size_type index) const
+ 00155 {
+ 00156 assert( index < length() );
+ 00157 return rep_->str[ index ];
+ 00158 }
+ 00159
+ 00160
+ 00161 size_type find (char lookup) const
+ 00162 {
+ 00163 return find(lookup, 0);
+ 00164 }
+ 00165
+ 00166
+ 00167 size_type find (char tofind, size_type offset) const
+ 00168 {
+ 00169 if (offset >= length()) return npos;
+ 00170
+ 00171 for (const char * p = c_str() + offset; *p != '\0' ; ++p)
+ 00172 {
+ 00173 if (*p == tofind) return static_cast< size_type > ( p - c_str() );
+ 00174 }
+ 00175 return npos;
+ 00176 }
+ 00177
+ 00178 void clear ()
+ 00179 {
+ 00180
+ 00181
+ 00182
+ 00183
+ 00184 quit();
+ 00185 init(0,0);
+ 00186 }
+ 00187
+ 00188
+ 00189
+ 00190
+ 00191 void reserve (size_type cap);
+ 00192
+ 00193 TiXmlString& assign (const char * str, size_type len);
+ 00194
+ 00195 TiXmlString& append (const char * str, size_type len);
+ 00196
+ 00197 void swap (TiXmlString& other)
+ 00198 {
+ 00199 Rep* r = rep_;
+ 00200 rep_ = other.rep_;
+ 00201 other.rep_ = r;
+ 00202 }
+ 00203
+ 00204 private :
+ 00205
+ 00206 void init(size_type sz) { init(sz, sz); }
+ 00207 void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0' ; }
+ 00208 char * start() const { return rep_->str; }
+ 00209 char * finish() const { return rep_->str + rep_->size; }
+ 00210
+ 00211 struct Rep
+ 00212 {
+ 00213 size_type size, capacity;
+ 00214 char str[1];
+ 00215 };
+ 00216
+ 00217 void init(size_type sz, size_type cap)
+ 00218 {
+ 00219 if (cap)
+ 00220 {
+ 00221
+ 00222
+ 00223
+ 00224
+ 00225
+ 00226 const size_type bytesNeeded = sizeof (Rep) + cap;
+ 00227 const size_type intsNeeded = ( bytesNeeded + sizeof (int) - 1 ) / sizeof ( int );
+ 00228 rep_ = reinterpret_cast< Rep*> ( new int [ intsNeeded ] );
+ 00229
+ 00230 rep_->str[ rep_->size = sz ] = '\0' ;
+ 00231 rep_->capacity = cap;
+ 00232 }
+ 00233 else
+ 00234 {
+ 00235 rep_ = &nullrep_;
+ 00236 }
+ 00237 }
+ 00238
+ 00239 void quit()
+ 00240 {
+ 00241 if (rep_ != &nullrep_)
+ 00242 {
+ 00243
+ 00244
+ 00245 delete [] ( reinterpret_cast< int *> ( rep_ ) );
+ 00246 }
+ 00247 }
+ 00248
+ 00249 Rep * rep_;
+ 00250 static Rep nullrep_;
+ 00251
+ 00252 } ;
+ 00253
+ 00254
+ 00255 inline bool operator == (const TiXmlString & a, const TiXmlString & b)
+ 00256 {
+ 00257 return ( a.length() == b.length() )
+ 00258 && ( strcmp(a.c_str(), b.c_str()) == 0 );
+ 00259 }
+ 00260 inline bool operator < (const TiXmlString & a, const TiXmlString & b)
+ 00261 {
+ 00262 return strcmp(a.c_str(), b.c_str()) < 0;
+ 00263 }
+ 00264
+ 00265 inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); }
+ 00266 inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; }
+ 00267 inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); }
+ 00268 inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); }
+ 00269
+ 00270 inline bool operator == (const TiXmlString & a, const char * b) { return strcmp(a.c_str(), b) == 0; }
+ 00271 inline bool operator == (const char * a, const TiXmlString & b) { return b == a; }
+ 00272 inline bool operator != (const TiXmlString & a, const char * b) { return !(a == b); }
+ 00273 inline bool operator != (const char * a, const TiXmlString & b) { return !(b == a); }
+ 00274
+ 00275 TiXmlString operator + (const TiXmlString & a, const TiXmlString & b);
+ 00276 TiXmlString operator + (const TiXmlString & a, const char * b);
+ 00277 TiXmlString operator + (const char * a, const TiXmlString & b);
+ 00278
+ 00279
+ 00280
+ 00281
+ 00282
+ 00283
+ 00284 class TiXmlOutStream : public TiXmlString
+ 00285 {
+ 00286 public :
+ 00287
+ 00288
+ 00289 TiXmlOutStream & operator << (const TiXmlString & in)
+ 00290 {
+ 00291 *this += in;
+ 00292 return *this ;
+ 00293 }
+ 00294
+ 00295
+ 00296 TiXmlOutStream & operator << (const char * in)
+ 00297 {
+ 00298 *this += in;
+ 00299 return *this ;
+ 00300 }
+ 00301
+ 00302 } ;
+ 00303
+ 00304 #endif // TIXML_STRING_INCLUDED
+ 00305 #endif // TIXML_USE_STL
+
+Generated by
+
+ 1.6.2
+
+
diff --git a/Engine/lib/tinyxml/docs/tinyxml_8h-source.html b/Engine/lib/tinyxml/docs/tinyxml_8h-source.html
deleted file mode 100644
index 135da9ce6..000000000
--- a/Engine/lib/tinyxml/docs/tinyxml_8h-source.html
+++ /dev/null
@@ -1,1201 +0,0 @@
-
-
-TinyXml: tinyxml.h Source File
-
-
-
-
-
-tinyxml.h 00001
- 00002
- 00003
- 00004
- 00005
- 00006
- 00007
- 00008
- 00009
- 00010
- 00011
- 00012
- 00013
- 00014
- 00015
- 00016
- 00017
- 00018
- 00019
- 00020
- 00021
- 00022
- 00023
- 00024
- 00025
- 00026 #ifndef TINYXML_INCLUDED
- 00027 #define TINYXML_INCLUDED
- 00028
- 00029 #ifdef _MSC_VER
- 00030 #pragma warning( push )
- 00031 #pragma warning( disable : 4530 )
- 00032 #pragma warning( disable : 4786 )
- 00033 #endif
- 00034
- 00035 #include <ctype.h>
- 00036 #include <stdio.h>
- 00037 #include <stdlib.h>
- 00038 #include <string.h>
- 00039 #include <assert.h>
- 00040
- 00041
- 00042 #if defined( _DEBUG ) && !defined( DEBUG )
- 00043 #define DEBUG
- 00044 #endif
- 00045
- 00046 #ifdef TIXML_USE_STL
- 00047 #include <string>
- 00048 #include <iostream>
- 00049 #include <sstream>
- 00050 #define TIXML_STRING std::string
- 00051 #else
- 00052 #include "tinystr.h"
- 00053 #define TIXML_STRING TiXmlString
- 00054 #endif
- 00055
- 00056
- 00057
- 00058
- 00059
- 00060 #define TIXML_SAFE
- 00061
- 00062 #ifdef TIXML_SAFE
- 00063 #if defined(_MSC_VER) && (_MSC_VER >= 1400 )
- 00064
- 00065 #define TIXML_SNPRINTF _snprintf_s
- 00066 #define TIXML_SNSCANF _snscanf_s
- 00067 #define TIXML_SSCANF sscanf_s
- 00068 #elif defined(_MSC_VER) && (_MSC_VER >= 1200 )
- 00069
- 00070
- 00071 #define TIXML_SNPRINTF _snprintf
- 00072 #define TIXML_SNSCANF _snscanf
- 00073 #define TIXML_SSCANF sscanf
- 00074 #elif defined(__GNUC__) && (__GNUC__ >= 3 )
- 00075
- 00076
- 00077 #define TIXML_SNPRINTF snprintf
- 00078 #define TIXML_SNSCANF snscanf
- 00079 #define TIXML_SSCANF sscanf
- 00080 #else
- 00081 #define TIXML_SSCANF sscanf
- 00082 #endif
- 00083 #endif
- 00084
- 00085 class TiXmlDocument ;
- 00086 class TiXmlElement ;
- 00087 class TiXmlComment ;
- 00088 class TiXmlUnknown ;
- 00089 class TiXmlAttribute ;
- 00090 class TiXmlText ;
- 00091 class TiXmlDeclaration ;
- 00092 class TiXmlParsingData;
- 00093
- 00094 const int TIXML_MAJOR_VERSION = 2;
- 00095 const int TIXML_MINOR_VERSION = 5;
- 00096 const int TIXML_PATCH_VERSION = 3;
- 00097
- 00098
- 00099
- 00100
- 00101 struct TiXmlCursor
- 00102 {
- 00103 TiXmlCursor() { Clear(); }
- 00104 void Clear() { row = col = -1; }
- 00105
- 00106 int row;
- 00107 int col;
- 00108 };
- 00109
- 00110
-00129 class TiXmlVisitor
- 00130 {
- 00131 public :
- 00132 virtual ~TiXmlVisitor () {}
- 00133
-00135 virtual bool VisitEnter ( const TiXmlDocument & ) { return true ; }
-00137 virtual bool VisitExit ( const TiXmlDocument & ) { return true ; }
- 00138
-00140 virtual bool VisitEnter ( const TiXmlElement & , const TiXmlAttribute * ) { return true ; }
-00142 virtual bool VisitExit ( const TiXmlElement & ) { return true ; }
- 00143
-00145 virtual bool Visit ( const TiXmlDeclaration & ) { return true ; }
-00147 virtual bool Visit ( const TiXmlText & ) { return true ; }
-00149 virtual bool Visit ( const TiXmlComment & ) { return true ; }
-00151 virtual bool Visit ( const TiXmlUnknown & ) { return true ; }
- 00152 };
- 00153
- 00154
- 00155 enum
- 00156 {
- 00157 TIXML_SUCCESS,
- 00158 TIXML_NO_ATTRIBUTE,
- 00159 TIXML_WRONG_TYPE
- 00160 };
- 00161
- 00162
- 00163
- 00164 enum TiXmlEncoding
- 00165 {
- 00166 TIXML_ENCODING_UNKNOWN,
- 00167 TIXML_ENCODING_UTF8,
- 00168 TIXML_ENCODING_LEGACY
- 00169 };
- 00170
- 00171 const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN;
- 00172
-00195 class TiXmlBase
- 00196 {
- 00197 friend class TiXmlNode ;
- 00198 friend class TiXmlElement ;
- 00199 friend class TiXmlDocument ;
- 00200
- 00201 public :
- 00202 TiXmlBase () : userData (0) {}
- 00203 virtual ~TiXmlBase () {}
- 00204
- 00214 virtual void Print ( FILE* cfile, int depth ) const = 0;
- 00215
-00222 static void SetCondenseWhiteSpace ( bool condense ) { condenseWhiteSpace = condense; }
- 00223
-00225 static bool IsWhiteSpaceCondensed () { return condenseWhiteSpace; }
- 00226
-00245 int Row () const { return location.row + 1; }
-00246 int Column () const { return location.col + 1; }
- 00247
-00248 void SetUserData ( void * user ) { userData = user; }
-00249 void * GetUserData () { return userData ; }
-00250 const void * GetUserData () const { return userData ; }
- 00251
- 00252
- 00253
- 00254 static const int utf8ByteTable[256];
- 00255
- 00256 virtual const char * Parse ( const char * p,
- 00257 TiXmlParsingData* data,
- 00258 TiXmlEncoding encoding ) = 0;
- 00259
- 00263 static void EncodeString ( const TIXML_STRING& str, TIXML_STRING* out );
- 00264
- 00265 enum
- 00266 {
- 00267 TIXML_NO_ERROR = 0,
- 00268 TIXML_ERROR,
- 00269 TIXML_ERROR_OPENING_FILE,
- 00270 TIXML_ERROR_OUT_OF_MEMORY,
- 00271 TIXML_ERROR_PARSING_ELEMENT,
- 00272 TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
- 00273 TIXML_ERROR_READING_ELEMENT_VALUE,
- 00274 TIXML_ERROR_READING_ATTRIBUTES,
- 00275 TIXML_ERROR_PARSING_EMPTY,
- 00276 TIXML_ERROR_READING_END_TAG,
- 00277 TIXML_ERROR_PARSING_UNKNOWN,
- 00278 TIXML_ERROR_PARSING_COMMENT,
- 00279 TIXML_ERROR_PARSING_DECLARATION,
- 00280 TIXML_ERROR_DOCUMENT_EMPTY,
- 00281 TIXML_ERROR_EMBEDDED_NULL,
- 00282 TIXML_ERROR_PARSING_CDATA,
- 00283 TIXML_ERROR_DOCUMENT_TOP_ONLY,
- 00284
- 00285 TIXML_ERROR_STRING_COUNT
- 00286 };
- 00287
- 00288 protected :
- 00289
- 00290 static const char * SkipWhiteSpace( const char *, TiXmlEncoding encoding );
- 00291 inline static bool IsWhiteSpace( char c )
- 00292 {
- 00293 return ( isspace( (unsigned char ) c ) || c == '\n' || c == '\r' );
- 00294 }
- 00295 inline static bool IsWhiteSpace( int c )
- 00296 {
- 00297 if ( c < 256 )
- 00298 return IsWhiteSpace( (char ) c );
- 00299 return false ;
- 00300 }
- 00301
- 00302 #ifdef TIXML_USE_STL
- 00303 static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag );
- 00304 static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag );
- 00305 #endif
- 00306
- 00307
- 00308
- 00309
- 00310
- 00311 static const char * ReadName( const char * p, TIXML_STRING* name, TiXmlEncoding encoding );
- 00312
- 00313
- 00314
- 00315
- 00316 static const char * ReadText( const char * in,
- 00317 TIXML_STRING* text,
- 00318 bool ignoreWhiteSpace,
- 00319 const char * endTag,
- 00320 bool ignoreCase,
- 00321 TiXmlEncoding encoding );
- 00322
- 00323
- 00324 static const char * GetEntity( const char * in, char * value, int * length, TiXmlEncoding encoding );
- 00325
- 00326
- 00327
- 00328 inline static const char * GetChar( const char * p, char * _value, int * length, TiXmlEncoding encoding )
- 00329 {
- 00330 assert( p );
- 00331 if ( encoding == TIXML_ENCODING_UTF8 )
- 00332 {
- 00333 *length = utf8ByteTable[ *((const unsigned char *)p) ];
- 00334 assert( *length >= 0 && *length < 5 );
- 00335 }
- 00336 else
- 00337 {
- 00338 *length = 1;
- 00339 }
- 00340
- 00341 if ( *length == 1 )
- 00342 {
- 00343 if ( *p == '&' )
- 00344 return GetEntity( p, _value, length, encoding );
- 00345 *_value = *p;
- 00346 return p+1;
- 00347 }
- 00348 else if ( *length )
- 00349 {
- 00350
- 00351
- 00352 for ( int i=0; p[i] && i<*length; ++i ) {
- 00353 _value[i] = p[i];
- 00354 }
- 00355 return p + (*length);
- 00356 }
- 00357 else
- 00358 {
- 00359
- 00360 return 0;
- 00361 }
- 00362 }
- 00363
- 00364
- 00365
- 00366
- 00367 static bool StringEqual( const char * p,
- 00368 const char * endTag,
- 00369 bool ignoreCase,
- 00370 TiXmlEncoding encoding );
- 00371
- 00372 static const char * errorString[ TIXML_ERROR_STRING_COUNT ];
- 00373
- 00374 TiXmlCursor location;
- 00375
-00377 void * userData ;
- 00378
- 00379
- 00380
- 00381 static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding );
- 00382 static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding );
- 00383 inline static int ToLower( int v, TiXmlEncoding encoding )
- 00384 {
- 00385 if ( encoding == TIXML_ENCODING_UTF8 )
- 00386 {
- 00387 if ( v < 128 ) return tolower( v );
- 00388 return v;
- 00389 }
- 00390 else
- 00391 {
- 00392 return tolower( v );
- 00393 }
- 00394 }
- 00395 static void ConvertUTF32ToUTF8( unsigned long input, char * output, int * length );
- 00396
- 00397 private :
- 00398 TiXmlBase ( const TiXmlBase & );
- 00399 void operator=( const TiXmlBase & base );
- 00400
- 00401 struct Entity
- 00402 {
- 00403 const char * str;
- 00404 unsigned int strLength;
- 00405 char chr;
- 00406 };
- 00407 enum
- 00408 {
- 00409 NUM_ENTITY = 5,
- 00410 MAX_ENTITY_LENGTH = 6
- 00411
- 00412 };
- 00413 static Entity entity[ NUM_ENTITY ];
- 00414 static bool condenseWhiteSpace;
- 00415 };
- 00416
- 00417
-00424 class TiXmlNode : public TiXmlBase
- 00425 {
- 00426 friend class TiXmlDocument ;
- 00427 friend class TiXmlElement ;
- 00428
- 00429 public :
- 00430 #ifdef TIXML_USE_STL
- 00431
- 00435 friend std::istream& operator >> (std::istream& in, TiXmlNode & base);
- 00436
- 00453 friend std::ostream& operator<< (std::ostream& out, const TiXmlNode & base);
- 00454
- 00456 friend std::string& operator<< (std::string& out, const TiXmlNode & base );
- 00457
- 00458 #endif
- 00459
-00463 enum NodeType
- 00464 {
- 00465 DOCUMENT,
- 00466 ELEMENT,
- 00467 COMMENT,
- 00468 UNKNOWN,
- 00469 TEXT,
- 00470 DECLARATION,
- 00471 TYPECOUNT
- 00472 };
- 00473
- 00474 virtual ~TiXmlNode ();
- 00475
-00488 const char *Value () const { return value.c_str (); }
- 00489
- 00490 #ifdef TIXML_USE_STL
- 00491
-00495 const std::string& ValueStr () const { return value; }
- 00496 #endif
- 00497
- 00498 const TIXML_STRING& ValueTStr() const { return value; }
- 00499
-00509 void SetValue (const char * _value) { value = _value;}
- 00510
- 00511 #ifdef TIXML_USE_STL
-00513 void SetValue( const std::string& _value ) { value = _value; }
- 00514 #endif
- 00515
- 00517 void Clear ();
- 00518
-00520 TiXmlNode * Parent () { return parent; }
- 00521 const TiXmlNode * Parent () const { return parent; }
- 00522
-00523 const TiXmlNode * FirstChild () const { return firstChild; }
- 00524 TiXmlNode * FirstChild () { return firstChild; }
- 00525 const TiXmlNode * FirstChild ( const char * value ) const ;
- 00526
-00527 TiXmlNode * FirstChild ( const char * _value ) {
- 00528
- 00529
- 00530 return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this ))->FirstChild( _value ));
- 00531 }
- 00532 const TiXmlNode * LastChild() const { return lastChild; }
-00533 TiXmlNode * LastChild() { return lastChild; }
- 00534
- 00535 const TiXmlNode * LastChild( const char * value ) const ;
-00536 TiXmlNode * LastChild( const char * _value ) {
- 00537 return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this ))->LastChild( _value ));
- 00538 }
- 00539
- 00540 #ifdef TIXML_USE_STL
-00541 const TiXmlNode * FirstChild ( const std::string& _value ) const { return FirstChild (_value.c_str ()); }
-00542 TiXmlNode * FirstChild ( const std::string& _value ) { return FirstChild (_value.c_str ()); }
-00543 const TiXmlNode * LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); }
-00544 TiXmlNode * LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); }
- 00545 #endif
- 00546
- 00563 const TiXmlNode * IterateChildren ( const TiXmlNode * previous ) const ;
- 00564 TiXmlNode * IterateChildren ( const TiXmlNode * previous ) {
- 00565 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this ))->IterateChildren( previous ) );
- 00566 }
- 00567
- 00569 const TiXmlNode * IterateChildren ( const char * value, const TiXmlNode * previous ) const ;
- 00570 TiXmlNode * IterateChildren ( const char * _value, const TiXmlNode * previous ) {
- 00571 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this ))->IterateChildren( _value, previous ) );
- 00572 }
- 00573
- 00574 #ifdef TIXML_USE_STL
-00575 const TiXmlNode * IterateChildren ( const std::string& _value, const TiXmlNode * previous ) const { return IterateChildren (_value.c_str (), previous); }
-00576 TiXmlNode * IterateChildren ( const std::string& _value, const TiXmlNode * previous ) { return IterateChildren (_value.c_str (), previous); }
- 00577 #endif
- 00578
- 00582 TiXmlNode * InsertEndChild ( const TiXmlNode & addThis );
- 00583
- 00584
- 00594 TiXmlNode * LinkEndChild ( TiXmlNode * addThis );
- 00595
- 00599 TiXmlNode * InsertBeforeChild ( TiXmlNode * beforeThis, const TiXmlNode & addThis );
- 00600
- 00604 TiXmlNode * InsertAfterChild ( TiXmlNode * afterThis, const TiXmlNode & addThis );
- 00605
- 00609 TiXmlNode * ReplaceChild ( TiXmlNode * replaceThis, const TiXmlNode & withThis );
- 00610
- 00612 bool RemoveChild ( TiXmlNode * removeThis );
- 00613
-00615 const TiXmlNode * PreviousSibling () const { return prev; }
- 00616 TiXmlNode * PreviousSibling () { return prev; }
- 00617
- 00619 const TiXmlNode * PreviousSibling ( const char * ) const ;
- 00620 TiXmlNode * PreviousSibling ( const char *_prev ) {
- 00621 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this ))->PreviousSibling( _prev ) );
- 00622 }
- 00623
- 00624 #ifdef TIXML_USE_STL
-00625 const TiXmlNode * PreviousSibling ( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); }
-00626 TiXmlNode * PreviousSibling ( const std::string& _value ) { return PreviousSibling (_value.c_str ()); }
-00627 const TiXmlNode * NextSibling ( const std::string& _value) const { return NextSibling (_value.c_str ()); }
-00628 TiXmlNode * NextSibling ( const std::string& _value) { return NextSibling (_value.c_str ()); }
- 00629 #endif
- 00630
-00632 const TiXmlNode * NextSibling () const { return next; }
- 00633 TiXmlNode * NextSibling () { return next; }
- 00634
- 00636 const TiXmlNode * NextSibling ( const char * ) const ;
- 00637 TiXmlNode * NextSibling ( const char * _next ) {
- 00638 return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this ))->NextSibling( _next ) );
- 00639 }
- 00640
- 00645 const TiXmlElement * NextSiblingElement () const ;
- 00646 TiXmlElement * NextSiblingElement () {
- 00647 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this ))->NextSiblingElement() );
- 00648 }
- 00649
- 00654 const TiXmlElement * NextSiblingElement ( const char * ) const ;
- 00655 TiXmlElement * NextSiblingElement ( const char *_next ) {
- 00656 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this ))->NextSiblingElement( _next ) );
- 00657 }
- 00658
- 00659 #ifdef TIXML_USE_STL
-00660 const TiXmlElement * NextSiblingElement ( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); }
-00661 TiXmlElement * NextSiblingElement ( const std::string& _value) { return NextSiblingElement (_value.c_str ()); }
- 00662 #endif
- 00663
- 00665 const TiXmlElement * FirstChildElement () const ;
- 00666 TiXmlElement * FirstChildElement () {
- 00667 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this ))->FirstChildElement() );
- 00668 }
- 00669
- 00671 const TiXmlElement * FirstChildElement ( const char * _value ) const ;
- 00672 TiXmlElement * FirstChildElement ( const char * _value ) {
- 00673 return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this ))->FirstChildElement( _value ) );
- 00674 }
- 00675
- 00676 #ifdef TIXML_USE_STL
-00677 const TiXmlElement * FirstChildElement ( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); }
-00678 TiXmlElement * FirstChildElement ( const std::string& _value ) { return FirstChildElement (_value.c_str ()); }
- 00679 #endif
- 00680
-00685 int Type () const { return type; }
- 00686
- 00690 const TiXmlDocument * GetDocument () const ;
- 00691 TiXmlDocument * GetDocument () {
- 00692 return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this ))->GetDocument() );
- 00693 }
- 00694
-00696 bool NoChildren () const { return !firstChild; }
- 00697
-00698 virtual const TiXmlDocument * ToDocument () const { return 0; }
-00699 virtual const TiXmlElement * ToElement () const { return 0; }
-00700 virtual const TiXmlComment * ToComment () const { return 0; }
-00701 virtual const TiXmlUnknown * ToUnknown () const { return 0; }
-00702 virtual const TiXmlText * ToText () const { return 0; }
-00703 virtual const TiXmlDeclaration * ToDeclaration () const { return 0; }
- 00704
-00705 virtual TiXmlDocument * ToDocument () { return 0; }
-00706 virtual TiXmlElement * ToElement () { return 0; }
-00707 virtual TiXmlComment * ToComment () { return 0; }
-00708 virtual TiXmlUnknown * ToUnknown () { return 0; }
-00709 virtual TiXmlText * ToText () { return 0; }
-00710 virtual TiXmlDeclaration * ToDeclaration () { return 0; }
- 00711
- 00715 virtual TiXmlNode * Clone () const = 0;
- 00716
- 00739 virtual bool Accept ( TiXmlVisitor * visitor ) const = 0;
- 00740
- 00741 protected :
- 00742 TiXmlNode ( NodeType _type );
- 00743
- 00744
- 00745
- 00746 void CopyTo( TiXmlNode * target ) const ;
- 00747
- 00748 #ifdef TIXML_USE_STL
- 00749
- 00750 virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0;
- 00751 #endif
- 00752
- 00753
- 00754 TiXmlNode * Identify( const char * start, TiXmlEncoding encoding );
- 00755
- 00756 TiXmlNode * parent;
- 00757 NodeType type;
- 00758
- 00759 TiXmlNode * firstChild;
- 00760 TiXmlNode * lastChild;
- 00761
- 00762 TIXML_STRING value;
- 00763
- 00764 TiXmlNode * prev;
- 00765 TiXmlNode * next;
- 00766
- 00767 private :
- 00768 TiXmlNode ( const TiXmlNode & );
- 00769 void operator=( const TiXmlNode & base );
- 00770 };
- 00771
- 00772
-00780 class TiXmlAttribute : public TiXmlBase
- 00781 {
- 00782 friend class TiXmlAttributeSet;
- 00783
- 00784 public :
-00786 TiXmlAttribute () : TiXmlBase ()
- 00787 {
- 00788 document = 0;
- 00789 prev = next = 0;
- 00790 }
- 00791
- 00792 #ifdef TIXML_USE_STL
-00794 TiXmlAttribute( const std::string& _name, const std::string& _value )
- 00795 {
- 00796 name = _name;
- 00797 value = _value;
- 00798 document = 0;
- 00799 prev = next = 0;
- 00800 }
- 00801 #endif
- 00802
-00804 TiXmlAttribute ( const char * _name, const char * _value )
- 00805 {
- 00806 name = _name;
- 00807 value = _value;
- 00808 document = 0;
- 00809 prev = next = 0;
- 00810 }
- 00811
-00812 const char * Name () const { return name.c_str(); }
-00813 const char * Value () const { return value.c_str(); }
- 00814 #ifdef TIXML_USE_STL
-00815 const std::string& ValueStr () const { return value; }
- 00816 #endif
- 00817 int IntValue () const ;
- 00818 double DoubleValue () const ;
- 00819
- 00820
- 00821 const TIXML_STRING& NameTStr() const { return name; }
- 00822
- 00832 int QueryIntValue ( int * _value ) const ;
- 00834 int QueryDoubleValue ( double * _value ) const ;
- 00835
-00836 void SetName ( const char * _name ) { name = _name; }
-00837 void SetValue ( const char * _value ) { value = _value; }
- 00838
- 00839 void SetIntValue ( int _value );
- 00840 void SetDoubleValue ( double _value );
- 00841
- 00842 #ifdef TIXML_USE_STL
-00844 void SetName( const std::string& _name ) { name = _name; }
-00846 void SetValue( const std::string& _value ) { value = _value; }
- 00847 #endif
- 00848
- 00850 const TiXmlAttribute * Next () const ;
- 00851 TiXmlAttribute * Next () {
- 00852 return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this ))->Next() );
- 00853 }
- 00854
- 00856 const TiXmlAttribute * Previous () const ;
- 00857 TiXmlAttribute * Previous () {
- 00858 return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this ))->Previous() );
- 00859 }
- 00860
- 00861 bool operator==( const TiXmlAttribute & rhs ) const { return rhs.name == name; }
- 00862 bool operator<( const TiXmlAttribute & rhs ) const { return name < rhs.name ; }
- 00863 bool operator>( const TiXmlAttribute & rhs ) const { return name > rhs.name ; }
- 00864
- 00865
- 00866
- 00867
- 00868 virtual const char * Parse( const char * p, TiXmlParsingData* data, TiXmlEncoding encoding );
- 00869
- 00870
-00871 virtual void Print ( FILE* cfile, int depth ) const {
- 00872 Print ( cfile, depth, 0 );
- 00873 }
- 00874 void Print ( FILE* cfile, int depth, TIXML_STRING* str ) const ;
- 00875
- 00876
- 00877
- 00878 void SetDocument( TiXmlDocument * doc ) { document = doc; }
- 00879
- 00880 private :
- 00881 TiXmlAttribute ( const TiXmlAttribute & );
- 00882 void operator=( const TiXmlAttribute & base );
- 00883
- 00884 TiXmlDocument * document;
- 00885 TIXML_STRING name;
- 00886 TIXML_STRING value;
- 00887 TiXmlAttribute * prev;
- 00888 TiXmlAttribute * next;
- 00889 };
- 00890
- 00891
- 00892
- 00893
- 00894
- 00895
- 00896
- 00897
- 00898
- 00899
- 00900
- 00901
- 00902
- 00903
- 00904 class TiXmlAttributeSet
- 00905 {
- 00906 public :
- 00907 TiXmlAttributeSet();
- 00908 ~TiXmlAttributeSet();
- 00909
- 00910 void Add( TiXmlAttribute * attribute );
- 00911 void Remove( TiXmlAttribute * attribute );
- 00912
- 00913 const TiXmlAttribute * First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
- 00914 TiXmlAttribute * First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
- 00915 const TiXmlAttribute * Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
- 00916 TiXmlAttribute * Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
- 00917
- 00918 const TiXmlAttribute * Find( const char * _name ) const ;
- 00919 TiXmlAttribute * Find( const char * _name ) {
- 00920 return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this ))->Find( _name ) );
- 00921 }
- 00922 #ifdef TIXML_USE_STL
- 00923 const TiXmlAttribute * Find( const std::string& _name ) const ;
- 00924 TiXmlAttribute * Find( const std::string& _name ) {
- 00925 return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this ))->Find( _name ) );
- 00926 }
- 00927
- 00928 #endif
- 00929
- 00930 private :
- 00931
- 00932
- 00933 TiXmlAttributeSet( const TiXmlAttributeSet& );
- 00934 void operator=( const TiXmlAttributeSet& );
- 00935
- 00936 TiXmlAttribute sentinel;
- 00937 };
- 00938
- 00939
-00944 class TiXmlElement : public TiXmlNode
- 00945 {
- 00946 public :
- 00948 TiXmlElement (const char * in_value);
- 00949
- 00950 #ifdef TIXML_USE_STL
- 00952 TiXmlElement( const std::string& _value );
- 00953 #endif
- 00954
- 00955 TiXmlElement ( const TiXmlElement & );
- 00956
- 00957 void operator=( const TiXmlElement & base );
- 00958
- 00959 virtual ~TiXmlElement ();
- 00960
- 00964 const char * Attribute ( const char * name ) const ;
- 00965
- 00972 const char * Attribute ( const char * name, int * i ) const ;
- 00973
- 00980 const char * Attribute ( const char * name, double * d ) const ;
- 00981
- 00989 int QueryIntAttribute ( const char * name, int * _value ) const ;
- 00991 int QueryDoubleAttribute ( const char * name, double * _value ) const ;
-00993 int QueryFloatAttribute ( const char * name, float * _value ) const {
- 00994 double d;
- 00995 int result = QueryDoubleAttribute ( name, &d );
- 00996 if ( result == TIXML_SUCCESS ) {
- 00997 *_value = (float)d;
- 00998 }
- 00999 return result;
- 01000 }
- 01001
- 01002 #ifdef TIXML_USE_STL
- 01003
-01011 template < typename T > int QueryValueAttribute ( const std::string& name, T* outValue ) const
- 01012 {
- 01013 const TiXmlAttribute * node = attributeSet.Find( name );
- 01014 if ( !node )
- 01015 return TIXML_NO_ATTRIBUTE;
- 01016
- 01017 std::stringstream sstream( node->ValueStr () );
- 01018 sstream >> *outValue;
- 01019 if ( !sstream.fail() )
- 01020 return TIXML_SUCCESS;
- 01021 return TIXML_WRONG_TYPE;
- 01022 }
- 01023
- 01024
- 01025
- 01026
- 01027
- 01028
- 01029
- 01030
- 01031
- 01032
- 01033
- 01034
- 01035
- 01036
- 01037
- 01038 #endif
- 01039
- 01043 void SetAttribute ( const char * name, const char * _value );
- 01044
- 01045 #ifdef TIXML_USE_STL
- 01046 const std::string* Attribute ( const std::string& name ) const ;
- 01047 const std::string* Attribute ( const std::string& name, int * i ) const ;
- 01048 const std::string* Attribute ( const std::string& name, double * d ) const ;
- 01049 int QueryIntAttribute ( const std::string& name, int * _value ) const ;
- 01050 int QueryDoubleAttribute ( const std::string& name, double * _value ) const ;
- 01051
- 01053 void SetAttribute ( const std::string& name, const std::string& _value );
- 01055 void SetAttribute ( const std::string& name, int _value );
- 01056 #endif
- 01057
- 01061 void SetAttribute ( const char * name, int value );
- 01062
- 01066 void SetDoubleAttribute ( const char * name, double value );
- 01067
- 01070 void RemoveAttribute ( const char * name );
- 01071 #ifdef TIXML_USE_STL
-01072 void RemoveAttribute ( const std::string& name ) { RemoveAttribute (name.c_str ()); }
- 01073 #endif
- 01074
-01075 const TiXmlAttribute * FirstAttribute () const { return attributeSet.First(); }
- 01076 TiXmlAttribute * FirstAttribute () { return attributeSet.First(); }
-01077 const TiXmlAttribute * LastAttribute () const { return attributeSet.Last(); }
- 01078 TiXmlAttribute * LastAttribute () { return attributeSet.Last(); }
- 01079
- 01112 const char * GetText () const ;
- 01113
- 01115 virtual TiXmlNode * Clone () const ;
- 01116
- 01117 virtual void Print ( FILE* cfile, int depth ) const ;
- 01118
- 01119
- 01120
- 01121
- 01122 virtual const char * Parse( const char * p, TiXmlParsingData* data, TiXmlEncoding encoding );
- 01123
-01124 virtual const TiXmlElement * ToElement () const { return this ; }
-01125 virtual TiXmlElement * ToElement () { return this ; }
- 01126
- 01129 virtual bool Accept ( TiXmlVisitor * visitor ) const ;
- 01130
- 01131 protected :
- 01132
- 01133 void CopyTo( TiXmlElement * target ) const ;
- 01134 void ClearThis();
- 01135
- 01136
- 01137 #ifdef TIXML_USE_STL
- 01138 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
- 01139 #endif
- 01140
- 01141
- 01142
- 01143
- 01144 const char * ReadValue( const char * in, TiXmlParsingData* prevData, TiXmlEncoding encoding );
- 01145
- 01146 private :
- 01147
- 01148 TiXmlAttributeSet attributeSet;
- 01149 };
- 01150
- 01151
-01154 class TiXmlComment : public TiXmlNode
- 01155 {
- 01156 public :
-01158 TiXmlComment () : TiXmlNode ( TiXmlNode ::COMMENT ) {}
-01160 TiXmlComment ( const char * _value ) : TiXmlNode ( TiXmlNode ::COMMENT ) {
- 01161 SetValue ( _value );
- 01162 }
- 01163 TiXmlComment ( const TiXmlComment & );
- 01164 void operator=( const TiXmlComment & base );
- 01165
- 01166 virtual ~TiXmlComment () {}
- 01167
- 01169 virtual TiXmlNode * Clone () const ;
- 01170
- 01171 virtual void Print ( FILE* cfile, int depth ) const ;
- 01172
- 01173
- 01174
- 01175
- 01176 virtual const char * Parse( const char * p, TiXmlParsingData* data, TiXmlEncoding encoding );
- 01177
-01178 virtual const TiXmlComment * ToComment () const { return this ; }
-01179 virtual TiXmlComment * ToComment () { return this ; }
- 01180
- 01183 virtual bool Accept ( TiXmlVisitor * visitor ) const ;
- 01184
- 01185 protected :
- 01186 void CopyTo( TiXmlComment * target ) const ;
- 01187
- 01188
- 01189 #ifdef TIXML_USE_STL
- 01190 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
- 01191 #endif
- 01192
- 01193
- 01194 private :
- 01195
- 01196 };
- 01197
- 01198
-01204 class TiXmlText : public TiXmlNode
- 01205 {
- 01206 friend class TiXmlElement ;
- 01207 public :
-01212 TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode ::TEXT)
- 01213 {
- 01214 SetValue ( initValue );
- 01215 cdata = false ;
- 01216 }
- 01217 virtual ~TiXmlText () {}
- 01218
- 01219 #ifdef TIXML_USE_STL
-01221 TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
- 01222 {
- 01223 SetValue ( initValue );
- 01224 cdata = false ;
- 01225 }
- 01226 #endif
- 01227
- 01228 TiXmlText ( const TiXmlText & copy ) : TiXmlNode ( TiXmlNode ::TEXT ) { copy.CopyTo ( this ); }
- 01229 void operator=( const TiXmlText & base ) { base.CopyTo ( this ); }
- 01230
- 01231
- 01232 virtual void Print ( FILE* cfile, int depth ) const ;
- 01233
-01235 bool CDATA () const { return cdata; }
-01237 void SetCDATA ( bool _cdata ) { cdata = _cdata; }
- 01238
- 01239 virtual const char * Parse( const char * p, TiXmlParsingData* data, TiXmlEncoding encoding );
- 01240
-01241 virtual const TiXmlText * ToText () const { return this ; }
-01242 virtual TiXmlText * ToText () { return this ; }
- 01243
- 01246 virtual bool Accept ( TiXmlVisitor * content ) const ;
- 01247
- 01248 protected :
- 01250 virtual TiXmlNode * Clone () const ;
- 01251 void CopyTo( TiXmlText * target ) const ;
- 01252
- 01253 bool Blank() const ;
- 01254
- 01255 #ifdef TIXML_USE_STL
- 01256 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
- 01257 #endif
- 01258
- 01259 private :
- 01260 bool cdata;
- 01261 };
- 01262
- 01263
-01277 class TiXmlDeclaration : public TiXmlNode
- 01278 {
- 01279 public :
-01281 TiXmlDeclaration () : TiXmlNode ( TiXmlNode ::DECLARATION ) {}
- 01282
- 01283 #ifdef TIXML_USE_STL
- 01285 TiXmlDeclaration( const std::string& _version,
- 01286 const std::string& _encoding,
- 01287 const std::string& _standalone );
- 01288 #endif
- 01289
- 01291 TiXmlDeclaration ( const char * _version,
- 01292 const char * _encoding,
- 01293 const char * _standalone );
- 01294
- 01295 TiXmlDeclaration ( const TiXmlDeclaration & copy );
- 01296 void operator=( const TiXmlDeclaration & copy );
- 01297
- 01298 virtual ~TiXmlDeclaration () {}
- 01299
-01301 const char *Version () const { return version.c_str (); }
-01303 const char *Encoding () const { return encoding.c_str (); }
-01305 const char *Standalone () const { return standalone.c_str (); }
- 01306
- 01308 virtual TiXmlNode * Clone () const ;
- 01309
- 01310 virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const ;
-01311 virtual void Print( FILE* cfile, int depth ) const {
- 01312 Print( cfile, depth, 0 );
- 01313 }
- 01314
- 01315 virtual const char * Parse( const char * p, TiXmlParsingData* data, TiXmlEncoding encoding );
- 01316
-01317 virtual const TiXmlDeclaration * ToDeclaration () const { return this ; }
-01318 virtual TiXmlDeclaration * ToDeclaration () { return this ; }
- 01319
- 01322 virtual bool Accept ( TiXmlVisitor * visitor ) const ;
- 01323
- 01324 protected :
- 01325 void CopyTo( TiXmlDeclaration * target ) const ;
- 01326
- 01327 #ifdef TIXML_USE_STL
- 01328 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
- 01329 #endif
- 01330
- 01331 private :
- 01332
- 01333 TIXML_STRING version;
- 01334 TIXML_STRING encoding;
- 01335 TIXML_STRING standalone;
- 01336 };
- 01337
- 01338
-01346 class TiXmlUnknown : public TiXmlNode
- 01347 {
- 01348 public :
- 01349 TiXmlUnknown () : TiXmlNode ( TiXmlNode::UNKNOWN ) {}
- 01350 virtual ~TiXmlUnknown () {}
- 01351
- 01352 TiXmlUnknown ( const TiXmlUnknown & copy ) : TiXmlNode ( TiXmlNode::UNKNOWN ) { copy.CopyTo ( this ); }
- 01353 void operator=( const TiXmlUnknown & copy ) { copy.CopyTo ( this ); }
- 01354
- 01356 virtual TiXmlNode * Clone () const ;
- 01357
- 01358 virtual void Print ( FILE* cfile, int depth ) const ;
- 01359
- 01360 virtual const char * Parse( const char * p, TiXmlParsingData* data, TiXmlEncoding encoding );
- 01361
-01362 virtual const TiXmlUnknown * ToUnknown () const { return this ; }
-01363 virtual TiXmlUnknown * ToUnknown () { return this ; }
- 01364
- 01367 virtual bool Accept ( TiXmlVisitor * content ) const ;
- 01368
- 01369 protected :
- 01370 void CopyTo( TiXmlUnknown * target ) const ;
- 01371
- 01372 #ifdef TIXML_USE_STL
- 01373 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
- 01374 #endif
- 01375
- 01376 private :
- 01377
- 01378 };
- 01379
- 01380
-01385 class TiXmlDocument : public TiXmlNode
- 01386 {
- 01387 public :
- 01389 TiXmlDocument ();
- 01391 TiXmlDocument ( const char * documentName );
- 01392
- 01393 #ifdef TIXML_USE_STL
- 01395 TiXmlDocument( const std::string& documentName );
- 01396 #endif
- 01397
- 01398 TiXmlDocument ( const TiXmlDocument & copy );
- 01399 void operator=( const TiXmlDocument & copy );
- 01400
- 01401 virtual ~TiXmlDocument () {}
- 01402
- 01407 bool LoadFile ( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
- 01409 bool SaveFile () const ;
- 01411 bool LoadFile ( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
- 01413 bool SaveFile ( const char * filename ) const ;
- 01419 bool LoadFile ( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
- 01421 bool SaveFile ( FILE* ) const ;
- 01422
- 01423 #ifdef TIXML_USE_STL
-01424 bool LoadFile ( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING )
- 01425 {
- 01426
- 01427
- 01428 return LoadFile ( filename.c_str(), encoding );
- 01429 }
-01430 bool SaveFile ( const std::string& filename ) const
- 01431 {
- 01432
- 01433
- 01434 return SaveFile ( filename.c_str() );
- 01435 }
- 01436 #endif
- 01437
- 01442 virtual const char * Parse ( const char * p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
- 01443
-01448 const TiXmlElement * RootElement () const { return FirstChildElement (); }
- 01449 TiXmlElement * RootElement () { return FirstChildElement (); }
- 01450
-01456 bool Error () const { return error; }
- 01457
-01459 const char * ErrorDesc () const { return errorDesc.c_str (); }
- 01460
-01464 int ErrorId () const { return errorId; }
- 01465
-01473 int ErrorRow () const { return errorLocation.row+1; }
-01474 int ErrorCol () const { return errorLocation.col+1; }
- 01475
-01500 void SetTabSize ( int _tabsize ) { tabsize = _tabsize; }
- 01501
- 01502 int TabSize() const { return tabsize; }
- 01503
-01507 void ClearError () { error = false ;
- 01508 errorId = 0;
- 01509 errorDesc = "" ;
- 01510 errorLocation.row = errorLocation.col = 0;
- 01511
- 01512 }
- 01513
-01515 void Print () const { Print ( stdout, 0 ); }
- 01516
- 01517
- 01518
- 01519
- 01520
- 01521
- 01522
- 01524 virtual void Print ( FILE* cfile, int depth = 0 ) const ;
- 01525
- 01526 void SetError( int err, const char * errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding );
- 01527
-01528 virtual const TiXmlDocument * ToDocument () const { return this ; }
-01529 virtual TiXmlDocument * ToDocument () { return this ; }
- 01530
- 01533 virtual bool Accept ( TiXmlVisitor * content ) const ;
- 01534
- 01535 protected :
- 01536
- 01537 virtual TiXmlNode * Clone () const ;
- 01538 #ifdef TIXML_USE_STL
- 01539 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
- 01540 #endif
- 01541
- 01542 private :
- 01543 void CopyTo( TiXmlDocument * target ) const ;
- 01544
- 01545 bool error;
- 01546 int errorId;
- 01547 TIXML_STRING errorDesc;
- 01548 int tabsize;
- 01549 TiXmlCursor errorLocation;
- 01550 bool useMicrosoftBOM;
- 01551 };
- 01552
- 01553
-01634 class TiXmlHandle
- 01635 {
- 01636 public :
-01638 TiXmlHandle ( TiXmlNode * _node ) { this->node = _node; }
-01640 TiXmlHandle ( const TiXmlHandle & ref ) { this->node = ref.node ; }
- 01641 TiXmlHandle operator=( const TiXmlHandle & ref ) { this->node = ref.node ; return *this ; }
- 01642
- 01644 TiXmlHandle FirstChild () const ;
- 01646 TiXmlHandle FirstChild ( const char * value ) const ;
- 01648 TiXmlHandle FirstChildElement () const ;
- 01650 TiXmlHandle FirstChildElement ( const char * value ) const ;
- 01651
- 01655 TiXmlHandle Child ( const char * value, int index ) const ;
- 01659 TiXmlHandle Child ( int index ) const ;
- 01664 TiXmlHandle ChildElement ( const char * value, int index ) const ;
- 01669 TiXmlHandle ChildElement ( int index ) const ;
- 01670
- 01671 #ifdef TIXML_USE_STL
- 01672 TiXmlHandle FirstChild ( const std::string& _value ) const { return FirstChild ( _value.c_str() ); }
- 01673 TiXmlHandle FirstChildElement ( const std::string& _value ) const { return FirstChildElement ( _value.c_str() ); }
- 01674
- 01675 TiXmlHandle Child ( const std::string& _value, int index ) const { return Child ( _value.c_str(), index ); }
- 01676 TiXmlHandle ChildElement ( const std::string& _value, int index ) const { return ChildElement ( _value.c_str(), index ); }
- 01677 #endif
- 01678
-01681 TiXmlNode * ToNode () const { return node; }
-01684 TiXmlElement * ToElement () const { return ( ( node && node->ToElement () ) ? node->ToElement () : 0 ); }
-01687 TiXmlText * ToText () const { return ( ( node && node->ToText () ) ? node->ToText () : 0 ); }
-01690 TiXmlUnknown * ToUnknown () const { return ( ( node && node->ToUnknown () ) ? node->ToUnknown () : 0 ); }
- 01691
-01695 TiXmlNode * Node () const { return ToNode (); }
-01699 TiXmlElement * Element () const { return ToElement (); }
-01703 TiXmlText * Text () const { return ToText (); }
-01707 TiXmlUnknown * Unknown () const { return ToUnknown (); }
- 01708
- 01709 private :
- 01710 TiXmlNode * node;
- 01711 };
- 01712
- 01713
-01733 class TiXmlPrinter : public TiXmlVisitor
- 01734 {
- 01735 public :
- 01736 TiXmlPrinter () : depth( 0 ), simpleTextPrint( false ),
- 01737 buffer(), indent( " " ), lineBreak( "\n" ) {}
- 01738
- 01739 virtual bool VisitEnter ( const TiXmlDocument & doc );
- 01740 virtual bool VisitExit ( const TiXmlDocument & doc );
- 01741
- 01742 virtual bool VisitEnter ( const TiXmlElement & element, const TiXmlAttribute * firstAttribute );
- 01743 virtual bool VisitExit ( const TiXmlElement & element );
- 01744
- 01745 virtual bool Visit ( const TiXmlDeclaration & declaration );
- 01746 virtual bool Visit ( const TiXmlText & text );
- 01747 virtual bool Visit ( const TiXmlComment & comment );
- 01748 virtual bool Visit ( const TiXmlUnknown & unknown );
- 01749
-01753 void SetIndent ( const char * _indent ) { indent = _indent ? _indent : "" ; }
-01755 const char * Indent () { return indent.c_str(); }
-01760 void SetLineBreak ( const char * _lineBreak ) { lineBreak = _lineBreak ? _lineBreak : "" ; }
-01762 const char * LineBreak () { return lineBreak.c_str(); }
- 01763
-01767 void SetStreamPrinting () { indent = "" ;
- 01768 lineBreak = "" ;
- 01769 }
-01771 const char * CStr () { return buffer.c_str(); }
-01773 size_t Size () { return buffer.size(); }
- 01774
- 01775 #ifdef TIXML_USE_STL
-01777 const std::string& Str() { return buffer; }
- 01778 #endif
- 01779
- 01780 private :
- 01781 void DoIndent() {
- 01782 for ( int i=0; i<depth; ++i )
- 01783 buffer += indent;
- 01784 }
- 01785 void DoLineBreak() {
- 01786 buffer += lineBreak;
- 01787 }
- 01788
- 01789 int depth;
- 01790 bool simpleTextPrint;
- 01791 TIXML_STRING buffer;
- 01792 TIXML_STRING indent;
- 01793 TIXML_STRING lineBreak;
- 01794 };
- 01795
- 01796
- 01797 #ifdef _MSC_VER
- 01798 #pragma warning( pop )
- 01799 #endif
- 01800
- 01801 #endif
- 01802
-Generated on Sun May 6 15:41:23 2007 for TinyXml by
-
- 1.4.7
-
-
diff --git a/Engine/lib/tinyxml/docs/tinyxml_8h_source.html b/Engine/lib/tinyxml/docs/tinyxml_8h_source.html
new file mode 100644
index 000000000..566e39600
--- /dev/null
+++ b/Engine/lib/tinyxml/docs/tinyxml_8h_source.html
@@ -0,0 +1,1206 @@
+
+
+
+
+TinyXml: tinyxml.h Source File
+
+
+
+
+
+
+
+
+
tinyxml.h 00001
+ 00002
+ 00003
+ 00004
+ 00005
+ 00006
+ 00007
+ 00008
+ 00009
+ 00010
+ 00011
+ 00012
+ 00013
+ 00014
+ 00015
+ 00016
+ 00017
+ 00018
+ 00019
+ 00020
+ 00021
+ 00022
+ 00023
+ 00024
+ 00025
+ 00026 #ifndef TINYXML_INCLUDED
+ 00027 #define TINYXML_INCLUDED
+ 00028
+ 00029 #ifdef _MSC_VER
+ 00030 #pragma warning( push )
+ 00031 #pragma warning( disable : 4530 )
+ 00032 #pragma warning( disable : 4786 )
+ 00033 #endif
+ 00034
+ 00035 #include <ctype.h>
+ 00036 #include <stdio.h>
+ 00037 #include <stdlib.h>
+ 00038 #include <string.h>
+ 00039 #include <assert.h>
+ 00040
+ 00041
+ 00042 #if defined( _DEBUG ) && !defined( DEBUG )
+ 00043 #define DEBUG
+ 00044 #endif
+ 00045
+ 00046 #ifdef TIXML_USE_STL
+ 00047 #include <string>
+ 00048 #include <iostream>
+ 00049 #include <sstream>
+ 00050 #define TIXML_STRING std::string
+ 00051 #else
+ 00052 #include "tinystr.h"
+ 00053 #define TIXML_STRING TiXmlString
+ 00054 #endif
+ 00055
+ 00056
+ 00057
+ 00058
+ 00059
+ 00060 #define TIXML_SAFE
+ 00061
+ 00062 #ifdef TIXML_SAFE
+ 00063 #if defined(_MSC_VER) && (_MSC_VER >= 1400 )
+ 00064
+ 00065 #define TIXML_SNPRINTF _snprintf_s
+ 00066 #define TIXML_SSCANF sscanf_s
+ 00067 #elif defined(_MSC_VER) && (_MSC_VER >= 1200 )
+ 00068
+ 00069
+ 00070 #define TIXML_SNPRINTF _snprintf
+ 00071 #define TIXML_SSCANF sscanf
+ 00072 #elif defined(__GNUC__) && (__GNUC__ >= 3 )
+ 00073
+ 00074
+ 00075 #define TIXML_SNPRINTF snprintf
+ 00076 #define TIXML_SSCANF sscanf
+ 00077 #else
+ 00078 #define TIXML_SNPRINTF snprintf
+ 00079 #define TIXML_SSCANF sscanf
+ 00080 #endif
+ 00081 #endif
+ 00082
+ 00083 class TiXmlDocument ;
+ 00084 class TiXmlElement ;
+ 00085 class TiXmlComment ;
+ 00086 class TiXmlUnknown ;
+ 00087 class TiXmlAttribute ;
+ 00088 class TiXmlText ;
+ 00089 class TiXmlDeclaration ;
+ 00090 class TiXmlParsingData;
+ 00091
+ 00092 const int TIXML_MAJOR_VERSION = 2;
+ 00093 const int TIXML_MINOR_VERSION = 6;
+ 00094 const int TIXML_PATCH_VERSION = 2;
+ 00095
+ 00096
+ 00097
+ 00098
+ 00099 struct TiXmlCursor
+ 00100 {
+ 00101 TiXmlCursor() { Clear(); }
+ 00102 void Clear() { row = col = -1; }
+ 00103
+ 00104 int row;
+ 00105 int col;
+ 00106 };
+ 00107
+ 00108
+00128 class TiXmlVisitor
+ 00129 {
+ 00130 public :
+ 00131 virtual ~TiXmlVisitor () {}
+ 00132
+00134 virtual bool VisitEnter ( const TiXmlDocument & ) { return true ; }
+00136 virtual bool VisitExit ( const TiXmlDocument & ) { return true ; }
+ 00137
+00139 virtual bool VisitEnter ( const TiXmlElement & , const TiXmlAttribute * ) { return true ; }
+00141 virtual bool VisitExit ( const TiXmlElement & ) { return true ; }
+ 00142
+00144 virtual bool Visit ( const TiXmlDeclaration & ) { return true ; }
+00146 virtual bool Visit ( const TiXmlText & ) { return true ; }
+00148 virtual bool Visit ( const TiXmlComment & ) { return true ; }
+00150 virtual bool Visit ( const TiXmlUnknown & ) { return true ; }
+ 00151 };
+ 00152
+ 00153
+ 00154 enum
+ 00155 {
+ 00156 TIXML_SUCCESS,
+ 00157 TIXML_NO_ATTRIBUTE,
+ 00158 TIXML_WRONG_TYPE
+ 00159 };
+ 00160
+ 00161
+ 00162
+ 00163 enum TiXmlEncoding
+ 00164 {
+ 00165 TIXML_ENCODING_UNKNOWN,
+ 00166 TIXML_ENCODING_UTF8,
+ 00167 TIXML_ENCODING_LEGACY
+ 00168 };
+ 00169
+ 00170 const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN;
+ 00171
+00194 class TiXmlBase
+ 00195 {
+ 00196 friend class TiXmlNode ;
+ 00197 friend class TiXmlElement ;
+ 00198 friend class TiXmlDocument ;
+ 00199
+ 00200 public :
+ 00201 TiXmlBase () : userData (0) {}
+ 00202 virtual ~TiXmlBase () {}
+ 00203
+ 00213 virtual void Print ( FILE* cfile, int depth ) const = 0;
+ 00214
+00221 static void SetCondenseWhiteSpace ( bool condense ) { condenseWhiteSpace = condense; }
+ 00222
+00224 static bool IsWhiteSpaceCondensed () { return condenseWhiteSpace; }
+ 00225
+00244 int Row () const { return location.row + 1; }
+00245 int Column () const { return location.col + 1; }
+ 00246
+00247 void SetUserData ( void * user ) { userData = user; }
+00248 void * GetUserData () { return userData ; }
+00249 const void * GetUserData () const { return userData ; }
+ 00250
+ 00251
+ 00252
+ 00253 static const int utf8ByteTable[256];
+ 00254
+ 00255 virtual const char * Parse ( const char * p,
+ 00256 TiXmlParsingData* data,
+ 00257 TiXmlEncoding encoding ) = 0;
+ 00258
+ 00262 static void EncodeString ( const TIXML_STRING& str, TIXML_STRING* out );
+ 00263
+ 00264 enum
+ 00265 {
+ 00266 TIXML_NO_ERROR = 0,
+ 00267 TIXML_ERROR,
+ 00268 TIXML_ERROR_OPENING_FILE,
+ 00269 TIXML_ERROR_PARSING_ELEMENT,
+ 00270 TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
+ 00271 TIXML_ERROR_READING_ELEMENT_VALUE,
+ 00272 TIXML_ERROR_READING_ATTRIBUTES,
+ 00273 TIXML_ERROR_PARSING_EMPTY,
+ 00274 TIXML_ERROR_READING_END_TAG,
+ 00275 TIXML_ERROR_PARSING_UNKNOWN,
+ 00276 TIXML_ERROR_PARSING_COMMENT,
+ 00277 TIXML_ERROR_PARSING_DECLARATION,
+ 00278 TIXML_ERROR_DOCUMENT_EMPTY,
+ 00279 TIXML_ERROR_EMBEDDED_NULL,
+ 00280 TIXML_ERROR_PARSING_CDATA,
+ 00281 TIXML_ERROR_DOCUMENT_TOP_ONLY,
+ 00282
+ 00283 TIXML_ERROR_STRING_COUNT
+ 00284 };
+ 00285
+ 00286 protected :
+ 00287
+ 00288 static const char * SkipWhiteSpace( const char *, TiXmlEncoding encoding );
+ 00289
+ 00290 inline static bool IsWhiteSpace( char c )
+ 00291 {
+ 00292 return ( isspace( (unsigned char ) c ) || c == '\n' || c == '\r' );
+ 00293 }
+ 00294 inline static bool IsWhiteSpace( int c )
+ 00295 {
+ 00296 if ( c < 256 )
+ 00297 return IsWhiteSpace( (char ) c );
+ 00298 return false ;
+ 00299 }
+ 00300
+ 00301 #ifdef TIXML_USE_STL
+ 00302 static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag );
+ 00303 static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag );
+ 00304 #endif
+ 00305
+ 00306
+ 00307
+ 00308
+ 00309
+ 00310 static const char * ReadName( const char * p, TIXML_STRING* name, TiXmlEncoding encoding );
+ 00311
+ 00312
+ 00313
+ 00314
+ 00315 static const char * ReadText( const char * in,
+ 00316 TIXML_STRING* text,
+ 00317 bool ignoreWhiteSpace,
+ 00318 const char * endTag,
+ 00319 bool ignoreCase,
+ 00320 TiXmlEncoding encoding );
+ 00321
+ 00322
+ 00323 static const char * GetEntity( const char * in, char * value, int * length, TiXmlEncoding encoding );
+ 00324
+ 00325
+ 00326
+ 00327 inline static const char * GetChar( const char * p, char * _value, int * length, TiXmlEncoding encoding )
+ 00328 {
+ 00329 assert( p );
+ 00330 if ( encoding == TIXML_ENCODING_UTF8 )
+ 00331 {
+ 00332 *length = utf8ByteTable[ *((const unsigned char *)p) ];
+ 00333 assert( *length >= 0 && *length < 5 );
+ 00334 }
+ 00335 else
+ 00336 {
+ 00337 *length = 1;
+ 00338 }
+ 00339
+ 00340 if ( *length == 1 )
+ 00341 {
+ 00342 if ( *p == '&' )
+ 00343 return GetEntity( p, _value, length, encoding );
+ 00344 *_value = *p;
+ 00345 return p+1;
+ 00346 }
+ 00347 else if ( *length )
+ 00348 {
+ 00349
+ 00350
+ 00351 for ( int i=0; p[i] && i<*length; ++i ) {
+ 00352 _value[i] = p[i];
+ 00353 }
+ 00354 return p + (*length);
+ 00355 }
+ 00356 else
+ 00357 {
+ 00358
+ 00359 return 0;
+ 00360 }
+ 00361 }
+ 00362
+ 00363
+ 00364
+ 00365
+ 00366 static bool StringEqual( const char * p,
+ 00367 const char * endTag,
+ 00368 bool ignoreCase,
+ 00369 TiXmlEncoding encoding );
+ 00370
+ 00371 static const char * errorString[ TIXML_ERROR_STRING_COUNT ];
+ 00372
+ 00373 TiXmlCursor location;
+ 00374
+00376 void * userData ;
+ 00377
+ 00378
+ 00379
+ 00380 static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding );
+ 00381 static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding );
+ 00382 inline static int ToLower( int v, TiXmlEncoding encoding )
+ 00383 {
+ 00384 if ( encoding == TIXML_ENCODING_UTF8 )
+ 00385 {
+ 00386 if ( v < 128 ) return tolower( v );
+ 00387 return v;
+ 00388 }
+ 00389 else
+ 00390 {
+ 00391 return tolower( v );
+ 00392 }
+ 00393 }
+ 00394 static void ConvertUTF32ToUTF8( unsigned long input, char * output, int * length );
+ 00395
+ 00396 private :
+ 00397 TiXmlBase ( const TiXmlBase & );
+ 00398 void operator=( const TiXmlBase & base );
+ 00399
+ 00400 struct Entity
+ 00401 {
+ 00402 const char * str;
+ 00403 unsigned int strLength;
+ 00404 char chr;
+ 00405 };
+ 00406 enum
+ 00407 {
+ 00408 NUM_ENTITY = 5,
+ 00409 MAX_ENTITY_LENGTH = 6
+ 00410
+ 00411 };
+ 00412 static Entity entity[ NUM_ENTITY ];
+ 00413 static bool condenseWhiteSpace;
+ 00414 };
+ 00415
+ 00416
+00423 class TiXmlNode : public TiXmlBase
+ 00424 {
+ 00425 friend class TiXmlDocument ;
+ 00426 friend class TiXmlElement ;
+ 00427
+ 00428 public :
+ 00429 #ifdef TIXML_USE_STL
+ 00430
+ 00434 friend std::istream& operator >> (std::istream& in, TiXmlNode & base);
+ 00435
+ 00452 friend std::ostream& operator<< (std::ostream& out, const TiXmlNode & base);
+ 00453
+ 00455 friend std::string& operator<< (std::string& out, const TiXmlNode & base );
+ 00456
+ 00457 #endif
+ 00458
+00462 enum NodeType
+ 00463 {
+ 00464 TINYXML_DOCUMENT,
+ 00465 TINYXML_ELEMENT,
+ 00466 TINYXML_COMMENT,
+ 00467 TINYXML_UNKNOWN,
+ 00468 TINYXML_TEXT,
+ 00469 TINYXML_DECLARATION,
+ 00470 TINYXML_TYPECOUNT
+ 00471 };
+ 00472
+ 00473 virtual ~TiXmlNode ();
+ 00474
+00487 const char *Value () const { return value.c_str (); }
+ 00488
+ 00489 #ifdef TIXML_USE_STL
+ 00490
+00494 const std::string& ValueStr () const { return value; }
+ 00495 #endif
+ 00496
+ 00497 const TIXML_STRING& ValueTStr() const { return value; }
+ 00498
+00508 void SetValue (const char * _value) { value = _value;}
+ 00509
+ 00510 #ifdef TIXML_USE_STL
+00512 void SetValue( const std::string& _value ) { value = _value; }
+ 00513 #endif
+ 00514
+ 00516 void Clear ();
+ 00517
+00519 TiXmlNode * Parent () { return parent; }
+ 00520 const TiXmlNode * Parent () const { return parent; }
+ 00521
+00522 const TiXmlNode * FirstChild () const { return firstChild; }
+ 00523 TiXmlNode * FirstChild () { return firstChild; }
+ 00524 const TiXmlNode * FirstChild ( const char * value ) const ;
+ 00525
+00526 TiXmlNode * FirstChild ( const char * _value ) {
+ 00527
+ 00528
+ 00529 return const_cast< TiXmlNode * > ((const_cast< const TiXmlNode * > (this ))->FirstChild( _value ));
+ 00530 }
+ 00531 const TiXmlNode * LastChild() const { return lastChild; }
+00532 TiXmlNode * LastChild () { return lastChild; }
+ 00533
+ 00534 const TiXmlNode * LastChild( const char * value ) const ;
+00535 TiXmlNode * LastChild ( const char * _value ) {
+ 00536 return const_cast< TiXmlNode * > ((const_cast< const TiXmlNode * > (this ))->LastChild( _value ));
+ 00537 }
+ 00538
+ 00539 #ifdef TIXML_USE_STL
+00540 const TiXmlNode * FirstChild ( const std::string& _value ) const { return FirstChild (_value.c_str ()); }
+00541 TiXmlNode * FirstChild ( const std::string& _value ) { return FirstChild (_value.c_str ()); }
+00542 const TiXmlNode * LastChild ( const std::string& _value ) const { return LastChild (_value.c_str ()); }
+00543 TiXmlNode * LastChild ( const std::string& _value ) { return LastChild (_value.c_str ()); }
+ 00544 #endif
+ 00545
+ 00562 const TiXmlNode * IterateChildren ( const TiXmlNode * previous ) const ;
+ 00563 TiXmlNode * IterateChildren ( const TiXmlNode * previous ) {
+ 00564 return const_cast< TiXmlNode * > ( (const_cast< const TiXmlNode * > (this ))->IterateChildren( previous ) );
+ 00565 }
+ 00566
+ 00568 const TiXmlNode * IterateChildren ( const char * value, const TiXmlNode * previous ) const ;
+ 00569 TiXmlNode * IterateChildren ( const char * _value, const TiXmlNode * previous ) {
+ 00570 return const_cast< TiXmlNode * > ( (const_cast< const TiXmlNode * > (this ))->IterateChildren( _value, previous ) );
+ 00571 }
+ 00572
+ 00573 #ifdef TIXML_USE_STL
+00574 const TiXmlNode * IterateChildren ( const std::string& _value, const TiXmlNode * previous ) const { return IterateChildren (_value.c_str (), previous); }
+00575 TiXmlNode * IterateChildren ( const std::string& _value, const TiXmlNode * previous ) { return IterateChildren (_value.c_str (), previous); }
+ 00576 #endif
+ 00577
+ 00581 TiXmlNode * InsertEndChild ( const TiXmlNode & addThis );
+ 00582
+ 00583
+ 00593 TiXmlNode * LinkEndChild ( TiXmlNode * addThis );
+ 00594
+ 00598 TiXmlNode * InsertBeforeChild ( TiXmlNode * beforeThis, const TiXmlNode & addThis );
+ 00599
+ 00603 TiXmlNode * InsertAfterChild ( TiXmlNode * afterThis, const TiXmlNode & addThis );
+ 00604
+ 00608 TiXmlNode * ReplaceChild ( TiXmlNode * replaceThis, const TiXmlNode & withThis );
+ 00609
+ 00611 bool RemoveChild ( TiXmlNode * removeThis );
+ 00612
+00614 const TiXmlNode * PreviousSibling () const { return prev; }
+ 00615 TiXmlNode * PreviousSibling () { return prev; }
+ 00616
+ 00618 const TiXmlNode * PreviousSibling ( const char * ) const ;
+ 00619 TiXmlNode * PreviousSibling ( const char *_prev ) {
+ 00620 return const_cast< TiXmlNode * > ( (const_cast< const TiXmlNode * > (this ))->PreviousSibling( _prev ) );
+ 00621 }
+ 00622
+ 00623 #ifdef TIXML_USE_STL
+00624 const TiXmlNode * PreviousSibling ( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); }
+00625 TiXmlNode * PreviousSibling ( const std::string& _value ) { return PreviousSibling (_value.c_str ()); }
+00626 const TiXmlNode * NextSibling ( const std::string& _value) const { return NextSibling (_value.c_str ()); }
+00627 TiXmlNode * NextSibling ( const std::string& _value) { return NextSibling (_value.c_str ()); }
+ 00628 #endif
+ 00629
+00631 const TiXmlNode * NextSibling () const { return next; }
+ 00632 TiXmlNode * NextSibling () { return next; }
+ 00633
+ 00635 const TiXmlNode * NextSibling ( const char * ) const ;
+ 00636 TiXmlNode * NextSibling ( const char * _next ) {
+ 00637 return const_cast< TiXmlNode * > ( (const_cast< const TiXmlNode * > (this ))->NextSibling( _next ) );
+ 00638 }
+ 00639
+ 00644 const TiXmlElement * NextSiblingElement () const ;
+ 00645 TiXmlElement * NextSiblingElement () {
+ 00646 return const_cast< TiXmlElement * > ( (const_cast< const TiXmlNode * > (this ))->NextSiblingElement() );
+ 00647 }
+ 00648
+ 00653 const TiXmlElement * NextSiblingElement ( const char * ) const ;
+ 00654 TiXmlElement * NextSiblingElement ( const char *_next ) {
+ 00655 return const_cast< TiXmlElement * > ( (const_cast< const TiXmlNode * > (this ))->NextSiblingElement( _next ) );
+ 00656 }
+ 00657
+ 00658 #ifdef TIXML_USE_STL
+00659 const TiXmlElement * NextSiblingElement ( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); }
+00660 TiXmlElement * NextSiblingElement ( const std::string& _value) { return NextSiblingElement (_value.c_str ()); }
+ 00661 #endif
+ 00662
+ 00664 const TiXmlElement * FirstChildElement () const ;
+ 00665 TiXmlElement * FirstChildElement () {
+ 00666 return const_cast< TiXmlElement * > ( (const_cast< const TiXmlNode * > (this ))->FirstChildElement() );
+ 00667 }
+ 00668
+ 00670 const TiXmlElement * FirstChildElement ( const char * _value ) const ;
+ 00671 TiXmlElement * FirstChildElement ( const char * _value ) {
+ 00672 return const_cast< TiXmlElement * > ( (const_cast< const TiXmlNode * > (this ))->FirstChildElement( _value ) );
+ 00673 }
+ 00674
+ 00675 #ifdef TIXML_USE_STL
+00676 const TiXmlElement * FirstChildElement ( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); }
+00677 TiXmlElement * FirstChildElement ( const std::string& _value ) { return FirstChildElement (_value.c_str ()); }
+ 00678 #endif
+ 00679
+00684 int Type () const { return type; }
+ 00685
+ 00689 const TiXmlDocument * GetDocument () const ;
+ 00690 TiXmlDocument * GetDocument () {
+ 00691 return const_cast< TiXmlDocument * > ( (const_cast< const TiXmlNode * > (this ))->GetDocument() );
+ 00692 }
+ 00693
+00695 bool NoChildren () const { return !firstChild; }
+ 00696
+00697 virtual const TiXmlDocument * ToDocument () const { return 0; }
+00698 virtual const TiXmlElement * ToElement () const { return 0; }
+00699 virtual const TiXmlComment * ToComment () const { return 0; }
+00700 virtual const TiXmlUnknown * ToUnknown () const { return 0; }
+00701 virtual const TiXmlText * ToText () const { return 0; }
+00702 virtual const TiXmlDeclaration * ToDeclaration () const { return 0; }
+ 00703
+00704 virtual TiXmlDocument * ToDocument () { return 0; }
+00705 virtual TiXmlElement * ToElement () { return 0; }
+00706 virtual TiXmlComment * ToComment () { return 0; }
+00707 virtual TiXmlUnknown * ToUnknown () { return 0; }
+00708 virtual TiXmlText * ToText () { return 0; }
+00709 virtual TiXmlDeclaration * ToDeclaration () { return 0; }
+ 00710
+ 00714 virtual TiXmlNode * Clone () const = 0;
+ 00715
+ 00738 virtual bool Accept ( TiXmlVisitor * visitor ) const = 0;
+ 00739
+ 00740 protected :
+ 00741 TiXmlNode ( NodeType _type );
+ 00742
+ 00743
+ 00744
+ 00745 void CopyTo( TiXmlNode * target ) const ;
+ 00746
+ 00747 #ifdef TIXML_USE_STL
+ 00748
+ 00749 virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0;
+ 00750 #endif
+ 00751
+ 00752
+ 00753 TiXmlNode * Identify( const char * start, TiXmlEncoding encoding );
+ 00754
+ 00755 TiXmlNode * parent;
+ 00756 NodeType type;
+ 00757
+ 00758 TiXmlNode * firstChild;
+ 00759 TiXmlNode * lastChild;
+ 00760
+ 00761 TIXML_STRING value;
+ 00762
+ 00763 TiXmlNode * prev;
+ 00764 TiXmlNode * next;
+ 00765
+ 00766 private :
+ 00767 TiXmlNode ( const TiXmlNode & );
+ 00768 void operator=( const TiXmlNode & base );
+ 00769 };
+ 00770
+ 00771
+00779 class TiXmlAttribute : public TiXmlBase
+ 00780 {
+ 00781 friend class TiXmlAttributeSet;
+ 00782
+ 00783 public :
+00785 TiXmlAttribute () : TiXmlBase ()
+ 00786 {
+ 00787 document = 0;
+ 00788 prev = next = 0;
+ 00789 }
+ 00790
+ 00791 #ifdef TIXML_USE_STL
+00793 TiXmlAttribute( const std::string& _name, const std::string& _value )
+ 00794 {
+ 00795 name = _name;
+ 00796 value = _value;
+ 00797 document = 0;
+ 00798 prev = next = 0;
+ 00799 }
+ 00800 #endif
+ 00801
+00803 TiXmlAttribute ( const char * _name, const char * _value )
+ 00804 {
+ 00805 name = _name;
+ 00806 value = _value;
+ 00807 document = 0;
+ 00808 prev = next = 0;
+ 00809 }
+ 00810
+00811 const char * Name () const { return name.c_str(); }
+00812 const char * Value () const { return value.c_str(); }
+ 00813 #ifdef TIXML_USE_STL
+00814 const std::string& ValueStr () const { return value; }
+ 00815 #endif
+ 00816 int IntValue () const ;
+ 00817 double DoubleValue () const ;
+ 00818
+ 00819
+ 00820 const TIXML_STRING& NameTStr() const { return name; }
+ 00821
+ 00831 int QueryIntValue ( int * _value ) const ;
+ 00833 int QueryDoubleValue ( double * _value ) const ;
+ 00834
+00835 void SetName ( const char * _name ) { name = _name; }
+00836 void SetValue ( const char * _value ) { value = _value; }
+ 00837
+ 00838 void SetIntValue ( int _value );
+ 00839 void SetDoubleValue ( double _value );
+ 00840
+ 00841 #ifdef TIXML_USE_STL
+00843 void SetName( const std::string& _name ) { name = _name; }
+00845 void SetValue( const std::string& _value ) { value = _value; }
+ 00846 #endif
+ 00847
+ 00849 const TiXmlAttribute * Next () const ;
+ 00850 TiXmlAttribute * Next () {
+ 00851 return const_cast< TiXmlAttribute * > ( (const_cast< const TiXmlAttribute * > (this ))->Next() );
+ 00852 }
+ 00853
+ 00855 const TiXmlAttribute * Previous () const ;
+ 00856 TiXmlAttribute * Previous () {
+ 00857 return const_cast< TiXmlAttribute * > ( (const_cast< const TiXmlAttribute * > (this ))->Previous() );
+ 00858 }
+ 00859
+ 00860 bool operator==( const TiXmlAttribute & rhs ) const { return rhs.name == name; }
+ 00861 bool operator<( const TiXmlAttribute & rhs ) const { return name < rhs.name; }
+ 00862 bool operator>( const TiXmlAttribute & rhs ) const { return name > rhs.name; }
+ 00863
+ 00864
+ 00865
+ 00866
+ 00867 virtual const char * Parse( const char * p, TiXmlParsingData* data, TiXmlEncoding encoding );
+ 00868
+ 00869
+00870 virtual void Print ( FILE* cfile, int depth ) const {
+ 00871 Print ( cfile, depth, 0 );
+ 00872 }
+ 00873 void Print ( FILE* cfile, int depth, TIXML_STRING* str ) const ;
+ 00874
+ 00875
+ 00876
+ 00877 void SetDocument( TiXmlDocument * doc ) { document = doc; }
+ 00878
+ 00879 private :
+ 00880 TiXmlAttribute ( const TiXmlAttribute & );
+ 00881 void operator=( const TiXmlAttribute & base );
+ 00882
+ 00883 TiXmlDocument * document;
+ 00884 TIXML_STRING name;
+ 00885 TIXML_STRING value;
+ 00886 TiXmlAttribute * prev;
+ 00887 TiXmlAttribute * next;
+ 00888 };
+ 00889
+ 00890
+ 00891
+ 00892
+ 00893
+ 00894
+ 00895
+ 00896
+ 00897
+ 00898
+ 00899
+ 00900
+ 00901
+ 00902
+ 00903 class TiXmlAttributeSet
+ 00904 {
+ 00905 public :
+ 00906 TiXmlAttributeSet();
+ 00907 ~TiXmlAttributeSet();
+ 00908
+ 00909 void Add( TiXmlAttribute * attribute );
+ 00910 void Remove( TiXmlAttribute * attribute );
+ 00911
+ 00912 const TiXmlAttribute * First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
+ 00913 TiXmlAttribute * First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
+ 00914 const TiXmlAttribute * Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
+ 00915 TiXmlAttribute * Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
+ 00916
+ 00917 TiXmlAttribute * Find( const char * _name ) const ;
+ 00918 TiXmlAttribute * FindOrCreate( const char * _name );
+ 00919
+ 00920 # ifdef TIXML_USE_STL
+ 00921 TiXmlAttribute * Find( const std::string& _name ) const ;
+ 00922 TiXmlAttribute * FindOrCreate( const std::string& _name );
+ 00923 # endif
+ 00924
+ 00925
+ 00926 private :
+ 00927
+ 00928
+ 00929 TiXmlAttributeSet( const TiXmlAttributeSet& );
+ 00930 void operator=( const TiXmlAttributeSet& );
+ 00931
+ 00932 TiXmlAttribute sentinel;
+ 00933 };
+ 00934
+ 00935
+00940 class TiXmlElement : public TiXmlNode
+ 00941 {
+ 00942 public :
+ 00944 TiXmlElement (const char * in_value);
+ 00945
+ 00946 #ifdef TIXML_USE_STL
+ 00948 TiXmlElement( const std::string& _value );
+ 00949 #endif
+ 00950
+ 00951 TiXmlElement ( const TiXmlElement & );
+ 00952
+ 00953 TiXmlElement & operator=( const TiXmlElement & base );
+ 00954
+ 00955 virtual ~TiXmlElement ();
+ 00956
+ 00960 const char * Attribute ( const char * name ) const ;
+ 00961
+ 00968 const char * Attribute ( const char * name, int * i ) const ;
+ 00969
+ 00976 const char * Attribute ( const char * name, double * d ) const ;
+ 00977
+ 00985 int QueryIntAttribute ( const char * name, int * _value ) const ;
+ 00987 int QueryUnsignedAttribute ( const char * name, unsigned * _value ) const ;
+ 00992 int QueryBoolAttribute ( const char * name, bool * _value ) const ;
+ 00994 int QueryDoubleAttribute ( const char * name, double * _value ) const ;
+00996 int QueryFloatAttribute ( const char * name, float * _value ) const {
+ 00997 double d;
+ 00998 int result = QueryDoubleAttribute ( name, &d );
+ 00999 if ( result == TIXML_SUCCESS ) {
+ 01000 *_value = (float)d;
+ 01001 }
+ 01002 return result;
+ 01003 }
+ 01004
+ 01005 #ifdef TIXML_USE_STL
+01007 int QueryStringAttribute( const char* name, std::string* _value ) const {
+ 01008 const char * cstr = Attribute ( name );
+ 01009 if ( cstr ) {
+ 01010 *_value = std::string( cstr );
+ 01011 return TIXML_SUCCESS;
+ 01012 }
+ 01013 return TIXML_NO_ATTRIBUTE;
+ 01014 }
+ 01015
+01024 template < typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const
+ 01025 {
+ 01026 const TiXmlAttribute * node = attributeSet.Find( name );
+ 01027 if ( !node )
+ 01028 return TIXML_NO_ATTRIBUTE;
+ 01029
+ 01030 std::stringstream sstream( node->ValueStr () );
+ 01031 sstream >> *outValue;
+ 01032 if ( !sstream.fail() )
+ 01033 return TIXML_SUCCESS;
+ 01034 return TIXML_WRONG_TYPE;
+ 01035 }
+ 01036
+ 01037 int QueryValueAttribute( const std::string& name, std::string* outValue ) const
+ 01038 {
+ 01039 const TiXmlAttribute * node = attributeSet.Find( name );
+ 01040 if ( !node )
+ 01041 return TIXML_NO_ATTRIBUTE;
+ 01042 *outValue = node->ValueStr ();
+ 01043 return TIXML_SUCCESS;
+ 01044 }
+ 01045 #endif
+ 01046
+ 01050 void SetAttribute( const char * name, const char * _value );
+ 01051
+ 01052 #ifdef TIXML_USE_STL
+ 01053 const std::string* Attribute( const std::string& name ) const ;
+ 01054 const std::string* Attribute( const std::string& name, int * i ) const ;
+ 01055 const std::string* Attribute( const std::string& name, double * d ) const ;
+ 01056 int QueryIntAttribute( const std::string& name, int * _value ) const ;
+ 01057 int QueryDoubleAttribute( const std::string& name, double * _value ) const ;
+ 01058
+ 01060 void SetAttribute( const std::string& name, const std::string& _value );
+ 01062 void SetAttribute( const std::string& name, int _value );
+ 01064 void SetDoubleAttribute( const std::string& name, double value );
+ 01065 #endif
+ 01066
+ 01070 void SetAttribute( const char * name, int value );
+ 01071
+ 01075 void SetDoubleAttribute( const char * name, double value );
+ 01076
+ 01079 void RemoveAttribute( const char * name );
+ 01080 #ifdef TIXML_USE_STL
+01081 void RemoveAttribute ( const std::string& name ) { RemoveAttribute (name.c_str ()); }
+ 01082 #endif
+ 01083
+01084 const TiXmlAttribute * FirstAttribute () const { return attributeSet.First(); }
+ 01085 TiXmlAttribute * FirstAttribute() { return attributeSet.First(); }
+01086 const TiXmlAttribute * LastAttribute () const { return attributeSet.Last(); }
+ 01087 TiXmlAttribute * LastAttribute() { return attributeSet.Last(); }
+ 01088
+ 01121 const char * GetText() const ;
+ 01122
+ 01124 virtual TiXmlNode * Clone() const ;
+ 01125
+ 01126 virtual void Print( FILE* cfile, int depth ) const ;
+ 01127
+ 01128
+ 01129
+ 01130
+ 01131 virtual const char * Parse( const char * p, TiXmlParsingData* data, TiXmlEncoding encoding );
+ 01132
+01133 virtual const TiXmlElement * ToElement () const { return this ; }
+01134 virtual TiXmlElement * ToElement () { return this ; }
+ 01135
+ 01138 virtual bool Accept( TiXmlVisitor * visitor ) const ;
+ 01139
+ 01140 protected :
+ 01141
+ 01142 void CopyTo( TiXmlElement * target ) const ;
+ 01143 void ClearThis();
+ 01144
+ 01145
+ 01146 #ifdef TIXML_USE_STL
+ 01147 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
+ 01148 #endif
+ 01149
+ 01150
+ 01151
+ 01152
+ 01153 const char * ReadValue( const char * in, TiXmlParsingData* prevData, TiXmlEncoding encoding );
+ 01154
+ 01155 private :
+ 01156 TiXmlAttributeSet attributeSet;
+ 01157 };
+ 01158
+ 01159
+01162 class TiXmlComment : public TiXmlNode
+ 01163 {
+ 01164 public :
+01166 TiXmlComment () : TiXmlNode ( TiXmlNode ::TINYXML_COMMENT ) {}
+01168 TiXmlComment ( const char * _value ) : TiXmlNode ( TiXmlNode ::TINYXML_COMMENT ) {
+ 01169 SetValue ( _value );
+ 01170 }
+ 01171 TiXmlComment ( const TiXmlComment & );
+ 01172 TiXmlComment & operator=( const TiXmlComment & base );
+ 01173
+ 01174 virtual ~TiXmlComment () {}
+ 01175
+ 01177 virtual TiXmlNode * Clone () const ;
+ 01178
+ 01179 virtual void Print ( FILE* cfile, int depth ) const ;
+ 01180
+ 01181
+ 01182
+ 01183
+ 01184 virtual const char * Parse( const char * p, TiXmlParsingData* data, TiXmlEncoding encoding );
+ 01185
+01186 virtual const TiXmlComment * ToComment () const { return this ; }
+01187 virtual TiXmlComment * ToComment () { return this ; }
+ 01188
+ 01191 virtual bool Accept ( TiXmlVisitor * visitor ) const ;
+ 01192
+ 01193 protected :
+ 01194 void CopyTo( TiXmlComment * target ) const ;
+ 01195
+ 01196
+ 01197 #ifdef TIXML_USE_STL
+ 01198 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
+ 01199 #endif
+ 01200
+ 01201
+ 01202 private :
+ 01203
+ 01204 };
+ 01205
+ 01206
+01212 class TiXmlText : public TiXmlNode
+ 01213 {
+ 01214 friend class TiXmlElement ;
+ 01215 public :
+01220 TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode ::TINYXML_TEXT)
+ 01221 {
+ 01222 SetValue ( initValue );
+ 01223 cdata = false ;
+ 01224 }
+ 01225 virtual ~TiXmlText () {}
+ 01226
+ 01227 #ifdef TIXML_USE_STL
+01229 TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT)
+ 01230 {
+ 01231 SetValue ( initValue );
+ 01232 cdata = false ;
+ 01233 }
+ 01234 #endif
+ 01235
+ 01236 TiXmlText ( const TiXmlText & copy ) : TiXmlNode ( TiXmlNode ::TINYXML_TEXT ) { copy.CopyTo( this ); }
+ 01237 TiXmlText & operator=( const TiXmlText & base ) { base.CopyTo( this ); return *this ; }
+ 01238
+ 01239
+ 01240 virtual void Print ( FILE* cfile, int depth ) const ;
+ 01241
+01243 bool CDATA () const { return cdata; }
+01245 void SetCDATA ( bool _cdata ) { cdata = _cdata; }
+ 01246
+ 01247 virtual const char * Parse( const char * p, TiXmlParsingData* data, TiXmlEncoding encoding );
+ 01248
+01249 virtual const TiXmlText * ToText () const { return this ; }
+01250 virtual TiXmlText * ToText () { return this ; }
+ 01251
+ 01254 virtual bool Accept ( TiXmlVisitor * content ) const ;
+ 01255
+ 01256 protected :
+ 01258 virtual TiXmlNode * Clone () const ;
+ 01259 void CopyTo( TiXmlText * target ) const ;
+ 01260
+ 01261 bool Blank() const ;
+ 01262
+ 01263 #ifdef TIXML_USE_STL
+ 01264 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
+ 01265 #endif
+ 01266
+ 01267 private :
+ 01268 bool cdata;
+ 01269 };
+ 01270
+ 01271
+01285 class TiXmlDeclaration : public TiXmlNode
+ 01286 {
+ 01287 public :
+01289 TiXmlDeclaration () : TiXmlNode ( TiXmlNode ::TINYXML_DECLARATION ) {}
+ 01290
+ 01291 #ifdef TIXML_USE_STL
+ 01293 TiXmlDeclaration( const std::string& _version,
+ 01294 const std::string& _encoding,
+ 01295 const std::string& _standalone );
+ 01296 #endif
+ 01297
+ 01299 TiXmlDeclaration ( const char * _version,
+ 01300 const char * _encoding,
+ 01301 const char * _standalone );
+ 01302
+ 01303 TiXmlDeclaration ( const TiXmlDeclaration & copy );
+ 01304 TiXmlDeclaration & operator=( const TiXmlDeclaration & copy );
+ 01305
+ 01306 virtual ~TiXmlDeclaration () {}
+ 01307
+01309 const char *Version () const { return version.c_str (); }
+01311 const char *Encoding () const { return encoding.c_str (); }
+01313 const char *Standalone () const { return standalone.c_str (); }
+ 01314
+ 01316 virtual TiXmlNode * Clone () const ;
+ 01317
+ 01318 virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const ;
+01319 virtual void Print ( FILE* cfile, int depth ) const {
+ 01320 Print( cfile, depth, 0 );
+ 01321 }
+ 01322
+ 01323 virtual const char * Parse( const char * p, TiXmlParsingData* data, TiXmlEncoding encoding );
+ 01324
+01325 virtual const TiXmlDeclaration * ToDeclaration () const { return this ; }
+01326 virtual TiXmlDeclaration * ToDeclaration () { return this ; }
+ 01327
+ 01330 virtual bool Accept ( TiXmlVisitor * visitor ) const ;
+ 01331
+ 01332 protected :
+ 01333 void CopyTo( TiXmlDeclaration * target ) const ;
+ 01334
+ 01335 #ifdef TIXML_USE_STL
+ 01336 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
+ 01337 #endif
+ 01338
+ 01339 private :
+ 01340
+ 01341 TIXML_STRING version;
+ 01342 TIXML_STRING encoding;
+ 01343 TIXML_STRING standalone;
+ 01344 };
+ 01345
+ 01346
+01354 class TiXmlUnknown : public TiXmlNode
+ 01355 {
+ 01356 public :
+ 01357 TiXmlUnknown () : TiXmlNode ( TiXmlNode::TINYXML_UNKNOWN ) {}
+ 01358 virtual ~TiXmlUnknown () {}
+ 01359
+ 01360 TiXmlUnknown ( const TiXmlUnknown & copy ) : TiXmlNode ( TiXmlNode::TINYXML_UNKNOWN ) { copy.CopyTo( this ); }
+ 01361 TiXmlUnknown & operator=( const TiXmlUnknown & copy ) { copy.CopyTo( this ); return *this ; }
+ 01362
+ 01364 virtual TiXmlNode * Clone () const ;
+ 01365
+ 01366 virtual void Print ( FILE* cfile, int depth ) const ;
+ 01367
+ 01368 virtual const char * Parse( const char * p, TiXmlParsingData* data, TiXmlEncoding encoding );
+ 01369
+01370 virtual const TiXmlUnknown * ToUnknown () const { return this ; }
+01371 virtual TiXmlUnknown * ToUnknown () { return this ; }
+ 01372
+ 01375 virtual bool Accept ( TiXmlVisitor * content ) const ;
+ 01376
+ 01377 protected :
+ 01378 void CopyTo( TiXmlUnknown * target ) const ;
+ 01379
+ 01380 #ifdef TIXML_USE_STL
+ 01381 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
+ 01382 #endif
+ 01383
+ 01384 private :
+ 01385
+ 01386 };
+ 01387
+ 01388
+01393 class TiXmlDocument : public TiXmlNode
+ 01394 {
+ 01395 public :
+ 01397 TiXmlDocument ();
+ 01399 TiXmlDocument ( const char * documentName );
+ 01400
+ 01401 #ifdef TIXML_USE_STL
+ 01403 TiXmlDocument( const std::string& documentName );
+ 01404 #endif
+ 01405
+ 01406 TiXmlDocument ( const TiXmlDocument & copy );
+ 01407 TiXmlDocument & operator=( const TiXmlDocument & copy );
+ 01408
+ 01409 virtual ~TiXmlDocument () {}
+ 01410
+ 01415 bool LoadFile ( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
+ 01417 bool SaveFile () const ;
+ 01419 bool LoadFile ( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
+ 01421 bool SaveFile ( const char * filename ) const ;
+ 01427 bool LoadFile ( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
+ 01429 bool SaveFile ( FILE* ) const ;
+ 01430
+ 01431 #ifdef TIXML_USE_STL
+01432 bool LoadFile ( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING )
+ 01433 {
+ 01434 return LoadFile ( filename.c_str(), encoding );
+ 01435 }
+01436 bool SaveFile ( const std::string& filename ) const
+ 01437 {
+ 01438 return SaveFile ( filename.c_str() );
+ 01439 }
+ 01440 #endif
+ 01441
+ 01446 virtual const char * Parse ( const char * p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING );
+ 01447
+01452 const TiXmlElement * RootElement () const { return FirstChildElement (); }
+ 01453 TiXmlElement * RootElement () { return FirstChildElement (); }
+ 01454
+01460 bool Error () const { return error; }
+ 01461
+01463 const char * ErrorDesc () const { return errorDesc.c_str (); }
+ 01464
+01468 int ErrorId () const { return errorId; }
+ 01469
+01477 int ErrorRow () const { return errorLocation.row+1; }
+01478 int ErrorCol () const { return errorLocation.col+1; }
+ 01479
+01504 void SetTabSize ( int _tabsize ) { tabsize = _tabsize; }
+ 01505
+ 01506 int TabSize() const { return tabsize; }
+ 01507
+01511 void ClearError () { error = false ;
+ 01512 errorId = 0;
+ 01513 errorDesc = "" ;
+ 01514 errorLocation.row = errorLocation.col = 0;
+ 01515
+ 01516 }
+ 01517
+01519 void Print () const { Print ( stdout, 0 ); }
+ 01520
+ 01521
+ 01522
+ 01523
+ 01524
+ 01525
+ 01526
+ 01528 virtual void Print ( FILE* cfile, int depth = 0 ) const ;
+ 01529
+ 01530 void SetError( int err, const char * errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding );
+ 01531
+01532 virtual const TiXmlDocument * ToDocument () const { return this ; }
+01533 virtual TiXmlDocument * ToDocument () { return this ; }
+ 01534
+ 01537 virtual bool Accept ( TiXmlVisitor * content ) const ;
+ 01538
+ 01539 protected :
+ 01540
+ 01541 virtual TiXmlNode * Clone () const ;
+ 01542 #ifdef TIXML_USE_STL
+ 01543 virtual void StreamIn( std::istream * in, TIXML_STRING * tag );
+ 01544 #endif
+ 01545
+ 01546 private :
+ 01547 void CopyTo( TiXmlDocument * target ) const ;
+ 01548
+ 01549 bool error;
+ 01550 int errorId;
+ 01551 TIXML_STRING errorDesc;
+ 01552 int tabsize;
+ 01553 TiXmlCursor errorLocation;
+ 01554 bool useMicrosoftBOM;
+ 01555 };
+ 01556
+ 01557
+01638 class TiXmlHandle
+ 01639 {
+ 01640 public :
+01642 TiXmlHandle ( TiXmlNode * _node ) { this->node = _node; }
+01644 TiXmlHandle ( const TiXmlHandle & ref ) { this->node = ref.node; }
+ 01645 TiXmlHandle operator=( const TiXmlHandle & ref ) { if ( &ref != this ) this->node = ref.node; return *this ; }
+ 01646
+ 01648 TiXmlHandle FirstChild () const ;
+ 01650 TiXmlHandle FirstChild ( const char * value ) const ;
+ 01652 TiXmlHandle FirstChildElement () const ;
+ 01654 TiXmlHandle FirstChildElement ( const char * value ) const ;
+ 01655
+ 01659 TiXmlHandle Child ( const char * value, int index ) const ;
+ 01663 TiXmlHandle Child ( int index ) const ;
+ 01668 TiXmlHandle ChildElement ( const char * value, int index ) const ;
+ 01673 TiXmlHandle ChildElement ( int index ) const ;
+ 01674
+ 01675 #ifdef TIXML_USE_STL
+ 01676 TiXmlHandle FirstChild ( const std::string& _value ) const { return FirstChild ( _value.c_str() ); }
+ 01677 TiXmlHandle FirstChildElement ( const std::string& _value ) const { return FirstChildElement ( _value.c_str() ); }
+ 01678
+ 01679 TiXmlHandle Child ( const std::string& _value, int index ) const { return Child ( _value.c_str(), index ); }
+ 01680 TiXmlHandle ChildElement ( const std::string& _value, int index ) const { return ChildElement ( _value.c_str(), index ); }
+ 01681 #endif
+ 01682
+01685 TiXmlNode * ToNode () const { return node; }
+01688 TiXmlElement * ToElement () const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); }
+01691 TiXmlText * ToText () const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); }
+01694 TiXmlUnknown * ToUnknown () const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); }
+ 01695
+01699 TiXmlNode * Node () const { return ToNode (); }
+01703 TiXmlElement * Element () const { return ToElement (); }
+01707 TiXmlText * Text () const { return ToText (); }
+01711 TiXmlUnknown * Unknown () const { return ToUnknown (); }
+ 01712
+ 01713 private :
+ 01714 TiXmlNode * node;
+ 01715 };
+ 01716
+ 01717
+01737 class TiXmlPrinter : public TiXmlVisitor
+ 01738 {
+ 01739 public :
+ 01740 TiXmlPrinter () : depth( 0 ), simpleTextPrint( false ),
+ 01741 buffer(), indent( " " ), lineBreak( "\n" ) {}
+ 01742
+ 01743 virtual bool VisitEnter ( const TiXmlDocument & doc );
+ 01744 virtual bool VisitExit ( const TiXmlDocument & doc );
+ 01745
+ 01746 virtual bool VisitEnter ( const TiXmlElement & element, const TiXmlAttribute * firstAttribute );
+ 01747 virtual bool VisitExit ( const TiXmlElement & element );
+ 01748
+ 01749 virtual bool Visit ( const TiXmlDeclaration & declaration );
+ 01750 virtual bool Visit ( const TiXmlText & text );
+ 01751 virtual bool Visit ( const TiXmlComment & comment );
+ 01752 virtual bool Visit ( const TiXmlUnknown & unknown );
+ 01753
+01757 void SetIndent ( const char * _indent ) { indent = _indent ? _indent : "" ; }
+01759 const char * Indent () { return indent.c_str(); }
+01764 void SetLineBreak ( const char * _lineBreak ) { lineBreak = _lineBreak ? _lineBreak : "" ; }
+01766 const char * LineBreak () { return lineBreak.c_str(); }
+ 01767
+01771 void SetStreamPrinting () { indent = "" ;
+ 01772 lineBreak = "" ;
+ 01773 }
+01775 const char * CStr () { return buffer.c_str(); }
+01777 size_t Size () { return buffer.size(); }
+ 01778
+ 01779 #ifdef TIXML_USE_STL
+01781 const std::string& Str() { return buffer; }
+ 01782 #endif
+ 01783
+ 01784 private :
+ 01785 void DoIndent() {
+ 01786 for ( int i=0; i<depth; ++i )
+ 01787 buffer += indent;
+ 01788 }
+ 01789 void DoLineBreak() {
+ 01790 buffer += lineBreak;
+ 01791 }
+ 01792
+ 01793 int depth;
+ 01794 bool simpleTextPrint;
+ 01795 TIXML_STRING buffer;
+ 01796 TIXML_STRING indent;
+ 01797 TIXML_STRING lineBreak;
+ 01798 };
+ 01799
+ 01800
+ 01801 #ifdef _MSC_VER
+ 01802 #pragma warning( pop )
+ 01803 #endif
+ 01804
+ 01805 #endif
+
+Generated by
+
+ 1.6.2
+
+
diff --git a/Engine/lib/tinyxml/docs/tutorial0.html b/Engine/lib/tinyxml/docs/tutorial0.html
index d5d19cab1..f974f859d 100644
--- a/Engine/lib/tinyxml/docs/tutorial0.html
+++ b/Engine/lib/tinyxml/docs/tutorial0.html
@@ -1,33 +1,41 @@
-
-
+
+
+
+
TinyXml: TinyXML Tutorial
-
-
-
-
-
-
-What is this?
-
-This tutorial has a few tips and suggestions on how to use TinyXML effectively.
-I've also tried to include some C++ tips like how to convert strings to integers and vice versa. This isn't anything to do with TinyXML itself, but it may helpful for your project so I've put it in anyway.
-If you don't know basic C++ concepts this tutorial won't be useful. Likewise if you don't know what a DOM is, look elsewhere first.
+
+
+
+
+
+
+
+
+
+
What is this?
+
This tutorial has a few tips and suggestions on how to use TinyXML effectively.
+
I've also tried to include some C++ tips like how to convert strings to integers and vice versa. This isn't anything to do with TinyXML itself, but it may helpful for your project so I've put it in anyway.
+
If you don't know basic C++ concepts this tutorial won't be useful. Likewise if you don't know what a DOM is, look elsewhere first.
Before we start
-
-Some example XML datasets/files will be used.
-example1.xml:
-
<?xml version="1.0" ?>
+Some example XML datasets/files will be used.
+example1.xml:
+
+<?xml version="1.0" ?>
<Hello>World</Hello>
-
-example2.xml:
-
example2.xml:
+
+<?xml version="1.0" ?>
<poetry>
<verse>
Alas
@@ -35,16 +43,16 @@ example2.xml:
Alas (again)
</verse>
</poetry>
-
-example3.xml:
-
example3.xml:
+
+<?xml version="1.0" ?>
<shapes>
<circle name="int-based" x="20" y="30" r="50" />
<point name="float-based" x="3.5" y="52.1" />
</shapes>
-
-example4.xml
-
example4.xml
+
+<?xml version="1.0" ?>
<MyApp>
<!-- Settings for MyApp -->
<Messages>
@@ -56,17 +64,15 @@ example4.xml
</Windows>
<Connection ip="192.168.0.1" timeout="123.456000" />
</MyApp>
-
-
Getting Started
-
+
Getting Started
Load XML from a file
-
-The simplest way to load a file into a TinyXML DOM is:
-
TiXmlDocument doc( "demo.xml" );
+The simplest way to load a file into a TinyXML DOM is:
+
+TiXmlDocument doc( "demo.xml" );
doc.LoadFile();
-
-A more real-world usage is shown below. This will load the file and display the contents to STDOUT:
-
// load the named file and dump its structure to STDOUT
+ A more real-world usage is shown below. This will load the file and display the contents to STDOUT:
+
+// load the named file and dump its structure to STDOUT
void dump_to_stdout(const char* pFilename)
{
TiXmlDocument doc(pFilename);
@@ -81,29 +87,28 @@ void dump_to_stdout(const char* pFilename)
printf("Failed to load file \"%s\"\n", pFilename);
}
}
-
-A simple demonstration of this function is to use a main like this:
-
A simple demonstration of this function is to use a main like this:
+
+int main(void)
{
dump_to_stdout("example1.xml");
return 0;
}
-
-Recall that Example 1 XML is:
-
Recall that Example 1 XML is:
+
+<?xml version="1.0" ?>
<Hello>World</Hello>
-
-Running the program with this XML will display this in the console/DOS window:
-
Running the program with this XML will display this in the console/DOS window:
+
+DOCUMENT
+ DECLARATION
+ ELEMENT Hello
+ TEXT[World]
-
-The ``dump_to_stdout`` function is defined later in this tutorial and is useful if you want to understand recursive traversal of a DOM.
+
The ``dump_to_stdout`` function is defined later in this tutorial and is useful if you want to understand recursive traversal of a DOM.
Building Documents Programatically
-
-This is how to build Example 1 pragmatically:
-
void build_simple_doc( )
+This is how to build Example 1 pragmatically:
+
+void build_simple_doc( )
{
// Make xml: <?xml ..><Hello>World</Hello>
TiXmlDocument doc;
@@ -115,19 +120,19 @@ This is how to build Example 1 pragmatically:
doc.LinkEndChild( element );
doc.SaveFile( "madeByHand.xml" );
}
-
-This can be loaded and displayed on the console with:
-
dump_to_stdout("madeByHand.xml"); // this func defined later in the tutorial
-
-and you'll see it is identical to Example 1:
-
This can be loaded and displayed on the console with:
+
+dump_to_stdout("madeByHand.xml"); // this func defined later in the tutorial
+ and you'll see it is identical to Example 1:
+
+madeByHand.xml:
Document
+ Declaration
+ Element [Hello]
+ Text: [World]
-
-This code produces exactly the same XML DOM but it shows a different ordering to node creation and linking:
-
void write_simple_doc2( )
+ This code produces exactly the same XML DOM but it shows a different ordering to node creation and linking:
+
+void write_simple_doc2( )
{
// same as write_simple_doc1 but add each node
// as early as possible into the tree.
@@ -144,29 +149,28 @@ This code produces exactly the same XML DOM but it shows a different ordering to
doc.SaveFile( "madeByHand2.xml" );
}
-
-Both of these produce the same XML, namely:
-
Both of these produce the same XML, namely:
+
+<?xml version="1.0" ?>
<Hello>World</Hello>
-
-Or in structure form:
-
Or in structure form:
+
+DOCUMENT
+ DECLARATION
+ ELEMENT Hello
+ TEXT[World]
-
-
Attributes
-
-Given an existing node, settings attributes is easy:
-
window = new TiXmlElement( "Demo" );
+ Attributes
+Given an existing node, settings attributes is easy:
+
+window = new TiXmlElement( "Demo" );
window->SetAttribute("name", "Circle");
window->SetAttribute("x", 5);
window->SetAttribute("y", 15);
window->SetDoubleAttribute("radius", 3.14159);
-
-You can it also work with the TiXmlAttribute objects if you want.
-The following code shows one way (not the only way) to get all attributes of an element, print the name and string value, and if the value can be converted to an integer or double, print that value too:
-
// print all attributes of pElement.
+ You can it also work with the TiXmlAttribute objects if you want.
+The following code shows one way (not the only way) to get all attributes of an element, print the name and string value, and if the value can be converted to an integer or double, print that value too:
+
+// print all attributes of pElement.
// returns the number of attributes printed
int dump_attribs_to_stdout(TiXmlElement* pElement, unsigned int indent)
{
@@ -190,14 +194,13 @@ int dump_attribs_to_stdout(TiXmlElement* pElement, unsigned int indent)
}
return i;
}
-
-
Writing a document to a file
-
-Writing a pre-built DOM to a file is trivial:
-
doc.SaveFile( saveFilename );
-
-Recall, for example, example 4:
-
Writing a document to a file
+Writing a pre-built DOM to a file is trivial:
+
+doc.SaveFile( saveFilename );
+ Recall, for example, example 4:
+
+<?xml version="1.0" ?>
<MyApp>
<!-- Settings for MyApp -->
<Messages>
@@ -209,9 +212,9 @@ Recall, for example, example 4:
</Windows>
<Connection ip="192.168.0.1" timeout="123.456000" />
</MyApp>
-
-The following function builds this DOM and writes the file "appsettings.xml":
-
void write_app_settings_doc( )
+ The following function builds this DOM and writes the file "appsettings.xml":
+
+void write_app_settings_doc( )
{
TiXmlDocument doc;
TiXmlElement* msg;
@@ -256,9 +259,9 @@ The following function builds this DOM and writes the file "appsettings.xml":
dump_to_stdout( &doc );
doc.SaveFile( "appsettings.xml" );
}
-
-The dump_to_stdout function will show this structure:
-
The dump_to_stdout function will show this structure:
+
+Document
+ Declaration
+ Element [MyApp]
(No attributes)
@@ -284,21 +287,18 @@ The dump_to_stdout function will show this structure:
+ ip: value=[192.168.0.1] int=192 d=192.2
+ timeout: value=[123.456000] int=123 d=123.5
2 attributes
-
-I was surprised that TinyXml, by default, writes the XML in what other APIs call a "pretty" format - it modifies the whitespace of text of elements that contain other nodes so that writing the tree includes an indication of nesting level.
-I haven't looked yet to see if there is a way to turn off indenting when writing a file - its bound to be easy.
-[Lee: It's easy in STL mode, just use cout << myDoc. Non-STL mode is always in "pretty" format. Adding a switch would be a nice feature and has been requested.]
+
I was surprised that TinyXml, by default, writes the XML in what other APIs call a "pretty" format - it modifies the whitespace of text of elements that contain other nodes so that writing the tree includes an indication of nesting level.
+
I haven't looked yet to see if there is a way to turn off indenting when writing a file - its bound to be easy.
+
[Lee: It's easy in STL mode, just use cout << myDoc. Non-STL mode is always in "pretty" format. Adding a switch would be a nice feature and has been requested.]
XML to/from C++ objects
-
Intro
-
-This example assumes you're loading and saving your app settings in an XML file, e.g. something like example4.xml.
-There are a number of ways to do this. For example, look into the TinyBind project at http://sourceforge.net/projects/tinybind
-This section shows a plain-old approach to loading and saving a basic object structure using XML.
+
This example assumes you're loading and saving your app settings in an XML file, e.g. something like example4.xml.
+
There are a number of ways to do this. For example, look into the TinyBind project at http://sourceforge.net/projects/tinybind
+
This section shows a plain-old approach to loading and saving a basic object structure using XML.
Set up your object classes
-
-Start off with some basic classes like these:
-
#include <string>
+Start off with some basic classes like these:
+
+#include <string>
#include <map>
using namespace std;
@@ -359,9 +359,9 @@ public:
m_connection.timeout=123.456;
}
};
-
-This is a basic main() that shows how to create a default settings object tree, save it and load it again:
-
This is a basic main() that shows how to create a default settings object tree, save it and load it again:
+
+int main(void)
{
AppSettings settings;
@@ -369,9 +369,9 @@ This is a basic main() that shows how to create a default settings object tree,
settings.load("appsettings2.xml");
return 0;
}
-
-The following main() shows creation, modification, saving and then loading of a settings structure:
-
The following main() shows creation, modification, saving and then loading of a settings structure:
+
+int main(void)
{
// block: customise and save settings
{
@@ -399,16 +399,15 @@ The following main() shows creation, modification, saving and then loading of a
}
return 0;
}
-
-When the save() and load() are completed (see below), running this main() displays on the console:
-
HitchHikerApp: Don't Panic
+ When the save() and load() are completed (see below), running this main() displays on the console:
+
+HitchHikerApp: Don't Panic
HitchHikerApp: Show window 'BookFrame' at 15,25 (300 x 100)
HitchHikerApp: Thanks for all the fish
-
-
Encode C++ state as XML
-
-There are lots of different ways to approach saving this to a file. Here's one:
-
void AppSettings::save(const char* pFilename)
+ Encode C++ state as XML
+There are lots of different ways to approach saving this to a file. Here's one:
+
+void AppSettings::save(const char* pFilename)
{
TiXmlDocument doc;
TiXmlElement* msg;
@@ -474,9 +473,9 @@ There are lots of different ways to approach saving this to a file. Here's one:<
doc.SaveFile(pFilename);
}
-
-Running this with the modified main produces this file:
-
Running this with the modified main produces this file:
+
+<?xml version="1.0" ?>
<HitchHikerApp>
<!-- Settings for HitchHikerApp -->
<Messages>
@@ -488,11 +487,10 @@ Running this with the modified main produces this file:
</Windows>
<Connection ip="192.168.0.77" timeout="42.000000" />
</HitchHikerApp>
-
-
Decoding state from XML
-
-As with encoding objects, there are a number of approaches to decoding XML into your own C++ object structure. The following approach uses TiXmlHandles.
-
void AppSettings::load(const char* pFilename)
+ Decoding state from XML
+As with encoding objects, there are a number of approaches to decoding XML into your own C++ object structure. The following approach uses TiXmlHandles.
+
+void AppSettings::load(const char* pFilename)
{
TiXmlDocument doc(pFilename);
if (!doc.LoadFile()) return;
@@ -558,11 +556,10 @@ As with encoding objects, there are a number of approaches to decoding XML into
}
}
}
-
-
Full listing for dump_to_stdout
-
-Below is a copy-and-paste demo program for loading arbitrary XML files and dumping the structure to STDOUT using the recursive traversal listed above.
-
// tutorial demo program
+ Full listing for dump_to_stdout
+Below is a copy-and-paste demo program for loading arbitrary XML files and dumping the structure to STDOUT using the recursive traversal listed above.
+
+// tutorial demo program
#include "stdafx.h"
#include "tinyxml.h"
@@ -627,11 +624,11 @@ void dump_to_stdout( TiXmlNode* pParent, unsigned int indent = 0 )
switch ( t )
{
- case TiXmlNode::DOCUMENT:
+ case TiXmlNode::TINYXML_DOCUMENT:
printf( "Document" );
break;
- case TiXmlNode::ELEMENT:
+ case TiXmlNode::TINYXML_ELEMENT:
printf( "Element [%s]", pParent->Value() );
num=dump_attribs_to_stdout(pParent->ToElement(), indent+1);
switch(num)
@@ -642,20 +639,20 @@ void dump_to_stdout( TiXmlNode* pParent, unsigned int indent = 0 )
}
break;
- case TiXmlNode::COMMENT:
+ case TiXmlNode::TINYXML_COMMENT:
printf( "Comment: [%s]", pParent->Value());
break;
- case TiXmlNode::UNKNOWN:
+ case TiXmlNode::TINYXML_UNKNOWN:
printf( "Unknown" );
break;
- case TiXmlNode::TEXT:
+ case TiXmlNode::TINYXML_TEXT:
pText = pParent->ToText();
printf( "Text: [%s]", pText->Value() );
break;
- case TiXmlNode::DECLARATION:
+ case TiXmlNode::TINYXML_DECLARATION:
printf( "Declaration" );
break;
default:
@@ -695,9 +692,9 @@ int main(int argc, char* argv[])
}
return 0;
}
-
-Run this from the command line or a DOS window, e.g.:
-
C:\dev\tinyxml> Debug\tinyxml_1.exe example1.xml
+ Run this from the command line or a DOS window, e.g.:
+
+C:\dev\tinyxml> Debug\tinyxml_1.exe example1.xml
example1.xml:
Document
@@ -705,8 +702,8 @@ Document
+ Element [Hello]
(No attributes)
+ Text: [World]
-
- Authors and Changes
Authors and Changes
+
Written by Ellers, April, May, June 2005
@@ -714,8 +711,10 @@ Minor edits and integration into doc system, Lee Thomason September 2005
Updated by Ellers, October 2005
-
Generated on Sun May 6 15:41:23 2007 for TinyXml by
+
+
+Generated by
- 1.4.7
+ 1.6.2
diff --git a/Engine/lib/tinyxml/readme.txt b/Engine/lib/tinyxml/readme.txt
index 14ec3d2e0..89d9e8d38 100644
--- a/Engine/lib/tinyxml/readme.txt
+++ b/Engine/lib/tinyxml/readme.txt
@@ -413,7 +413,7 @@ relate to the DOM.
TiXmlDeclaration class. It will be the first child of the
document node.
- This is the only directive/special tag parsed by by TinyXML.
+ This is the only directive/special tag parsed by TinyXML.
Generally directive tags are stored in TiXmlUnknown so the
commands wont be lost when it is saved back to disk.
@@ -499,7 +499,7 @@ distribution.
References
The World Wide Web Consortium is the definitive standard body for
-XML, and there web pages contain huge amounts of information.
+XML, and their web pages contain huge amounts of information.
The definitive spec:
http://www.w3.org/TR/2004/REC-xml-20040204/
diff --git a/Engine/lib/tinyxml/tinystr.cpp b/Engine/lib/tinyxml/tinystr.cpp
index 681250714..066576820 100644
--- a/Engine/lib/tinyxml/tinystr.cpp
+++ b/Engine/lib/tinyxml/tinystr.cpp
@@ -1,6 +1,5 @@
/*
www.sourceforge.net/projects/tinyxml
-Original file by Yves Berquin.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
@@ -22,10 +21,6 @@ must not be misrepresented as being the original software.
distribution.
*/
-/*
- * THIS FILE WAS ALTERED BY Tyge Løvset, 7. April 2005.
- */
-
#ifndef TIXML_USE_STL
diff --git a/Engine/lib/tinyxml/tinystr.h b/Engine/lib/tinyxml/tinystr.h
index 3c2aa9d54..89cca3341 100644
--- a/Engine/lib/tinyxml/tinystr.h
+++ b/Engine/lib/tinyxml/tinystr.h
@@ -1,6 +1,5 @@
/*
www.sourceforge.net/projects/tinyxml
-Original file by Yves Berquin.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
@@ -22,17 +21,6 @@ must not be misrepresented as being the original software.
distribution.
*/
-/*
- * THIS FILE WAS ALTERED BY Tyge Lovset, 7. April 2005.
- *
- * - completely rewritten. compact, clean, and fast implementation.
- * - sizeof(TiXmlString) = pointer size (4 bytes on 32-bit systems)
- * - fixed reserve() to work as per specification.
- * - fixed buggy compares operator==(), operator<(), and operator>()
- * - fixed operator+=() to take a const ref argument, following spec.
- * - added "copy" constructor with length, and most compare operators.
- * - added swap(), clear(), size(), capacity(), operator+().
- */
#ifndef TIXML_USE_STL
@@ -106,13 +94,11 @@ class TiXmlString
quit();
}
- // = operator
TiXmlString& operator = (const char * copy)
{
return assign( copy, (size_type)strlen(copy));
}
- // = operator
TiXmlString& operator = (const TiXmlString & copy)
{
return assign(copy.start(), copy.length());
diff --git a/Engine/lib/tinyxml/tinyxml.cpp b/Engine/lib/tinyxml/tinyxml.cpp
index 9fea74ccf..9c161dfcb 100644
--- a/Engine/lib/tinyxml/tinyxml.cpp
+++ b/Engine/lib/tinyxml/tinyxml.cpp
@@ -1,6 +1,6 @@
/*
www.sourceforge.net/projects/tinyxml
-Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
+Original code by Lee Thomason (www.grinninglizard.com)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
@@ -31,6 +31,7 @@ distribution.
#include "tinyxml.h"
+FILE* TiXmlFOpen( const char* filename, const char* mode );
bool TiXmlBase::condenseWhiteSpace = true;
@@ -161,6 +162,7 @@ void TiXmlNode::CopyTo( TiXmlNode* target ) const
{
target->SetValue (value.c_str() );
target->userData = userData;
+ target->location = location;
}
@@ -186,10 +188,11 @@ TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node )
assert( node->parent == 0 || node->parent == this );
assert( node->GetDocument() == 0 || node->GetDocument() == this->GetDocument() );
- if ( node->Type() == TiXmlNode::DOCUMENT )
+ if ( node->Type() == TiXmlNode::TINYXML_DOCUMENT )
{
delete node;
- if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
+ if ( GetDocument() )
+ GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
return 0;
}
@@ -210,9 +213,10 @@ TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node )
TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis )
{
- if ( addThis.Type() == TiXmlNode::DOCUMENT )
+ if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT )
{
- if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
+ if ( GetDocument() )
+ GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
return 0;
}
TiXmlNode* node = addThis.Clone();
@@ -228,9 +232,10 @@ TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode&
if ( !beforeThis || beforeThis->parent != this ) {
return 0;
}
- if ( addThis.Type() == TiXmlNode::DOCUMENT )
+ if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT )
{
- if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
+ if ( GetDocument() )
+ GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
return 0;
}
@@ -260,9 +265,10 @@ TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& a
if ( !afterThis || afterThis->parent != this ) {
return 0;
}
- if ( addThis.Type() == TiXmlNode::DOCUMENT )
+ if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT )
{
- if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
+ if ( GetDocument() )
+ GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
return 0;
}
@@ -289,9 +295,20 @@ TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& a
TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis )
{
+ if ( !replaceThis )
+ return 0;
+
if ( replaceThis->parent != this )
return 0;
+ if ( withThis.ToDocument() ) {
+ // A document can never be a child. Thanks to Noam.
+ TiXmlDocument* document = GetDocument();
+ if ( document )
+ document->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
+ return 0;
+ }
+
TiXmlNode* node = withThis.Clone();
if ( !node )
return 0;
@@ -317,6 +334,10 @@ TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& wit
bool TiXmlNode::RemoveChild( TiXmlNode* removeThis )
{
+ if ( !removeThis ) {
+ return false;
+ }
+
if ( removeThis->parent != this )
{
assert( 0 );
@@ -502,7 +523,7 @@ const TiXmlDocument* TiXmlNode::GetDocument() const
TiXmlElement::TiXmlElement (const char * _value)
- : TiXmlNode( TiXmlNode::ELEMENT )
+ : TiXmlNode( TiXmlNode::TINYXML_ELEMENT )
{
firstChild = lastChild = 0;
value = _value;
@@ -511,7 +532,7 @@ TiXmlElement::TiXmlElement (const char * _value)
#ifdef TIXML_USE_STL
TiXmlElement::TiXmlElement( const std::string& _value )
- : TiXmlNode( TiXmlNode::ELEMENT )
+ : TiXmlNode( TiXmlNode::TINYXML_ELEMENT )
{
firstChild = lastChild = 0;
value = _value;
@@ -520,17 +541,18 @@ TiXmlElement::TiXmlElement( const std::string& _value )
TiXmlElement::TiXmlElement( const TiXmlElement& copy)
- : TiXmlNode( TiXmlNode::ELEMENT )
+ : TiXmlNode( TiXmlNode::TINYXML_ELEMENT )
{
firstChild = lastChild = 0;
copy.CopyTo( this );
}
-void TiXmlElement::operator=( const TiXmlElement& base )
+TiXmlElement& TiXmlElement::operator=( const TiXmlElement& base )
{
ClearThis();
base.CopyTo( this );
+ return *this;
}
@@ -564,9 +586,9 @@ const char* TiXmlElement::Attribute( const char* name ) const
#ifdef TIXML_USE_STL
const std::string* TiXmlElement::Attribute( const std::string& name ) const
{
- const TiXmlAttribute* node = attributeSet.Find( name );
- if ( node )
- return &node->ValueStr();
+ const TiXmlAttribute* attrib = attributeSet.Find( name );
+ if ( attrib )
+ return &attrib->ValueStr();
return 0;
}
#endif
@@ -574,195 +596,202 @@ const std::string* TiXmlElement::Attribute( const std::string& name ) const
const char* TiXmlElement::Attribute( const char* name, int* i ) const
{
- const char* s = Attribute( name );
- if ( i )
- {
- if ( s ) {
- *i = atoi( s );
- }
- else {
- *i = 0;
+ const TiXmlAttribute* attrib = attributeSet.Find( name );
+ const char* result = 0;
+
+ if ( attrib ) {
+ result = attrib->Value();
+ if ( i ) {
+ attrib->QueryIntValue( i );
}
}
- return s;
+ return result;
}
#ifdef TIXML_USE_STL
const std::string* TiXmlElement::Attribute( const std::string& name, int* i ) const
{
- const std::string* s = Attribute( name );
- if ( i )
- {
- if ( s ) {
- *i = atoi( s->c_str() );
- }
- else {
- *i = 0;
+ const TiXmlAttribute* attrib = attributeSet.Find( name );
+ const std::string* result = 0;
+
+ if ( attrib ) {
+ result = &attrib->ValueStr();
+ if ( i ) {
+ attrib->QueryIntValue( i );
}
}
- return s;
+ return result;
}
#endif
const char* TiXmlElement::Attribute( const char* name, double* d ) const
{
- const char* s = Attribute( name );
- if ( d )
- {
- if ( s ) {
- *d = atof( s );
- }
- else {
- *d = 0;
+ const TiXmlAttribute* attrib = attributeSet.Find( name );
+ const char* result = 0;
+
+ if ( attrib ) {
+ result = attrib->Value();
+ if ( d ) {
+ attrib->QueryDoubleValue( d );
}
}
- return s;
+ return result;
}
#ifdef TIXML_USE_STL
const std::string* TiXmlElement::Attribute( const std::string& name, double* d ) const
{
- const std::string* s = Attribute( name );
- if ( d )
- {
- if ( s ) {
- *d = atof( s->c_str() );
- }
- else {
- *d = 0;
+ const TiXmlAttribute* attrib = attributeSet.Find( name );
+ const std::string* result = 0;
+
+ if ( attrib ) {
+ result = &attrib->ValueStr();
+ if ( d ) {
+ attrib->QueryDoubleValue( d );
}
}
- return s;
+ return result;
}
#endif
int TiXmlElement::QueryIntAttribute( const char* name, int* ival ) const
+{
+ const TiXmlAttribute* attrib = attributeSet.Find( name );
+ if ( !attrib )
+ return TIXML_NO_ATTRIBUTE;
+ return attrib->QueryIntValue( ival );
+}
+
+
+int TiXmlElement::QueryUnsignedAttribute( const char* name, unsigned* value ) const
{
const TiXmlAttribute* node = attributeSet.Find( name );
if ( !node )
return TIXML_NO_ATTRIBUTE;
- return node->QueryIntValue( ival );
+
+ int ival = 0;
+ int result = node->QueryIntValue( &ival );
+ *value = (unsigned)ival;
+ return result;
}
+int TiXmlElement::QueryBoolAttribute( const char* name, bool* bval ) const
+{
+ const TiXmlAttribute* node = attributeSet.Find( name );
+ if ( !node )
+ return TIXML_NO_ATTRIBUTE;
+
+ int result = TIXML_WRONG_TYPE;
+ if ( StringEqual( node->Value(), "true", true, TIXML_ENCODING_UNKNOWN )
+ || StringEqual( node->Value(), "yes", true, TIXML_ENCODING_UNKNOWN )
+ || StringEqual( node->Value(), "1", true, TIXML_ENCODING_UNKNOWN ) )
+ {
+ *bval = true;
+ result = TIXML_SUCCESS;
+ }
+ else if ( StringEqual( node->Value(), "false", true, TIXML_ENCODING_UNKNOWN )
+ || StringEqual( node->Value(), "no", true, TIXML_ENCODING_UNKNOWN )
+ || StringEqual( node->Value(), "0", true, TIXML_ENCODING_UNKNOWN ) )
+ {
+ *bval = false;
+ result = TIXML_SUCCESS;
+ }
+ return result;
+}
+
+
+
#ifdef TIXML_USE_STL
int TiXmlElement::QueryIntAttribute( const std::string& name, int* ival ) const
{
- const TiXmlAttribute* node = attributeSet.Find( name );
- if ( !node )
+ const TiXmlAttribute* attrib = attributeSet.Find( name );
+ if ( !attrib )
return TIXML_NO_ATTRIBUTE;
- return node->QueryIntValue( ival );
+ return attrib->QueryIntValue( ival );
}
#endif
int TiXmlElement::QueryDoubleAttribute( const char* name, double* dval ) const
{
- const TiXmlAttribute* node = attributeSet.Find( name );
- if ( !node )
+ const TiXmlAttribute* attrib = attributeSet.Find( name );
+ if ( !attrib )
return TIXML_NO_ATTRIBUTE;
- return node->QueryDoubleValue( dval );
+ return attrib->QueryDoubleValue( dval );
}
#ifdef TIXML_USE_STL
int TiXmlElement::QueryDoubleAttribute( const std::string& name, double* dval ) const
{
- const TiXmlAttribute* node = attributeSet.Find( name );
- if ( !node )
+ const TiXmlAttribute* attrib = attributeSet.Find( name );
+ if ( !attrib )
return TIXML_NO_ATTRIBUTE;
- return node->QueryDoubleValue( dval );
+ return attrib->QueryDoubleValue( dval );
}
#endif
void TiXmlElement::SetAttribute( const char * name, int val )
{
- char buf[64];
- #if defined(TIXML_SNPRINTF)
- TIXML_SNPRINTF( buf, sizeof(buf), "%d", val );
- #else
- sprintf( buf, "%d", val );
- #endif
- SetAttribute( name, buf );
+ TiXmlAttribute* attrib = attributeSet.FindOrCreate( name );
+ if ( attrib ) {
+ attrib->SetIntValue( val );
+ }
}
#ifdef TIXML_USE_STL
void TiXmlElement::SetAttribute( const std::string& name, int val )
{
- std::ostringstream oss;
- oss << val;
- SetAttribute( name, oss.str() );
+ TiXmlAttribute* attrib = attributeSet.FindOrCreate( name );
+ if ( attrib ) {
+ attrib->SetIntValue( val );
+ }
}
#endif
void TiXmlElement::SetDoubleAttribute( const char * name, double val )
{
- char buf[256];
- #if defined(TIXML_SNPRINTF)
- TIXML_SNPRINTF( buf, sizeof(buf), "%f", val );
- #else
- sprintf( buf, "%f", val );
- #endif
- SetAttribute( name, buf );
-}
-
-
-void TiXmlElement::SetAttribute( const char * cname, const char * cvalue )
-{
- #ifdef TIXML_USE_STL
- TIXML_STRING _name( cname );
- TIXML_STRING _value( cvalue );
- #else
- const char* _name = cname;
- const char* _value = cvalue;
- #endif
-
- TiXmlAttribute* node = attributeSet.Find( _name );
- if ( node )
- {
- node->SetValue( _value );
- return;
- }
-
- TiXmlAttribute* attrib = new TiXmlAttribute( cname, cvalue );
- if ( attrib )
- {
- attributeSet.Add( attrib );
- }
- else
- {
- TiXmlDocument* document = GetDocument();
- if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
+ TiXmlAttribute* attrib = attributeSet.FindOrCreate( name );
+ if ( attrib ) {
+ attrib->SetDoubleValue( val );
}
}
#ifdef TIXML_USE_STL
-void TiXmlElement::SetAttribute( const std::string& name, const std::string& _value )
-{
- TiXmlAttribute* node = attributeSet.Find( name );
- if ( node )
- {
- node->SetValue( _value );
- return;
+void TiXmlElement::SetDoubleAttribute( const std::string& name, double val )
+{
+ TiXmlAttribute* attrib = attributeSet.FindOrCreate( name );
+ if ( attrib ) {
+ attrib->SetDoubleValue( val );
}
+}
+#endif
- TiXmlAttribute* attrib = new TiXmlAttribute( name, _value );
- if ( attrib )
- {
- attributeSet.Add( attrib );
+
+void TiXmlElement::SetAttribute( const char * cname, const char * cvalue )
+{
+ TiXmlAttribute* attrib = attributeSet.FindOrCreate( cname );
+ if ( attrib ) {
+ attrib->SetValue( cvalue );
}
- else
- {
- TiXmlDocument* document = GetDocument();
- if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
+}
+
+
+#ifdef TIXML_USE_STL
+void TiXmlElement::SetAttribute( const std::string& _name, const std::string& _value )
+{
+ TiXmlAttribute* attrib = attributeSet.FindOrCreate( _name );
+ if ( attrib ) {
+ attrib->SetValue( _value );
}
}
#endif
@@ -806,15 +835,10 @@ void TiXmlElement::Print( FILE* cfile, int depth ) const
for ( node = firstChild; node; node=node->NextSibling() )
{
- fprintf( cfile, "\n" );
-
- if ( node->ToText() )
+ if ( !node->ToText() )
{
- for( i=0; iPrint( cfile, depth+1 );
}
fprintf( cfile, "\n" );
@@ -886,14 +910,14 @@ const char* TiXmlElement::GetText() const
}
-TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::DOCUMENT )
+TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT )
{
tabsize = 4;
useMicrosoftBOM = false;
ClearError();
}
-TiXmlDocument::TiXmlDocument( const char * documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
+TiXmlDocument::TiXmlDocument( const char * documentName ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT )
{
tabsize = 4;
useMicrosoftBOM = false;
@@ -903,7 +927,7 @@ TiXmlDocument::TiXmlDocument( const char * documentName ) : TiXmlNode( TiXmlNode
#ifdef TIXML_USE_STL
-TiXmlDocument::TiXmlDocument( const std::string& documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
+TiXmlDocument::TiXmlDocument( const std::string& documentName ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT )
{
tabsize = 4;
useMicrosoftBOM = false;
@@ -913,49 +937,33 @@ TiXmlDocument::TiXmlDocument( const std::string& documentName ) : TiXmlNode( TiX
#endif
-TiXmlDocument::TiXmlDocument( const TiXmlDocument& copy ) : TiXmlNode( TiXmlNode::DOCUMENT )
+TiXmlDocument::TiXmlDocument( const TiXmlDocument& copy ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT )
{
copy.CopyTo( this );
}
-void TiXmlDocument::operator=( const TiXmlDocument& copy )
+TiXmlDocument& TiXmlDocument::operator=( const TiXmlDocument& copy )
{
Clear();
copy.CopyTo( this );
+ return *this;
}
bool TiXmlDocument::LoadFile( TiXmlEncoding encoding )
{
- // See STL_STRING_BUG below.
- //StringToBuffer buf( value );
-
return LoadFile( Value(), encoding );
}
bool TiXmlDocument::SaveFile() const
{
- // See STL_STRING_BUG below.
-// StringToBuffer buf( value );
-//
-// if ( buf.buffer && SaveFile( buf.buffer ) )
-// return true;
-//
-// return false;
return SaveFile( Value() );
}
bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding )
{
- // There was a really terrifying little bug here. The code:
- // value = filename
- // in the STL case, cause the assignment method of the std::string to
- // be called. What is strange, is that the std::string had the same
- // address as it's c_str() method, and so bad things happen. Looks
- // like a bug in the Microsoft STL implementation.
- // Add an extra string to avoid the crash.
TIXML_STRING filename( _filename );
value = filename;
@@ -1000,11 +1008,6 @@ bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding )
return false;
}
- // If we have a file, assume it is all one big XML file, and read it in.
- // The document parser may decide the document ends sooner than the entire file, however.
- TIXML_STRING data;
- data.reserve( length );
-
// Subtle bug here. TinyXml did use fgets. But from the XML spec:
// 2.11 End-of-Line Handling
//
@@ -1035,58 +1038,46 @@ bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding )
return false;
}
- const char* lastPos = buf;
- const char* p = buf;
+ // Process the buffer in place to normalize new lines. (See comment above.)
+ // Copies from the 'p' to 'q' pointer, where p can advance faster if
+ // a newline-carriage return is hit.
+ //
+ // Wikipedia:
+ // Systems based on ASCII or a compatible character set use either LF (Line feed, '\n', 0x0A, 10 in decimal) or
+ // CR (Carriage return, '\r', 0x0D, 13 in decimal) individually, or CR followed by LF (CR+LF, 0x0D 0x0A)...
+ // * LF: Multics, Unix and Unix-like systems (GNU/Linux, AIX, Xenix, Mac OS X, FreeBSD, etc.), BeOS, Amiga, RISC OS, and others
+ // * CR+LF: DEC RT-11 and most other early non-Unix, non-IBM OSes, CP/M, MP/M, DOS, OS/2, Microsoft Windows, Symbian OS
+ // * CR: Commodore 8-bit machines, Apple II family, Mac OS up to version 9 and OS-9
+
+ const char* p = buf; // the read head
+ char* q = buf; // the write head
+ const char CR = 0x0d;
+ const char LF = 0x0a;
buf[length] = 0;
while( *p ) {
assert( p < (buf+length) );
- if ( *p == 0xa ) {
- // Newline character. No special rules for this. Append all the characters
- // since the last string, and include the newline.
- data.append( lastPos, (p-lastPos+1) ); // append, include the newline
- ++p; // move past the newline
- lastPos = p; // and point to the new buffer (may be 0)
- assert( p <= (buf+length) );
- }
- else if ( *p == 0xd ) {
- // Carriage return. Append what we have so far, then
- // handle moving forward in the buffer.
- if ( (p-lastPos) > 0 ) {
- data.append( lastPos, p-lastPos ); // do not add the CR
- }
- data += (char)0xa; // a proper newline
+ assert( q <= (buf+length) );
+ assert( q <= p );
- if ( *(p+1) == 0xa ) {
- // Carriage return - new line sequence
- p += 2;
- lastPos = p;
- assert( p <= (buf+length) );
- }
- else {
- // it was followed by something else...that is presumably characters again.
- ++p;
- lastPos = p;
- assert( p <= (buf+length) );
+ if ( *p == CR ) {
+ *q++ = LF;
+ p++;
+ if ( *p == LF ) { // check for CR+LF (and skip LF)
+ p++;
}
}
else {
- ++p;
+ *q++ = *p++;
}
}
- // Handle any left over characters.
- if ( p-lastPos ) {
- data.append( lastPos, p-lastPos );
- }
+ assert( q <= (buf+length) );
+ *q = 0;
+
+ Parse( buf, 0, encoding );
+
delete [] buf;
- buf = 0;
-
- Parse( data.c_str(), 0, encoding );
-
- if ( Error() )
- return false;
- else
- return true;
+ return !Error();
}
@@ -1225,7 +1216,7 @@ void TiXmlAttribute::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) cons
if (value.find ('\"') == TIXML_STRING::npos) {
if ( cfile ) {
- fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() );
+ fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() );
}
if ( str ) {
(*str) += n; (*str) += "=\""; (*str) += v; (*str) += "\"";
@@ -1233,7 +1224,7 @@ void TiXmlAttribute::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) cons
}
else {
if ( cfile ) {
- fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() );
+ fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() );
}
if ( str ) {
(*str) += n; (*str) += "='"; (*str) += v; (*str) += "'";
@@ -1271,9 +1262,9 @@ void TiXmlAttribute::SetDoubleValue( double _value )
{
char buf [256];
#if defined(TIXML_SNPRINTF)
- TIXML_SNPRINTF( buf, sizeof(buf), "%lf", _value);
+ TIXML_SNPRINTF( buf, sizeof(buf), "%g", _value);
#else
- sprintf (buf, "%lf", _value);
+ sprintf (buf, "%g", _value);
#endif
SetValue (buf);
}
@@ -1289,16 +1280,17 @@ double TiXmlAttribute::DoubleValue() const
}
-TiXmlComment::TiXmlComment( const TiXmlComment& copy ) : TiXmlNode( TiXmlNode::COMMENT )
+TiXmlComment::TiXmlComment( const TiXmlComment& copy ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT )
{
copy.CopyTo( this );
}
-void TiXmlComment::operator=( const TiXmlComment& base )
+TiXmlComment& TiXmlComment::operator=( const TiXmlComment& base )
{
Clear();
base.CopyTo( this );
+ return *this;
}
@@ -1387,7 +1379,7 @@ TiXmlNode* TiXmlText::Clone() const
TiXmlDeclaration::TiXmlDeclaration( const char * _version,
const char * _encoding,
const char * _standalone )
- : TiXmlNode( TiXmlNode::DECLARATION )
+ : TiXmlNode( TiXmlNode::TINYXML_DECLARATION )
{
version = _version;
encoding = _encoding;
@@ -1399,7 +1391,7 @@ TiXmlDeclaration::TiXmlDeclaration( const char * _version,
TiXmlDeclaration::TiXmlDeclaration( const std::string& _version,
const std::string& _encoding,
const std::string& _standalone )
- : TiXmlNode( TiXmlNode::DECLARATION )
+ : TiXmlNode( TiXmlNode::TINYXML_DECLARATION )
{
version = _version;
encoding = _encoding;
@@ -1409,16 +1401,17 @@ TiXmlDeclaration::TiXmlDeclaration( const std::string& _version,
TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy )
- : TiXmlNode( TiXmlNode::DECLARATION )
+ : TiXmlNode( TiXmlNode::TINYXML_DECLARATION )
{
copy.CopyTo( this );
}
-void TiXmlDeclaration::operator=( const TiXmlDeclaration& copy )
+TiXmlDeclaration& TiXmlDeclaration::operator=( const TiXmlDeclaration& copy )
{
Clear();
copy.CopyTo( this );
+ return *this;
}
@@ -1553,18 +1546,7 @@ void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe )
#ifdef TIXML_USE_STL
-const TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name ) const
-{
- for( const TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
- {
- if ( node->name == name )
- return node;
- }
- return 0;
-}
-
-/*
-TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name )
+TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name ) const
{
for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
{
@@ -1573,22 +1555,21 @@ TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name )
}
return 0;
}
-*/
+
+TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const std::string& _name )
+{
+ TiXmlAttribute* attrib = Find( _name );
+ if ( !attrib ) {
+ attrib = new TiXmlAttribute();
+ Add( attrib );
+ attrib->SetName( _name );
+ }
+ return attrib;
+}
#endif
-const TiXmlAttribute* TiXmlAttributeSet::Find( const char* name ) const
-{
- for( const TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
- {
- if ( strcmp( node->name.c_str(), name ) == 0 )
- return node;
- }
- return 0;
-}
-
-/*
-TiXmlAttribute* TiXmlAttributeSet::Find( const char* name )
+TiXmlAttribute* TiXmlAttributeSet::Find( const char* name ) const
{
for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
{
@@ -1597,7 +1578,19 @@ TiXmlAttribute* TiXmlAttributeSet::Find( const char* name )
}
return 0;
}
-*/
+
+
+TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const char* _name )
+{
+ TiXmlAttribute* attrib = Find( _name );
+ if ( !attrib ) {
+ attrib = new TiXmlAttribute();
+ Add( attrib );
+ attrib->SetName( _name );
+ }
+ return attrib;
+}
+
#ifdef TIXML_USE_STL
std::istream& operator>> (std::istream & in, TiXmlNode & base)
diff --git a/Engine/lib/tinyxml/tinyxml.h b/Engine/lib/tinyxml/tinyxml.h
index c6f40cc27..a3589e5b2 100644
--- a/Engine/lib/tinyxml/tinyxml.h
+++ b/Engine/lib/tinyxml/tinyxml.h
@@ -1,6 +1,6 @@
/*
www.sourceforge.net/projects/tinyxml
-Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
+Original code by Lee Thomason (www.grinninglizard.com)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
@@ -63,21 +63,19 @@ distribution.
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
// Microsoft visual studio, version 2005 and higher.
#define TIXML_SNPRINTF _snprintf_s
- #define TIXML_SNSCANF _snscanf_s
#define TIXML_SSCANF sscanf_s
#elif defined(_MSC_VER) && (_MSC_VER >= 1200 )
// Microsoft visual studio, version 6 and higher.
//#pragma message( "Using _sn* functions." )
#define TIXML_SNPRINTF _snprintf
- #define TIXML_SNSCANF _snscanf
#define TIXML_SSCANF sscanf
#elif defined(__GNUC__) && (__GNUC__ >= 3 )
// GCC version 3 and higher.s
//#warning( "Using sn* functions." )
#define TIXML_SNPRINTF snprintf
- #define TIXML_SNSCANF snscanf
#define TIXML_SSCANF sscanf
#else
+ #define TIXML_SNPRINTF snprintf
#define TIXML_SSCANF sscanf
#endif
#endif
@@ -92,8 +90,8 @@ class TiXmlDeclaration;
class TiXmlParsingData;
const int TIXML_MAJOR_VERSION = 2;
-const int TIXML_MINOR_VERSION = 5;
-const int TIXML_PATCH_VERSION = 3;
+const int TIXML_MINOR_VERSION = 6;
+const int TIXML_PATCH_VERSION = 2;
/* Internal structure for tracking location of items
in the XML file.
@@ -109,10 +107,11 @@ struct TiXmlCursor
/**
+ Implements the interface to the "Visitor pattern" (see the Accept() method.)
If you call the Accept() method, it requires being passed a TiXmlVisitor
class to handle callbacks. For nodes that contain other nodes (Document, Element)
you will get called with a VisitEnter/VisitExit pair. Nodes that are always leaves
- are simple called with Visit().
+ are simply called with Visit().
If you return 'true' from a Visit method, recursive parsing will continue. If you return
false, no children of this node or its sibilings will be Visited.
@@ -147,7 +146,7 @@ public:
virtual bool Visit( const TiXmlText& /*text*/ ) { return true; }
/// Visit a comment node
virtual bool Visit( const TiXmlComment& /*comment*/ ) { return true; }
- /// Visit an unknow node
+ /// Visit an unknown node
virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) { return true; }
};
@@ -267,7 +266,6 @@ public:
TIXML_NO_ERROR = 0,
TIXML_ERROR,
TIXML_ERROR_OPENING_FILE,
- TIXML_ERROR_OUT_OF_MEMORY,
TIXML_ERROR_PARSING_ELEMENT,
TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME,
TIXML_ERROR_READING_ELEMENT_VALUE,
@@ -288,6 +286,7 @@ public:
protected:
static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding );
+
inline static bool IsWhiteSpace( char c )
{
return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' );
@@ -462,13 +461,13 @@ public:
*/
enum NodeType
{
- DOCUMENT,
- ELEMENT,
- COMMENT,
- UNKNOWN,
- TEXT,
- DECLARATION,
- TYPECOUNT
+ TINYXML_DOCUMENT,
+ TINYXML_ELEMENT,
+ TINYXML_COMMENT,
+ TINYXML_UNKNOWN,
+ TINYXML_TEXT,
+ TINYXML_DECLARATION,
+ TINYXML_TYPECOUNT
};
virtual ~TiXmlNode();
@@ -679,8 +678,8 @@ public:
#endif
/** Query the type (as an enumerated value, above) of this node.
- The possible types are: DOCUMENT, ELEMENT, COMMENT,
- UNKNOWN, TEXT, and DECLARATION.
+ The possible types are: TINYXML_DOCUMENT, TINYXML_ELEMENT, TINYXML_COMMENT,
+ TINYXML_UNKNOWN, TINYXML_TEXT, and TINYXML_DECLARATION.
*/
int Type() const { return type; }
@@ -915,17 +914,14 @@ public:
const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
- const TiXmlAttribute* Find( const char* _name ) const;
- TiXmlAttribute* Find( const char* _name ) {
- return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this))->Find( _name ) );
- }
- #ifdef TIXML_USE_STL
- const TiXmlAttribute* Find( const std::string& _name ) const;
- TiXmlAttribute* Find( const std::string& _name ) {
- return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttributeSet* >(this))->Find( _name ) );
- }
+ TiXmlAttribute* Find( const char* _name ) const;
+ TiXmlAttribute* FindOrCreate( const char* _name );
+
+# ifdef TIXML_USE_STL
+ TiXmlAttribute* Find( const std::string& _name ) const;
+ TiXmlAttribute* FindOrCreate( const std::string& _name );
+# endif
- #endif
private:
//*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element),
@@ -954,7 +950,7 @@ public:
TiXmlElement( const TiXmlElement& );
- void operator=( const TiXmlElement& base );
+ TiXmlElement& operator=( const TiXmlElement& base );
virtual ~TiXmlElement();
@@ -987,6 +983,13 @@ public:
does not exist, then TIXML_NO_ATTRIBUTE is returned.
*/
int QueryIntAttribute( const char* name, int* _value ) const;
+ /// QueryUnsignedAttribute examines the attribute - see QueryIntAttribute().
+ int QueryUnsignedAttribute( const char* name, unsigned* _value ) const;
+ /** QueryBoolAttribute examines the attribute - see QueryIntAttribute().
+ Note that '1', 'true', or 'yes' are considered true, while '0', 'false'
+ and 'no' are considered false.
+ */
+ int QueryBoolAttribute( const char* name, bool* _value ) const;
/// QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
int QueryDoubleAttribute( const char* name, double* _value ) const;
/// QueryFloatAttribute examines the attribute - see QueryIntAttribute().
@@ -1000,11 +1003,21 @@ public:
}
#ifdef TIXML_USE_STL
+ /// QueryStringAttribute examines the attribute - see QueryIntAttribute().
+ int QueryStringAttribute( const char* name, std::string* _value ) const {
+ const char* cstr = Attribute( name );
+ if ( cstr ) {
+ *_value = std::string( cstr );
+ return TIXML_SUCCESS;
+ }
+ return TIXML_NO_ATTRIBUTE;
+ }
+
/** Template form of the attribute query which will try to read the
attribute into the specified type. Very easy, very powerful, but
be careful to make sure to call this with the correct type.
- NOTE: This method doesn't work correctly for 'string' types.
+ NOTE: This method doesn't work correctly for 'string' types that contain spaces.
@return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE
*/
@@ -1020,13 +1033,8 @@ public:
return TIXML_SUCCESS;
return TIXML_WRONG_TYPE;
}
- /*
- This is - in theory - a bug fix for "QueryValueAtribute returns truncated std::string"
- but template specialization is hard to get working cross-compiler. Leaving the bug for now.
-
- // The above will fail for std::string because the space character is used as a seperator.
- // Specialize for strings. Bug [ 1695429 ] QueryValueAtribute returns truncated std::string
- template<> int QueryValueAttribute( const std::string& name, std::string* outValue ) const
+
+ int QueryValueAttribute( const std::string& name, std::string* outValue ) const
{
const TiXmlAttribute* node = attributeSet.Find( name );
if ( !node )
@@ -1034,7 +1042,6 @@ public:
*outValue = node->ValueStr();
return TIXML_SUCCESS;
}
- */
#endif
/** Sets an attribute of name to a given value. The attribute
@@ -1053,6 +1060,8 @@ public:
void SetAttribute( const std::string& name, const std::string& _value );
///< STL std::string form.
void SetAttribute( const std::string& name, int _value );
+ ///< STL std::string form.
+ void SetDoubleAttribute( const std::string& name, double value );
#endif
/** Sets an attribute of name to a given value. The attribute
@@ -1144,7 +1153,6 @@ protected:
const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding );
private:
-
TiXmlAttributeSet attributeSet;
};
@@ -1155,13 +1163,13 @@ class TiXmlComment : public TiXmlNode
{
public:
/// Constructs an empty comment.
- TiXmlComment() : TiXmlNode( TiXmlNode::COMMENT ) {}
+ TiXmlComment() : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {}
/// Construct a comment from text.
- TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::COMMENT ) {
+ TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {
SetValue( _value );
}
TiXmlComment( const TiXmlComment& );
- void operator=( const TiXmlComment& base );
+ TiXmlComment& operator=( const TiXmlComment& base );
virtual ~TiXmlComment() {}
@@ -1175,8 +1183,8 @@ public:
*/
virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
- virtual const TiXmlComment* ToComment() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
- virtual TiXmlComment* ToComment() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
+ virtual const TiXmlComment* ToComment() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
+ virtual TiXmlComment* ToComment() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
/** Walk the XML tree visiting this node and all of its children.
*/
@@ -1209,7 +1217,7 @@ public:
normal, encoded text. If you want it be output as a CDATA text
element, set the parameter _cdata to 'true'
*/
- TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TEXT)
+ TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT)
{
SetValue( initValue );
cdata = false;
@@ -1218,15 +1226,15 @@ public:
#ifdef TIXML_USE_STL
/// Constructor.
- TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
+ TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT)
{
SetValue( initValue );
cdata = false;
}
#endif
- TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TEXT ) { copy.CopyTo( this ); }
- void operator=( const TiXmlText& base ) { base.CopyTo( this ); }
+ TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TINYXML_TEXT ) { copy.CopyTo( this ); }
+ TiXmlText& operator=( const TiXmlText& base ) { base.CopyTo( this ); return *this; }
// Write this text object to a FILE stream.
virtual void Print( FILE* cfile, int depth ) const;
@@ -1278,7 +1286,7 @@ class TiXmlDeclaration : public TiXmlNode
{
public:
/// Construct an empty declaration.
- TiXmlDeclaration() : TiXmlNode( TiXmlNode::DECLARATION ) {}
+ TiXmlDeclaration() : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) {}
#ifdef TIXML_USE_STL
/// Constructor.
@@ -1293,7 +1301,7 @@ public:
const char* _standalone );
TiXmlDeclaration( const TiXmlDeclaration& copy );
- void operator=( const TiXmlDeclaration& copy );
+ TiXmlDeclaration& operator=( const TiXmlDeclaration& copy );
virtual ~TiXmlDeclaration() {}
@@ -1346,11 +1354,11 @@ private:
class TiXmlUnknown : public TiXmlNode
{
public:
- TiXmlUnknown() : TiXmlNode( TiXmlNode::UNKNOWN ) {}
+ TiXmlUnknown() : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) {}
virtual ~TiXmlUnknown() {}
- TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::UNKNOWN ) { copy.CopyTo( this ); }
- void operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); }
+ TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) { copy.CopyTo( this ); }
+ TiXmlUnknown& operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); return *this; }
/// Creates a copy of this Unknown and returns it.
virtual TiXmlNode* Clone() const;
@@ -1359,8 +1367,8 @@ public:
virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding );
- virtual const TiXmlUnknown* ToUnknown() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
- virtual TiXmlUnknown* ToUnknown() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
+ virtual const TiXmlUnknown* ToUnknown() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
+ virtual TiXmlUnknown* ToUnknown() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
/** Walk the XML tree visiting this node and all of its children.
*/
@@ -1396,7 +1404,7 @@ public:
#endif
TiXmlDocument( const TiXmlDocument& copy );
- void operator=( const TiXmlDocument& copy );
+ TiXmlDocument& operator=( const TiXmlDocument& copy );
virtual ~TiXmlDocument() {}
@@ -1423,14 +1431,10 @@ public:
#ifdef TIXML_USE_STL
bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ) ///< STL std::string version.
{
-// StringToBuffer f( filename );
-// return ( f.buffer && LoadFile( f.buffer, encoding ));
return LoadFile( filename.c_str(), encoding );
}
bool SaveFile( const std::string& filename ) const ///< STL std::string version.
{
-// StringToBuffer f( filename );
-// return ( f.buffer && SaveFile( f.buffer ));
return SaveFile( filename.c_str() );
}
#endif
@@ -1638,7 +1642,7 @@ public:
TiXmlHandle( TiXmlNode* _node ) { this->node = _node; }
/// Copy constructor
TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; }
- TiXmlHandle operator=( const TiXmlHandle& ref ) { this->node = ref.node; return *this; }
+ TiXmlHandle operator=( const TiXmlHandle& ref ) { if ( &ref != this ) this->node = ref.node; return *this; }
/// Return a handle to the first child node.
TiXmlHandle FirstChild() const;
@@ -1799,4 +1803,3 @@ private:
#endif
#endif
-
diff --git a/Engine/lib/tinyxml/tinyxmlerror.cpp b/Engine/lib/tinyxml/tinyxmlerror.cpp
index d24f63b2e..538c21d0b 100644
--- a/Engine/lib/tinyxml/tinyxmlerror.cpp
+++ b/Engine/lib/tinyxml/tinyxmlerror.cpp
@@ -31,12 +31,11 @@ distribution.
// It also cleans up the code a bit.
//
-const char* TiXmlBase::errorString[ TIXML_ERROR_STRING_COUNT ] =
+const char* TiXmlBase::errorString[ TiXmlBase::TIXML_ERROR_STRING_COUNT ] =
{
"No error",
"Error",
"Failed to open file",
- "Memory allocation failed.",
"Error parsing Element.",
"Failed to read Element name",
"Error reading Element value.",
diff --git a/Engine/lib/tinyxml/tinyxmlparser.cpp b/Engine/lib/tinyxml/tinyxmlparser.cpp
index 2e8f56739..81b7eae96 100644
--- a/Engine/lib/tinyxml/tinyxmlparser.cpp
+++ b/Engine/lib/tinyxml/tinyxmlparser.cpp
@@ -1,6 +1,6 @@
/*
www.sourceforge.net/projects/tinyxml
-Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
+Original code by Lee Thomason (www.grinninglizard.com)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
@@ -40,7 +40,7 @@ distribution.
// Note tha "PutString" hardcodes the same list. This
// is less flexible than it appears. Changing the entries
// or order will break putstring.
-TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] =
+TiXmlBase::Entity TiXmlBase::entity[ TiXmlBase::NUM_ENTITY ] =
{
{ "&", 5, '&' },
{ "<", 4, '<' },
@@ -174,7 +174,7 @@ class TiXmlParsingData
public:
void Stamp( const char* now, TiXmlEncoding encoding );
- const TiXmlCursor& Cursor() { return cursor; }
+ const TiXmlCursor& Cursor() const { return cursor; }
private:
// Only used by the document!
@@ -346,7 +346,7 @@ const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding )
continue;
}
- if ( IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' ) // Still using old rules for white space.
+ if ( IsWhiteSpace( *p ) ) // Still using old rules for white space.
++p;
else
break;
@@ -354,7 +354,7 @@ const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding )
}
else
{
- while ( *p && IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' )
+ while ( *p && IsWhiteSpace( *p ) )
++p;
}
@@ -631,9 +631,9 @@ const char* TiXmlBase::ReadText( const char* p,
}
}
}
- if ( p )
+ if ( p && *p )
p += strlen( endTag );
- return p;
+ return ( p && *p ) ? p : 0;
}
#ifdef TIXML_USE_STL
@@ -825,7 +825,6 @@ TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding )
return 0;
}
- TiXmlDocument* doc = GetDocument();
p = SkipWhiteSpace( p, encoding );
if ( !p || !*p )
@@ -896,11 +895,6 @@ TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding )
// Set the parent, so it can report errors
returnNode->parent = this;
}
- else
- {
- if ( doc )
- doc->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
- }
return returnNode;
}
@@ -1121,18 +1115,20 @@ const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
}
// We should find the end tag now
+ // note that:
+ // and
+ //
+ // are both valid end tags.
if ( StringEqual( p, endTag.c_str(), false, encoding ) )
{
- // Handle whitespace between end tag name and '>' character
p += endTag.length();
p = SkipWhiteSpace( p, encoding );
- if (*p == '>')
- return ++p;
- else
- {
- if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding );
- return 0;
+ if ( p && *p && *p == '>' ) {
+ ++p;
+ return p;
}
+ if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding );
+ return 0;
}
else
{
@@ -1146,7 +1142,6 @@ const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
TiXmlAttribute* attrib = new TiXmlAttribute();
if ( !attrib )
{
- if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, pErr, data, encoding );
return 0;
}
@@ -1169,7 +1164,7 @@ const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
#endif
if ( node )
{
- node->SetValue( attrib->Value() );
+ if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding );
delete attrib;
return 0;
}
@@ -1198,8 +1193,7 @@ const char* TiXmlElement::ReadValue( const char* p, TiXmlParsingData* data, TiXm
if ( !textNode )
{
- if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, encoding );
- return 0;
+ return 0;
}
if ( TiXmlBase::IsWhiteSpaceCondensed() )
@@ -1304,9 +1298,10 @@ const char* TiXmlUnknown::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
if ( !p )
{
- if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN, 0, 0, encoding );
+ if ( document )
+ document->SetError( TIXML_ERROR_PARSING_UNKNOWN, 0, 0, encoding );
}
- if ( *p == '>' )
+ if ( p && *p == '>' )
return p+1;
return p;
}
@@ -1356,7 +1351,8 @@ const char* TiXmlComment::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
if ( !StringEqual( p, startTag, false, encoding ) )
{
- document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding );
+ if ( document )
+ document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding );
return 0;
}
p += strlen( startTag );
@@ -1386,7 +1382,7 @@ const char* TiXmlComment::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc
value.append( p, 1 );
++p;
}
- if ( p )
+ if ( p && *p )
p += strlen( endTag );
return p;
@@ -1398,10 +1394,6 @@ const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlE
p = SkipWhiteSpace( p, encoding );
if ( !p || !*p ) return 0;
-// int tabsize = 4;
-// if ( document )
-// tabsize = document->TabSize();
-
if ( data )
{
data->Stamp( p, encoding );
@@ -1453,7 +1445,7 @@ const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlE
// its best, even without them.
value = "";
while ( p && *p // existence
- && !IsWhiteSpace( *p ) && *p != '\n' && *p != '\r' // whitespace
+ && !IsWhiteSpace( *p ) // whitespace
&& *p != '/' && *p != '>' ) // tag end
{
if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) {
@@ -1522,7 +1514,8 @@ const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncodi
if ( !StringEqual( p, startTag, false, encoding ) )
{
- document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding );
+ if ( document )
+ document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding );
return 0;
}
p += strlen( startTag );
@@ -1546,7 +1539,7 @@ const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncodi
const char* end = "<";
p = ReadText( p, &value, ignoreWhite, end, false, encoding );
- if ( p )
+ if ( p && *p )
return p-1; // don't truncate the '<'
return 0;
}