mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-25 16:46:17 +00:00
Changed: Replace some const char* by std::string
--HG-- branch : develop
This commit is contained in:
parent
3142a8d99f
commit
cbf2c744f0
33 changed files with 366 additions and 361 deletions
|
@ -22,7 +22,7 @@
|
|||
#include "form_elm.h"
|
||||
#include "header.h"
|
||||
|
||||
extern bool convertFormFile (const char *oldFileName, const char *newFileName);
|
||||
extern bool convertFormFile (const std::string &oldFileName, const std::string &newFileName);
|
||||
|
||||
namespace NLGEORGES
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ class UFormElm;
|
|||
class CForm : public UForm
|
||||
{
|
||||
friend class CFormLoader;
|
||||
friend bool convertFormFile (const char *oldFileName, const char *newFileName);
|
||||
friend bool convertFormFile (const std::string &oldFileName, const std::string &newFileName);
|
||||
public:
|
||||
|
||||
enum { HeldElementCount = 4 };
|
||||
|
@ -73,12 +73,12 @@ public:
|
|||
|
||||
// ** IO functions
|
||||
// Set the filename before saving the form
|
||||
void write (xmlDocPtr doc, const char *filename);
|
||||
void write (xmlDocPtr doc, const std::string &filename);
|
||||
|
||||
// ** Parent access
|
||||
|
||||
// Insert parent before parent indexed "before".
|
||||
bool insertParent (uint before, const char *filename, CForm *parent);
|
||||
bool insertParent (uint before, const std::string &filename, CForm *parent);
|
||||
|
||||
// Remove a parent from parent list
|
||||
void removeParent (uint parent);
|
||||
|
@ -97,7 +97,7 @@ public:
|
|||
const std::string &getFilename () const;
|
||||
|
||||
// Error handling
|
||||
void warning (bool exception, const char *function, const char *format, ... ) const;
|
||||
void warning (bool exception, const std::string &function, const char *format, ... ) const;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -114,7 +114,7 @@ private:
|
|||
|
||||
// CFormLoader call it
|
||||
// Set the filename before reading the form
|
||||
void read (xmlNodePtr node, CFormLoader &loader, CFormDfn *dfn, const char *filename);
|
||||
void read (xmlNodePtr node, CFormLoader &loader, CFormDfn *dfn, const std::string &filename);
|
||||
|
||||
// Called by read
|
||||
void readParent (const char *parent, CFormLoader &loader);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "header.h"
|
||||
#include "type.h"
|
||||
|
||||
bool convertDfnFile (const char *oldFileName, const char *newFileName);
|
||||
bool convertDfnFile (const std::string &oldFileName, const std::string &newFileName);
|
||||
|
||||
namespace NLGEORGES
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ class CFormDfn : public UFormDfn
|
|||
friend class CFormElm;
|
||||
friend class CFormLoader;
|
||||
friend class CFormElmStruct;
|
||||
friend bool convertDfnFile (const char *oldFileName, const char *newFileName);
|
||||
friend bool convertDfnFile (const std::string &oldFileName, const std::string &newFileName);
|
||||
public:
|
||||
|
||||
// Default cstr
|
||||
|
@ -60,7 +60,7 @@ public:
|
|||
friend class CFormElm;
|
||||
friend class CFormDfn;
|
||||
friend class CFormElmStruct;
|
||||
friend bool convertDfnFile (const char *oldFileName, const char *newFileName);
|
||||
friend bool convertDfnFile (const std::string &oldFileName, const std::string &newFileName);
|
||||
public:
|
||||
|
||||
CEntry ()
|
||||
|
@ -85,12 +85,12 @@ public:
|
|||
TEntryType getType () const;
|
||||
|
||||
// Set as a type
|
||||
void setType (CFormLoader &loader, const char *filename);
|
||||
void setType (CFormLoader &loader, const std::string &filename);
|
||||
|
||||
void setType (TEntryType type);
|
||||
|
||||
// Set as a dfn
|
||||
void setDfn (CFormLoader &loader, const char *filename);
|
||||
void setDfn (CFormLoader &loader, const std::string &filename);
|
||||
|
||||
// Set as a dfn pointer
|
||||
void setDfnPointer ();
|
||||
|
@ -99,7 +99,7 @@ public:
|
|||
const std::string &getName () const;
|
||||
|
||||
// Set element Name
|
||||
void setName (const char *name);
|
||||
void setName (const std::string &name);
|
||||
|
||||
// Get the filename
|
||||
const std::string &getFilename() const;
|
||||
|
@ -108,16 +108,16 @@ public:
|
|||
const std::string &getFilenameExt() const;
|
||||
|
||||
// Set the filename
|
||||
void setFilename (const char *def);
|
||||
void setFilename (const std::string &def);
|
||||
|
||||
// Set the filename extension
|
||||
void setFilenameExt (const char *ext);
|
||||
void setFilenameExt (const std::string &ext);
|
||||
|
||||
// Get default value
|
||||
const std::string &getDefault () const;
|
||||
|
||||
// Set default value
|
||||
void setDefault (const char *def);
|
||||
void setDefault (const std::string &def);
|
||||
|
||||
// Set array flag
|
||||
void setArrayFlag (bool flag);
|
||||
|
@ -167,7 +167,7 @@ public:
|
|||
void removeEntry( uint idx );
|
||||
|
||||
// ** IO functions
|
||||
void write (xmlDocPtr root, const char *filename);
|
||||
void write (xmlDocPtr root, const std::string &filename);
|
||||
|
||||
// Count parent DFN
|
||||
uint countParentDfn (uint32 round=0) const;
|
||||
|
@ -185,7 +185,7 @@ public:
|
|||
void setNumParent (uint size);
|
||||
|
||||
// Set a parent
|
||||
void setParent (uint parent, CFormLoader &loader, const char *filename);
|
||||
void setParent (uint parent, CFormLoader &loader, const std::string &filename);
|
||||
|
||||
// Get a parent
|
||||
CFormDfn *getParent (uint parent) const;
|
||||
|
@ -232,7 +232,7 @@ public:
|
|||
CFileHeader Header;
|
||||
|
||||
// Error handling
|
||||
void warning (bool exception, const char *function, const char *format, ... ) const;
|
||||
void warning (bool exception, const std::string &function, const char *format, ... ) const;
|
||||
|
||||
private:
|
||||
// The parents array
|
||||
|
@ -249,7 +249,7 @@ private:
|
|||
|
||||
private:
|
||||
// Read method called by the form loader
|
||||
void read (xmlNodePtr doc, CFormLoader &loader, bool forceLoad, const char *filename);
|
||||
void read (xmlNodePtr doc, CFormLoader &loader, bool forceLoad, const std::string &filename);
|
||||
};
|
||||
|
||||
} // NLGEORGES
|
||||
|
|
|
@ -62,30 +62,30 @@ public:
|
|||
virtual void getFormName (std::string &result, const CFormElm *child=NULL) const = 0;
|
||||
|
||||
// From UFormElm
|
||||
virtual bool getNodeByName (const UFormElm **result, const char *name, TWhereIsNode *where, bool verbose, uint32 round=0) const;
|
||||
virtual bool getNodeByName (UFormElm **result, const char *name, TWhereIsNode *where, bool verbose, uint32 round=0);
|
||||
virtual bool getValueByName (std::string &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool getValueByName (sint8 &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool getValueByName (uint8 &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool getValueByName (sint16 &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool getValueByName (uint16 &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool getValueByName (sint32 &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool getValueByName (uint32 &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool getValueByName (float &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool getValueByName (double &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool getValueByName (bool &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool getValueByName (NLMISC::CRGBA &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool setValueByName (const char *value, const char *name, bool *created);
|
||||
virtual bool setValueByName (sint8 value, const char *name, bool *created);
|
||||
virtual bool setValueByName (uint8 value, const char *name, bool *created);
|
||||
virtual bool setValueByName (sint16 value, const char *name, bool *created);
|
||||
virtual bool setValueByName (uint16 value, const char *name, bool *created);
|
||||
virtual bool setValueByName (sint32 value, const char *name, bool *created);
|
||||
virtual bool setValueByName (uint32 value, const char *name, bool *created);
|
||||
virtual bool setValueByName (float value, const char *name, bool *created);
|
||||
virtual bool setValueByName (double value, const char *name, bool *created);
|
||||
virtual bool setValueByName (bool value, const char *name, bool *created);
|
||||
virtual bool setValueByName (NLMISC::CRGBA value, const char *name, bool *created);
|
||||
virtual bool getNodeByName (const UFormElm **result, const std::string &name, TWhereIsNode *where, bool verbose, uint32 round=0) const;
|
||||
virtual bool getNodeByName (UFormElm **result, const std::string &name, TWhereIsNode *where, bool verbose, uint32 round=0);
|
||||
virtual bool getValueByName (std::string &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool getValueByName (sint8 &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool getValueByName (uint8 &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool getValueByName (sint16 &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool getValueByName (uint16 &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool getValueByName (sint32 &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool getValueByName (uint32 &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool getValueByName (float &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool getValueByName (double &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool getValueByName (bool &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool getValueByName (NLMISC::CRGBA &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const;
|
||||
virtual bool setValueByName (const std::string &value, const std::string &name, bool *created);
|
||||
virtual bool setValueByName (sint8 value, const std::string &name, bool *created);
|
||||
virtual bool setValueByName (uint8 value, const std::string &name, bool *created);
|
||||
virtual bool setValueByName (sint16 value, const std::string &name, bool *created);
|
||||
virtual bool setValueByName (uint16 value, const std::string &name, bool *created);
|
||||
virtual bool setValueByName (sint32 value, const std::string &name, bool *created);
|
||||
virtual bool setValueByName (uint32 value, const std::string &name, bool *created);
|
||||
virtual bool setValueByName (float value, const std::string &name, bool *created);
|
||||
virtual bool setValueByName (double value, const std::string &name, bool *created);
|
||||
virtual bool setValueByName (bool value, const std::string &name, bool *created);
|
||||
virtual bool setValueByName (NLMISC::CRGBA value, const std::string &name, bool *created);
|
||||
virtual UFormElm *getParent () const;
|
||||
virtual const CType *getType ();
|
||||
virtual bool isArray () const;
|
||||
|
@ -127,16 +127,16 @@ public:
|
|||
|
||||
// ** Convert functions
|
||||
|
||||
inline bool convertValue (sint8 &result, const char *value) const;
|
||||
inline bool convertValue (uint8 &result, const char *value) const;
|
||||
inline bool convertValue (sint16 &result, const char *value) const;
|
||||
inline bool convertValue (uint16 &result, const char *value) const;
|
||||
inline bool convertValue (sint32 &result, const char *value) const;
|
||||
inline bool convertValue (uint32 &result, const char *value) const;
|
||||
inline bool convertValue (float &result, const char *value) const;
|
||||
inline bool convertValue (double &result, const char *value) const;
|
||||
inline bool convertValue (bool &result, const char *value) const;
|
||||
inline bool convertValue (NLMISC::CRGBA &result, const char *value) const;
|
||||
inline bool convertValue (sint8 &result, const std::string &value) const;
|
||||
inline bool convertValue (uint8 &result, const std::string &value) const;
|
||||
inline bool convertValue (sint16 &result, const std::string &value) const;
|
||||
inline bool convertValue (uint16 &result, const std::string &value) const;
|
||||
inline bool convertValue (sint32 &result, const std::string &value) const;
|
||||
inline bool convertValue (uint32 &result, const std::string &value) const;
|
||||
inline bool convertValue (float &result, const std::string &value) const;
|
||||
inline bool convertValue (double &result, const std::string &value) const;
|
||||
inline bool convertValue (bool &result, const std::string &value) const;
|
||||
inline bool convertValue (NLMISC::CRGBA &result, const std::string &value) const;
|
||||
|
||||
// ** Get dependencies
|
||||
virtual void getDependencies (std::set<std::string> &dependencies) const = 0;
|
||||
|
@ -144,7 +144,7 @@ public:
|
|||
// ** Internal node access
|
||||
|
||||
// Create a node by name. If the node already exists, return it
|
||||
bool createNodeByName (const char *name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
bool createNodeByName (const std::string &, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
const CFormDfn **nodeDfn, const CType **nodeType,
|
||||
CFormElm **node, UFormDfn::TEntryType &type,
|
||||
bool &array, bool &created);
|
||||
|
@ -153,13 +153,13 @@ public:
|
|||
* Delete a node by name. If the node already exists, return it
|
||||
*Delete its parent if not used
|
||||
*/
|
||||
bool deleteNodeByName (const char *name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
bool deleteNodeByName (const std::string &name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
const CFormDfn **nodeDfn, const CType **nodeType,
|
||||
CFormElm **node, UFormDfn::TEntryType &type,
|
||||
bool &array);
|
||||
|
||||
// Search for a node by name
|
||||
bool getNodeByName (const char *name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
bool getNodeByName (const std::string &name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
const CFormDfn **nodeDfn, const CType **nodeType,
|
||||
CFormElm **node, UFormDfn::TEntryType &type,
|
||||
bool &array, bool &parentVDfnArray, bool verbose, uint32 round) const;
|
||||
|
@ -168,7 +168,7 @@ public:
|
|||
* Insert an array node by name
|
||||
* The index asked must be < the size of the array.
|
||||
*/
|
||||
bool arrayInsertNodeByName (const char *name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
bool arrayInsertNodeByName (const std::string &name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
const CFormDfn **nodeDfn, const CType **nodeType,
|
||||
CFormElm **node, UFormDfn::TEntryType &type,
|
||||
bool &array, bool verbose, uint arrayIndex) const;
|
||||
|
@ -177,7 +177,7 @@ public:
|
|||
* Delete an array node by name
|
||||
* The index asked must be < the size of the array.
|
||||
*/
|
||||
bool arrayDeleteNodeByName (const char *name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
bool arrayDeleteNodeByName (const std::string &name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
const CFormDfn **nodeDfn, const CType **nodeType,
|
||||
CFormElm **node, UFormDfn::TEntryType &type,
|
||||
bool &array, bool verbose, uint arrayIndex) const;
|
||||
|
@ -199,7 +199,7 @@ protected:
|
|||
* Then, else (*parentDfn / indexDfn ) or *node must be defined.
|
||||
* Other values are for result only.
|
||||
*/
|
||||
static bool getInternalNodeByName (CForm *form, const char *name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
static bool getInternalNodeByName (CForm *form, const std::string &name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
const CFormDfn **nodeDfn, const CType **nodeType,
|
||||
CFormElm **node, UFormDfn::TEntryType &type,
|
||||
bool &array, TNodeAction action, bool &created, bool &parentVDfnArray, bool verbose, uint32 round);
|
||||
|
@ -215,7 +215,7 @@ public:
|
|||
static const char* tokenize (const char *name, std::string &str, uint &errorIndex, uint &code);
|
||||
|
||||
// ** IO functions
|
||||
virtual xmlNodePtr write (xmlNodePtr node, const CForm *form, const char *structName = NULL, bool forceWrite = false) const = 0;
|
||||
virtual xmlNodePtr write (xmlNodePtr node, const CForm *form, const std::string &structName = "", bool forceWrite = false) const = 0;
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -235,8 +235,8 @@ protected:
|
|||
uint32 Round;
|
||||
|
||||
// Error handling
|
||||
static void warning (bool exception, const char *formName, const char *formFileName, const char *function, const char *format, ... );
|
||||
virtual void warning (bool exception, const char *function, const char *format, ... ) const;
|
||||
static void warning (bool exception, const std::string &formName, const std::string &formFileName, const std::string &function, const char *format, ... );
|
||||
virtual void warning (bool exception, const std::string &function, const char *format, ... ) const;
|
||||
|
||||
private:
|
||||
// Tokens
|
||||
|
@ -298,7 +298,7 @@ public:
|
|||
|
||||
// From CFormElm
|
||||
bool isUsed (const CForm *form) const;
|
||||
xmlNodePtr write (xmlNodePtr node, const CForm *form, const char *structName, bool forceWrite = false) const;
|
||||
xmlNodePtr write (xmlNodePtr node, const CForm *form, const std::string &structName, bool forceWrite = false) const;
|
||||
void unlink (CFormElm *child);
|
||||
void getFormName (std::string &result, const CFormElm *child) const;
|
||||
void getDependencies (std::set<std::string> &dependencies) const;
|
||||
|
@ -310,7 +310,7 @@ public:
|
|||
std::vector<CFormElmStructElm> Elements;
|
||||
|
||||
// Error handling
|
||||
virtual void warning (bool exception, const char *function, const char *format, ... ) const;
|
||||
virtual void warning (bool exception, const std::string &function, const char *format, ... ) const;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -332,13 +332,13 @@ public:
|
|||
|
||||
// From CFormElm
|
||||
bool isUsed (const CForm *form) const;
|
||||
xmlNodePtr write (xmlNodePtr node, const CForm *form, const char *structName, bool forceWrite = false) const;
|
||||
xmlNodePtr write (xmlNodePtr node, const CForm *form, const std::string &structName, bool forceWrite = false) const;
|
||||
|
||||
// Call by CFormLoader
|
||||
void read (xmlNodePtr node, CFormLoader &loader, CForm *form);
|
||||
|
||||
// Error handling
|
||||
virtual void warning (bool exception, const char *function, const char *format, ... ) const;
|
||||
virtual void warning (bool exception, const std::string &function, const char *format, ... ) const;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -377,7 +377,7 @@ public:
|
|||
bool getArrayValue (NLMISC::CRGBA &result, uint arrayIndex, TEval evaluate, TWhereIsValue *where) const;
|
||||
|
||||
// From CFormElm
|
||||
xmlNodePtr write (xmlNodePtr node, const CForm *form, const char *structName, bool forceWrite = false) const;
|
||||
xmlNodePtr write (xmlNodePtr node, const CForm *form, const std::string &structName, bool forceWrite = false) const;
|
||||
bool setParent (CFormElm *parent);
|
||||
void unlink (CFormElm *child);
|
||||
bool isUsed (const CForm *form) const;
|
||||
|
@ -406,7 +406,7 @@ public:
|
|||
std::vector<CElement> Elements;
|
||||
|
||||
// Error handling
|
||||
virtual void warning (bool exception, const char *function, const char *format, ... ) const;
|
||||
virtual void warning (bool exception, const std::string &function, const char *format, ... ) const;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -429,7 +429,7 @@ public:
|
|||
const CType *Type;
|
||||
|
||||
// From CFormElm
|
||||
xmlNodePtr write (xmlNodePtr node, const CForm *form, const char *structName, bool forceWrite = false) const;
|
||||
xmlNodePtr write (xmlNodePtr node, const CForm *form, const std::string &structName, bool forceWrite = false) const;
|
||||
bool setParent (CFormElm *parent);
|
||||
void getFormName (std::string &result, const CFormElm *child) const;
|
||||
void getDependencies (std::set<std::string> &dependencies) const;
|
||||
|
@ -453,7 +453,7 @@ public:
|
|||
bool getValue (NLMISC::CRGBA &result, TEval evaluate) const;
|
||||
|
||||
// Set the value, the elt been used
|
||||
void setValue (const char *value);
|
||||
void setValue (const std::string &value);
|
||||
|
||||
// Get the raw value. Does not care about any parent or default values
|
||||
void getValue (std::string &result) const;
|
||||
|
@ -463,14 +463,14 @@ private:
|
|||
std::string Value;
|
||||
|
||||
// Error handling
|
||||
virtual void warning (bool exception, const char *function, const char *format, ... ) const;
|
||||
virtual void warning (bool exception, const std::string &function, const char *format, ... ) const;
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
// CFormElm inlines
|
||||
// ***************************************************************************
|
||||
|
||||
inline bool CFormElm::convertValue (sint8 &result, const char *value) const
|
||||
inline bool CFormElm::convertValue (sint8 &result, const std::string &value) const
|
||||
{
|
||||
float tmp;
|
||||
if (NLMISC::fromString(value, tmp))
|
||||
|
@ -482,14 +482,14 @@ inline bool CFormElm::convertValue (sint8 &result, const char *value) const
|
|||
else
|
||||
{
|
||||
// Error message
|
||||
warning (false, "convertValue", "Can't convert the string \"%s\" in sint8.", value);
|
||||
warning (false, "convertValue", "Can't convert the string \"%s\" in sint8.", value.c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
inline bool CFormElm::convertValue (uint8 &result, const char *value) const
|
||||
inline bool CFormElm::convertValue (uint8 &result, const std::string &value) const
|
||||
{
|
||||
float tmp;
|
||||
if (NLMISC::fromString(value, tmp))
|
||||
|
@ -501,14 +501,14 @@ inline bool CFormElm::convertValue (uint8 &result, const char *value) const
|
|||
else
|
||||
{
|
||||
// Error message
|
||||
warning (false, "convertValue", "Can't convert the string \"%s\" in uint8.", value);
|
||||
warning (false, "convertValue", "Can't convert the string \"%s\" in uint8.", value.c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
inline bool CFormElm::convertValue (sint16 &result, const char *value) const
|
||||
inline bool CFormElm::convertValue (sint16 &result, const std::string &value) const
|
||||
{
|
||||
float tmp;
|
||||
if (NLMISC::fromString(value, tmp))
|
||||
|
@ -520,14 +520,14 @@ inline bool CFormElm::convertValue (sint16 &result, const char *value) const
|
|||
else
|
||||
{
|
||||
// Error message
|
||||
warning (false, "convertValue", "Can't convert the string \"%s\" in sint16.", value);
|
||||
warning (false, "convertValue", "Can't convert the string \"%s\" in sint16.", value.c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
inline bool CFormElm::convertValue (uint16 &result, const char *value) const
|
||||
inline bool CFormElm::convertValue (uint16 &result, const std::string &value) const
|
||||
{
|
||||
float tmp;
|
||||
if (NLMISC::fromString(value, tmp))
|
||||
|
@ -539,14 +539,14 @@ inline bool CFormElm::convertValue (uint16 &result, const char *value) const
|
|||
else
|
||||
{
|
||||
// Error message
|
||||
warning (false, "convertValue", "Can't convert the string \"%s\" in uint16.", value);
|
||||
warning (false, "convertValue", "Can't convert the string \"%s\" in uint16.", value.c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
inline bool CFormElm::convertValue (sint32 &result, const char *value) const
|
||||
inline bool CFormElm::convertValue (sint32 &result, const std::string &value) const
|
||||
{
|
||||
float tmp;
|
||||
if (NLMISC::fromString(value, tmp))
|
||||
|
@ -558,14 +558,14 @@ inline bool CFormElm::convertValue (sint32 &result, const char *value) const
|
|||
else
|
||||
{
|
||||
// Error message
|
||||
warning (false, "convertValue", "Can't convert the string \"%s\" in sint32.", value);
|
||||
warning (false, "convertValue", "Can't convert the string \"%s\" in sint32.", value.c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
inline bool CFormElm::convertValue (uint32 &result, const char *value) const
|
||||
inline bool CFormElm::convertValue (uint32 &result, const std::string &value) const
|
||||
{
|
||||
float tmp;
|
||||
if (NLMISC::fromString(value, tmp))
|
||||
|
@ -577,14 +577,14 @@ inline bool CFormElm::convertValue (uint32 &result, const char *value) const
|
|||
else
|
||||
{
|
||||
// Error message
|
||||
warning (false, "convertValue", "Can't convert the string \"%s\" in uint32.", value);
|
||||
warning (false, "convertValue", "Can't convert the string \"%s\" in uint32.", value.c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
inline bool CFormElm::convertValue (float &result, const char *value) const
|
||||
inline bool CFormElm::convertValue (float &result, const std::string &value) const
|
||||
{
|
||||
if (NLMISC::fromString(value, result))
|
||||
{
|
||||
|
@ -593,16 +593,16 @@ inline bool CFormElm::convertValue (float &result, const char *value) const
|
|||
else
|
||||
{
|
||||
// Error message
|
||||
warning (false, "convertValue", "Can't convert the string \"%s\" in float.", value);
|
||||
warning (false, "convertValue", "Can't convert the string \"%s\" in float.", value.c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
inline bool CFormElm::convertValue (double &result, const char *value) const
|
||||
inline bool CFormElm::convertValue (double &result, const std::string &value) const
|
||||
{
|
||||
float tmp;
|
||||
double tmp;
|
||||
if (NLMISC::fromString(value, tmp))
|
||||
{
|
||||
result = tmp;
|
||||
|
@ -611,14 +611,14 @@ inline bool CFormElm::convertValue (double &result, const char *value) const
|
|||
else
|
||||
{
|
||||
// Error message
|
||||
warning (false, "convertValue", "Can't convert the string \"%s\" in double.", value);
|
||||
warning (false, "convertValue", "Can't convert the string \"%s\" in double.", value.c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
inline bool CFormElm::convertValue (bool &result, const char *value) const
|
||||
inline bool CFormElm::convertValue (bool &result, const std::string &value) const
|
||||
{
|
||||
int tmp;
|
||||
if (NLMISC::fromString(value, tmp))
|
||||
|
@ -628,7 +628,7 @@ inline bool CFormElm::convertValue (bool &result, const char *value) const
|
|||
}
|
||||
else
|
||||
{
|
||||
std::string temp = NLMISC::toLower(std::string(value));
|
||||
std::string temp = NLMISC::toLower(value);
|
||||
if (strcmp (temp.c_str (), "true") == 0)
|
||||
{
|
||||
result = true;
|
||||
|
@ -642,17 +642,17 @@ inline bool CFormElm::convertValue (bool &result, const char *value) const
|
|||
}
|
||||
|
||||
// Error message
|
||||
warning (false, "convertValue", "Can't convert the string \"%s\" in boolean.", value);
|
||||
warning (false, "convertValue", "Can't convert the string \"%s\" in boolean.", value.c_str());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
inline bool CFormElm::convertValue (NLMISC::CRGBA &result, const char *value) const
|
||||
inline bool CFormElm::convertValue (NLMISC::CRGBA &result, const std::string &value) const
|
||||
{
|
||||
float r, g, b;
|
||||
if (sscanf (value, "%f,%f,%f", &r, &g, &b) == 3)
|
||||
if (sscanf (value.c_str(), "%f,%f,%f", &r, &g, &b) == 3)
|
||||
{
|
||||
NLMISC::clamp (r, 0.f, 255.f);
|
||||
NLMISC::clamp (g, 0.f, 255.f);
|
||||
|
@ -664,7 +664,7 @@ inline bool CFormElm::convertValue (NLMISC::CRGBA &result, const char *value) co
|
|||
}
|
||||
|
||||
// Error message
|
||||
warning (false, "convertValue", "Can't convert the string \"%s\" in RGB color.", value);
|
||||
warning (false, "convertValue", "Can't convert the string \"%s\" in RGB color.", value.c_str());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -42,18 +42,18 @@ class CFormLoader : public UFormLoader
|
|||
public:
|
||||
virtual ~CFormLoader();
|
||||
// From UFormLoader
|
||||
UForm *loadForm (const char *filename);
|
||||
UFormDfn *loadFormDfn (const char *filename);
|
||||
UType *loadFormType (const char *filename);
|
||||
UForm *loadForm (const std::string &filename);
|
||||
UFormDfn *loadFormDfn (const std::string &filename);
|
||||
UType *loadFormType (const std::string &filename);
|
||||
|
||||
// Load type and formDfn
|
||||
CType *loadType (const char *filename);
|
||||
CFormDfn *loadFormDfn (const char *filename, bool forceLoad);
|
||||
CType *loadType (const std::string &filename);
|
||||
CFormDfn *loadFormDfn (const std::string &filename, bool forceLoad);
|
||||
|
||||
private:
|
||||
|
||||
// Error handling
|
||||
virtual void warning (bool exception, const char *function, const char *format, ... ) const;
|
||||
virtual void warning (bool exception, const std::string &function, const char *format, ... ) const;
|
||||
|
||||
typedef std::map<std::string, NLMISC::CRefPtr<CType> > TTypeMap;
|
||||
typedef std::map<std::string, NLMISC::CRefPtr<CFormDfn> > TFormDfnMap;
|
||||
|
|
|
@ -44,10 +44,10 @@ public:
|
|||
};
|
||||
|
||||
/// Add a log
|
||||
void addLog (const char *log);
|
||||
void addLog(const std::string &log);
|
||||
|
||||
/// Set the comment
|
||||
void setComments (const char *comments);
|
||||
void setComments (const std::string &comments);
|
||||
|
||||
/// Major version number
|
||||
uint32 MajorVersion;
|
||||
|
@ -72,7 +72,7 @@ public:
|
|||
static const char *getStateString (TState state);
|
||||
|
||||
// Error handling
|
||||
void warning (bool exception, const char *function, const char *format, ... ) const;
|
||||
void warning (bool exception, const std::string &function, const char *format, ... ) const;
|
||||
};
|
||||
|
||||
} // NLGEORGES
|
||||
|
|
|
@ -80,7 +80,7 @@ public:
|
|||
|
||||
// Evaluate a node
|
||||
bool getValue (std::string &result, const class CForm *form, const class CFormElmAtom *node, const class CFormDfn &parentDfn,
|
||||
uint parentIndex, UFormElm::TEval evaluate, uint32 *where, uint32 round, const char *formName) const;
|
||||
uint parentIndex, UFormElm::TEval evaluate, uint32 *where, uint32 round, const std::string &formName) const;
|
||||
|
||||
// Definitions
|
||||
class CDefinition
|
||||
|
@ -114,8 +114,8 @@ public:
|
|||
private:
|
||||
|
||||
// Error handling
|
||||
virtual void warning (bool exception, const char *formName, const char *formFilename, const char *function, const char *format, ... ) const;
|
||||
virtual void warning2 (bool exception, const char *function, const char *format, ... ) const;
|
||||
virtual void warning (bool exception, const std::string &formName, const std::string &formFilename, const std::string &function, const char *format, ... ) const;
|
||||
virtual void warning2 (bool exception, const std::string &function, const char *format, ... ) const;
|
||||
|
||||
// Type names
|
||||
static const char *TypeNames[];
|
||||
|
|
|
@ -78,8 +78,8 @@ public:
|
|||
* "position.x" : get the element named x in the struct named position
|
||||
* "entities[2].color" : get the node named color in the second element of the entities array
|
||||
*/
|
||||
virtual bool getNodeByName (const UFormElm **result, const char *name, TWhereIsNode *where = NULL, bool reserved=true, uint32 round=0) const = 0;
|
||||
virtual bool getNodeByName (UFormElm **result, const char *name, TWhereIsNode *where = NULL, bool reserved=true, uint32 round=0) = 0;
|
||||
virtual bool getNodeByName (const UFormElm **result, const std::string &name, TWhereIsNode *where = NULL, bool reserved=true, uint32 round=0) const = 0;
|
||||
virtual bool getNodeByName (UFormElm **result, const std::string &name, TWhereIsNode *where = NULL, bool reserved=true, uint32 round=0) = 0;
|
||||
|
||||
|
||||
/// Where a value has been found
|
||||
|
@ -104,19 +104,19 @@ public:
|
|||
* \return true if the result has been filled, false if the value has not been found or the cast has failed or the evaluation has failed.
|
||||
* \see getNodeByName ()
|
||||
*/
|
||||
virtual bool getValueByName (std::string &result, const char *namename, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
virtual bool getValueByName (sint8 &result, const char *name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
virtual bool getValueByName (uint8 &result, const char *name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
virtual bool getValueByName (sint16 &result, const char *name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
virtual bool getValueByName (uint16 &result, const char *name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
virtual bool getValueByName (sint32 &result, const char *name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
virtual bool getValueByName (uint32 &result, const char *name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
virtual bool getValueByName (float &result, const char *name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
virtual bool getValueByName (double &result, const char *name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
virtual bool getValueByName (bool &result, const char *name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
virtual bool getValueByName (std::string &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
virtual bool getValueByName (sint8 &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
virtual bool getValueByName (uint8 &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
virtual bool getValueByName (sint16 &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
virtual bool getValueByName (uint16 &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
virtual bool getValueByName (sint32 &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
virtual bool getValueByName (uint32 &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
virtual bool getValueByName (float &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
virtual bool getValueByName (double &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
virtual bool getValueByName (bool &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
|
||||
/// Warning, only R, G and B members are filled, not A.
|
||||
virtual bool getValueByName (NLMISC::CRGBA &result, const char *name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
virtual bool getValueByName (NLMISC::CRGBA &result, const std::string &name, TEval evaluate = Eval, TWhereIsValue *where = NULL, uint32 round=0) const = 0;
|
||||
|
||||
/**
|
||||
* Set a form value with its name. If the node doesn't exist, it is created.
|
||||
|
@ -129,17 +129,17 @@ public:
|
|||
* true if the value has been created, false it the value has been filled.
|
||||
* \return true if the value has been set, false if the value has not been found or hasn't been created.
|
||||
*/
|
||||
virtual bool setValueByName (const char *value, const char *name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (sint8 value, const char *name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (uint8 value, const char *name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (sint16 value, const char *name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (uint16 value, const char *name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (sint32 value, const char *name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (uint32 value, const char *name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (float value, const char *name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (double value, const char *name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (bool value, const char *name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (NLMISC::CRGBA value, const char *name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (const std::string &value, const std::string &name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (sint8 value, const std::string &name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (uint8 value, const std::string &name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (sint16 value, const std::string &name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (uint16 value, const std::string &name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (sint32 value, const std::string &name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (uint32 value, const std::string &name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (float value, const std::string &name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (double value, const std::string &name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (bool value, const std::string &name, bool *created = NULL) = 0;
|
||||
virtual bool setValueByName (NLMISC::CRGBA value, const std::string &name, bool *created = NULL) = 0;
|
||||
|
||||
|
||||
// ** Array element methods
|
||||
|
|
|
@ -43,19 +43,19 @@ public:
|
|||
*
|
||||
* The pointer on the form must be held in a CSmartPtr<UForm>. Returns NULL if the form can't be loaded.
|
||||
*/
|
||||
virtual UForm *loadForm (const char *filename) = 0;
|
||||
virtual UForm *loadForm (const std::string &filename) = 0;
|
||||
|
||||
/** Load a DFN, use NMISC::CPath to find the file.
|
||||
*
|
||||
* The pointer on the form must be held in a CSmartPtr<UFormDfn>. Returns NULL if the DFN can't be loaded.
|
||||
*/
|
||||
virtual UFormDfn *loadFormDfn (const char *filename) = 0;
|
||||
virtual UFormDfn *loadFormDfn (const std::string &filename) = 0;
|
||||
|
||||
/** Load a type, use NMISC::CPath to find the file.
|
||||
*
|
||||
* The pointer on the form must be held in a CSmartPtr<UType>. Returns NULL if the type can't be loaded.
|
||||
*/
|
||||
virtual UType *loadFormType (const char *filename) = 0;
|
||||
virtual UType *loadFormType (const std::string &filename) = 0;
|
||||
|
||||
/// Create a form loader
|
||||
static UFormLoader *createLoader ();
|
||||
|
|
|
@ -104,10 +104,10 @@ CForm::~CForm ()
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CForm::write (xmlDocPtr doc, const char *filename)
|
||||
void CForm::write (xmlDocPtr doc, const std::string &filename)
|
||||
{
|
||||
// Save the filename
|
||||
if (filename)
|
||||
if (!filename.empty())
|
||||
_Filename = CFile::getFilename (filename);
|
||||
|
||||
// Create the first node
|
||||
|
@ -176,7 +176,7 @@ void CForm::readParent (const char *parent, CFormLoader &loader)
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CForm::read (xmlNodePtr node, CFormLoader &loader, CFormDfn *dfn, const char *filename)
|
||||
void CForm::read (xmlNodePtr node, CFormLoader &loader, CFormDfn *dfn, const std::string &filename)
|
||||
{
|
||||
// Save the filename
|
||||
_Filename = CFile::getFilename (filename);
|
||||
|
@ -271,7 +271,7 @@ void CForm::write (class NLMISC::IStream &stream)
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CForm::insertParent (uint before, const char *filename, CForm *parent)
|
||||
bool CForm::insertParent (uint before, const std::string &filename, CForm *parent)
|
||||
{
|
||||
// Set or reset ?
|
||||
nlassert (parent);
|
||||
|
@ -346,7 +346,7 @@ const std::string &CForm::getFilename () const
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CForm::warning (bool exception, const char *function, const char *format, ... ) const
|
||||
void CForm::warning (bool exception, const std::string &function, const char *format, ... ) const
|
||||
{
|
||||
// Make a buffer string
|
||||
va_list args;
|
||||
|
@ -356,7 +356,7 @@ void CForm::warning (bool exception, const char *function, const char *format, .
|
|||
va_end( args );
|
||||
|
||||
// Set the warning
|
||||
NLGEORGES::warning (exception, "(CForm::%s) in form (%s) : %s", function, _Filename.c_str (), buffer);
|
||||
NLGEORGES::warning (exception, "(CForm::%s) in form (%s) : %s", function.c_str(), _Filename.c_str (), buffer);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
|
|
@ -56,7 +56,7 @@ void CFormDfn::removeEntry( uint idx )
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormDfn::write (xmlDocPtr doc, const char *filename)
|
||||
void CFormDfn::write (xmlDocPtr doc, const std::string &filename)
|
||||
{
|
||||
// Save filename
|
||||
_Filename = CFile::getFilename (filename);
|
||||
|
@ -121,7 +121,7 @@ void CFormDfn::write (xmlDocPtr doc, const char *filename)
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormDfn::read (xmlNodePtr root, CFormLoader &loader, bool forceLoad, const char *filename)
|
||||
void CFormDfn::read (xmlNodePtr root, CFormLoader &loader, bool forceLoad, const std::string &filename)
|
||||
{
|
||||
// Save filename
|
||||
_Filename = CFile::getFilename (filename);
|
||||
|
@ -459,9 +459,9 @@ void CFormDfn::setNumParent (uint size)
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormDfn::setParent (uint parent, CFormLoader &loader, const char *filename)
|
||||
void CFormDfn::setParent (uint parent, CFormLoader &loader, const std::string &filename)
|
||||
{
|
||||
if (strcmp (filename, "")==0)
|
||||
if (filename.empty())
|
||||
Parents[parent].Parent = NULL;
|
||||
else
|
||||
Parents[parent].Parent = loader.loadFormDfn (filename, false);
|
||||
|
@ -470,7 +470,7 @@ void CFormDfn::setParent (uint parent, CFormLoader &loader, const char *filename
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormDfn::CEntry::setType (CFormLoader &loader, const char *filename)
|
||||
void CFormDfn::CEntry::setType (CFormLoader &loader, const std::string &filename)
|
||||
{
|
||||
TypeElement = EntryType;
|
||||
Dfn = NULL;
|
||||
|
@ -485,7 +485,7 @@ void CFormDfn::CEntry::setType( TEntryType type )
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormDfn::CEntry::setDfn (CFormLoader &loader, const char *filename)
|
||||
void CFormDfn::CEntry::setDfn (CFormLoader &loader, const std::string &filename)
|
||||
{
|
||||
TypeElement = EntryDfn;
|
||||
Filename = filename;
|
||||
|
@ -512,7 +512,7 @@ const std::string &CFormDfn::CEntry::getName () const
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormDfn::CEntry::setName (const char *name)
|
||||
void CFormDfn::CEntry::setName (const std::string &name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
@ -526,7 +526,7 @@ const std::string &CFormDfn::CEntry::getDefault () const
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormDfn::CEntry::setDefault (const char *def)
|
||||
void CFormDfn::CEntry::setDefault (const std::string &def)
|
||||
{
|
||||
Default = def;
|
||||
}
|
||||
|
@ -561,7 +561,7 @@ const std::string &CFormDfn::CEntry::getFilename() const
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormDfn::CEntry::setFilename (const char *def)
|
||||
void CFormDfn::CEntry::setFilename (const std::string &def)
|
||||
{
|
||||
Filename = def;
|
||||
}
|
||||
|
@ -849,14 +849,14 @@ const std::string &CFormDfn::CEntry::getFilenameExt() const
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormDfn::CEntry::setFilenameExt (const char *ext)
|
||||
void CFormDfn::CEntry::setFilenameExt (const std::string &ext)
|
||||
{
|
||||
FilenameExt = ext;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormDfn::warning (bool exception, const char *function, const char *format, ... ) const
|
||||
void CFormDfn::warning (bool exception, const std::string &function, const char *format, ... ) const
|
||||
{
|
||||
// Make a buffer string
|
||||
va_list args;
|
||||
|
@ -866,7 +866,7 @@ void CFormDfn::warning (bool exception, const char *function, const char *format
|
|||
va_end( args );
|
||||
|
||||
// Set the warning
|
||||
NLGEORGES::warning (exception, "(CFormDfn::%s) in form DFN (%s) : %s", function, _Filename.c_str (), buffer);
|
||||
NLGEORGES::warning (exception, "(CFormDfn::%s) in form DFN (%s) : %s", function.c_str(), _Filename.c_str (), buffer);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
|
|
@ -356,7 +356,7 @@ CForm *CFormElm::getForm () const
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::getNodeByName (UFormElm **result, const char *name, TWhereIsNode *where, bool verbose, uint32 round)
|
||||
bool CFormElm::getNodeByName (UFormElm **result, const std::string &name, TWhereIsNode *where, bool verbose, uint32 round)
|
||||
{
|
||||
const UFormElm *resultConst = NULL;
|
||||
if (((const UFormElm*)this)->getNodeByName (&resultConst, name, where, verbose, round))
|
||||
|
@ -369,7 +369,7 @@ bool CFormElm::getNodeByName (UFormElm **result, const char *name, TWhereIsNode
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::getNodeByName (const UFormElm **result, const char *name, TWhereIsNode *where, bool verbose, uint32 round) const
|
||||
bool CFormElm::getNodeByName (const UFormElm **result, const std::string &name, TWhereIsNode *where, bool verbose, uint32 round) const
|
||||
{
|
||||
// The parent Dfn
|
||||
const CFormDfn *parentDfn;
|
||||
|
@ -402,7 +402,7 @@ bool CFormElm::getNodeByName (const UFormElm **result, const char *name, TWhereI
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::getValueByName (string& result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
bool CFormElm::getValueByName (string& result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
{
|
||||
// The parent Dfn
|
||||
const CFormDfn *parentDfn;
|
||||
|
@ -430,13 +430,13 @@ bool CFormElm::getValueByName (string& result, const char *name, TEval evaluate,
|
|||
else
|
||||
{
|
||||
// Error message
|
||||
warning (false, "getValueByName", "The node (%s) is not an atom element. Can't return a value.", name);
|
||||
warning (false, "getValueByName", "The node (%s) is not an atom element. Can't return a value.", name.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Error message
|
||||
warning (false, "getValueByName", "Can't find the node (%s).", name);
|
||||
warning (false, "getValueByName", "Can't find the node (%s).", name.c_str());
|
||||
}
|
||||
|
||||
// Error
|
||||
|
@ -445,13 +445,13 @@ bool CFormElm::getValueByName (string& result, const char *name, TEval evaluate,
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::getValueByName (sint8 &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
bool CFormElm::getValueByName (sint8 &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
{
|
||||
// Get the string value
|
||||
string value;
|
||||
if (getValueByName (value, name, evaluate, where, round))
|
||||
{
|
||||
return convertValue (result, value.c_str ());
|
||||
return convertValue (result, value);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -459,13 +459,13 @@ bool CFormElm::getValueByName (sint8 &result, const char *name, TEval evaluate,
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::getValueByName (uint8 &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
bool CFormElm::getValueByName (uint8 &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
{
|
||||
// Get the string value
|
||||
string value;
|
||||
if (getValueByName (value, name, evaluate, where, round))
|
||||
{
|
||||
return convertValue (result, value.c_str ());
|
||||
return convertValue (result, value);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -473,13 +473,13 @@ bool CFormElm::getValueByName (uint8 &result, const char *name, TEval evaluate,
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::getValueByName (sint16 &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
bool CFormElm::getValueByName (sint16 &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
{
|
||||
// Get the string value
|
||||
string value;
|
||||
if (getValueByName (value, name, evaluate, where, round))
|
||||
{
|
||||
return convertValue (result, value.c_str ());
|
||||
return convertValue (result, value);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -487,13 +487,13 @@ bool CFormElm::getValueByName (sint16 &result, const char *name, TEval evaluate,
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::getValueByName (uint16 &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
bool CFormElm::getValueByName (uint16 &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
{
|
||||
// Get the string value
|
||||
string value;
|
||||
if (getValueByName (value, name, evaluate, where, round))
|
||||
{
|
||||
return convertValue (result, value.c_str ());
|
||||
return convertValue (result, value);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -501,13 +501,13 @@ bool CFormElm::getValueByName (uint16 &result, const char *name, TEval evaluate,
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::getValueByName (sint32 &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
bool CFormElm::getValueByName (sint32 &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
{
|
||||
// Get the string value
|
||||
string value;
|
||||
if (getValueByName (value, name, evaluate, where, round))
|
||||
{
|
||||
return convertValue (result, value.c_str ());
|
||||
return convertValue (result, value);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -515,13 +515,13 @@ bool CFormElm::getValueByName (sint32 &result, const char *name, TEval evaluate,
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::getValueByName (uint32 &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
bool CFormElm::getValueByName (uint32 &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
{
|
||||
// Get the string value
|
||||
string value;
|
||||
if (getValueByName (value, name, evaluate, where, round))
|
||||
{
|
||||
return convertValue (result, value.c_str ());
|
||||
return convertValue (result, value);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -529,13 +529,13 @@ bool CFormElm::getValueByName (uint32 &result, const char *name, TEval evaluate,
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::getValueByName (float &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
bool CFormElm::getValueByName (float &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
{
|
||||
// Get the string value
|
||||
string value;
|
||||
if (getValueByName (value, name, evaluate, where, round))
|
||||
{
|
||||
return convertValue (result, value.c_str ());
|
||||
return convertValue (result, value);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -543,13 +543,13 @@ bool CFormElm::getValueByName (float &result, const char *name, TEval evaluate,
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::getValueByName (double &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
bool CFormElm::getValueByName(double &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
{
|
||||
// Get the string value
|
||||
string value;
|
||||
if (getValueByName (value, name, evaluate, where, round))
|
||||
{
|
||||
return convertValue (result, value.c_str ());
|
||||
return convertValue (result, value);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -557,13 +557,13 @@ bool CFormElm::getValueByName (double &result, const char *name, TEval evaluate,
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::getValueByName (bool &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
bool CFormElm::getValueByName (bool &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
{
|
||||
// Get the string value
|
||||
string value;
|
||||
if (getValueByName (value, name, evaluate, where, round))
|
||||
{
|
||||
return convertValue (result, value.c_str ());
|
||||
return convertValue (result, value);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -571,13 +571,13 @@ bool CFormElm::getValueByName (bool &result, const char *name, TEval evaluate, T
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::getValueByName (NLMISC::CRGBA &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
bool CFormElm::getValueByName (NLMISC::CRGBA &result, const std::string &name, TEval evaluate, TWhereIsValue *where, uint32 round) const
|
||||
{
|
||||
// Get the string value
|
||||
string value;
|
||||
if (getValueByName (value, name, evaluate, where, round))
|
||||
{
|
||||
return convertValue (result, value.c_str ());
|
||||
return convertValue (result, value);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -592,7 +592,7 @@ UFormElm *CFormElm::getParent () const
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::createNodeByName (const char *name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
bool CFormElm::createNodeByName (const std::string &name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
const CFormDfn **nodeDfn, const CType **nodeType,
|
||||
CFormElm **node, UFormDfn::TEntryType &type,
|
||||
bool &array, bool &created)
|
||||
|
@ -608,7 +608,7 @@ bool CFormElm::createNodeByName (const char *name, const CFormDfn **parentDfn, u
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::deleteNodeByName (const char *name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
bool CFormElm::deleteNodeByName (const std::string &name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
const CFormDfn **nodeDfn, const CType **nodeType,
|
||||
CFormElm **node, UFormDfn::TEntryType &type,
|
||||
bool &array)
|
||||
|
@ -625,7 +625,7 @@ bool CFormElm::deleteNodeByName (const char *name, const CFormDfn **parentDfn, u
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::getNodeByName (const char *name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
bool CFormElm::getNodeByName (const std::string &name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
const CFormDfn **nodeDfn, const CType **nodeType,
|
||||
CFormElm **node, UFormDfn::TEntryType &type,
|
||||
bool &array, bool &parentVDfnArray, bool verbose, uint32 round) const
|
||||
|
@ -641,7 +641,7 @@ bool CFormElm::getNodeByName (const char *name, const CFormDfn **parentDfn, uint
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::arrayInsertNodeByName (const char *name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
bool CFormElm::arrayInsertNodeByName (const std::string &name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
const CFormDfn **nodeDfn, const CType **nodeType,
|
||||
CFormElm **node, UFormDfn::TEntryType &type,
|
||||
bool &array, bool verbose, uint arrayIndex) const
|
||||
|
@ -715,7 +715,7 @@ bool CFormElm::arrayInsertNodeByName (const char *name, const CFormDfn **parentD
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::arrayDeleteNodeByName (const char *name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
bool CFormElm::arrayDeleteNodeByName (const std::string &name, const CFormDfn **parentDfn, uint &indexDfn,
|
||||
const CFormDfn **nodeDfn, const CType **nodeType,
|
||||
CFormElm **node, UFormDfn::TEntryType &type,
|
||||
bool &array, bool verbose, uint arrayIndex) const
|
||||
|
@ -760,7 +760,7 @@ bool CFormElm::arrayDeleteNodeByName (const char *name, const CFormDfn **parentD
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::getInternalNodeByName (CForm *form, const char *name, const CFormDfn **parentDfn, uint &indexDfn, const CFormDfn **nodeDfn, const CType **nodeType, CFormElm **node, UFormDfn::TEntryType &type, bool &array, TNodeAction action, bool &created, bool &parentVDfnArray, bool verbose, uint32 round)
|
||||
bool CFormElm::getInternalNodeByName (CForm *form, const std::string &name, const CFormDfn **parentDfn, uint &indexDfn, const CFormDfn **nodeDfn, const CType **nodeType, CFormElm **node, UFormDfn::TEntryType &type, bool &array, TNodeAction action, bool &created, bool &parentVDfnArray, bool verbose, uint32 round)
|
||||
{
|
||||
// *** Init output variables
|
||||
created = false;
|
||||
|
@ -815,7 +815,7 @@ bool CFormElm::getInternalNodeByName (CForm *form, const char *name, const CForm
|
|||
// *** Parsing variables
|
||||
|
||||
// Current token start and end
|
||||
const char *startToken = name;
|
||||
const char *startToken = name.c_str();
|
||||
const char *endToken;
|
||||
|
||||
// Current token start
|
||||
|
@ -909,7 +909,7 @@ bool CFormElm::getInternalNodeByName (CForm *form, const char *name, const CForm
|
|||
|
||||
// Get the virtual node by name
|
||||
UFormElm *uelm;
|
||||
if (parentPtr->getRootNode ().getNodeByName (&uelm, formName.c_str (), NULL, verbose, round+1) && uelm)
|
||||
if (parentPtr->getRootNode ().getNodeByName (&uelm, formName, NULL, verbose, round+1) && uelm)
|
||||
{
|
||||
// Value node ?
|
||||
if (uelm->isVirtualStruct ())
|
||||
|
@ -1134,7 +1134,7 @@ bool CFormElm::getInternalNodeByName (CForm *form, const char *name, const CForm
|
|||
case TokenString:
|
||||
{
|
||||
// To int
|
||||
if (sscanf (token.c_str(), "%d", &arrayIndex)!=1)
|
||||
if (!fromString(token, arrayIndex))
|
||||
{
|
||||
// Error message
|
||||
smprintf (error, 512, "Keyword (%s) is not an array index.", token.c_str());
|
||||
|
@ -1406,7 +1406,7 @@ exit:;
|
|||
bool arrayParent;
|
||||
bool createdParent;
|
||||
bool parentVDfnArray;
|
||||
if (getInternalNodeByName (parentPtr, formName.c_str (), &parentDfnParent, indexDfnParent, &nodeDfnParent, &nodeTypeParent, &nodeParent, typeParent, arrayParent, action, createdParent, parentVDfnArray, false, round+1))
|
||||
if (getInternalNodeByName (parentPtr, formName, &parentDfnParent, indexDfnParent, &nodeDfnParent, &nodeTypeParent, &nodeParent, typeParent, arrayParent, action, createdParent, parentVDfnArray, false, round+1))
|
||||
{
|
||||
// Node found ?
|
||||
if (nodeParent)
|
||||
|
@ -1466,7 +1466,7 @@ exit:;
|
|||
// Turn around..
|
||||
string formName;
|
||||
(*node)->getFormName (formName);
|
||||
warning (false, formName.c_str (), form->getFilename ().c_str(), "getInternalNodeByName", "Recursive call on the same node (%s), look for loop references or inheritances.", name);
|
||||
warning (false, formName, form->getFilename (), "getInternalNodeByName", "Recursive call on the same node (%s), look for loop references or inheritances.", name.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1476,7 +1476,7 @@ exit:;
|
|||
nlassert (*error);
|
||||
|
||||
// Get the best form name
|
||||
warning (false, currentName.c_str (), form->getFilename ().c_str(), "getInternalNodeByName", "Getting the node (%s) : %s", name, error);
|
||||
warning (false, currentName, form->getFilename (), "getInternalNodeByName", "Getting the node (%s) : %s", name.c_str(), error);
|
||||
}
|
||||
|
||||
return !errorAppend;
|
||||
|
@ -1534,7 +1534,7 @@ void CFormElm::unlink (CFormElm * /* child */)
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::setValueByName (const char *value, const char *name, bool *created)
|
||||
bool CFormElm::setValueByName(const std::string &value, const std::string &name, bool *created)
|
||||
{
|
||||
// The parent Dfn
|
||||
const CFormDfn *parentDfn;
|
||||
|
@ -1567,13 +1567,13 @@ bool CFormElm::setValueByName (const char *value, const char *name, bool *create
|
|||
else
|
||||
{
|
||||
// Error message
|
||||
warning (false, "setValueByName", "The node (%s) is not an atom element. Can't set the value.", name);
|
||||
warning (false, "setValueByName", "The node (%s) is not an atom element. Can't set the value.", name.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Error message
|
||||
warning (false, "setValueByName", "Can't created / set the node (%s).", name);
|
||||
warning (false, "setValueByName", "Can't created / set the node (%s).", name.c_str());
|
||||
|
||||
// Created flag
|
||||
if (created)
|
||||
|
@ -1586,70 +1586,70 @@ bool CFormElm::setValueByName (const char *value, const char *name, bool *create
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::setValueByName (sint8 value, const char *name, bool *created)
|
||||
bool CFormElm::setValueByName (sint8 value, const std::string &name, bool *created)
|
||||
{
|
||||
return setValueByName (toString (value).c_str (), name, created);
|
||||
return setValueByName (toString (value), name, created);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::setValueByName (uint8 value, const char *name, bool *created)
|
||||
bool CFormElm::setValueByName (uint8 value, const std::string &name, bool *created)
|
||||
{
|
||||
return setValueByName (toString (value).c_str (), name, created);
|
||||
return setValueByName (toString (value), name, created);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::setValueByName (sint16 value, const char *name, bool *created)
|
||||
bool CFormElm::setValueByName (sint16 value, const std::string &name, bool *created)
|
||||
{
|
||||
return setValueByName (toString (value).c_str (), name, created);
|
||||
return setValueByName (toString (value), name, created);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::setValueByName (uint16 value, const char *name, bool *created)
|
||||
bool CFormElm::setValueByName (uint16 value, const std::string &name, bool *created)
|
||||
{
|
||||
return setValueByName (toString (value).c_str (), name, created);
|
||||
return setValueByName (toString (value), name, created);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::setValueByName (sint32 value, const char *name, bool *created)
|
||||
bool CFormElm::setValueByName(sint32 value, const std::string &name, bool *created)
|
||||
{
|
||||
return setValueByName (toString (value).c_str (), name, created);
|
||||
return setValueByName (toString (value), name, created);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::setValueByName (uint32 value, const char *name, bool *created)
|
||||
bool CFormElm::setValueByName (uint32 value, const std::string &name, bool *created)
|
||||
{
|
||||
return setValueByName (toString (value).c_str (), name, created);
|
||||
return setValueByName (toString (value), name, created);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::setValueByName (float value, const char *name, bool *created)
|
||||
bool CFormElm::setValueByName (float value, const std::string &name, bool *created)
|
||||
{
|
||||
return setValueByName (toString (value).c_str (), name, created);
|
||||
return setValueByName (toString (value), name, created);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::setValueByName (double value, const char *name, bool *created)
|
||||
bool CFormElm::setValueByName (double value, const std::string &name, bool *created)
|
||||
{
|
||||
return setValueByName (toString (value).c_str (), name, created);
|
||||
return setValueByName (toString (value), name, created);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::setValueByName (bool value, const char *name, bool *created)
|
||||
bool CFormElm::setValueByName (bool value, const std::string &name, bool *created)
|
||||
{
|
||||
return setValueByName (toString (value).c_str (), name, created);
|
||||
return setValueByName (toString (value), name, created);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::setValueByName (NLMISC::CRGBA value, const char *name, bool *created)
|
||||
bool CFormElm::setValueByName (NLMISC::CRGBA value, const std::string &name, bool *created)
|
||||
{
|
||||
char tmp[512];
|
||||
smprintf (tmp, 512, "%d,%d,%d", value.R, value.G, value.B);
|
||||
|
@ -1658,7 +1658,7 @@ bool CFormElm::setValueByName (NLMISC::CRGBA value, const char *name, bool *crea
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormElm::warning (bool exception, const char *formName, const char *formFileName, const char *function, const char *format, ... )
|
||||
void CFormElm::warning (bool exception, const std::string &formName, const std::string &formFileName, const std::string &function, const char *format, ... )
|
||||
{
|
||||
// Make a buffer string
|
||||
va_list args;
|
||||
|
@ -1668,19 +1668,19 @@ void CFormElm::warning (bool exception, const char *formName, const char *formFi
|
|||
va_end( args );
|
||||
|
||||
// Set the warning
|
||||
NLGEORGES::warning (exception, "(CFormElm::%s) on node (%s) in form (%s) : %s", function, formName, formFileName, buffer);
|
||||
NLGEORGES::warning (exception, "(CFormElm::%s) on node (%s) in form (%s) : %s", function.c_str(), formName.c_str(), formFileName.c_str(), buffer);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormElm::warning (bool exception, const char *function, const char *format, ... ) const
|
||||
void CFormElm::warning (bool exception, const std::string &function, const char *format, ... ) const
|
||||
{
|
||||
va_list args;
|
||||
va_start( args, format );
|
||||
|
||||
string formName;
|
||||
getFormName (formName);
|
||||
warning (exception, formName.c_str (), getForm ()->getFilename ().c_str (), function, format, args);
|
||||
warning (exception, formName, getForm ()->getFilename (), function, format, args);
|
||||
|
||||
va_end( args );
|
||||
}
|
||||
|
@ -1741,7 +1741,7 @@ bool CFormElmStruct::getStructNodeName (uint element, string &result) const
|
|||
}
|
||||
else
|
||||
{
|
||||
warning (false, "getStructNodeName", "Index (%d) out of bound (%d).", element, Elements.size() );
|
||||
warning (false, "getStructNodeName", "Index (%u) out of bound (%u).", element, (uint)Elements.size() );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1757,7 +1757,7 @@ bool CFormElmStruct::getStructNode (uint element, const UFormElm **result) const
|
|||
}
|
||||
else
|
||||
{
|
||||
warning (false, "getStructNode", "Index (%d) out of bound (%d).", element, Elements.size() );
|
||||
warning (false, "getStructNode", "Index (%u) out of bound (%u).", element, (uint)Elements.size() );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1780,14 +1780,14 @@ bool CFormElmStruct::getStructNode (uint element, UFormElm **result)
|
|||
}
|
||||
else
|
||||
{
|
||||
warning (false, "getStructNode", "Index (%d) out of bound (%d).", element, Elements.size() );
|
||||
warning (false, "getStructNode", "Index (%u) out of bound (%u).", element, (uint)Elements.size() );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
xmlNodePtr CFormElmStruct::write (xmlNodePtr root, const CForm *form, const char *structName, bool forceWrite) const
|
||||
xmlNodePtr CFormElmStruct::write (xmlNodePtr root, const CForm *form, const std::string &structName, bool forceWrite) const
|
||||
{
|
||||
// Is used ?
|
||||
if (isUsed (form) || forceWrite)
|
||||
|
@ -1796,10 +1796,10 @@ xmlNodePtr CFormElmStruct::write (xmlNodePtr root, const CForm *form, const cha
|
|||
xmlNodePtr node = xmlNewChild ( root, NULL, (const xmlChar*)"STRUCT", NULL);
|
||||
|
||||
// Element name
|
||||
if (structName != NULL)
|
||||
if (!structName.empty())
|
||||
{
|
||||
// Struct name
|
||||
xmlSetProp (node, (const xmlChar*)"Name", (const xmlChar*)structName);
|
||||
xmlSetProp (node, (const xmlChar*)"Name", (const xmlChar*)structName.c_str());
|
||||
}
|
||||
|
||||
// For each elements of the structure
|
||||
|
@ -1808,7 +1808,7 @@ xmlNodePtr CFormElmStruct::write (xmlNodePtr root, const CForm *form, const cha
|
|||
{
|
||||
// Create a node if it exist
|
||||
if (Elements[elm].Element)
|
||||
Elements[elm].Element->write (node, form, Elements[elm].Name.c_str());
|
||||
Elements[elm].Element->write (node, form, Elements[elm].Name);
|
||||
}
|
||||
|
||||
// Return the new node
|
||||
|
@ -1905,8 +1905,8 @@ void CFormElmStruct::read (xmlNodePtr node, CFormLoader &loader, const CFormDfn
|
|||
else
|
||||
{
|
||||
// Make a warning message
|
||||
warning (false, "read", "In block line %p, node (%s) type in DFN have changed.",
|
||||
child->content, child->name);
|
||||
warning (false, "read", "In block line %u, node (%s) type in DFN have changed.",
|
||||
(uint)child->line, child->name);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1918,8 +1918,8 @@ void CFormElmStruct::read (xmlNodePtr node, CFormLoader &loader, const CFormDfn
|
|||
}
|
||||
|
||||
// Throw exception
|
||||
warning (true, "read", "XML Syntax error in block line %p, node (%s) name should be STRUCT, ATOM or ARRAY.",
|
||||
child->content, child->name);
|
||||
warning (true, "read", "XML Syntax error in block line %u, node (%s) name should be STRUCT, ATOM or ARRAY.",
|
||||
(uint)child->line, child->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2101,7 +2101,7 @@ void CFormElmStruct::getFormName (std::string &result, const CFormElm *child) co
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormElmStruct::warning (bool exception, const char *function, const char *format, ... ) const
|
||||
void CFormElmStruct::warning (bool exception, const std::string &function, const char *format, ... ) const
|
||||
{
|
||||
// Make a buffer string
|
||||
va_list args;
|
||||
|
@ -2113,7 +2113,7 @@ void CFormElmStruct::warning (bool exception, const char *function, const char *
|
|||
// Set the warning
|
||||
string formName;
|
||||
getFormName (formName, NULL);
|
||||
NLGEORGES::warning (exception, "(CFormElmStruct::%s) on node (%s) in form (%s) : %s", function, formName.c_str (), Form->getFilename ().c_str (), buffer);
|
||||
NLGEORGES::warning (exception, "(CFormElmStruct::%s) on node (%s) in form (%s) : %s", function.c_str(), formName.c_str (), Form->getFilename ().c_str (), buffer);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -2142,7 +2142,7 @@ CFormElmVirtualStruct::CFormElmVirtualStruct (CForm *form, CFormElm *parentNode,
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
xmlNodePtr CFormElmVirtualStruct::write (xmlNodePtr root, const CForm *form, const char *structName, bool forceWrite) const
|
||||
xmlNodePtr CFormElmVirtualStruct::write (xmlNodePtr root, const CForm *form, const std::string &structName, bool forceWrite) const
|
||||
{
|
||||
// Is used ?
|
||||
if (isUsed (form) || forceWrite)
|
||||
|
@ -2154,10 +2154,10 @@ xmlNodePtr CFormElmVirtualStruct::write (xmlNodePtr root, const CForm *form, co
|
|||
xmlSetProp (node, (const xmlChar*)"DfnName", (const xmlChar*)DfnFilename.c_str());
|
||||
|
||||
// Element name
|
||||
if (structName != NULL)
|
||||
if (!structName.empty())
|
||||
{
|
||||
// Struct name
|
||||
xmlSetProp (node, (const xmlChar*)"Name", (const xmlChar*)structName);
|
||||
xmlSetProp (node, (const xmlChar*)"Name", (const xmlChar*)structName.c_str());
|
||||
}
|
||||
|
||||
// For each elements of the structure
|
||||
|
@ -2166,7 +2166,7 @@ xmlNodePtr CFormElmVirtualStruct::write (xmlNodePtr root, const CForm *form, co
|
|||
{
|
||||
// Create a node if it exist
|
||||
if (Elements[elm].Element)
|
||||
Elements[elm].Element->write (node, form, Elements[elm].Name.c_str());
|
||||
Elements[elm].Element->write (node, form, Elements[elm].Name);
|
||||
}
|
||||
|
||||
// Return the new node
|
||||
|
@ -2190,7 +2190,7 @@ void CFormElmVirtualStruct::read (xmlNodePtr node, CFormLoader &loader, CForm *f
|
|||
xmlFree ((void*)filename);
|
||||
|
||||
// Load the dfn
|
||||
FormDfn = loader.loadFormDfn (DfnFilename.c_str (), false);
|
||||
FormDfn = loader.loadFormDfn (DfnFilename, false);
|
||||
if (!FormDfn)
|
||||
{
|
||||
// Throw exception
|
||||
|
@ -2200,8 +2200,8 @@ void CFormElmVirtualStruct::read (xmlNodePtr node, CFormLoader &loader, CForm *f
|
|||
else
|
||||
{
|
||||
// Throw exception
|
||||
warning (true, "read", "XML Syntax error in virtual struct in block line %p, should have a DfnName property.",
|
||||
node->content);
|
||||
warning (true, "read", "XML Syntax error in virtual struct in block line %u, should have a DfnName property.",
|
||||
(uint)node->line);
|
||||
}
|
||||
|
||||
// Read the parent
|
||||
|
@ -2232,7 +2232,7 @@ bool CFormElmVirtualStruct::isUsed (const CForm * /* form */) const
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormElmVirtualStruct::warning (bool exception, const char *function, const char *format, ... ) const
|
||||
void CFormElmVirtualStruct::warning (bool exception, const std::string &function, const char *format, ... ) const
|
||||
{
|
||||
// Make a buffer string
|
||||
va_list args;
|
||||
|
@ -2244,7 +2244,7 @@ void CFormElmVirtualStruct::warning (bool exception, const char *function, const
|
|||
// Set the warning
|
||||
string formName;
|
||||
getFormName (formName, NULL);
|
||||
NLGEORGES::warning (exception, "(CFormElmVirtualStruct::%s) on node (%s) in form (%s) : %s", function, formName.c_str (), Form->getFilename ().c_str (), buffer);
|
||||
NLGEORGES::warning (exception, "(CFormElmVirtualStruct::%s) on node (%s) in form (%s) : %s", function.c_str(), formName.c_str (), Form->getFilename ().c_str (), buffer);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -2304,7 +2304,7 @@ bool CFormElmArray::getArrayNode (const UFormElm **result, uint arrayIndex) cons
|
|||
}
|
||||
else
|
||||
{
|
||||
warning (false, "getArrayNode", "Index (%d) out of bound (%d).", arrayIndex, Elements.size() );
|
||||
warning (false, "getArrayNode", "Index (%u) out of bound (%u).", arrayIndex, (uint)Elements.size() );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -2323,7 +2323,7 @@ bool CFormElmArray::getArrayNodeName (std::string &result, uint arrayIndex) cons
|
|||
}
|
||||
else
|
||||
{
|
||||
warning (false, "getArrayNodeName", "Index (%d) out of bound (%d).", arrayIndex, Elements.size() );
|
||||
warning (false, "getArrayNodeName", "Index (%u) out of bound (%u).", arrayIndex, (uint)Elements.size() );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -2339,7 +2339,7 @@ bool CFormElmArray::getArrayNode (UFormElm **result, uint arrayIndex)
|
|||
}
|
||||
else
|
||||
{
|
||||
warning (false, "getArrayNode", "Index (%d) out of bound (%d).", arrayIndex, Elements.size() );
|
||||
warning (false, "getArrayNode", "Index (%u) out of bound (%u).", arrayIndex, (uint)Elements.size() );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -2351,11 +2351,11 @@ bool CFormElmArray::getArrayValue (std::string &result, uint arrayIndex, TEval e
|
|||
{
|
||||
if (arrayIndex >= Elements.size())
|
||||
{
|
||||
warning (false, "getArrayValue", "Access out of bound, trying to access array index %u, array size is %u.", arrayIndex, Elements.size());
|
||||
warning (false, "getArrayValue", "Access out of bound, trying to access array index %u, array size is %u.", arrayIndex, (uint)Elements.size());
|
||||
}
|
||||
else if (Type)
|
||||
{
|
||||
return (Type->getValue (result, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL));
|
||||
return (Type->getValue (result, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2372,9 +2372,9 @@ bool CFormElmArray::getArrayValue (sint8 &result, uint arrayIndex, TEval evaluat
|
|||
if (Type)
|
||||
{
|
||||
string str;
|
||||
if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL))
|
||||
if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, ""))
|
||||
{
|
||||
return convertValue (result, str.c_str ());
|
||||
return convertValue (result, str);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2392,9 +2392,9 @@ bool CFormElmArray::getArrayValue (uint8 &result, uint arrayIndex, TEval evaluat
|
|||
if (Type)
|
||||
{
|
||||
string str;
|
||||
if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL))
|
||||
if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, ""))
|
||||
{
|
||||
return convertValue (result, str.c_str ());
|
||||
return convertValue (result, str);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2412,9 +2412,9 @@ bool CFormElmArray::getArrayValue (sint16 &result, uint arrayIndex, TEval evalua
|
|||
if (Type)
|
||||
{
|
||||
string str;
|
||||
if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL))
|
||||
if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, ""))
|
||||
{
|
||||
return convertValue (result, str.c_str ());
|
||||
return convertValue (result, str);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2432,9 +2432,9 @@ bool CFormElmArray::getArrayValue (uint16 &result, uint arrayIndex, TEval evalua
|
|||
if (Type)
|
||||
{
|
||||
string str;
|
||||
if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL))
|
||||
if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, ""))
|
||||
{
|
||||
return convertValue (result, str.c_str ());
|
||||
return convertValue (result, str);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2452,9 +2452,9 @@ bool CFormElmArray::getArrayValue (sint32 &result, uint arrayIndex, TEval evalua
|
|||
if (Type)
|
||||
{
|
||||
string str;
|
||||
if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL))
|
||||
if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, ""))
|
||||
{
|
||||
return convertValue (result, str.c_str ());
|
||||
return convertValue (result, str);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2472,9 +2472,9 @@ bool CFormElmArray::getArrayValue (uint32 &result, uint arrayIndex, TEval evalua
|
|||
if (Type)
|
||||
{
|
||||
string str;
|
||||
if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL))
|
||||
if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, ""))
|
||||
{
|
||||
return convertValue (result, str.c_str ());
|
||||
return convertValue (result, str);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2492,9 +2492,9 @@ bool CFormElmArray::getArrayValue (float &result, uint arrayIndex, TEval evaluat
|
|||
if (Type)
|
||||
{
|
||||
string str;
|
||||
if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL))
|
||||
if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, ""))
|
||||
{
|
||||
return convertValue (result, str.c_str ());
|
||||
return convertValue (result, str);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2512,9 +2512,9 @@ bool CFormElmArray::getArrayValue (double &result, uint arrayIndex, TEval evalua
|
|||
if (Type)
|
||||
{
|
||||
string str;
|
||||
if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL))
|
||||
if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, ""))
|
||||
{
|
||||
return convertValue (result, str.c_str ());
|
||||
return convertValue (result, str);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2532,9 +2532,9 @@ bool CFormElmArray::getArrayValue (bool &result, uint arrayIndex, TEval evaluate
|
|||
if (Type)
|
||||
{
|
||||
string str;
|
||||
if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL))
|
||||
if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, ""))
|
||||
{
|
||||
return convertValue (result, str.c_str ());
|
||||
return convertValue (result, str);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2552,9 +2552,9 @@ bool CFormElmArray::getArrayValue (NLMISC::CRGBA &result, uint arrayIndex, TEval
|
|||
if (Type)
|
||||
{
|
||||
string str;
|
||||
if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL))
|
||||
if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, ""))
|
||||
{
|
||||
return convertValue (result, str.c_str ());
|
||||
return convertValue (result, str);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2567,7 +2567,7 @@ bool CFormElmArray::getArrayValue (NLMISC::CRGBA &result, uint arrayIndex, TEval
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
xmlNodePtr CFormElmArray::write (xmlNodePtr root, const CForm *form, const char *structName, bool forceWrite) const
|
||||
xmlNodePtr CFormElmArray::write (xmlNodePtr root, const CForm *form, const std::string &structName, bool forceWrite) const
|
||||
{
|
||||
// Arrau is used ?
|
||||
if (isUsed (form) || forceWrite)
|
||||
|
@ -2576,10 +2576,10 @@ xmlNodePtr CFormElmArray::write (xmlNodePtr root, const CForm *form, const char
|
|||
xmlNodePtr node = xmlNewChild ( root, NULL, (const xmlChar*)"ARRAY", NULL);
|
||||
|
||||
// Element name
|
||||
if (structName != NULL)
|
||||
if (!structName.empty())
|
||||
{
|
||||
// Struct name
|
||||
xmlSetProp (node, (const xmlChar*)"Name", (const xmlChar*)structName);
|
||||
xmlSetProp (node, (const xmlChar*)"Name", (const xmlChar*)structName.c_str());
|
||||
}
|
||||
|
||||
// For each elements of the structure
|
||||
|
@ -2588,7 +2588,7 @@ xmlNodePtr CFormElmArray::write (xmlNodePtr root, const CForm *form, const char
|
|||
{
|
||||
// Create a node
|
||||
if (Elements[elm].Element)
|
||||
Elements[elm].Element->write (node, form, Elements[elm].Name.empty ()?NULL:Elements[elm].Name.c_str (), true);
|
||||
Elements[elm].Element->write (node, form, Elements[elm].Name, true);
|
||||
}
|
||||
|
||||
// Return the new node
|
||||
|
@ -2760,7 +2760,7 @@ void CFormElmArray::getFormName (std::string &result, const CFormElm *child) con
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormElmArray::warning (bool exception, const char *function, const char *format, ... ) const
|
||||
void CFormElmArray::warning (bool exception, const std::string &function, const char *format, ... ) const
|
||||
{
|
||||
// Make a buffer string
|
||||
va_list args;
|
||||
|
@ -2772,7 +2772,7 @@ void CFormElmArray::warning (bool exception, const char *function, const char *f
|
|||
// Set the warning
|
||||
string formName;
|
||||
getFormName (formName, NULL);
|
||||
NLGEORGES::warning (exception, "(CFormElmArray::%s) on node (%s) in form (%s) : %s", function, formName.c_str (), Form->getFilename ().c_str (), buffer);
|
||||
NLGEORGES::warning (exception, "(CFormElmArray::%s) on node (%s) in form (%s) : %s", function.c_str(), formName.c_str (), Form->getFilename ().c_str (), buffer);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -2979,7 +2979,7 @@ bool CFormElmAtom::getValue (NLMISC::CRGBA &result, TEval evaluate) const
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
xmlNodePtr CFormElmAtom::write (xmlNodePtr root, const CForm *form, const char *structName, bool forceWrite) const
|
||||
xmlNodePtr CFormElmAtom::write (xmlNodePtr root, const CForm *form, const std::string &structName, bool forceWrite) const
|
||||
{
|
||||
// Atom is used ?
|
||||
if (isUsed (form) || forceWrite)
|
||||
|
@ -2988,16 +2988,16 @@ xmlNodePtr CFormElmAtom::write (xmlNodePtr root, const CForm *form, const char
|
|||
xmlNodePtr node = xmlNewChild ( root, NULL, (const xmlChar*)"ATOM", NULL);
|
||||
|
||||
// Element name
|
||||
if (structName != NULL)
|
||||
if (!structName.empty())
|
||||
{
|
||||
// Struct name
|
||||
xmlSetProp (node, (const xmlChar*)"Name", (const xmlChar*)structName);
|
||||
xmlSetProp (node, (const xmlChar*)"Name", (const xmlChar*)structName.c_str());
|
||||
}
|
||||
|
||||
// The value
|
||||
if (!Value.empty ())
|
||||
{
|
||||
if (COXml::isStringValidForProperties (Value.c_str ()))
|
||||
if (COXml::isStringValidForProperties (Value))
|
||||
xmlSetProp (node, (const xmlChar*)"Value", (const xmlChar*)Value.c_str());
|
||||
else
|
||||
{
|
||||
|
@ -3049,7 +3049,7 @@ void CFormElmAtom::read (xmlNodePtr node, CFormLoader &/* loader */, const CType
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormElmAtom::setValue (const char *value)
|
||||
void CFormElmAtom::setValue (const std::string &value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
@ -3077,7 +3077,7 @@ void CFormElmAtom::getFormName (std::string &result, const CFormElm *child) cons
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormElmAtom::warning (bool exception, const char *function, const char *format, ... ) const
|
||||
void CFormElmAtom::warning (bool exception, const std::string &function, const char *format, ... ) const
|
||||
{
|
||||
// Make a buffer string
|
||||
va_list args;
|
||||
|
@ -3089,7 +3089,7 @@ void CFormElmAtom::warning (bool exception, const char *function, const char *fo
|
|||
// Set the warning
|
||||
string formName;
|
||||
getFormName (formName, NULL);
|
||||
NLGEORGES::warning (exception, "(CFormElmAtom::%s) on node (%s) in form (%s) : %s", function, formName.c_str (), Form->getFilename ().c_str (), buffer);
|
||||
NLGEORGES::warning (exception, "(CFormElmAtom::%s) on node (%s) in form (%s) : %s", function.c_str(), formName.c_str (), Form->getFilename ().c_str (), buffer);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
|
|
@ -60,10 +60,10 @@ CFormLoader::~CFormLoader()
|
|||
{
|
||||
}
|
||||
|
||||
CType *CFormLoader::loadType (const char *filename)
|
||||
CType *CFormLoader::loadType (const std::string &filename)
|
||||
{
|
||||
// Lower string filename
|
||||
string lowerStr = toLower((string)filename);
|
||||
string lowerStr = toLower(filename);
|
||||
lowerStr = CFile::getFilename (lowerStr);
|
||||
|
||||
// Already in the map ?
|
||||
|
@ -98,7 +98,7 @@ CType *CFormLoader::loadType (const char *filename)
|
|||
else
|
||||
{
|
||||
// Output error
|
||||
warning (false, "loadType", "Can't open the form file (%s).", filename);
|
||||
warning (false, "loadType", "Can't open the form file (%s).", filename.c_str());
|
||||
|
||||
// Delete the type
|
||||
delete type;
|
||||
|
@ -108,7 +108,7 @@ CType *CFormLoader::loadType (const char *filename)
|
|||
catch (const Exception &e)
|
||||
{
|
||||
// Output error
|
||||
warning (false, "loadType", "Error while loading the form (%s): %s", filename, e.what());
|
||||
warning (false, "loadType", "Error while loading the form (%s): %s", filename.c_str(), e.what());
|
||||
|
||||
// Delete the type
|
||||
delete type;
|
||||
|
@ -130,10 +130,10 @@ CType *CFormLoader::loadType (const char *filename)
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
CFormDfn *CFormLoader::loadFormDfn (const char *filename, bool forceLoad)
|
||||
CFormDfn *CFormLoader::loadFormDfn (const std::string &filename, bool forceLoad)
|
||||
{
|
||||
// Lower string filename
|
||||
string lowerStr = toLower((string)filename);
|
||||
string lowerStr = toLower(filename);
|
||||
lowerStr = CFile::getFilename (lowerStr);
|
||||
|
||||
// Already in the map ?
|
||||
|
@ -196,7 +196,7 @@ CFormDfn *CFormLoader::loadFormDfn (const char *filename, bool forceLoad)
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
UForm *CFormLoader::loadForm (const char *filename)
|
||||
UForm *CFormLoader::loadForm (const std::string &filename)
|
||||
{
|
||||
// Lower string filename
|
||||
string lowerStr = toLower((string)filename);
|
||||
|
@ -237,7 +237,7 @@ UForm *CFormLoader::loadForm (const char *filename)
|
|||
name += ".dfn";
|
||||
|
||||
// Load the dfn
|
||||
CFormDfn *dfn = loadFormDfn (name.c_str (), false);
|
||||
CFormDfn *dfn = loadFormDfn (name, false);
|
||||
if (dfn)
|
||||
{
|
||||
// Open the file
|
||||
|
@ -293,21 +293,21 @@ UForm *CFormLoader::loadForm (const char *filename)
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
UFormDfn *CFormLoader::loadFormDfn (const char *filename)
|
||||
UFormDfn *CFormLoader::loadFormDfn (const std::string &filename)
|
||||
{
|
||||
return loadFormDfn (filename, false);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
UType *CFormLoader::loadFormType (const char *filename)
|
||||
UType *CFormLoader::loadFormType (const std::string &filename)
|
||||
{
|
||||
return loadType (filename);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFormLoader::warning (bool exception, const char *function, const char *format, ... ) const
|
||||
void CFormLoader::warning (bool exception, const std::string &function, const char *format, ... ) const
|
||||
{
|
||||
// Make a buffer string
|
||||
va_list args;
|
||||
|
|
|
@ -76,7 +76,7 @@ void CFileHeader::write (xmlNodePtr node) const
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFileHeader::addLog (const char *log)
|
||||
void CFileHeader::addLog (const std::string &log)
|
||||
{
|
||||
time_t t;
|
||||
time (&t);
|
||||
|
@ -92,7 +92,7 @@ void CFileHeader::addLog (const char *log)
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFileHeader::setComments (const char *comments)
|
||||
void CFileHeader::setComments (const std::string &comments)
|
||||
{
|
||||
Comments = comments;
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ const char *CFileHeader::getStateString (TState state)
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CFileHeader::warning (bool exception, const char *function, const char *format, ... ) const
|
||||
void CFileHeader::warning (bool exception, const std::string &function, const char *format, ... ) const
|
||||
{
|
||||
// Make a buffer string
|
||||
va_list args;
|
||||
|
@ -225,7 +225,7 @@ void CFileHeader::warning (bool exception, const char *function, const char *for
|
|||
va_end( args );
|
||||
|
||||
// Set the warning
|
||||
NLGEORGES::warning (exception, "(CFileHeader::%s) : %s", function, buffer);
|
||||
NLGEORGES::warning (exception, "(CFileHeader::%s) : %s", function.c_str(), buffer);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
|
|
@ -326,6 +326,7 @@ public:
|
|||
Type = type;
|
||||
Form = form;
|
||||
}
|
||||
|
||||
virtual CEvalNumExpr::TReturnState evalValue (const char *value, double &result, uint32 round)
|
||||
{
|
||||
// If a form is available
|
||||
|
@ -412,7 +413,7 @@ public:
|
|||
result = res.empty ()?0:1;
|
||||
return CEvalNumExpr::NoError;
|
||||
}
|
||||
else if (((const CFormElm&)Form->getRootNode ()).convertValue (result, res.c_str ()))
|
||||
else if (((const CFormElm&)Form->getRootNode ()).convertValue (result, res))
|
||||
{
|
||||
return CEvalNumExpr::NoError;
|
||||
}
|
||||
|
@ -535,7 +536,7 @@ void buildError (char *msg, uint offset)
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CType::getValue (string &result, const CForm *form, const CFormElmAtom *node, const CFormDfn &parentDfn, uint parentIndex, UFormElm::TEval evaluate, uint32 *where, uint32 round, const char *formName) const
|
||||
bool CType::getValue (string &result, const CForm *form, const CFormElmAtom *node, const CFormDfn &parentDfn, uint parentIndex, UFormElm::TEval evaluate, uint32 *where, uint32 round, const std::string &formName) const
|
||||
{
|
||||
if (round > NLGEORGES_MAX_RECURSION)
|
||||
{
|
||||
|
@ -721,7 +722,7 @@ bool CType::getValue (string &result, const CForm *form, const CFormElmAtom *nod
|
|||
UFormDfn::TEntryType type;
|
||||
|
||||
// Search for the node
|
||||
if (((const CFormElm&)form->getRootNode ()).getNodeByName (valueName.c_str (), &parentDfn, parentIndex, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, false, round+1))
|
||||
if (((const CFormElm&)form->getRootNode ()).getNodeByName (valueName, &parentDfn, parentIndex, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, false, round+1))
|
||||
{
|
||||
// End, return the current index
|
||||
if (type == UFormDfn::EntryType)
|
||||
|
@ -809,7 +810,7 @@ bool CType::uiCompatible (TType type, TUI ui)
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CType::warning (bool exception, const char *formName, const char *formFilename, const char *function, const char *format, ... ) const
|
||||
void CType::warning (bool exception, const std::string &formName, const std::string &formFilename, const std::string &function, const char *format, ... ) const
|
||||
{
|
||||
// Make a buffer string
|
||||
va_list args;
|
||||
|
@ -819,12 +820,12 @@ void CType::warning (bool exception, const char *formName, const char *formFilen
|
|||
va_end( args );
|
||||
|
||||
// Set the warning
|
||||
NLGEORGES::warning (exception, "(CType::%s) In form (%s) in node (%s) : %s", function, formFilename, formName, buffer);
|
||||
NLGEORGES::warning (exception, "(CType::%s) In form (%s) in node (%s) : %s", function.c_str(), formFilename.c_str(), formName.c_str(), buffer);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
void CType::warning2 (bool exception, const char *function, const char *format, ... ) const
|
||||
void CType::warning2 (bool exception, const std::string &function, const char *format, ... ) const
|
||||
{
|
||||
// Make a buffer string
|
||||
va_list args;
|
||||
|
@ -834,7 +835,7 @@ void CType::warning2 (bool exception, const char *function, const char *format,
|
|||
va_end( args );
|
||||
|
||||
// Set the warning
|
||||
NLGEORGES::warning (exception, "(CType::%s) : %s", function, buffer);
|
||||
NLGEORGES::warning (exception, "(CType::%s) : %s", function.c_str(), buffer);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
|
|
@ -405,7 +405,7 @@ void scanFiles(const CSString &filespec)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (form->getRootNode ().getValueByName(valueString,fields[i]._name.c_str(),fields[i]._evaluated,&where)) //fieldForm->getValue(valueString,fields[i]._evaluated))
|
||||
if (form->getRootNode ().getValueByName(valueString,fields[i]._name, fields[i]._evaluated, &where)) //fieldForm->getValue(valueString,fields[i]._evaluated))
|
||||
;//addQuotesRoundString (valueString);
|
||||
else
|
||||
setErrorString (valueString, fields[i]._evaluated, where);
|
||||
|
@ -422,7 +422,7 @@ void scanFiles(const CSString &filespec)
|
|||
|
||||
// UFormElm::TWhereIsValue where;
|
||||
//
|
||||
// bool result=form->getRootNode ().getValueByName(s,fields[i]._name.c_str(),fields[i]._evaluated,&where);
|
||||
// bool result=form->getRootNode ().getValueByName(s,fields[i]._name, fields[i]._evaluated,&where);
|
||||
// if (!result)
|
||||
// {
|
||||
// if (fields[i]._evaluated)
|
||||
|
@ -1122,8 +1122,8 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
|
|||
}
|
||||
//nldebug( "%s: %s '%s'", args[0].c_str(), var.c_str(), memberVal.c_str() );
|
||||
// need to put the value at the correct index.
|
||||
const std::string fieldName=NLMISC::toString("%s[%d]", var.c_str(), currentMemberIndex).c_str();
|
||||
const_cast<UFormElm&>(rootForm).setValueByName(memberVal.c_str(), fieldName.c_str());
|
||||
const std::string fieldName=NLMISC::toString("%s[%u]", var.c_str(), currentMemberIndex).c_str();
|
||||
const_cast<UFormElm&>(rootForm).setValueByName(memberVal, fieldName);
|
||||
isModified=true;
|
||||
displayed = true;
|
||||
}
|
||||
|
@ -1132,7 +1132,7 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
|
|||
if (!isNewSheet)
|
||||
{
|
||||
string test;
|
||||
if ( rootForm.getValueByName(test,var.c_str())
|
||||
if ( rootForm.getValueByName(test, var)
|
||||
&& test==memberVal )
|
||||
{
|
||||
continue;
|
||||
|
@ -1140,7 +1140,7 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
|
|||
|
||||
}
|
||||
//nldebug( "%s: %s '%s'", args[0].c_str(), var.c_str(), memberVal.c_str() );
|
||||
const_cast<UFormElm&>(rootForm).setValueByName(memberVal.c_str(), var.c_str());
|
||||
const_cast<UFormElm&>(rootForm).setValueByName(memberVal, var);
|
||||
isModified=true;
|
||||
displayed = true;
|
||||
}
|
||||
|
|
|
@ -60,6 +60,6 @@ void browseFAQ(NLMISC::CConfigFile &cf)
|
|||
}
|
||||
else
|
||||
{
|
||||
openURL(url.c_str());
|
||||
openURL(url);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ void CItemFXSheet::build(const NLGEORGES::UFormElm &item, const std::string &pre
|
|||
item.getValueByName(AttackFXRot.z, (prefix + "AttackFXRot.Z").c_str());
|
||||
item.getValueByName(ImpactFXDelay, (prefix + "ImpactFXDelay").c_str());
|
||||
const NLGEORGES::UFormElm *array = NULL;
|
||||
if (item.getNodeByName(&array, (prefix + "StaticFXs").c_str()) && array)
|
||||
if (item.getNodeByName(&array, prefix + "StaticFXs") && array)
|
||||
{
|
||||
uint count;
|
||||
nlverify(array->getArraySize(count));
|
||||
|
|
|
@ -75,7 +75,7 @@ void COutpostBuildingSheet::build(const NLGEORGES::UFormElm &root)
|
|||
// Get Mps sheets
|
||||
const UFormElm *pMp;
|
||||
uint32 i = 0;
|
||||
while (pDriller->getNodeByName(&pMp, ("mp" + NLMISC::toString(i)).c_str()) && pMp)
|
||||
while (pDriller->getNodeByName(&pMp, "mp" + NLMISC::toString(i)) && pMp)
|
||||
{
|
||||
string sTmp;
|
||||
pMp->getValueByName(sTmp, "name");
|
||||
|
|
|
@ -226,7 +226,7 @@ void CRaceStatsSheet::buildGroundFXs(const NLGEORGES::UFormElm &item, const std:
|
|||
{
|
||||
// ground fxs
|
||||
const NLGEORGES::UFormElm *elm;
|
||||
if(item.getNodeByName(&elm, name.c_str()) && elm)
|
||||
if(item.getNodeByName(&elm, name) && elm)
|
||||
{
|
||||
// Check array.
|
||||
if(elm->isArray())
|
||||
|
|
|
@ -48,7 +48,7 @@ void CSkyObjectSheet::CColorGradientInfoSheet::build(const NLGEORGES::UFormElm &
|
|||
{
|
||||
item.getValueByName(TargetTextureStage, (prefix + "TargetTextureStage").c_str());
|
||||
const NLGEORGES::UFormElm *elm = NULL;
|
||||
if(item.getNodeByName (&elm, (prefix + "WeatherToGradient").c_str()) && elm)
|
||||
if(item.getNodeByName (&elm, prefix + "WeatherToGradient") && elm)
|
||||
{
|
||||
uint numBitmaps;
|
||||
nlverify (elm->getArraySize (numBitmaps));
|
||||
|
|
|
@ -3910,7 +3910,7 @@ NLMISC_COMMAND (url, "launch a browser to the specified url", "<url>")
|
|||
if (args.size () != 1)
|
||||
return false;
|
||||
|
||||
return openURL(args[0].c_str());
|
||||
return openURL(args[0]);
|
||||
}
|
||||
|
||||
NLMISC_COMMAND( reconnect, "Reconnect to the same shard (self Far TP)", "")
|
||||
|
|
|
@ -1911,7 +1911,7 @@ class CAHOpenURL : public IActionHandler
|
|||
else
|
||||
url += "?";
|
||||
url += "language=" + ClientCfg.LanguageCode;
|
||||
openURL(url.c_str());
|
||||
openURL(url);
|
||||
|
||||
nlinfo("openURL %s", url.c_str());
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ void CLightCycle::build(const NLGEORGES::UFormElm &item)
|
|||
for(uint k = 0; k < EGSPD::CSeason::Invalid; ++k)
|
||||
{
|
||||
const NLGEORGES::UFormElm *seasonsItem;
|
||||
if (item.getNodeByName(&seasonsItem, EGSPD::CSeason::toString( (EGSPD::CSeason::TSeason) k).c_str()) && seasonsItem)
|
||||
if (item.getNodeByName(&seasonsItem, EGSPD::CSeason::toString( (EGSPD::CSeason::TSeason) k)) && seasonsItem)
|
||||
{
|
||||
SeasonLightCycle[k].build(*seasonsItem);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ void CStaticLightCycle::readGeorges( const NLMISC::CSmartPtr<NLGEORGES::UForm> &
|
|||
for( uint i = 0; i < NbSeasons; ++i )
|
||||
{
|
||||
UFormElm* SeasonElt = NULL;
|
||||
if( ! ( root.getNodeByName( &SeasonElt, season[ i ].c_str() ) && SeasonElt ) )
|
||||
if( ! ( root.getNodeByName( &SeasonElt, season[ i ] ) && SeasonElt ) )
|
||||
{
|
||||
nlwarning("<CStaticLightCycle readGeorges> can get node %s in sheet %s", season[ i ].c_str(), sheetId.toString().c_str() );
|
||||
}
|
||||
|
|
|
@ -258,7 +258,7 @@ void AISHEETS::CCreature::calcFightAndVisualValues(std::string* left, std::strin
|
|||
void AISHEETS::CCreature::parseFightConfig(NLGEORGES::UForm const* form, std::string const& fightConfigString, uint32 actionListIndex, NLMISC::CDbgPtr<CActionList>& fightConfig)
|
||||
{
|
||||
NLGEORGES::UFormElm const* actionListNode = NULL;
|
||||
const_cast<NLGEORGES::UFormElm&>(form->getRootNode()).getNodeByName(&actionListNode, fightConfigString.c_str());
|
||||
const_cast<NLGEORGES::UFormElm&>(form->getRootNode()).getNodeByName(&actionListNode, fightConfigString);
|
||||
|
||||
if (actionListNode)
|
||||
{
|
||||
|
|
|
@ -1754,10 +1754,10 @@ void CStaticBrick::loadFaber( const UFormElm &root, const CSheetId &sheetId )
|
|||
for (uint i = 1 ; i <= 5 ; ++i)
|
||||
{
|
||||
propName = "faber.Create.MP "+toString(i);
|
||||
if (root.getValueByName( value, propName.c_str() ) && !value.empty() )
|
||||
if (root.getValueByName( value, propName ) && !value.empty() )
|
||||
{
|
||||
propName = "faber.Create.Quantity "+toString(i);
|
||||
if ( root.getValueByName( quantity, propName.c_str() ) && quantity > 0)
|
||||
if ( root.getValueByName( quantity, propName ) && quantity > 0)
|
||||
{
|
||||
CFaber::TRawMaterial mp;
|
||||
mp.MpType = RM_FABER_TYPE::toFaberType( value );
|
||||
|
|
|
@ -1770,12 +1770,12 @@ void CStaticCharacters::readGeorges( const NLMISC::CSmartPtr<NLGEORGES::UForm> &
|
|||
|
||||
for( i = 0; i < SLOT_EQUIPMENT::NB_SLOT_EQUIPMENT; ++i )
|
||||
{
|
||||
root.getValueByName( sheetName, (string("Basics.Equipment.") + SLOT_EQUIPMENT::toString( (SLOT_EQUIPMENT::TSlotEquipment) i ) + string(".Item" )).c_str() );
|
||||
if( sheetName != string("") )
|
||||
root.getValueByName( sheetName, "Basics.Equipment." + SLOT_EQUIPMENT::toString( (SLOT_EQUIPMENT::TSlotEquipment) i ) + ".Item" );
|
||||
if (!sheetName.empty())
|
||||
{
|
||||
sheet = CSheetId( sheetName );
|
||||
Items[ i ].IdSheet = sheet.asInt();
|
||||
root.getValueByName( Items[ i ].Quality, (string("Basics.Equipment.") + SLOT_EQUIPMENT::toString( (SLOT_EQUIPMENT::TSlotEquipment) i ) + string(".Quality")).c_str() );
|
||||
root.getValueByName( Items[ i ].Quality, "Basics.Equipment." + SLOT_EQUIPMENT::toString( (SLOT_EQUIPMENT::TSlotEquipment) i ) + ".Quality" );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1789,12 +1789,12 @@ void CStaticCharacters::readGeorges( const NLMISC::CSmartPtr<NLGEORGES::UForm> &
|
|||
///////////////////////////////////////////////////////
|
||||
/* for( i = 0; i < NB_SHEATH; ++i )
|
||||
{
|
||||
root.getValueByName( sheetName, (string("Basics.Equipment.Sheath") + toString( i ) + string("LeftHand.Item" )).c_str() );
|
||||
root.getValueByName( sheetName, "Basics.Equipment.Sheath" + toString( i ) + "LeftHand.Item" );
|
||||
if( sheetName != string("") )
|
||||
{
|
||||
sheet = CSheetId( sheetName );
|
||||
Sheaths[ i ].Left.IdSheet = sheet.asInt();
|
||||
root.getValueByName( Sheaths[ i ].Left.Quality, (string("Basics.Equipment.Sheath") + toString( i ) + string("LeftHand.Quality")).c_str() );
|
||||
root.getValueByName( Sheaths[ i ].Left.Quality, "Basics.Equipment.Sheath" + toString( i ) + "LeftHand.Quality" );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1802,12 +1802,12 @@ void CStaticCharacters::readGeorges( const NLMISC::CSmartPtr<NLGEORGES::UForm> &
|
|||
Sheaths[ i ].Left.Quality = 0;
|
||||
}
|
||||
|
||||
root.getValueByName( sheetName, (string("Basics.Equipment.Sheath") + toString( i ) + string("RightHand.Item" )).c_str() );
|
||||
root.getValueByName( sheetName, "Basics.Equipment.Sheath" + toString( i ) + "RightHand.Item" );
|
||||
if( sheetName != string("") )
|
||||
{
|
||||
sheet = CSheetId( sheetName );
|
||||
Sheaths[ i ].Right.IdSheet = sheet.asInt();
|
||||
root.getValueByName( Sheaths[ i ].Right.Quality, (string("Basics.Equipment.Sheath") + toString( i ) + string("RightHand.Quality")).c_str() );
|
||||
root.getValueByName( Sheaths[ i ].Right.Quality, "Basics.Equipment.Sheath" + toString( i ) + "RightHand.Quality" );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1815,12 +1815,12 @@ void CStaticCharacters::readGeorges( const NLMISC::CSmartPtr<NLGEORGES::UForm> &
|
|||
Sheaths[ i ].Right.Quality = 0;
|
||||
}
|
||||
|
||||
root.getValueByName( sheetName, (string("Basics.Equipment.Sheath") + toString( i ) + string("Ammo0.Item" )).c_str() );
|
||||
root.getValueByName( sheetName, "Basics.Equipment.Sheath" + toString( i ) + "Ammo0.Item" );
|
||||
if( sheetName != string("") )
|
||||
{
|
||||
sheet = CSheetId( sheetName );
|
||||
Sheaths[ i ].Ammo0.IdSheet = sheet.asInt();
|
||||
root.getValueByName( Sheaths[ i ].Ammo0.Quality, (string("Basics.Equipment.Sheath") + toString( i ) + string("Ammo0.Quality")).c_str() );
|
||||
root.getValueByName( Sheaths[ i ].Ammo0.Quality, "Basics.Equipment.Sheath" + toString( i ) + "Ammo0.Quality" );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1828,12 +1828,12 @@ void CStaticCharacters::readGeorges( const NLMISC::CSmartPtr<NLGEORGES::UForm> &
|
|||
Sheaths[ i ].Ammo0.Quality = 0;
|
||||
}
|
||||
|
||||
root.getValueByName( sheetName, (string("Basics.Equipment.Sheath") + toString( i ) + string("Ammo1.Item" )).c_str() );
|
||||
root.getValueByName( sheetName, "Basics.Equipment.Sheath" + toString( i ) + "Ammo1.Item" );
|
||||
if( sheetName != string("") )
|
||||
{
|
||||
sheet = CSheetId( sheetName );
|
||||
Sheaths[ i ].Ammo1.IdSheet = sheet.asInt();
|
||||
root.getValueByName( Sheaths[ i ].Ammo1.Quality, (string("Basics.Equipment.Sheath") + toString( i ) + string("Ammo1.Quality")).c_str() );
|
||||
root.getValueByName( Sheaths[ i ].Ammo1.Quality, "Basics.Equipment.Sheath" + toString( i ) + "Ammo1.Quality" );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1841,12 +1841,12 @@ void CStaticCharacters::readGeorges( const NLMISC::CSmartPtr<NLGEORGES::UForm> &
|
|||
Sheaths[ i ].Ammo1.Quality = 0;
|
||||
}
|
||||
|
||||
root.getValueByName( sheetName, (string("Basics.Equipment.Sheath") + toString( i ) + string("Ammo2.Item" )).c_str() );
|
||||
root.getValueByName( sheetName, "Basics.Equipment.Sheath" + toString( i ) + "Ammo2.Item" );
|
||||
if( sheetName != string("") )
|
||||
{
|
||||
sheet = CSheetId( sheetName );
|
||||
Sheaths[ i ].Ammo2.IdSheet = sheet.asInt();
|
||||
root.getValueByName( Sheaths[ i ].Ammo2.Quality, (string("Basics.Equipment.Sheath") + toString( i ) + string("Ammo2.Quality")).c_str() );
|
||||
root.getValueByName( Sheaths[ i ].Ammo2.Quality, "Basics.Equipment.Sheath" + toString( i ) + "Ammo2.Quality" );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2202,7 +2202,7 @@ void CStaticRaceStats::readGeorges( const NLMISC::CSmartPtr<NLGEORGES::UForm> &f
|
|||
int i;
|
||||
for( i = 0; i < CHARACTERISTICS::NUM_CHARACTERISTICS; ++i )
|
||||
{
|
||||
root.getValueByName( Characteristics[ (CHARACTERISTICS::TCharacteristics)i ], ( string("Characteristics.") + CHARACTERISTICS::toString( (CHARACTERISTICS::TCharacteristics)i ) ).c_str() );
|
||||
root.getValueByName( Characteristics[ (CHARACTERISTICS::TCharacteristics)i ], "Characteristics." + CHARACTERISTICS::toString( (CHARACTERISTICS::TCharacteristics)i ) );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
|
@ -2210,7 +2210,7 @@ void CStaticRaceStats::readGeorges( const NLMISC::CSmartPtr<NLGEORGES::UForm> &f
|
|||
///////////////////////////////////////////////////////
|
||||
for( i = 0; i < SCORES::NUM_SCORES; ++i )
|
||||
{
|
||||
root.getValueByName( Scores[ i ], ( string("Scores.") + SCORES::toString( i ) ).c_str(), UFormElm::Formula );
|
||||
root.getValueByName( Scores[ i ], "Scores." + SCORES::toString( i ), UFormElm::Formula );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
|
@ -2306,7 +2306,7 @@ void CStaticRole::readGeorgesSentenceAndEquipment( UFormElm& root, const NLMISC:
|
|||
{
|
||||
string value;
|
||||
const UFormElm *sentenceArray = NULL;
|
||||
if (root.getNodeByName (&sentenceArray, SentenceString.c_str()) && sentenceArray)
|
||||
if (root.getNodeByName (&sentenceArray, SentenceString) && sentenceArray)
|
||||
{
|
||||
// Get array size
|
||||
uint size;
|
||||
|
@ -2352,12 +2352,12 @@ void CStaticRole::readGeorgesSentenceAndEquipment( UFormElm& root, const NLMISC:
|
|||
|
||||
for( int i = 0; i < SLOT_EQUIPMENT::NB_SLOT_EQUIPMENT; ++i )
|
||||
{
|
||||
root.getValueByName( sheetName, ( EquipmentString + string(".") + SLOT_EQUIPMENT::toString( (SLOT_EQUIPMENT::TSlotEquipment) i ) + string(".Item" )).c_str() );
|
||||
if( sheetName != string("") )
|
||||
root.getValueByName( sheetName, EquipmentString + "." + SLOT_EQUIPMENT::toString( (SLOT_EQUIPMENT::TSlotEquipment) i ) + ".Item" );
|
||||
if (!sheetName.empty())
|
||||
{
|
||||
sheet = CSheetId( sheetName );
|
||||
Items[ i ].IdSheet = sheet.asInt();
|
||||
root.getValueByName( Items[ i ].Quality, ( EquipmentString + string(".") + SLOT_EQUIPMENT::toString( (SLOT_EQUIPMENT::TSlotEquipment) i ) + string(".Quality")).c_str() );
|
||||
root.getValueByName( Items[ i ].Quality, EquipmentString + "." + SLOT_EQUIPMENT::toString( (SLOT_EQUIPMENT::TSlotEquipment) i ) + ".Quality" );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -83,8 +83,8 @@ static void getVarListFromParents (const NLGEORGES::UForm *form, std::set<NLGEOR
|
|||
const NLGEORGES::UFormElm &item=form->getRootNode();
|
||||
|
||||
NLGEORGES::UFormElm *elem=NULL;
|
||||
const_cast<NLGEORGES::UFormElm*>(&item)->getNodeByName(&elem, varName.c_str());
|
||||
if (elem!=NULL) // item.getValueByName(temp, varName.c_str()))
|
||||
const_cast<NLGEORGES::UFormElm*>(&item)->getNodeByName(&elem, varName);
|
||||
if (elem!=NULL) // item.getValueByName(temp, varName))
|
||||
{
|
||||
varList.insert (elem);
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ void CStaticHarvestable::loadFromGeorges( const UForm &form, const NLMISC::CShee
|
|||
*/
|
||||
{
|
||||
string value;
|
||||
if ( form.getRootNode().getValueByName( value, (string("Harvest.")+"Skill").c_str() )
|
||||
if ( form.getRootNode().getValueByName( value, "Harvest.Skill" )
|
||||
&& !value.empty() )
|
||||
{
|
||||
_HarvestSkill = SKILLS::toSkill( value );
|
||||
|
@ -139,22 +139,22 @@ void CStaticHarvestable::loadFromGeorges( const UForm &form, const NLMISC::CShee
|
|||
const string mpName=NLMISC::toString("MP%u",i);
|
||||
CStaticCreatureRawMaterial mp;
|
||||
|
||||
if( form.getRootNode().getValueByName( mp.MpCommon.AssociatedItemName, ("Harvest." +mpName+".AssociatedItem").c_str())
|
||||
if( form.getRootNode().getValueByName( mp.MpCommon.AssociatedItemName, "Harvest." +mpName+".AssociatedItem")
|
||||
&& !mp.MpCommon.AssociatedItemName.empty() )
|
||||
{
|
||||
if (VerboseQuartering)
|
||||
nldebug("QRTR: %s=%s", mpName.c_str(), mp.MpCommon.AssociatedItemName.c_str());
|
||||
|
||||
form.getRootNode().getValueByName( mp.MpCommon.Name, ("Harvest." +mpName+".Name").c_str() );
|
||||
form.getRootNode().getValueByName( mp.MpCommon.Name, "Harvest." +mpName+".Name" );
|
||||
uint16 sheetQuantity;
|
||||
form.getRootNode().getValueByName( sheetQuantity, ("Harvest." +mpName+".Quantity").c_str() );
|
||||
form.getRootNode().getValueByName( sheetQuantity, "Harvest." +mpName+".Quantity" );
|
||||
if ( sheetQuantity != 0 )
|
||||
{
|
||||
nlwarning( "Quantity set to %hu in %s", sheetQuantity, sheetId.toString().c_str() );
|
||||
}
|
||||
form.getRootNode().getValueByName( mp.MpCommon.MinQuality, ("Harvest." +mpName+".MinQuality").c_str() );
|
||||
form.getRootNode().getValueByName( mp.MpCommon.MaxQuality, ("Harvest." +mpName+".MaxQuality").c_str() );
|
||||
// harvest->getValueByName( mp.PresenceProbabilities, (mpName+".PresenceProbabilities").c_str() );
|
||||
form.getRootNode().getValueByName( mp.MpCommon.MinQuality, "Harvest." +mpName+".MinQuality" );
|
||||
form.getRootNode().getValueByName( mp.MpCommon.MaxQuality, "Harvest." +mpName+".MaxQuality" );
|
||||
// harvest->getValueByName( mp.PresenceProbabilities, mpName+".PresenceProbabilities" );
|
||||
|
||||
mp.ItemId = mp.MpCommon.AssociatedItemName;
|
||||
if ( mp.MpCommon.MinQuality == 0)
|
||||
|
|
|
@ -142,12 +142,12 @@ void CStaticOutpostBuilding::CDriller::readGeorges (const NLGEORGES::UFormElm *p
|
|||
TotalMP = 0.0f;
|
||||
for (uint i = 0; i < 20; ++i)
|
||||
{
|
||||
string namePath = NLMISC::toString("mp%d.name", i);
|
||||
string quantityPath = NLMISC::toString("mp%d.quantity", i);
|
||||
string namePath = NLMISC::toString("mp%u.name", i);
|
||||
string quantityPath = NLMISC::toString("mp%u.quantity", i);
|
||||
string name;
|
||||
float quantity;
|
||||
pElt->getValueByName (name, namePath.c_str());
|
||||
pElt->getValueByName (quantity, quantityPath.c_str());
|
||||
pElt->getValueByName (name, namePath);
|
||||
pElt->getValueByName (quantity, quantityPath);
|
||||
if(!name.empty() && quantity>0.f)
|
||||
{
|
||||
CSheetId mpSheetId = CSheetId(name);
|
||||
|
|
|
@ -41,7 +41,7 @@ void CStaticRolemasterPhrase::readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UF
|
|||
uint i = 0;
|
||||
while ( i < 100 )
|
||||
{
|
||||
bool res = form->getRootNode().getValueByName( sbrickSheetName, toString( "brick %u", i ).c_str() );
|
||||
bool res = form->getRootNode().getValueByName( sbrickSheetName, toString( "brick %u", i ) );
|
||||
if ( (! res) || sbrickSheetName.empty() )
|
||||
{
|
||||
++i;
|
||||
|
|
|
@ -44,7 +44,7 @@ IAction::IAction (TTypeAction type, uint selId, uint slot)
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void IAction::setLabel (const char *logLabel, CGeorgesEditDoc &doc)
|
||||
void IAction::setLabel (const std::string &logLabel, CGeorgesEditDoc &doc)
|
||||
{
|
||||
_LogLabel = logLabel;
|
||||
|
||||
|
@ -75,7 +75,7 @@ bool IAction::doAction (CGeorgesEditDoc &doc, bool redo, bool &modified, bool fi
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void IAction::update (bool updateLeftView, TUpdateRightView rightViewFlag, CGeorgesEditDoc &doc, const char *_FormName)
|
||||
void IAction::update (bool updateLeftView, TUpdateRightView rightViewFlag, CGeorgesEditDoc &doc, const std::string &_FormName)
|
||||
{
|
||||
// Right and left view
|
||||
CGeorgesEditView *rightView = doc.getRightView ();
|
||||
|
@ -129,7 +129,7 @@ void IAction::update (bool updateLeftView, TUpdateRightView rightViewFlag, CGeor
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
CActionString::CActionString (IAction::TTypeAction type, const char *newValue, CGeorgesEditDoc &doc, const char *formName, const char *userData, uint selId, uint slot) : IAction (type, selId, slot)
|
||||
CActionString::CActionString (IAction::TTypeAction type, const std::string &newValue, CGeorgesEditDoc &doc, const std::string &formName, const std::string &userData, uint selId, uint slot) : IAction (type, selId, slot)
|
||||
{
|
||||
// Set the new value
|
||||
_NewValue = newValue;
|
||||
|
@ -145,7 +145,9 @@ CActionString::CActionString (IAction::TTypeAction type, const char *newValue, C
|
|||
CType *type = doc.getTypePtr ();
|
||||
_OldValue = toString ((int)(type->Type));
|
||||
setLabel ("Type Type", doc);
|
||||
_Log[1] = type->getTypeName ((UType::TType)atoi (newValue));
|
||||
uint ttype;
|
||||
fromString(newValue, ttype);
|
||||
_Log[1] = type->getTypeName ((UType::TType)ttype);
|
||||
}
|
||||
break;
|
||||
case TypeUI:
|
||||
|
@ -153,7 +155,9 @@ CActionString::CActionString (IAction::TTypeAction type, const char *newValue, C
|
|||
CType *type = doc.getTypePtr ();
|
||||
_OldValue = toString ((int)(type->UIType));
|
||||
setLabel ("Type UI", doc);
|
||||
_Log[1] = type->getUIName ((CType::TUI)atoi (newValue));
|
||||
uint ttype;
|
||||
fromString(newValue, ttype);
|
||||
_Log[1] = type->getUIName ((CType::TUI)ttype);
|
||||
}
|
||||
break;
|
||||
case TypeDefault:
|
||||
|
|
|
@ -59,7 +59,7 @@ protected:
|
|||
IAction (TTypeAction type, uint selId, uint slot);
|
||||
|
||||
// Init log label
|
||||
void setLabel (const char *logLabel, CGeorgesEditDoc &doc);
|
||||
void setLabel (const std::string &logLabel, CGeorgesEditDoc &doc);
|
||||
|
||||
public:
|
||||
|
||||
|
@ -96,7 +96,7 @@ protected:
|
|||
UpdateValues,
|
||||
Redraw
|
||||
};
|
||||
void update (bool updateLeftView, TUpdateRightView rightView, CGeorgesEditDoc &doc, const char *_FormName);
|
||||
void update (bool updateLeftView, TUpdateRightView rightView, CGeorgesEditDoc &doc, const std::string &_FormName);
|
||||
};
|
||||
|
||||
// String modification action
|
||||
|
@ -105,7 +105,7 @@ class CActionString : public IAction
|
|||
public:
|
||||
|
||||
// Constructor
|
||||
CActionString (IAction::TTypeAction type, const char *newValue, CGeorgesEditDoc &doc, const char *formName, const char *userData, uint selId, uint slot);
|
||||
CActionString(IAction::TTypeAction type, const std::string &newValue, CGeorgesEditDoc &doc, const std::string &formName, const std::string &userData, uint selId, uint slot);
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -165,7 +165,7 @@ class CActionBuffer : public IAction
|
|||
public:
|
||||
|
||||
// Constructor
|
||||
CActionBuffer (IAction::TTypeAction type, const uint8 *buffer, uint bufferSize, CGeorgesEditDoc &doc, const char *formName, const char *userData, uint selId, uint slot);
|
||||
CActionBuffer (IAction::TTypeAction type, const uint8 *buffer, uint bufferSize, CGeorgesEditDoc &doc, const std::string &formName, const std::string &userData, uint selId, uint slot);
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -182,4 +182,4 @@ protected:
|
|||
virtual bool doAction (CGeorgesEditDoc &doc, bool redo, bool &modified, bool firstTime);
|
||||
};
|
||||
|
||||
#endif GEORGES_EDIT_ACTION_H
|
||||
#endif
|
||||
|
|
|
@ -1292,14 +1292,14 @@ void IFormWidget::updateLabel ()
|
|||
UFormElm::TWhereIsValue where;
|
||||
CForm *form=doc->getFormPtr ();
|
||||
CFormElm *elm = doc->getRootNode (getSlot ());
|
||||
nlverify (elm->getValueByName (result, FormName.c_str (), UFormElm::NoEval, &where));
|
||||
nlverify (elm->getValueByName (result, FormName, UFormElm::NoEval, &where));
|
||||
|
||||
// Get the value evaluated
|
||||
std::string resultEvaluated;
|
||||
#ifdef TEST_EVAL_FORMULA
|
||||
bool error = !elm->getValueByName (resultEvaluated, FormName.c_str (), UFormElm::Formula, &where);
|
||||
bool error = !elm->getValueByName (resultEvaluated, FormName, UFormElm::Formula, &where);
|
||||
#else // TEST_EVAL_FORMULA
|
||||
bool error = !elm->getValueByName (resultEvaluated, FormName.c_str (), UFormElm::Eval, &where);
|
||||
bool error = !elm->getValueByName (resultEvaluated, FormName, UFormElm::Eval, &where);
|
||||
#endif // TEST_EVAL_FORMULA
|
||||
|
||||
// Complete the array ?
|
||||
|
@ -1688,7 +1688,7 @@ void CFormMemCombo::getFromDocument (CForm &form)
|
|||
if ((SrcType == TypeForm) || (SrcType == TypeType))
|
||||
{
|
||||
string result;
|
||||
if (doc->getRootNode(getSlot ())->getValueByName (result, FormName.c_str(), UFormElm::NoEval, NULL))
|
||||
if (doc->getRootNode(getSlot ())->getValueByName (result, FormName, UFormElm::NoEval, NULL))
|
||||
{
|
||||
Combo.UpdateData ();
|
||||
Combo.SetWindowText (result.c_str());
|
||||
|
|
Loading…
Reference in a new issue