Merge pull request #1 from aaronkirkham/master

added uint64_t methods to XMLPrinter
This commit is contained in:
cugone
2019-05-21 21:05:36 -05:00
committed by GitHub
2 changed files with 31 additions and 3 deletions

View File

@@ -1580,6 +1580,13 @@ int64_t XMLElement::Int64Attribute(const char* name, int64_t defaultValue) const
return i; return i;
} }
uint64_t XMLElement::Unsigned64Attribute(const char* name, uint64_t defaultValue) const
{
uint64_t i = defaultValue;
QueryUnsigned64Attribute(name, &i);
return i;
}
bool XMLElement::BoolAttribute(const char* name, bool defaultValue) const bool XMLElement::BoolAttribute(const char* name, bool defaultValue) const
{ {
bool b = defaultValue; bool b = defaultValue;
@@ -2664,6 +2671,14 @@ void XMLPrinter::PushAttribute(const char* name, int64_t v)
} }
void XMLPrinter::PushAttribute(const char* name, uint64_t v)
{
char buf[BUF_SIZE];
XMLUtil::ToStr(v, buf, BUF_SIZE);
PushAttribute(name, buf);
}
void XMLPrinter::PushAttribute( const char* name, bool v ) void XMLPrinter::PushAttribute( const char* name, bool v )
{ {
char buf[BUF_SIZE]; char buf[BUF_SIZE];
@@ -2733,6 +2748,7 @@ void XMLPrinter::PushText( const char* text, bool cdata )
} }
} }
void XMLPrinter::PushText( int64_t value ) void XMLPrinter::PushText( int64_t value )
{ {
char buf[BUF_SIZE]; char buf[BUF_SIZE];
@@ -2740,6 +2756,15 @@ void XMLPrinter::PushText( int64_t value )
PushText( buf, false ); PushText( buf, false );
} }
void XMLPrinter::PushText( uint64_t value )
{
char buf[BUF_SIZE];
XMLUtil::ToStr(value, buf, BUF_SIZE);
PushText(buf, false);
}
void XMLPrinter::PushText( int value ) void XMLPrinter::PushText( int value )
{ {
char buf[BUF_SIZE]; char buf[BUF_SIZE];

View File

@@ -2221,6 +2221,7 @@ public:
void PushAttribute( const char* name, int value ); void PushAttribute( const char* name, int value );
void PushAttribute( const char* name, unsigned value ); void PushAttribute( const char* name, unsigned value );
void PushAttribute( const char* name, int64_t value ); void PushAttribute( const char* name, int64_t value );
void PushAttribute( const char* name, uint64_t value );
void PushAttribute( const char* name, bool value ); void PushAttribute( const char* name, bool value );
void PushAttribute( const char* name, double value ); void PushAttribute( const char* name, double value );
/// If streaming, close the Element. /// If streaming, close the Element.
@@ -2232,8 +2233,10 @@ public:
void PushText( int value ); void PushText( int value );
/// Add a text node from an unsigned. /// Add a text node from an unsigned.
void PushText( unsigned value ); void PushText( unsigned value );
/// Add a text node from an unsigned. /// Add a text node from a signed 64bit integer.
void PushText( int64_t value ); void PushText( int64_t value );
/// Add a text node from an unsigned 64bit integer.
void PushText( uint64_t value );
/// Add a text node from a bool. /// Add a text node from a bool.
void PushText( bool value ); void PushText( bool value );
/// Add a text node from a float. /// Add a text node from a float.