Skip to content

Commit

Permalink
Merge remote-tracking branch 'github/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
leethomason committed Mar 15, 2014
2 parents 5938e6f + 85afe9c commit e7eb7d3
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 41 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")


################################
Expand Down
2 changes: 1 addition & 1 deletion dox
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 14 additions & 15 deletions setversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def fileProcess( name, lineFunction ):
filestream.write( output );
filestream.close()


def echoInput( line ):
return line

Expand All @@ -40,8 +39,8 @@ def echoInput( line ):
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 ####

Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
27 changes: 12 additions & 15 deletions tinyxml2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 );
}

Expand Down Expand Up @@ -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();
Expand All @@ -2016,7 +2011,7 @@ void XMLPrinter::CloseElement()
Print( "/>" );
}
else {
if ( _textDepth < 0 && !_compactMode) {
if ( _textDepth < 0 && !compactMode) {
Print( "\n" );
PrintSpace( _depth );
}
Expand All @@ -2026,7 +2021,7 @@ void XMLPrinter::CloseElement()
if ( _textDepth == _depth ) {
_textDepth = -1;
}
if ( _depth == 0 && !_compactMode) {
if ( _depth == 0 && !compactMode) {
Print( "\n" );
}
_elementJustOpened = false;
Expand Down Expand Up @@ -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();
Expand All @@ -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;
}

Expand Down
15 changes: 7 additions & 8 deletions tinyxml2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1967,15 +1964,15 @@ class TINYXML2_LIB XMLPrinter : public XMLVisitor
/** 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 );
void PushAttribute( const char* name, unsigned value );
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 );
Expand Down Expand Up @@ -2034,6 +2031,8 @@ class TINYXML2_LIB XMLPrinter : public XMLVisitor
}

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().
*/
Expand Down

0 comments on commit e7eb7d3

Please sign in to comment.