Merge remote-tracking branch 'github/master'

This commit is contained in:
Lee Thomason 2014-03-15 15:01:18 -07:00
commit e7eb7d3327
5 changed files with 36 additions and 41 deletions

View File

@ -10,8 +10,8 @@ include(GNUInstallDirs)
################################
# set lib version here
set(GENERIC_LIB_VERSION "1.0.14")
set(GENERIC_LIB_SOVERSION "1")
set(GENERIC_LIB_VERSION "2.0.0")
set(GENERIC_LIB_SOVERSION "2")
################################

2
dox
View File

@ -32,7 +32,7 @@ PROJECT_NAME = "TinyXML-2"
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 1.0.14
PROJECT_NUMBER = 2.0.0
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer

View File

@ -26,7 +26,6 @@ def fileProcess( name, lineFunction ):
filestream.write( output );
filestream.close()
def echoInput( line ):
return line
@ -40,8 +39,8 @@ minor = args[1]
build = args[2]
versionStr = major + "." + minor + "." + build
print "Setting dox,tinyxml2.h"
print "Version: " + `major` + "." + `minor` + "." + `build`
print ("Setting dox,tinyxml2.h")
print ("Version: " + major + "." + minor + "." + build)
#### Write the tinyxml.h ####
@ -52,16 +51,16 @@ def engineRule( line ):
matchBuild = "static const int TIXML2_PATCH_VERSION"
if line[0:len(matchMajor)] == matchMajor:
print "1)tinyxml2.h Major found"
return matchMajor + " = " + `major` + ";\n"
print( "1)tinyxml2.h Major found" )
return matchMajor + " = " + major + ";\n"
elif line[0:len(matchMinor)] == matchMinor:
print "2)tinyxml2.h Minor found"
return matchMinor + " = " + `minor` + ";\n"
print( "2)tinyxml2.h Minor found" )
return matchMinor + " = " + minor + ";\n"
elif line[0:len(matchBuild)] == matchBuild:
print "3)tinyxml2.h Build found"
return matchBuild + " = " + `build` + ";\n"
print( "3)tinyxml2.h Build found" )
return matchBuild + " = " + build + ";\n"
else:
return line;
@ -76,8 +75,8 @@ def doxRule( line ):
match = "PROJECT_NUMBER"
if line[0:len( match )] == match:
print "dox project found"
return "PROJECT_NUMBER = " + `major` + "." + `minor` + "." + `build` + "\n"
print( "dox project found" )
return "PROJECT_NUMBER = " + major + "." + minor + "." + build + "\n"
else:
return line;
@ -92,8 +91,8 @@ def cmakeRule1( line ):
matchVersion = "set(GENERIC_LIB_VERSION"
if line[0:len(matchVersion)] == matchVersion:
print "1)tinyxml2.h Major found"
return matchVersion + " \"" + `major` + "." + `minor` + "." + `build` + "\")" + "\n"
print( "1)tinyxml2.h Major found" )
return matchVersion + " \"" + major + "." + minor + "." + build + "\")" + "\n"
else:
return line;
@ -105,8 +104,8 @@ def cmakeRule2( line ):
matchSoversion = "set(GENERIC_LIB_SOVERSION"
if line[0:len(matchSoversion)] == matchSoversion:
print "1)tinyxml2.h Major found"
return matchSoversion + " \"" + `major` + "\")" + "\n"
print( "1)tinyxml2.h Major found" )
return matchSoversion + " \"" + major + "\")" + "\n"
else:
return line;

View File

@ -1758,12 +1758,7 @@ XMLError XMLDocument::Parse( const char* p, size_t len )
const char* start = p;
Clear();
if ( len == 0 ) {
SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 );
return _errorID;
}
if ( !p || !*p ) {
if ( len == 0 || !p || !*p ) {
SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 );
return _errorID;
}
@ -1945,17 +1940,17 @@ void XMLPrinter::PushHeader( bool writeBOM, bool writeDec )
}
void XMLPrinter::OpenElement( const char* name )
void XMLPrinter::OpenElement( const char* name, bool compactMode )
{
if ( _elementJustOpened ) {
SealElement();
}
_stack.Push( name );
if ( _textDepth < 0 && !_firstElement && !_compactMode ) {
if ( _textDepth < 0 && !_firstElement && !compactMode ) {
Print( "\n" );
}
if ( !_compactMode ) {
if ( !compactMode ) {
PrintSpace( _depth );
}
@ -2007,7 +2002,7 @@ void XMLPrinter::PushAttribute( const char* name, double v )
}
void XMLPrinter::CloseElement()
void XMLPrinter::CloseElement( bool compactMode )
{
--_depth;
const char* name = _stack.Pop();
@ -2016,7 +2011,7 @@ void XMLPrinter::CloseElement()
Print( "/>" );
}
else {
if ( _textDepth < 0 && !_compactMode) {
if ( _textDepth < 0 && !compactMode) {
Print( "\n" );
PrintSpace( _depth );
}
@ -2026,7 +2021,7 @@ void XMLPrinter::CloseElement()
if ( _textDepth == _depth ) {
_textDepth = -1;
}
if ( _depth == 0 && !_compactMode) {
if ( _depth == 0 && !compactMode) {
Print( "\n" );
}
_elementJustOpened = false;
@ -2151,7 +2146,9 @@ bool XMLPrinter::VisitEnter( const XMLDocument& doc )
bool XMLPrinter::VisitEnter( const XMLElement& element, const XMLAttribute* attribute )
{
OpenElement( element.Name() );
const XMLElement* parentElem = element.Parent()->ToElement();
bool compactMode = parentElem ? CompactMode(*parentElem) : _compactMode;
OpenElement( element.Name(), compactMode );
while ( attribute ) {
PushAttribute( attribute->Name(), attribute->Value() );
attribute = attribute->Next();
@ -2160,9 +2157,9 @@ bool XMLPrinter::VisitEnter( const XMLElement& element, const XMLAttribute* attr
}
bool XMLPrinter::VisitExit( const XMLElement& )
bool XMLPrinter::VisitExit( const XMLElement& element )
{
CloseElement();
CloseElement( CompactMode(element) );
return true;
}

View File

@ -117,13 +117,10 @@ inline int TIXML_SNPRINTF( char* buffer, size_t size, const char* format, ... )
#endif
/* Versioning, past 1.0.14:
A backwards-incompatible change or API change bumps the major version.
An API addition or a backwards-compatible change, bumps the minor version.
Simple bug fixes bump the build number.
http://semver.org/
*/
static const int TIXML2_MAJOR_VERSION = 1;
static const int TIXML2_MINOR_VERSION = 1;
static const int TIXML2_MAJOR_VERSION = 2;
static const int TIXML2_MINOR_VERSION = 0;
static const int TIXML2_PATCH_VERSION = 0;
namespace tinyxml2
@ -1967,7 +1964,7 @@ public:
/** If streaming, start writing an element.
The element must be closed with CloseElement()
*/
void OpenElement( const char* name );
void OpenElement( const char* name, bool compactMode );
/// If streaming, add an attribute to an open element.
void PushAttribute( const char* name, const char* value );
void PushAttribute( const char* name, int value );
@ -1975,7 +1972,7 @@ public:
void PushAttribute( const char* name, bool value );
void PushAttribute( const char* name, double value );
/// If streaming, close the Element.
virtual void CloseElement();
virtual void CloseElement( bool compactMode );
/// Add a text node.
void PushText( const char* text, bool cdata=false );
@ -2034,6 +2031,8 @@ public:
}
protected:
virtual bool CompactMode( const XMLElement& ) { return _compactMode; };
/** Prints out the space before an element. You may override to change
the space and tabs used. A PrintSpace() override should call Print().
*/