Changed: Replace a lot of const char* by std::string parameters

--HG--
branch : develop
This commit is contained in:
kervala 2016-12-10 18:40:03 +01:00
parent 6bbe0ad774
commit 27b272f012
4 changed files with 12 additions and 12 deletions

View file

@ -107,7 +107,7 @@ public:
const CPrimitiveClass *getPrimitiveClass (const NLLIGO::IPrimitive &primitive) const; const CPrimitiveClass *getPrimitiveClass (const NLLIGO::IPrimitive &primitive) const;
// Get a primitive class // Get a primitive class
const CPrimitiveClass *getPrimitiveClass (const char *className) const; const CPrimitiveClass *getPrimitiveClass (const std::string &className) const;
// Get the primitive color // Get the primitive color
NLMISC::CRGBA getPrimitiveColor (const NLLIGO::IPrimitive &primitive); NLMISC::CRGBA getPrimitiveColor (const NLLIGO::IPrimitive &primitive);
@ -134,10 +134,10 @@ public:
bool canBeRoot (const NLLIGO::IPrimitive &primitive); bool canBeRoot (const NLLIGO::IPrimitive &primitive);
// Read a property from an XML file // Read a property from an XML file
bool getPropertyString (std::string &result, const char *filename, xmlNodePtr xmlNode, const char *propName); bool getPropertyString (std::string &result, const std::string &filename, xmlNodePtr xmlNode, const std::string &propName);
// Output error message // Output error message
void syntaxError (const char *filename, xmlNodePtr xmlNode, const char *format, ...); void syntaxError (const std::string &filename, xmlNodePtr xmlNode, const char *format, ...);
virtual void errorMessage (const char *format, ... ); virtual void errorMessage (const char *format, ... );
// Access to the config string // Access to the config string
@ -157,7 +157,7 @@ public:
private: private:
// Init primitive class manager // Init primitive class manager
bool initPrimitiveClass (const char *filename); bool initPrimitiveClass (const std::string &ilename);
// The primitive class manager // The primitive class manager
std::map<std::string, CPrimitiveClass> _PrimitiveClasses; std::map<std::string, CPrimitiveClass> _PrimitiveClasses;

View file

@ -209,7 +209,7 @@ public:
* \param relativePath is the path to make relative to basePath. * \param relativePath is the path to make relative to basePath.
* return true if relativePath as been done relative to basePath, false is relativePath has not been changed. * return true if relativePath as been done relative to basePath, false is relativePath has not been changed.
*/ */
bool makePathRelative (const char *basePath, std::string &relativePath); bool makePathRelative (const std::string &basePath, std::string &relativePath);
/** If File in this list is added more than one in an addSearchPath, it doesn't launch a warning. /** If File in this list is added more than one in an addSearchPath, it doesn't launch a warning.
*/ */
@ -505,7 +505,7 @@ public:
* \param relativePath is the path to make relative to basePath. * \param relativePath is the path to make relative to basePath.
* return true if relativePath as been done relative to basePath, false is relativePath has not been changed. * return true if relativePath as been done relative to basePath, false is relativePath has not been changed.
*/ */
static bool makePathRelative (const char *basePath, std::string &relativePath); static bool makePathRelative(const std::string &basePath, std::string &relativePath);
/** Make path absolute /** Make path absolute
* \param relativePath - The relative path * \param relativePath - The relative path

View file

@ -508,13 +508,13 @@ bool CLigoConfig::canBeRoot (const NLLIGO::IPrimitive &child)
// *************************************************************************** // ***************************************************************************
bool CLigoConfig::getPropertyString (std::string &result, const char *filename, xmlNodePtr xmlNode, const char *propName) bool CLigoConfig::getPropertyString(std::string &result, const std::string &filename, xmlNodePtr xmlNode, const std::string &propName)
{ {
// Call the CIXml version // Call the CIXml version
if (!CIXml::getPropertyString (result, xmlNode, propName)) if (!CIXml::getPropertyString (result, xmlNode, propName))
{ {
// Output a formated error // Output a formated error
syntaxError (filename, xmlNode, "Missing XML node property (%s)", propName); syntaxError (filename, xmlNode, "Missing XML node property (%s)", propName.c_str());
return false; return false;
} }
return true; return true;
@ -522,7 +522,7 @@ bool CLigoConfig::getPropertyString (std::string &result, const char *filename,
// *************************************************************************** // ***************************************************************************
void CLigoConfig::syntaxError (const char *filename, xmlNodePtr xmlNode, const char *format, ...) void CLigoConfig::syntaxError (const std::string &filename, xmlNodePtr xmlNode, const char *format, ...)
{ {
va_list args; va_list args;
va_start( args, format ); va_start( args, format );
@ -530,7 +530,7 @@ void CLigoConfig::syntaxError (const char *filename, xmlNodePtr xmlNode, const c
vsnprintf( buffer, 1024, format, args ); vsnprintf( buffer, 1024, format, args );
va_end( args ); va_end( args );
errorMessage ("(%s), node (%s), line (%p) :\n%s", filename, xmlNode->name, xmlNode->content, buffer); errorMessage ("(%s), node (%s), line (%p) :\n%s", filename.c_str(), xmlNode->name, xmlNode->content, buffer);
} }
// *************************************************************************** // ***************************************************************************
@ -589,7 +589,7 @@ const CPrimitiveClass *CLigoConfig::getPrimitiveClass (const IPrimitive &primiti
// *************************************************************************** // ***************************************************************************
const CPrimitiveClass *CLigoConfig::getPrimitiveClass (const char *className) const const CPrimitiveClass *CLigoConfig::getPrimitiveClass(const std::string &className) const
{ {
std::map<std::string, CPrimitiveClass>::const_iterator ite = _PrimitiveClasses.find (className); std::map<std::string, CPrimitiveClass>::const_iterator ite = _PrimitiveClasses.find (className);
if (ite != _PrimitiveClasses.end ()) if (ite != _PrimitiveClasses.end ())

View file

@ -2523,7 +2523,7 @@ bool CFile::createDirectoryTree(const std::string &filename)
return lastResult; return lastResult;
} }
bool CPath::makePathRelative (const char *basePath, std::string &relativePath) bool CPath::makePathRelative (const std::string &basePath, std::string &relativePath)
{ {
// Standard path with final slash // Standard path with final slash
string tmp = standardizePath (basePath, true); string tmp = standardizePath (basePath, true);