fix up error system issues

This commit is contained in:
Lee Thomason
2017-10-11 10:57:49 -07:00
parent 714ccfe29b
commit f49b9658bb
3 changed files with 47 additions and 43 deletions

View File

@@ -1634,6 +1634,13 @@ enum Whitespace {
class TINYXML2_LIB XMLDocument : public XMLNode
{
friend class XMLElement;
// Gives access to SetError, but over-access for everything else.
// Wishing C++ had "internal" scope.
friend class XMLNode;
friend class XMLText;
friend class XMLComment;
friend class XMLDeclaration;
friend class XMLUnknown;
public:
/// constructor
XMLDocument( bool processEntities = true, Whitespace whitespaceMode = PRESERVE_WHITESPACE );
@@ -1785,8 +1792,6 @@ public:
*/
void DeleteNode( XMLNode* node );
void SetError( XMLError error, int lineNum, const char* format, ... );
void ClearError() {
SetError(XML_SUCCESS, 0, 0);
}
@@ -1802,16 +1807,19 @@ public:
const char* ErrorName() const;
static const char* ErrorIDToName(XMLError errorID);
/// Return a possibly helpful diagnostic location or string.
const char* GetErrorStr() const;
/** Returns a "long form" error description. A hopefully helpful
diagnostic with location, line number, and/or additional info.
*/
const char* ErrorStr() const;
/// A (trivial) utility function that prints the ErrorStr() to stdout.
void PrintError() const;
/// Return the line where the error occured, or zero if unknown.
int GetErrorLineNum() const
int ErrorLineNum() const
{
return _errorLineNum;
}
/// If there is an error, print it to stdout.
void PrintError() const;
/// Clear the document, resetting it to the initial state.
void Clear();
@@ -1867,6 +1875,8 @@ private:
void Parse();
void SetError( XMLError error, int lineNum, const char* format, ... );
template<class NodeType, int PoolElementSize>
NodeType* CreateUnlinkedNode( MemPoolT<PoolElementSize>& pool );
};