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

This commit is contained in:
kervala 2016-12-10 18:40:03 +01:00
parent b36b97b05a
commit a4f0c1f4d8
4 changed files with 12 additions and 12 deletions

View file

@ -107,7 +107,7 @@ public:
const CPrimitiveClass *getPrimitiveClass (const NLLIGO::IPrimitive &primitive) const;
// Get a primitive class
const CPrimitiveClass *getPrimitiveClass (const char *className) const;
const CPrimitiveClass *getPrimitiveClass (const std::string &className) const;
// Get the primitive color
NLMISC::CRGBA getPrimitiveColor (const NLLIGO::IPrimitive &primitive);
@ -134,10 +134,10 @@ public:
bool canBeRoot (const NLLIGO::IPrimitive &primitive);
// 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
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, ... );
// Access to the config string
@ -157,7 +157,7 @@ public:
private:
// Init primitive class manager
bool initPrimitiveClass (const char *filename);
bool initPrimitiveClass (const std::string &ilename);
// The primitive class manager
std::map<std::string, CPrimitiveClass> _PrimitiveClasses;

View file

@ -209,7 +209,7 @@ public:
* \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.
*/
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.
*/
@ -505,7 +505,7 @@ public:
* \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.
*/
static bool makePathRelative (const char *basePath, std::string &relativePath);
static bool makePathRelative(const std::string &basePath, std::string &relativePath);
/** Make path absolute
* \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
if (!CIXml::getPropertyString (result, xmlNode, propName))
{
// 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 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_start( args, format );
@ -530,7 +530,7 @@ void CLigoConfig::syntaxError (const char *filename, xmlNodePtr xmlNode, const c
vsnprintf( buffer, 1024, format, 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);
if (ite != _PrimitiveClasses.end ())

View file

@ -2523,7 +2523,7 @@ bool CFile::createDirectoryTree(const std::string &filename)
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
string tmp = standardizePath (basePath, true);