mirror of https://github.com/AxioDL/tinyxml2.git
Merge branch 'master' of https://github.com/leethomason/tinyxml2
This commit is contained in:
commit
513e69ba68
|
@ -7,6 +7,9 @@ IF(BIICODE)
|
|||
ENDIF(BIICODE)
|
||||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||
cmake_policy(VERSION 2.6)
|
||||
if(POLICY CMP0063)
|
||||
cmake_policy(SET CMP0063 OLD)
|
||||
endif()
|
||||
|
||||
project(tinyxml2)
|
||||
include(GNUInstallDirs)
|
||||
|
|
|
@ -111,7 +111,7 @@ by the Document. When the Document is deleted, so are all the nodes it contains.
|
|||
|
||||
Microsoft has an excellent article on white space: http://msdn.microsoft.com/en-us/library/ms256097.aspx
|
||||
|
||||
By default, TinyXML-2 preserves white space in a (hopefully) sane way that is almost complient with the
|
||||
By default, TinyXML-2 preserves white space in a (hopefully) sane way that is almost compliant with the
|
||||
spec. (TinyXML-1 used a completely different model, much more similar to 'collapse', below.)
|
||||
|
||||
As a first step, all newlines / carriage-returns / line-feeds are normalized to a
|
||||
|
|
11
tinyxml2.cpp
11
tinyxml2.cpp
|
@ -191,6 +191,7 @@ void StrPair::SetStr( const char* str, int flags )
|
|||
|
||||
char* StrPair::ParseText( char* p, const char* endTag, int strFlags )
|
||||
{
|
||||
TIXMLASSERT( p );
|
||||
TIXMLASSERT( endTag && *endTag );
|
||||
|
||||
char* start = p;
|
||||
|
@ -204,6 +205,7 @@ char* StrPair::ParseText( char* p, const char* endTag, int strFlags )
|
|||
return p + length;
|
||||
}
|
||||
++p;
|
||||
TIXMLASSERT( p );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -281,7 +283,8 @@ const char* StrPair::GetStr()
|
|||
else {
|
||||
++p;
|
||||
}
|
||||
*q++ = LF;
|
||||
*q = LF;
|
||||
++q;
|
||||
}
|
||||
else if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == LF ) {
|
||||
if ( *(p+1) == CR ) {
|
||||
|
@ -290,7 +293,8 @@ const char* StrPair::GetStr()
|
|||
else {
|
||||
++p;
|
||||
}
|
||||
*q++ = LF;
|
||||
*q = LF;
|
||||
++q;
|
||||
}
|
||||
else if ( (_flags & NEEDS_ENTITY_PROCESSING) && *p == '&' ) {
|
||||
// Entities handled by tinyXML2:
|
||||
|
@ -2261,7 +2265,8 @@ XMLPrinter::XMLPrinter( FILE* file, bool compact, int depth ) :
|
|||
}
|
||||
for( int i=0; i<NUM_ENTITIES; ++i ) {
|
||||
const char entityValue = entities[i].value;
|
||||
TIXMLASSERT( 0 <= entityValue && entityValue < ENTITY_RANGE );
|
||||
// cast to explicit signed because char may be unsigned (on PowerPC)
|
||||
TIXMLASSERT( 0 <= static_cast<signed char>(entityValue) && entityValue < ENTITY_RANGE );
|
||||
_entityFlag[ (unsigned char)entityValue ] = true;
|
||||
}
|
||||
_restrictedEntityFlag[(unsigned char)'&'] = true;
|
||||
|
|
25
tinyxml2.h
25
tinyxml2.h
|
@ -211,7 +211,8 @@ public:
|
|||
void Push( T t ) {
|
||||
TIXMLASSERT( _size < INT_MAX );
|
||||
EnsureCapacity( _size+1 );
|
||||
_mem[_size++] = t;
|
||||
_mem[_size] = t;
|
||||
++_size;
|
||||
}
|
||||
|
||||
T* PushArr( int count ) {
|
||||
|
@ -225,7 +226,8 @@ public:
|
|||
|
||||
T Pop() {
|
||||
TIXMLASSERT( _size > 0 );
|
||||
return _mem[--_size];
|
||||
--_size;
|
||||
return _mem[_size];
|
||||
}
|
||||
|
||||
void PopArr( int count ) {
|
||||
|
@ -568,6 +570,9 @@ public:
|
|||
if ( p == q ) {
|
||||
return true;
|
||||
}
|
||||
TIXMLASSERT( p );
|
||||
TIXMLASSERT( q );
|
||||
TIXMLASSERT( nChar >= 0 );
|
||||
return strncmp( p, q, nChar ) == 0;
|
||||
}
|
||||
|
||||
|
@ -1127,7 +1132,7 @@ public:
|
|||
}
|
||||
|
||||
/** QueryIntValue interprets the attribute as an integer, and returns the value
|
||||
in the provided parameter. The function will return XML_NO_ERROR on success,
|
||||
in the provided parameter. The function will return XML_SUCCESS on success,
|
||||
and XML_WRONG_ATTRIBUTE_TYPE if the conversion is not successful.
|
||||
*/
|
||||
XMLError QueryIntValue( int* value ) const;
|
||||
|
@ -1244,7 +1249,7 @@ public:
|
|||
float FloatAttribute(const char* name, float defaultValue = 0) const;
|
||||
|
||||
/** Given an attribute name, QueryIntAttribute() returns
|
||||
XML_NO_ERROR, XML_WRONG_ATTRIBUTE_TYPE if the conversion
|
||||
XML_SUCCESS, XML_WRONG_ATTRIBUTE_TYPE if the conversion
|
||||
can't be performed, or XML_NO_ATTRIBUTE if the attribute
|
||||
doesn't exist. If successful, the result of the conversion
|
||||
will be written to 'value'. If not successful, nothing will
|
||||
|
@ -1309,7 +1314,7 @@ public:
|
|||
|
||||
|
||||
/** Given an attribute name, QueryAttribute() returns
|
||||
XML_NO_ERROR, XML_WRONG_ATTRIBUTE_TYPE if the conversion
|
||||
XML_SUCCESS, XML_WRONG_ATTRIBUTE_TYPE if the conversion
|
||||
can't be performed, or XML_NO_ATTRIBUTE if the attribute
|
||||
doesn't exist. It is overloaded for the primitive types,
|
||||
and is a generally more convenient replacement of
|
||||
|
@ -1596,7 +1601,7 @@ public:
|
|||
|
||||
/**
|
||||
Parse an XML file from a character string.
|
||||
Returns XML_NO_ERROR (0) on success, or
|
||||
Returns XML_SUCCESS (0) on success, or
|
||||
an errorID.
|
||||
|
||||
You may optionally pass in the 'nBytes', which is
|
||||
|
@ -1608,7 +1613,7 @@ public:
|
|||
|
||||
/**
|
||||
Load an XML file from disk.
|
||||
Returns XML_NO_ERROR (0) on success, or
|
||||
Returns XML_SUCCESS (0) on success, or
|
||||
an errorID.
|
||||
*/
|
||||
XMLError LoadFile( const char* filename );
|
||||
|
@ -1621,14 +1626,14 @@ public:
|
|||
not text in order for TinyXML-2 to correctly
|
||||
do newline normalization.
|
||||
|
||||
Returns XML_NO_ERROR (0) on success, or
|
||||
Returns XML_SUCCESS (0) on success, or
|
||||
an errorID.
|
||||
*/
|
||||
XMLError LoadFile( FILE* );
|
||||
|
||||
/**
|
||||
Save the XML file to disk.
|
||||
Returns XML_NO_ERROR (0) on success, or
|
||||
Returns XML_SUCCESS (0) on success, or
|
||||
an errorID.
|
||||
*/
|
||||
XMLError SaveFile( const char* filename, bool compact = false );
|
||||
|
@ -1637,7 +1642,7 @@ public:
|
|||
Save the XML file to disk. You are responsible
|
||||
for providing and closing the FILE*.
|
||||
|
||||
Returns XML_NO_ERROR (0) on success, or
|
||||
Returns XML_SUCCESS (0) on success, or
|
||||
an errorID.
|
||||
*/
|
||||
XMLError SaveFile( FILE* fp, bool compact = false );
|
||||
|
|
Loading…
Reference in New Issue