104
tinyxml2.h
104
tinyxml2.h
@@ -305,9 +305,9 @@ private:
|
|||||||
if ( cap > _allocated ) {
|
if ( cap > _allocated ) {
|
||||||
TIXMLASSERT( cap <= INT_MAX / 2 );
|
TIXMLASSERT( cap <= INT_MAX / 2 );
|
||||||
const int newAllocated = cap * 2;
|
const int newAllocated = cap * 2;
|
||||||
T* newMem = new T[newAllocated];
|
T* newMem = new T[static_cast<unsigned int>(newAllocated)];
|
||||||
TIXMLASSERT( newAllocated >= _size );
|
TIXMLASSERT( newAllocated >= _size );
|
||||||
memcpy( newMem, _mem, sizeof(T)*_size ); // warning: not using constructors, only works for PODs
|
memcpy( newMem, _mem, sizeof(T)*static_cast<size_t>(_size) ); // warning: not using constructors, only works for PODs
|
||||||
if ( _mem != _pool ) {
|
if ( _mem != _pool ) {
|
||||||
delete [] _mem;
|
delete [] _mem;
|
||||||
}
|
}
|
||||||
@@ -317,7 +317,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
T* _mem;
|
T* _mem;
|
||||||
T _pool[INITIAL_SIZE];
|
T _pool[static_cast<size_t>(INITIAL_SIZE)];
|
||||||
int _allocated; // objects allocated
|
int _allocated; // objects allocated
|
||||||
int _size; // number objects in use
|
int _size; // number objects in use
|
||||||
};
|
};
|
||||||
@@ -365,14 +365,14 @@ public:
|
|||||||
_nUntracked = 0;
|
_nUntracked = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int ItemSize() const {
|
virtual int ItemSize() const override{
|
||||||
return ITEM_SIZE;
|
return ITEM_SIZE;
|
||||||
}
|
}
|
||||||
int CurrentAllocs() const {
|
int CurrentAllocs() const {
|
||||||
return _currentAllocs;
|
return _currentAllocs;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void* Alloc() {
|
virtual void* Alloc() override{
|
||||||
if ( !_root ) {
|
if ( !_root ) {
|
||||||
// Need a new block.
|
// Need a new block.
|
||||||
Block* block = new Block;
|
Block* block = new Block;
|
||||||
@@ -398,7 +398,7 @@ public:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Free( void* mem ) {
|
virtual void Free( void* mem ) override {
|
||||||
if ( !mem ) {
|
if ( !mem ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -416,7 +416,7 @@ public:
|
|||||||
ITEM_SIZE, _nAllocs, _blockPtrs.Size() );
|
ITEM_SIZE, _nAllocs, _blockPtrs.Size() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetTracked() {
|
void SetTracked() override {
|
||||||
--_nUntracked;
|
--_nUntracked;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -443,7 +443,7 @@ private:
|
|||||||
|
|
||||||
union Item {
|
union Item {
|
||||||
Item* next;
|
Item* next;
|
||||||
char itemData[ITEM_SIZE];
|
char itemData[static_cast<size_t>(ITEM_SIZE)];
|
||||||
};
|
};
|
||||||
struct Block {
|
struct Block {
|
||||||
Item items[ITEMS_PER_BLOCK];
|
Item items[ITEMS_PER_BLOCK];
|
||||||
@@ -603,7 +603,7 @@ public:
|
|||||||
TIXMLASSERT( p );
|
TIXMLASSERT( p );
|
||||||
TIXMLASSERT( q );
|
TIXMLASSERT( q );
|
||||||
TIXMLASSERT( nChar >= 0 );
|
TIXMLASSERT( nChar >= 0 );
|
||||||
return strncmp( p, q, nChar ) == 0;
|
return strncmp( p, q, static_cast<size_t>(nChar) ) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static bool IsUTF8Continuation( const char p ) {
|
inline static bool IsUTF8Continuation( const char p ) {
|
||||||
@@ -992,12 +992,12 @@ class TINYXML2_LIB XMLText : public XMLNode
|
|||||||
{
|
{
|
||||||
friend class XMLDocument;
|
friend class XMLDocument;
|
||||||
public:
|
public:
|
||||||
virtual bool Accept( XMLVisitor* visitor ) const;
|
virtual bool Accept( XMLVisitor* visitor ) const override;
|
||||||
|
|
||||||
virtual XMLText* ToText() {
|
virtual XMLText* ToText() override {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
virtual const XMLText* ToText() const {
|
virtual const XMLText* ToText() const override {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1010,14 +1010,14 @@ public:
|
|||||||
return _isCData;
|
return _isCData;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual XMLNode* ShallowClone( XMLDocument* document ) const;
|
virtual XMLNode* ShallowClone( XMLDocument* document ) const override;
|
||||||
virtual bool ShallowEqual( const XMLNode* compare ) const;
|
virtual bool ShallowEqual( const XMLNode* compare ) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit XMLText( XMLDocument* doc ) : XMLNode( doc ), _isCData( false ) {}
|
explicit XMLText( XMLDocument* doc ) : XMLNode( doc ), _isCData( false ) {}
|
||||||
virtual ~XMLText() {}
|
virtual ~XMLText() {}
|
||||||
|
|
||||||
char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr );
|
char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _isCData;
|
bool _isCData;
|
||||||
@@ -1032,23 +1032,23 @@ class TINYXML2_LIB XMLComment : public XMLNode
|
|||||||
{
|
{
|
||||||
friend class XMLDocument;
|
friend class XMLDocument;
|
||||||
public:
|
public:
|
||||||
virtual XMLComment* ToComment() {
|
virtual XMLComment* ToComment() override {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
virtual const XMLComment* ToComment() const {
|
virtual const XMLComment* ToComment() const override {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool Accept( XMLVisitor* visitor ) const;
|
virtual bool Accept( XMLVisitor* visitor ) const override;
|
||||||
|
|
||||||
virtual XMLNode* ShallowClone( XMLDocument* document ) const;
|
virtual XMLNode* ShallowClone( XMLDocument* document ) const override;
|
||||||
virtual bool ShallowEqual( const XMLNode* compare ) const;
|
virtual bool ShallowEqual( const XMLNode* compare ) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit XMLComment( XMLDocument* doc );
|
explicit XMLComment( XMLDocument* doc );
|
||||||
virtual ~XMLComment();
|
virtual ~XMLComment();
|
||||||
|
|
||||||
char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr);
|
char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
XMLComment( const XMLComment& ); // not supported
|
XMLComment( const XMLComment& ); // not supported
|
||||||
@@ -1071,23 +1071,23 @@ class TINYXML2_LIB XMLDeclaration : public XMLNode
|
|||||||
{
|
{
|
||||||
friend class XMLDocument;
|
friend class XMLDocument;
|
||||||
public:
|
public:
|
||||||
virtual XMLDeclaration* ToDeclaration() {
|
virtual XMLDeclaration* ToDeclaration() override {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
virtual const XMLDeclaration* ToDeclaration() const {
|
virtual const XMLDeclaration* ToDeclaration() const override {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool Accept( XMLVisitor* visitor ) const;
|
virtual bool Accept( XMLVisitor* visitor ) const override;
|
||||||
|
|
||||||
virtual XMLNode* ShallowClone( XMLDocument* document ) const;
|
virtual XMLNode* ShallowClone( XMLDocument* document ) const override;
|
||||||
virtual bool ShallowEqual( const XMLNode* compare ) const;
|
virtual bool ShallowEqual( const XMLNode* compare ) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit XMLDeclaration( XMLDocument* doc );
|
explicit XMLDeclaration( XMLDocument* doc );
|
||||||
virtual ~XMLDeclaration();
|
virtual ~XMLDeclaration();
|
||||||
|
|
||||||
char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr );
|
char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
XMLDeclaration( const XMLDeclaration& ); // not supported
|
XMLDeclaration( const XMLDeclaration& ); // not supported
|
||||||
@@ -1106,23 +1106,23 @@ class TINYXML2_LIB XMLUnknown : public XMLNode
|
|||||||
{
|
{
|
||||||
friend class XMLDocument;
|
friend class XMLDocument;
|
||||||
public:
|
public:
|
||||||
virtual XMLUnknown* ToUnknown() {
|
virtual XMLUnknown* ToUnknown() override {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
virtual const XMLUnknown* ToUnknown() const {
|
virtual const XMLUnknown* ToUnknown() const override {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool Accept( XMLVisitor* visitor ) const;
|
virtual bool Accept( XMLVisitor* visitor ) const override;
|
||||||
|
|
||||||
virtual XMLNode* ShallowClone( XMLDocument* document ) const;
|
virtual XMLNode* ShallowClone( XMLDocument* document ) const override;
|
||||||
virtual bool ShallowEqual( const XMLNode* compare ) const;
|
virtual bool ShallowEqual( const XMLNode* compare ) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit XMLUnknown( XMLDocument* doc );
|
explicit XMLUnknown( XMLDocument* doc );
|
||||||
virtual ~XMLUnknown();
|
virtual ~XMLUnknown();
|
||||||
|
|
||||||
char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr );
|
char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
XMLUnknown( const XMLUnknown& ); // not supported
|
XMLUnknown( const XMLUnknown& ); // not supported
|
||||||
@@ -1274,13 +1274,13 @@ public:
|
|||||||
SetValue( str, staticMem );
|
SetValue( str, staticMem );
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual XMLElement* ToElement() {
|
virtual XMLElement* ToElement() override {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
virtual const XMLElement* ToElement() const {
|
virtual const XMLElement* ToElement() const override {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
virtual bool Accept( XMLVisitor* visitor ) const;
|
virtual bool Accept( XMLVisitor* visitor ) const override;
|
||||||
|
|
||||||
/** Given an attribute name, Attribute() returns the value
|
/** Given an attribute name, Attribute() returns the value
|
||||||
for the attribute of that name, or null if none
|
for the attribute of that name, or null if none
|
||||||
@@ -1676,11 +1676,11 @@ public:
|
|||||||
ElementClosingType ClosingType() const {
|
ElementClosingType ClosingType() const {
|
||||||
return _closingType;
|
return _closingType;
|
||||||
}
|
}
|
||||||
virtual XMLNode* ShallowClone( XMLDocument* document ) const;
|
virtual XMLNode* ShallowClone( XMLDocument* document ) const override;
|
||||||
virtual bool ShallowEqual( const XMLNode* compare ) const;
|
virtual bool ShallowEqual( const XMLNode* compare ) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr );
|
char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
XMLElement( XMLDocument* doc );
|
XMLElement( XMLDocument* doc );
|
||||||
@@ -1728,11 +1728,11 @@ public:
|
|||||||
XMLDocument( bool processEntities = true, Whitespace whitespaceMode = PRESERVE_WHITESPACE );
|
XMLDocument( bool processEntities = true, Whitespace whitespaceMode = PRESERVE_WHITESPACE );
|
||||||
~XMLDocument();
|
~XMLDocument();
|
||||||
|
|
||||||
virtual XMLDocument* ToDocument() {
|
virtual XMLDocument* ToDocument() override {
|
||||||
TIXMLASSERT( this == _document );
|
TIXMLASSERT( this == _document );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
virtual const XMLDocument* ToDocument() const {
|
virtual const XMLDocument* ToDocument() const override {
|
||||||
TIXMLASSERT( this == _document );
|
TIXMLASSERT( this == _document );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -1829,7 +1829,7 @@ public:
|
|||||||
@endverbatim
|
@endverbatim
|
||||||
*/
|
*/
|
||||||
void Print( XMLPrinter* streamer=0 ) const;
|
void Print( XMLPrinter* streamer=0 ) const;
|
||||||
virtual bool Accept( XMLVisitor* visitor ) const;
|
virtual bool Accept( XMLVisitor* visitor ) const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a new Element associated with
|
Create a new Element associated with
|
||||||
@@ -1920,10 +1920,10 @@ public:
|
|||||||
// internal
|
// internal
|
||||||
void MarkInUse(const XMLNode* const);
|
void MarkInUse(const XMLNode* const);
|
||||||
|
|
||||||
virtual XMLNode* ShallowClone( XMLDocument* /*document*/ ) const {
|
virtual XMLNode* ShallowClone( XMLDocument* /*document*/ ) const override{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
virtual bool ShallowEqual( const XMLNode* /*compare*/ ) const {
|
virtual bool ShallowEqual( const XMLNode* /*compare*/ ) const override{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2286,18 +2286,18 @@ public:
|
|||||||
void PushDeclaration( const char* value );
|
void PushDeclaration( const char* value );
|
||||||
void PushUnknown( const char* value );
|
void PushUnknown( const char* value );
|
||||||
|
|
||||||
virtual bool VisitEnter( const XMLDocument& /*doc*/ );
|
virtual bool VisitEnter( const XMLDocument& /*doc*/ ) override;
|
||||||
virtual bool VisitExit( const XMLDocument& /*doc*/ ) {
|
virtual bool VisitExit( const XMLDocument& /*doc*/ ) override {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool VisitEnter( const XMLElement& element, const XMLAttribute* attribute );
|
virtual bool VisitEnter( const XMLElement& element, const XMLAttribute* attribute ) override;
|
||||||
virtual bool VisitExit( const XMLElement& element );
|
virtual bool VisitExit( const XMLElement& element ) override;
|
||||||
|
|
||||||
virtual bool Visit( const XMLText& text );
|
virtual bool Visit( const XMLText& text ) override;
|
||||||
virtual bool Visit( const XMLComment& comment );
|
virtual bool Visit( const XMLComment& comment ) override;
|
||||||
virtual bool Visit( const XMLDeclaration& declaration );
|
virtual bool Visit( const XMLDeclaration& declaration ) override;
|
||||||
virtual bool Visit( const XMLUnknown& unknown );
|
virtual bool Visit( const XMLUnknown& unknown ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
If in print to memory mode, return a pointer to
|
If in print to memory mode, return a pointer to
|
||||||
|
|||||||
Reference in New Issue
Block a user