mirror of
https://github.com/AxioDL/tinyxml2.git
synced 2025-05-14 19:31:23 +00:00
ErrorNames is not implemented by vector<string> but *char[]
This commit is contained in:
parent
8f5d3f8e80
commit
003368429f
@ -476,13 +476,9 @@ bool XMLUtil::ToDouble( const char* str, double* value )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string XMLUtil::ToErrorName( const XMLError errorID )
|
const char* XMLUtil::ToErrorName( const XMLError errorID )
|
||||||
{
|
{
|
||||||
#if __cplusplus > 199711LL
|
|
||||||
return ErrorNames[errorID];
|
return ErrorNames[errorID];
|
||||||
#else
|
|
||||||
return std::string("Use C++11 or higher to use this function");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char* XMLDocument::Identify( char* p, XMLNode** node )
|
char* XMLDocument::Identify( char* p, XMLNode** node )
|
||||||
|
@ -39,8 +39,6 @@ distribution.
|
|||||||
# include <cstdlib>
|
# include <cstdlib>
|
||||||
# include <cstring>
|
# include <cstring>
|
||||||
# include <cstdarg>
|
# include <cstdarg>
|
||||||
# include <vector>
|
|
||||||
# include <string>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -512,14 +510,12 @@ enum XMLError {
|
|||||||
};
|
};
|
||||||
#undef FF
|
#undef FF
|
||||||
|
|
||||||
#if __cplusplus > 199711LL
|
|
||||||
#define FF(X) #X,
|
#define FF(X) #X,
|
||||||
const std::vector<std::string> ErrorNames = {
|
static const char *ErrorNames[] = {
|
||||||
FOR_EACH(FF)
|
FOR_EACH(FF)
|
||||||
"OUT_OF_RANGE"
|
"OUT_OF_RANGE"
|
||||||
};
|
};
|
||||||
#undef FF
|
#undef FF
|
||||||
#endif
|
|
||||||
#undef FOR_EACH
|
#undef FOR_EACH
|
||||||
|
|
||||||
|
|
||||||
@ -601,7 +597,7 @@ public:
|
|||||||
static bool ToDouble( const char* str, double* value );
|
static bool ToDouble( const char* str, double* value );
|
||||||
|
|
||||||
// converts XMLError to strings
|
// converts XMLError to strings
|
||||||
static std::string ToErrorName( const XMLError errorID );
|
static const char* ToErrorName( const XMLError errorID );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1222,9 +1222,7 @@ int main( int argc, const char ** argv )
|
|||||||
XMLDocument doc;
|
XMLDocument doc;
|
||||||
XMLError error = doc.LoadFile( "resources/empty.xml" );
|
XMLError error = doc.LoadFile( "resources/empty.xml" );
|
||||||
XMLTest( "Loading an empty file", XML_ERROR_EMPTY_DOCUMENT, error );
|
XMLTest( "Loading an empty file", XML_ERROR_EMPTY_DOCUMENT, error );
|
||||||
#if __cplusplus > 199711LL
|
XMLTest( "Loading an empty file and ErrorName as string", "XML_ERROR_EMPTY_DOCUMENT", XMLUtil::ToErrorName(error) );
|
||||||
XMLTest( "Loading an empty file and ErrorName as string", "XML_ERROR_EMPTY_DOCUMENT", XMLUtil::ToErrorName(error).c_str() );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user