From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a02552.html | 7440 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 7440 insertions(+) create mode 100644 docs/doxygen/nel/a02552.html (limited to 'docs/doxygen/nel/a02552.html') diff --git a/docs/doxygen/nel/a02552.html b/docs/doxygen/nel/a02552.html new file mode 100644 index 00000000..c4bc7e8b --- /dev/null +++ b/docs/doxygen/nel/a02552.html @@ -0,0 +1,7440 @@ + + +NeL: NLGEORGES::CFormElmArray class Reference + + + +
+

NLGEORGES::CFormElmArray Class Reference

#include <form_elm.h> +

+

Inheritance diagram for NLGEORGES::CFormElmArray: +

+ +NLGEORGES::CFormElm +NLGEORGES::UFormElm + +

Detailed Description

+Define an array of elements +

+ +

+Definition at line 355 of file form_elm.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Types

enum  TEval { NoEval, +Formula, +Eval + }
 Value evalution. More...

enum  TWhereIsNode { NodeForm, +NodeParentForm, +NodeDfn, +NodeType + }
 Where a node has been found. More...

enum  TWhereIsValue {
+  ValueForm, +ValueParentForm, +ValueDefaultDfn, +ValueDefaultType, +
+  Dummy = 0xffffffff +
+ }
 Where a value has been found. More...


Public Member Functions

bool arrayDeleteNodeByName (const char *name, const CFormDfn **parentDfn, uint &indexDfn, const CFormDfn **nodeDfn, const CType **nodeType, CFormElm **node, UFormDfn::TEntryType &type, bool &array, bool verbose, uint arrayIndex) const
bool arrayInsertNodeByName (const char *name, const CFormDfn **parentDfn, uint &indexDfn, const CFormDfn **nodeDfn, const CType **nodeType, CFormElm **node, UFormDfn::TEntryType &type, bool &array, bool verbose, uint arrayIndex) const
 CFormElmArray (CForm *form, const CFormDfn *formDfn, const CType *type, CFormElm *parentNode, const CFormDfn *parentDfn, uint parentIndex)
void clean ()
 Reset contents.

bool convertValue (NLMISC::CRGBA &result, const char *value) const
bool convertValue (bool &result, const char *value) const
bool convertValue (double &result, const char *value) const
bool convertValue (float &result, const char *value) const
bool convertValue (uint32 &result, const char *value) const
bool convertValue (sint32 &result, const char *value) const
bool convertValue (uint16 &result, const char *value) const
bool convertValue (sint16 &result, const char *value) const
bool convertValue (uint8 &result, const char *value) const
bool convertValue (sint8 &result, const char *value) const
bool createNodeByName (const char *name, const CFormDfn **parentDfn, uint &indexDfn, const CFormDfn **nodeDfn, const CType **nodeType, CFormElm **node, UFormDfn::TEntryType &type, bool &array, bool &created)
bool deleteNodeByName (const char *name, const CFormDfn **parentDfn, uint &indexDfn, const CFormDfn **nodeDfn, const CType **nodeType, CFormElm **node, UFormDfn::TEntryType &type, bool &array)
bool getArrayNode (UFormElm **result, uint arrayIndex)
bool getArrayNode (const UFormElm **result, uint arrayIndex) const
bool getArrayNodeName (std::string &result, uint arrayIndex) const
 Return the name of a table element.

bool getArraySize (uint &size) const
 Return true if the element is an array and fill size with the array size.

bool getArrayValue (NLMISC::CRGBA &result, uint arrayIndex, TEval evaluate, TWhereIsValue *where) const
 Warning, only R, G and B members are filled, not A.

bool getArrayValue (bool &result, uint arrayIndex, TEval evaluate, TWhereIsValue *where) const
bool getArrayValue (double &result, uint arrayIndex, TEval evaluate, TWhereIsValue *where) const
bool getArrayValue (float &result, uint arrayIndex, TEval evaluate, TWhereIsValue *where) const
bool getArrayValue (uint32 &result, uint arrayIndex, TEval evaluate, TWhereIsValue *where) const
bool getArrayValue (sint32 &result, uint arrayIndex, TEval evaluate, TWhereIsValue *where) const
bool getArrayValue (uint16 &result, uint arrayIndex, TEval evaluate, TWhereIsValue *where) const
bool getArrayValue (sint16 &result, uint arrayIndex, TEval evaluate, TWhereIsValue *where) const
bool getArrayValue (uint8 &result, uint arrayIndex, TEval evaluate, TWhereIsValue *where) const
bool getArrayValue (sint8 &result, uint arrayIndex, TEval evaluate, TWhereIsValue *where) const
bool getArrayValue (std::string &result, uint arrayIndex, TEval evaluate, TWhereIsValue *where) const
void getDependencies (std::set< std::string > &dependencies) const
virtual bool getDfnName (std::string &dfnName) const
 Get the dfn filename for this virtual struct. Must be a virtual struct node.

CFormgetForm () const
void getFormName (std::string &result, const CFormElm *child) const
bool getNodeByName (const char *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
virtual bool getNodeByName (UFormElm **result, const char *name, TWhereIsNode *where, bool verbose, uint32 round=0)
virtual bool getNodeByName (const UFormElm **result, const char *name, TWhereIsNode *where, bool verbose, uint32 round=0) const
virtual UFormElmgetParent () const
virtual UFormDfngetStructDfn ()
 Return the struct dfn.

virtual bool getStructNode (uint element, UFormElm **result)
 Return a mutable element pointer. Can be NULL if the node doesn't exist.

virtual bool getStructNode (uint element, const UFormElm **result) const
 Return a const element pointer. Can be NULL if the node doesn't exist.

virtual bool getStructNodeName (uint element, std::string &result) const
 Return the element name.

virtual bool getStructSize (uint &size) const
 Return the struct size.

virtual bool getValue (NLMISC::CRGBA &resultname, TEval evaluate) const
 Warning, only R, G and B members are filled, not A.

virtual bool getValue (bool &resultname, TEval evaluate) const
virtual bool getValue (double &resultname, TEval evaluate) const
virtual bool getValue (float &resultname, TEval evaluate) const
virtual bool getValue (uint32 &resultname, TEval evaluate) const
virtual bool getValue (sint32 &resultname, TEval evaluate) const
virtual bool getValue (uint16 &resultname, TEval evaluate) const
virtual bool getValue (sint16 &resultname, TEval evaluate) const
virtual bool getValue (uint8 &resultname, TEval evaluate) const
virtual bool getValue (sint8 &resultname, TEval evaluate) const
virtual bool getValue (std::string &resultname, TEval evaluate) const
virtual bool getValueByName (NLMISC::CRGBA &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const
 Warning, only R, G and B members are filled, not A.

virtual bool getValueByName (bool &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 (float &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 (sint32 &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 (sint16 &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 (sint8 &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const
virtual bool getValueByName (std::string &result, const char *name, TEval evaluate, TWhereIsValue *where, uint32 round=0) const
bool isArray () const
 Return true if the element is an array.

virtual bool isAtom () const
 Return true if the element is an atom.

virtual bool isStruct () const
 Return true if the element is a struct or a virtual struct.

bool isUsed (const CForm *form) const
virtual bool isVirtualStruct () const
 Return true if the element is a virtual struct.

void read (xmlNodePtr node, CFormLoader &loader, CForm *form)
bool setParent (CFormElm *parent)
virtual bool setValueByName (NLMISC::CRGBA value, const char *name, bool *created)
virtual bool setValueByName (bool value, const char *name, bool *created)
virtual bool setValueByName (double value, const char *name, bool *created)
virtual bool setValueByName (float value, const char *name, bool *created)
virtual bool setValueByName (uint32 value, const char *name, bool *created)
virtual bool setValueByName (sint32 value, const char *name, bool *created)
virtual bool setValueByName (uint16 value, const char *name, bool *created)
virtual bool setValueByName (sint16 value, const char *name, bool *created)
virtual bool setValueByName (uint8 value, const char *name, bool *created)
virtual bool setValueByName (sint8 value, const char *name, bool *created)
virtual bool setValueByName (const char *value, const char *name, bool *created)
void unlink (CFormElm *child)
virtual void warning (bool exception, const char *function, const char *format,...) const
xmlNodePtr write (xmlNodePtr node, const CForm *form, const char *structName, bool forceWrite=false) const
virtual ~CFormElmArray ()

Static Public Member Functions

const char * tokenize (const char *name, std::string &str, uint &errorIndex, uint &code)

Data Fields

std::vector< CElementElements
NLMISC::CSmartPtr< CFormDfnFormDfn
const CTypeType

Protected Types

enum  TNodeAction { Return, +Create, +Delete + }

Static Protected Member Functions

bool getIternalNodeByName (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)
void warning (bool exception, const char *formName, const char *formFileName, const char *function, const char *format,...)

Protected Attributes

CFormForm
const CFormDfnParentDfn
uint ParentIndex
CFormElmParentNode
uint32 Round
+


Member Enumeration Documentation

+

+ + + + +
+ + +
enum NLGEORGES::UFormElm::TEval [inherited] +
+
+ + + + + +
+   + + +

+Value evalution. +

+

Enumeration values:
+ + + + +
NoEval  +
Formula  +The value will not be evaluated at all, the litteral value will be returned.
Eval  +Eval the enumeration value, but don't evaluate the formula nor the value references.
+
+ +

+Definition at line 47 of file u_form_elm.h. +

+

00048         {               
+00049                 NoEval,                         
+00050                 Formula,                        
+00051                 Eval,                           
+00052         };
+
+

+ + + + +
+ + +
enum NLGEORGES::CFormElm::TNodeAction [protected, inherited] +
+
+ + + + + +
+   + + +

+

Enumeration values:
+ + + + +
Return  +
Create  +
Delete  +
+
+ +

+Definition at line 195 of file form_elm.h. +

+

00196         {
+00197                 Return,
+00198                 Create,
+00199                 Delete,
+00200         };
+
+

+ + + + +
+ + +
enum NLGEORGES::UFormElm::TWhereIsNode [inherited] +
+
+ + + + + +
+   + + +

+Where a node has been found. +

+

Enumeration values:
+ + + + + +
NodeForm  +
NodeParentForm  +The node has been found in the form.
NodeDfn  +The node has been found in the parent form.
NodeType  +The node is a DFN.
+
+ +

+Definition at line 55 of file u_form_elm.h. +

+

00056         {
+00057                 NodeForm,                       
+00058                 NodeParentForm,         
+00059                 NodeDfn,                        
+00060                 NodeType,                       
+00061         };
+
+

+ + + + +
+ + +
enum NLGEORGES::UFormElm::TWhereIsValue [inherited] +
+
+ + + + + +
+   + + +

+Where a value has been found. +

+

Enumeration values:
+ + + + + + +
ValueForm  +
ValueParentForm  +The value has been found in the form.
ValueDefaultDfn  +The value has been found in the parent form.
ValueDefaultType  +The value has been found in the DFN default value.
Dummy  +The value has been found in the TYPE default value.
+
+ +

+Definition at line 94 of file u_form_elm.h. +

+

00095         {
+00096                 ValueForm,                              
+00097                 ValueParentForm,                
+00098                 ValueDefaultDfn,                
+00099                 ValueDefaultType,               
+00100                 Dummy = 0xffffffff              
+00101         };
+
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NLGEORGES::CFormElmArray::CFormElmArray CForm form,
const CFormDfn formDfn,
const CType type,
CFormElm parentNode,
const CFormDfn parentDfn,
uint  parentIndex
+
+ + + + + +
+   + + +

+ +

+Definition at line 2249 of file form_elm.cpp. +

+References type, and uint. +

+

02249                                                                                                                                                         : CFormElm (form, parentNode, parentDfn, parentIndex)
+02250 {
+02251         FormDfn = (CFormDfn*)formDfn;
+02252         Type = type;
+02253 }
+
+

+ + + + +
+ + + + + + + + + +
NLGEORGES::CFormElmArray::~CFormElmArray  )  [virtual]
+
+ + + + + +
+   + + +

+ +

+Definition at line 2257 of file form_elm.cpp. +

+

02258 {
+02259         // Job done in clean()
+02260 }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::arrayDeleteNodeByName const char *  name,
const CFormDfn **  parentDfn,
uint indexDfn,
const CFormDfn **  nodeDfn,
const CType **  nodeType,
CFormElm **  node,
UFormDfn::TEntryType type,
bool &  array,
bool  verbose,
uint  arrayIndex
const [inherited]
+
+ + + + + +
+   + + +

+Delete an array node by name The index asked must be < the size of the array. +

+Definition at line 719 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::Create, Elements, NLGEORGES::CFormElm::Form, NLGEORGES::CFormElm::getIternalNodeByName(), NLGEORGES::CFormElm::isArray(), nlassert, NLGEORGES_FIRST_ROUND, NLGEORGES::CFormElm::ParentDfn, NLGEORGES::CFormElm::ParentIndex, type, and uint. +

+

00723 {
+00724         // Get the node by name
+00725         *parentDfn = ParentDfn;
+00726         indexDfn = ParentIndex;
+00727         *nodeDfn = NULL;
+00728         *nodeType = NULL;
+00729         *node = (CFormElm*)this;
+00730         bool created;
+00731         bool parentVDfnArray;
+00732         if (getIternalNodeByName (Form, name, parentDfn, indexDfn, nodeDfn, nodeType, node, type, array, Create, created, parentVDfnArray, verbose, NLGEORGES_FIRST_ROUND))
+00733         {
+00734                 // Must be in the same form
+00735                 nlassert ((*node) && ((*node)->Form == Form));
+00736 
+00737                 // Get its parent
+00738                 CFormElm *parentNode = (*node)->ParentNode;
+00739                 if (parentNode->isArray ())
+00740                 {
+00741                         // Cast pointer
+00742                         CFormElmArray *array = safe_cast<CFormElmArray*>(parentNode);
+00743 
+00744                         // Valid index ?
+00745                         if (arrayIndex<array->Elements.size ())
+00746                         {
+00747                                 // Insert the element
+00748                                 if (array->Elements[arrayIndex].Element)
+00749                                         delete array->Elements[arrayIndex].Element;
+00750 
+00751                                 // Erase the entry
+00752                                 array->Elements.erase (array->Elements.begin () + arrayIndex);
+00753 
+00754                                 // Ok 
+00755                                 return true;
+00756                         }
+00757                 }
+00758         }
+00759         return false;
+00760 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::arrayInsertNodeByName const char *  name,
const CFormDfn **  parentDfn,
uint indexDfn,
const CFormDfn **  nodeDfn,
const CType **  nodeType,
CFormElm **  node,
UFormDfn::TEntryType type,
bool &  array,
bool  verbose,
uint  arrayIndex
const [inherited]
+
+ + + + + +
+   + + +

+Insert an array node by name The index asked must be < the size of the array. +

+Definition at line 645 of file form_elm.cpp. +

+References NLGEORGES::CFormElmStruct::build(), NLGEORGES::CFormElm::Create, Elements, NLGEORGES::CFormElm::Form, NLGEORGES::CFormElm::getIternalNodeByName(), NLGEORGES::CFormElm::isArray(), nlassert, NLGEORGES_FIRST_ROUND, nlstop, NLGEORGES::CFormElm::ParentDfn, NLGEORGES::CFormElm::ParentIndex, type, and uint. +

+

00649 {
+00650         // Get the node by name
+00651         *parentDfn = ParentDfn;
+00652         indexDfn = ParentIndex;
+00653         *nodeDfn = NULL;
+00654         *nodeType = NULL;
+00655         *node = (CFormElm*)this;
+00656         bool created;
+00657         bool parentVDfnArray;
+00658         if (getIternalNodeByName (Form, name, parentDfn, indexDfn, nodeDfn, nodeType, node, type, array, Create, created, parentVDfnArray, verbose, NLGEORGES_FIRST_ROUND))
+00659         {
+00660                 // Must be in the same form
+00661                 nlassert ((*node) && ((*node)->Form == Form));
+00662 
+00663                 // Get its parent
+00664                 CFormElm *parentNode = (*node)->ParentNode;
+00665                 if (parentNode->isArray ())
+00666                 {
+00667                         // Cast pointer
+00668                         CFormElmArray *array = safe_cast<CFormElmArray*>(parentNode);
+00669 
+00670                         // Valid index ?
+00671                         if (arrayIndex<array->Elements.size ())
+00672                         {
+00673                                 // Insert the element
+00674                                 array->Elements.insert (array->Elements.begin() + arrayIndex);
+00675 
+00676                                 // Create a new element
+00677 
+00678                                 // The new element
+00679                                 CFormElm *newelm = NULL;
+00680                                 switch (type)
+00681                                 {
+00682                                 case UFormDfn::EntryType:
+00683                                         {
+00684                                                 // Create an atom
+00685                                                 CFormElmAtom *atom = new CFormElmAtom (Form, array, *parentDfn, indexDfn);
+00686                                                 newelm = atom;
+00687                                         }
+00688                                         break;
+00689                                 case UFormDfn::EntryDfn:
+00690                                         {
+00691                                                 CFormElmStruct *_struct = new CFormElmStruct (Form, array, *parentDfn, indexDfn);
+00692                                                 _struct->build (*nodeDfn);
+00693                                                 newelm = _struct;
+00694                                         }
+00695                                         break;
+00696                                 case UFormDfn::EntryVirtualDfn:
+00697                                         // todo array of virtual struct
+00698                                         //newelm = new CFormElmVirtualStruct (Form, array, *parentDfn, indexDfn);
+00699                                         break;
+00700                                 default:
+00701                                         nlstop;
+00702                                 }
+00703 
+00704                                 nlassert (newelm);
+00705 
+00706                                 // Set the element pointer
+00707                                 array->Elements[arrayIndex].Element = newelm;
+00708 
+00709                                 // Ok 
+00710                                 return true;
+00711                         }
+00712                 }
+00713         }
+00714         return false;
+00715 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLGEORGES::CFormElmArray::clean void   )  [virtual]
+
+ + + + + +
+   + + +

+Reset contents. +

+ +

+Reimplemented from NLGEORGES::CFormElm. +

+Definition at line 2264 of file form_elm.cpp. +

+References uint. +

+Referenced by read(). +

+

02265 {
+02266         // For each element of the array
+02267         uint elm;
+02268         for (elm =0; elm<Elements.size(); elm++)
+02269         {
+02270                 if (Elements[elm].Element)
+02271                         delete Elements[elm].Element;
+02272         }
+02273         Elements.clear ();
+02274 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::convertValue NLMISC::CRGBA result,
const char *  value
const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 657 of file form_elm.h. +

+References NLMISC::CRGBA::B, NLMISC::clamp(), NLMISC::CRGBA::G, NLMISC::CRGBA::R, r, uint8, value, and NLGEORGES::CFormElm::warning(). +

+

00658 {
+00659         float r, g, b;
+00660         if (sscanf (value, "%f,%f,%f", &r, &g, &b) == 3)
+00661         {
+00662                 NLMISC::clamp (r, 0.f, 255.f);
+00663                 NLMISC::clamp (g, 0.f, 255.f);
+00664                 NLMISC::clamp (b, 0.f, 255.f);
+00665                 result.R = (uint8)r;
+00666                 result.G = (uint8)g;
+00667                 result.B = (uint8)b;
+00668                 return true;
+00669         }
+00670 
+00671         // Error message
+00672         warning (false, "convertValue", "Can't convert the string \"%s\" in RGB color.", value);
+00673         
+00674         return false;
+00675 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::convertValue bool &  result,
const char *  value
const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 625 of file form_elm.h. +

+References NLMISC::strlwr(), value, and NLGEORGES::CFormElm::warning(). +

+

00626 {
+00627         int tmp;
+00628         if (sscanf (value, "%d", &tmp) == 1)
+00629         {
+00630                 result = tmp != 0;
+00631                 return true;
+00632         }
+00633         else
+00634         {
+00635                 std::string temp = value;
+00636                 temp = NLMISC::strlwr (temp);
+00637                 if (strcmp (temp.c_str (), "true") == 0)
+00638                 {
+00639                         result  = true;
+00640                         return true;
+00641                 }
+00642                 if (strcmp (temp.c_str (), "false") == 0)
+00643                 {
+00644                         result  = false;
+00645                         return true;
+00646                 }
+00647         }
+00648 
+00649         // Error message
+00650         warning (false, "convertValue", "Can't convert the string \"%s\" in boolean.", value);
+00651         
+00652         return false;
+00653 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::convertValue double &  result,
const char *  value
const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 607 of file form_elm.h. +

+References value, and NLGEORGES::CFormElm::warning(). +

+

00608 {
+00609         float tmp;
+00610         if (sscanf (value, "%f", &tmp) == 1)
+00611         {
+00612                 result = tmp;
+00613                 return true;
+00614         }
+00615         else
+00616         {
+00617                 // Error message
+00618                 warning (false, "convertValue", "Can't convert the string \"%s\" in double.", value);
+00619         }
+00620         return false;
+00621 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::convertValue float &  result,
const char *  value
const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 591 of file form_elm.h. +

+References value, and NLGEORGES::CFormElm::warning(). +

+

00592 {
+00593         if (sscanf (value, "%f", &result) == 1)
+00594         {
+00595                 return true;
+00596         }
+00597         else
+00598         {
+00599                 // Error message
+00600                 warning (false, "convertValue", "Can't convert the string \"%s\" in float.", value);
+00601         }
+00602         return false;
+00603 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::convertValue uint32 result,
const char *  value
const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 572 of file form_elm.h. +

+References NLMISC::clamp(), sint32, uint32, value, and NLGEORGES::CFormElm::warning(). +

+

00573 {
+00574         float tmp;
+00575         if (sscanf (value, "%f", &tmp) == 1)
+00576         {
+00577                 NLMISC::clamp (tmp, 0.f, 4294967295.f);
+00578                 result = (sint32)tmp;
+00579                 return true;
+00580         }
+00581         else
+00582         {
+00583                 // Error message
+00584                 warning (false, "convertValue", "Can't convert the string \"%s\" in uint32.", value);
+00585         }
+00586         return false;
+00587 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::convertValue sint32 result,
const char *  value
const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 553 of file form_elm.h. +

+References NLMISC::clamp(), sint32, value, and NLGEORGES::CFormElm::warning(). +

+

00554 {
+00555         float tmp;
+00556         if (sscanf (value, "%f", &tmp) == 1)
+00557         {
+00558                 NLMISC::clamp (tmp, -2147483648.f, 2147483647.f);
+00559                 result = (sint32)tmp;
+00560                 return true;
+00561         }
+00562         else
+00563         {
+00564                 // Error message
+00565                 warning (false, "convertValue", "Can't convert the string \"%s\" in sint32.", value);
+00566         }
+00567         return false;
+00568 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::convertValue uint16 result,
const char *  value
const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 534 of file form_elm.h. +

+References NLMISC::clamp(), uint16, value, and NLGEORGES::CFormElm::warning(). +

+

00535 {
+00536         float tmp;
+00537         if (sscanf (value, "%f", &tmp) == 1)
+00538         {
+00539                 NLMISC::clamp (tmp, 0.f, 65535.f);
+00540                 result = (uint16)tmp;
+00541                 return true;
+00542         }
+00543         else
+00544         {
+00545                 // Error message
+00546                 warning (false, "convertValue", "Can't convert the string \"%s\" in uint16.", value);
+00547         }
+00548         return false;
+00549 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::convertValue sint16 result,
const char *  value
const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 515 of file form_elm.h. +

+References NLMISC::clamp(), sint16, value, and NLGEORGES::CFormElm::warning(). +

+

00516 {
+00517         float tmp;
+00518         if (sscanf (value, "%f", &tmp) == 1)
+00519         {
+00520                 NLMISC::clamp (tmp, -32768.f, 32767.f);
+00521                 result = (sint16)tmp;
+00522                 return true;
+00523         }
+00524         else
+00525         {
+00526                 // Error message
+00527                 warning (false, "convertValue", "Can't convert the string \"%s\" in sint16.", value);
+00528         }
+00529         return false;
+00530 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::convertValue uint8 result,
const char *  value
const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 496 of file form_elm.h. +

+References NLMISC::clamp(), uint8, value, and NLGEORGES::CFormElm::warning(). +

+

00497 {
+00498         float tmp;
+00499         if (sscanf (value, "%f", &tmp) == 1)
+00500         {
+00501                 NLMISC::clamp (tmp, 0.f, 255.f);
+00502                 result = (uint8)tmp;
+00503                 return true;
+00504         }
+00505         else
+00506         {
+00507                 // Error message
+00508                 warning (false, "convertValue", "Can't convert the string \"%s\" in uint8.", value);
+00509         }
+00510         return false;
+00511 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::convertValue sint8 result,
const char *  value
const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 477 of file form_elm.h. +

+References NLMISC::clamp(), sint8, value, and NLGEORGES::CFormElm::warning(). +

+Referenced by getArrayValue(), NLGEORGES::CFormElmAtom::getValue(), and NLGEORGES::CFormElm::getValueByName(). +

+

00478 {
+00479         float tmp;
+00480         if (sscanf (value, "%f", &tmp) == 1)
+00481         {
+00482                 NLMISC::clamp (tmp, -128.f, 127.f);
+00483                 result = (sint8)tmp;
+00484                 return true;
+00485         }
+00486         else
+00487         {
+00488                 // Error message
+00489                 warning (false, "convertValue", "Can't convert the string \"%s\" in sint8.", value);
+00490         }
+00491         return false;
+00492 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::createNodeByName const char *  name,
const CFormDfn **  parentDfn,
uint indexDfn,
const CFormDfn **  nodeDfn,
const CType **  nodeType,
CFormElm **  node,
UFormDfn::TEntryType type,
bool &  array,
bool &  created
[inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 596 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::Create, NLGEORGES::CFormElm::Form, NLGEORGES::CFormElm::getIternalNodeByName(), NLGEORGES_FIRST_ROUND, NLGEORGES::CFormElm::ParentDfn, NLGEORGES::CFormElm::ParentIndex, type, and uint. +

+Referenced by NLGEORGES::CFormElm::setValueByName(). +

+

00600 {
+00601         *parentDfn = ParentDfn;
+00602         indexDfn = ParentIndex;
+00603         *nodeDfn = NULL;
+00604         *nodeType = NULL;
+00605         *node = this;
+00606         bool parentVDfnArray;
+00607         return getIternalNodeByName (Form, name, parentDfn, indexDfn, nodeDfn, nodeType, node, type, array, Create, created, parentVDfnArray, true, NLGEORGES_FIRST_ROUND);
+00608 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::deleteNodeByName const char *  name,
const CFormDfn **  parentDfn,
uint indexDfn,
const CFormDfn **  nodeDfn,
const CType **  nodeType,
CFormElm **  node,
UFormDfn::TEntryType type,
bool &  array
[inherited]
+
+ + + + + +
+   + + +

+Delete a node by name. If the node already exist, return it Delete its parent if not used +

+Definition at line 612 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::Delete, NLGEORGES::CFormElm::Form, NLGEORGES::CFormElm::getIternalNodeByName(), NLGEORGES_FIRST_ROUND, NLGEORGES::CFormElm::ParentDfn, NLGEORGES::CFormElm::ParentIndex, type, and uint. +

+

00616 {
+00617         *parentDfn = ParentDfn;
+00618         indexDfn = ParentIndex;
+00619         *nodeDfn = NULL;
+00620         *nodeType = NULL;
+00621         *node = this;
+00622         bool created;
+00623         bool parentVDfnArray;
+00624         return getIternalNodeByName (Form, name, parentDfn, indexDfn, nodeDfn, nodeType, node, type, array, Delete, created, parentVDfnArray, true, NLGEORGES_FIRST_ROUND);
+00625 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElmArray::getArrayNode UFormElm **  result,
uint  arrayIndex
[virtual]
+
+ + + + + +
+   + + +

+Get a array sub element mutable pointer. If return true, fill result with the arrayIndex cell's element pointer. Can be NULL if the node doesn't exist. +

+Reimplemented from NLGEORGES::CFormElm. +

+Definition at line 2328 of file form_elm.cpp. +

+References uint, and warning(). +

+

02329 {
+02330         if (arrayIndex<Elements.size())
+02331         {
+02332                 *result = Elements[arrayIndex].Element;
+02333                 return true;
+02334         }
+02335         else
+02336         {
+02337                 warning (false, "getArrayNode", "Index (%d) out of bound (%d).", arrayIndex, Elements.size() );
+02338                 return false;
+02339         }
+02340 };
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElmArray::getArrayNode const UFormElm **  result,
uint  arrayIndex
const [virtual]
+
+ + + + + +
+   + + +

+Get a array sub element const pointer. If return true, fill result with the arrayIndex cell's element Can be NULL if the node doesn't exist. +

+Reimplemented from NLGEORGES::CFormElm. +

+Definition at line 2293 of file form_elm.cpp. +

+References uint, and warning(). +

+

02294 {
+02295         if (arrayIndex<Elements.size())
+02296         {
+02297                 *result = Elements[arrayIndex].Element;
+02298                 return true;
+02299         }
+02300         else
+02301         {
+02302                 warning (false, "getArrayNode", "Index (%d) out of bound (%d).", arrayIndex, Elements.size() );
+02303                 return false;
+02304         }
+02305 };
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElmArray::getArrayNodeName std::string &  result,
uint  arrayIndex
const [virtual]
+
+ + + + + +
+   + + +

+Return the name of a table element. +

+ +

+Reimplemented from NLGEORGES::CFormElm. +

+Definition at line 2309 of file form_elm.cpp. +

+References NLMISC::toString(), uint, and warning(). +

+

02310 {
+02311         if (arrayIndex<Elements.size())
+02312         {
+02313                 if (Elements[arrayIndex].Name.empty ())
+02314                         result = "#" + toString (arrayIndex);
+02315                 else
+02316                         result = Elements[arrayIndex].Name;
+02317                 return true;
+02318         }
+02319         else
+02320         {
+02321                 warning (false, "getArrayNodeName", "Index (%d) out of bound (%d).", arrayIndex, Elements.size() );
+02322                 return false;
+02323         }
+02324 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NLGEORGES::CFormElmArray::getArraySize uint size  )  const [virtual]
+
+ + + + + +
+   + + +

+Return true if the element is an array and fill size with the array size. +

+ +

+Reimplemented from NLGEORGES::CFormElm. +

+Definition at line 2285 of file form_elm.cpp. +

+References size, and uint. +

+

02286 {
+02287         size = Elements.size ();
+02288         return true;
+02289 };
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElmArray::getArrayValue NLMISC::CRGBA result,
uint  arrayIndex,
TEval  evaluate,
TWhereIsValue where
const [virtual]
+
+ + + + + +
+   + + +

+Warning, only R, G and B members are filled, not A. +

+ +

+Reimplemented from NLGEORGES::CFormElm. +

+Definition at line 2541 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::convertValue(), NLGEORGES::CType::getValue(), NLGEORGES_FIRST_ROUND, uint, uint32, and warning(). +

+

02542 {
+02543         if (Type)
+02544         {
+02545                 string str;
+02546                 if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL))
+02547                 {
+02548                         return convertValue (result, str.c_str ());
+02549                 }
+02550         }
+02551         else
+02552         {
+02553                 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
+02554         }
+02555 
+02556         return false;
+02557 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElmArray::getArrayValue bool &  result,
uint  arrayIndex,
TEval  evaluate,
TWhereIsValue where
const [virtual]
+
+ + + + + +
+   + + +

+ +

+Reimplemented from NLGEORGES::CFormElm. +

+Definition at line 2521 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::convertValue(), NLGEORGES::CType::getValue(), NLGEORGES_FIRST_ROUND, uint, uint32, and warning(). +

+

02522 {
+02523         if (Type)
+02524         {
+02525                 string str;
+02526                 if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL))
+02527                 {
+02528                         return convertValue (result, str.c_str ());
+02529                 }
+02530         }
+02531         else
+02532         {
+02533                 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
+02534         }
+02535 
+02536         return false;
+02537 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElmArray::getArrayValue double &  result,
uint  arrayIndex,
TEval  evaluate,
TWhereIsValue where
const [virtual]
+
+ + + + + +
+   + + +

+ +

+Reimplemented from NLGEORGES::CFormElm. +

+Definition at line 2501 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::convertValue(), NLGEORGES::CType::getValue(), NLGEORGES_FIRST_ROUND, uint, uint32, and warning(). +

+

02502 {
+02503         if (Type)
+02504         {
+02505                 string str;
+02506                 if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL))
+02507                 {
+02508                         return convertValue (result, str.c_str ());
+02509                 }
+02510         }
+02511         else
+02512         {
+02513                 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
+02514         }
+02515 
+02516         return false;
+02517 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElmArray::getArrayValue float &  result,
uint  arrayIndex,
TEval  evaluate,
TWhereIsValue where
const [virtual]
+
+ + + + + +
+   + + +

+ +

+Reimplemented from NLGEORGES::CFormElm. +

+Definition at line 2481 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::convertValue(), NLGEORGES::CType::getValue(), NLGEORGES_FIRST_ROUND, uint, uint32, and warning(). +

+

02482 {
+02483         if (Type)
+02484         {
+02485                 string str;
+02486                 if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL))
+02487                 {
+02488                         return convertValue (result, str.c_str ());
+02489                 }
+02490         }
+02491         else
+02492         {
+02493                 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
+02494         }
+02495 
+02496         return false;
+02497 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElmArray::getArrayValue uint32 result,
uint  arrayIndex,
TEval  evaluate,
TWhereIsValue where
const [virtual]
+
+ + + + + +
+   + + +

+ +

+Reimplemented from NLGEORGES::CFormElm. +

+Definition at line 2461 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::convertValue(), NLGEORGES::CType::getValue(), NLGEORGES_FIRST_ROUND, uint, uint32, and warning(). +

+

02462 {
+02463         if (Type)
+02464         {
+02465                 string str;
+02466                 if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL))
+02467                 {
+02468                         return convertValue (result, str.c_str ());
+02469                 }
+02470         }
+02471         else
+02472         {
+02473                 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
+02474         }
+02475 
+02476         return false;
+02477 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElmArray::getArrayValue sint32 result,
uint  arrayIndex,
TEval  evaluate,
TWhereIsValue where
const [virtual]
+
+ + + + + +
+   + + +

+ +

+Reimplemented from NLGEORGES::CFormElm. +

+Definition at line 2441 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::convertValue(), NLGEORGES::CType::getValue(), NLGEORGES_FIRST_ROUND, sint32, uint, uint32, and warning(). +

+

02442 {
+02443         if (Type)
+02444         {
+02445                 string str;
+02446                 if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL))
+02447                 {
+02448                         return convertValue (result, str.c_str ());
+02449                 }
+02450         }
+02451         else
+02452         {
+02453                 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
+02454         }
+02455 
+02456         return false;
+02457 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElmArray::getArrayValue uint16 result,
uint  arrayIndex,
TEval  evaluate,
TWhereIsValue where
const [virtual]
+
+ + + + + +
+   + + +

+ +

+Reimplemented from NLGEORGES::CFormElm. +

+Definition at line 2421 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::convertValue(), NLGEORGES::CType::getValue(), NLGEORGES_FIRST_ROUND, uint, uint16, uint32, and warning(). +

+

02422 {
+02423         if (Type)
+02424         {
+02425                 string str;
+02426                 if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL))
+02427                 {
+02428                         return convertValue (result, str.c_str ());
+02429                 }
+02430         }
+02431         else
+02432         {
+02433                 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
+02434         }
+02435 
+02436         return false;
+02437 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElmArray::getArrayValue sint16 result,
uint  arrayIndex,
TEval  evaluate,
TWhereIsValue where
const [virtual]
+
+ + + + + +
+   + + +

+ +

+Reimplemented from NLGEORGES::CFormElm. +

+Definition at line 2401 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::convertValue(), NLGEORGES::CType::getValue(), NLGEORGES_FIRST_ROUND, sint16, uint, uint32, and warning(). +

+

02402 {
+02403         if (Type)
+02404         {
+02405                 string str;
+02406                 if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL))
+02407                 {
+02408                         return convertValue (result, str.c_str ());
+02409                 }
+02410         }
+02411         else
+02412         {
+02413                 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
+02414         }
+02415 
+02416         return false;
+02417 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElmArray::getArrayValue uint8 result,
uint  arrayIndex,
TEval  evaluate,
TWhereIsValue where
const [virtual]
+
+ + + + + +
+   + + +

+ +

+Reimplemented from NLGEORGES::CFormElm. +

+Definition at line 2381 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::convertValue(), NLGEORGES::CType::getValue(), NLGEORGES_FIRST_ROUND, uint, uint32, uint8, and warning(). +

+

02382 {
+02383         if (Type)
+02384         {
+02385                 string str;
+02386                 if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL))
+02387                 {
+02388                         return convertValue (result, str.c_str ());
+02389                 }
+02390         }
+02391         else
+02392         {
+02393                 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
+02394         }
+02395 
+02396         return false;
+02397 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElmArray::getArrayValue sint8 result,
uint  arrayIndex,
TEval  evaluate,
TWhereIsValue where
const [virtual]
+
+ + + + + +
+   + + +

+ +

+Reimplemented from NLGEORGES::CFormElm. +

+Definition at line 2361 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::convertValue(), NLGEORGES::CType::getValue(), NLGEORGES_FIRST_ROUND, sint8, uint, uint32, and warning(). +

+

02362 {
+02363         if (Type)
+02364         {
+02365                 string str;
+02366                 if (Type->getValue (str, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL))
+02367                 {
+02368                         return convertValue (result, str.c_str ());
+02369                 }
+02370         }
+02371         else
+02372         {
+02373                 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
+02374         }
+02375 
+02376         return false;
+02377 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElmArray::getArrayValue std::string &  result,
uint  arrayIndex,
TEval  evaluate,
TWhereIsValue where
const [virtual]
+
+ + + + + +
+   + + +

+Get an array value. The node must be an array of atom element.

+

Parameters:
+ + + + + +
result is a reference on the value to fill with the result.
arrayIndex is the array index to evaluate.
evaluate must be true if you want to have an evaluated value, false if you want the formula value.
where is a pointer on the information flag of the value. If Where is not NULL, it is filled with the position where the value has been found.
+
+
Returns:
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.
+ +

+Reimplemented from NLGEORGES::CFormElm. +

+Definition at line 2345 of file form_elm.cpp. +

+References NLGEORGES::CType::getValue(), NLGEORGES_FIRST_ROUND, uint, uint32, and warning(). +

+

02346 {
+02347         if (Type)
+02348         {
+02349                 return (Type->getValue (result, Form, safe_cast<const CFormElmAtom*> (Elements[arrayIndex].Element), *ParentDfn, ParentIndex, evaluate, (uint32*)where, NLGEORGES_FIRST_ROUND, NULL));
+02350         }
+02351         else
+02352         {
+02353                 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
+02354         }
+02355 
+02356         return false;
+02357 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLGEORGES::CFormElmArray::getDependencies std::set< std::string > &  dependencies  )  const [virtual]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::CFormElm. +

+Definition at line 2771 of file form_elm.cpp. +

+References NLGEORGES::CType::getDependencies(), and uint. +

+

02772 {
+02773         if (FormDfn)
+02774         {
+02775                 // Add the dfn
+02776                 FormDfn->getDependencies (dependencies);
+02777 
+02778                 // Add each elements
+02779                 for (uint i=0; i<Elements.size (); i++)
+02780                 {
+02781                         Elements[i].Element->getDependencies (dependencies);
+02782                 }
+02783         }
+02784 
+02785         if (Type)
+02786         {
+02787                 // Add the type
+02788                 Type->getDependencies (dependencies);
+02789         }
+02790 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NLGEORGES::CFormElm::getDfnName std::string &  dfnName  )  const [virtual, inherited]
+
+ + + + + +
+   + + +

+Get the dfn filename for this virtual struct. Must be a virtual struct node. +

+ +

+Implements NLGEORGES::UFormElm. +

+Reimplemented in NLGEORGES::CFormElmVirtualStruct. +

+Definition at line 194 of file form_elm.cpp. +

+

00195 {
+00196         return false;
+00197 }
+
+

+ + + + +
+ + + + + + + + + +
CForm * NLGEORGES::CFormElm::getForm  )  const [inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 353 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::Form. +

+Referenced by NLGEORGES::CFormElm::warning(). +

+

00354 {
+00355         return Form;
+00356 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLGEORGES::CFormElmArray::getFormName std::string &  result,
const CFormElm child
const [virtual]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::CFormElm. +

+Definition at line 2712 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::getFormName(), NLMISC::smprintf(), uint, and warning(). +

+Referenced by warning(). +

+

02713 {
+02714         // Reset the result
+02715         if (child == NULL)
+02716         {
+02717                 result = "";
+02718                 result.reserve (50);
+02719         }
+02720 
+02721         // Get parent form name
+02722         if (ParentNode)
+02723                 ParentNode->getFormName (result, this);
+02724 
+02725         // Get node name
+02726         if (child)
+02727         {
+02728                 // Look for the child
+02729                 uint i;
+02730                 for (i=0; i<Elements.size (); i++)
+02731                 {
+02732                         // This one ?
+02733                         if (Elements[i].Element == child)
+02734                         {
+02735                                 char name[512];
+02736                                 smprintf (name, 512, "[%d]", i);
+02737 
+02738                                 // Add the field name
+02739                                 result += name;
+02740                                 break;
+02741                         }
+02742                 }
+02743 
+02744                 // Draw some warning
+02745                 if (i==Elements.size ())
+02746                 {
+02747                         warning (false, "getFormName", "Child node not found.");
+02748                 }
+02749         }
+02750 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getIternalNodeByName 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
[static, protected, inherited]
+
+ + + + + +
+   + + +

+Is createNode == Create, (*node)->Form must be == to the form argument. Is createNode == Return, form argument is not used, can be undefined.

+Only form, name, and action, must be defined. Then, else (*parentDfn / indexDfn ) or *node must be defined. Others value are for result only. +

+Definition at line 764 of file form_elm.cpp. +

+References NLGEORGES::CFormElmStruct::build(), NLGEORGES::CFormElm::Create, NLGEORGES::CFormElm::Delete, NLGEORGES::CFormElmVirtualStruct::DfnFilename, Elements, NLGEORGES::CFormElmStruct::Elements, NLGEORGES::CFormDfn::Entries, NLGEORGES::CFormElmStruct::FormDfn, NLGEORGES::CFormDfn::CEntry::getArrayFlag(), NLGEORGES::CFormDfn::CEntry::getDfnPtr(), NLGEORGES::CFormDfn::getEntry(), NLGEORGES::CForm::getFilename(), NLGEORGES::CFormElm::getFormName(), NLGEORGES::CFormElmStruct::getFormName(), NLGEORGES::UFormElm::getNodeByName(), NLGEORGES::CForm::getParent(), NLGEORGES::CForm::getParentCount(), NLGEORGES::CForm::getRootNode(), NLGEORGES::CFormDfn::CEntry::getType(), NLGEORGES::CFormDfn::CEntry::getTypePtr(), NLGEORGES::CFormElm::isArray(), NLGEORGES::UFormElm::isVirtualStruct(), nlassert, NLGEORGES_MAX_RECURSION, nlstop, nlverify, NLGEORGES::CFormElm::Return, NLMISC::smprintf(), NLGEORGES::CFormElm::TokenArrayBegin, NLGEORGES::CFormElm::TokenArrayEnd, NLGEORGES::CFormElm::tokenize(), NLGEORGES::CFormElm::TokenPoint, NLGEORGES::CFormElm::TokenString, NLGEORGES::CType::Type, type, uint, uint32, NLGEORGES::CFormElm::unlink(), and NLGEORGES::CFormElm::warning(). +

+Referenced by NLGEORGES::CFormElm::arrayDeleteNodeByName(), NLGEORGES::CFormElm::arrayInsertNodeByName(), NLGEORGES::CFormElm::createNodeByName(), NLGEORGES::CFormElm::deleteNodeByName(), and NLGEORGES::CFormElm::getNodeByName(). +

+

00765 {
+00766         // *** Init output variables
+00767         created = false;
+00768         parentVDfnArray = false;
+00769         
+00770         // ParentDfn or Node..
+00771         nlassert ( (*parentDfn) || (*node) );
+00772 
+00773         // Error message
+00774         char error[512];
+00775 
+00776         // Parent exist ?
+00777         if (*parentDfn)
+00778         {
+00779                 // Get the entry
+00780                 const CFormDfn::CEntry &theEntry = (*parentDfn)->getEntry (indexDfn);
+00781 
+00782                 // Get the type
+00783                 type = theEntry.getType ();
+00784                 *nodeType = theEntry.getTypePtr ();
+00785                 if (type == UFormDfn::EntryVirtualDfn)
+00786                 {
+00787                         if (*node)
+00788                                 *nodeDfn = safe_cast <CFormElmVirtualStruct*> (*node)->FormDfn;
+00789                         else
+00790                                 *nodeDfn = NULL;
+00791                 }
+00792                 else
+00793                         *nodeDfn = theEntry.getDfnPtr ();
+00794                 array = theEntry.getArrayFlag ();
+00795         }
+00796         else if (*node)
+00797         {
+00798                 nlassert (!(*node)->isArray ());
+00799                 indexDfn = 0xffffffff;
+00800                 *nodeType = (*node)->isAtom () ? safe_cast<CFormElmAtom*>(*node)->Type : NULL;
+00801                 *nodeDfn = (*node)->isStruct () ? (const CFormDfn *)(safe_cast<CFormElmStruct*>(*node)->FormDfn) : NULL;
+00802                 type = (*node)->isAtom () ? UFormDfn::EntryType : (*node)->isVirtualStruct () ? UFormDfn::EntryVirtualDfn : UFormDfn::EntryDfn;
+00803                 array = false;
+00804         }
+00805 
+00806         // Check node pointer
+00807         if (action == Create)
+00808         {
+00809                 nlassert (*node);
+00810                 nlassert ((*node)->getForm () == form);
+00811         }
+00812 
+00813         // Backup current node
+00814         CFormElm *backupFirstElm = *node;
+00815 
+00816         // *** Parsing variables
+00817 
+00818         // Current token start and end
+00819         const char *startToken = name;
+00820         const char *endToken;
+00821 
+00822         // Current token start
+00823         string token;
+00824 
+00825         // Current form name
+00826         string currentName;
+00827         if (*node)
+00828                 (*node)->getFormName (currentName);
+00829 
+00830         // Error
+00831         uint errorIndex;
+00832 
+00833         // Token code
+00834         uint code;
+00835 
+00836         // Are we parsing an array ?
+00837         bool inArrayIndex = false;
+00838 
+00839         // Index in the array
+00840         uint arrayIndex;
+00841 
+00842         // Bool next token must be an array index
+00843         bool wantArrayIndex = false;
+00844 
+00845         // Last struct elm
+00846         CFormElmStruct *lastStructElm = ((*node)->ParentNode && (*node)->ParentNode->isStruct ()) ? safe_cast<CFormElmStruct*> ((*node)->ParentNode) : NULL;
+00847         uint lastStructIndex = 0;
+00848         if (lastStructElm)
+00849         {
+00850                 // Look for node in the parent
+00851                 for (; lastStructIndex<lastStructElm->Elements.size (); lastStructIndex++)
+00852                 {
+00853                         // The same node ?
+00854                         if (lastStructElm->Elements[lastStructIndex].Element == (*node))
+00855                                 break;
+00856                 }
+00857 
+00858                 // Must have been found
+00859                 nlassert (lastStructIndex<lastStructElm->Elements.size ());
+00860         }
+00861 
+00862         // While there is tokens
+00863         while ((endToken = tokenize (startToken, token, errorIndex, code)))
+00864         {
+00865                 // Ready an array index ?
+00866                 if (!inArrayIndex)
+00867                 {
+00868                         // For each code
+00869                         switch (code)
+00870                         {
+00871                         case TokenString:
+00872                                 {
+00873                                         // Need an array index array ?
+00874                                         if (wantArrayIndex)
+00875                                         {
+00876                                                 // Error message
+00877                                                 smprintf (error, 512, "Token (%s) should be an array index.", token.c_str());
+00878                                                 goto exit;
+00879                                         }
+00880 
+00881                                         // Are we a struct ?
+00882                                         if ( ((type == UFormDfn::EntryDfn) || (type == UFormDfn::EntryVirtualDfn)) /*&& (!array)*/ )
+00883                                         {
+00884                                                 // Check the virtual DFN is not empty..
+00885                                                 if ( (type == UFormDfn::EntryVirtualDfn) && (*nodeDfn == NULL) )
+00886                                                 {
+00887                                                         // Is it a parent virtual DFN ?
+00888                                                         if ( (type == UFormDfn::EntryVirtualDfn) && (*node == NULL) )
+00889                                                                 parentVDfnArray = true;
+00890 
+00891                                                         // Create mode ?
+00892                                                         if (action == Create)
+00893                                                         {
+00894                                                                 // Should have a valid node
+00895                                                                 nlassert (*node && lastStructElm);
+00896 
+00897                                                                 // Get the current virtual dfn
+00898                                                                 CFormElmVirtualStruct *vStruct = safe_cast<CFormElmVirtualStruct*> (*node);
+00899 
+00900                                                                 // Get the form name of the current node
+00901                                                                 string formName;
+00902                                                                 vStruct->getFormName (formName, NULL);
+00903 
+00904                                                                 // Get the parent node if available
+00905                                                                 for (uint parent=0; parent<form->getParentCount (); parent++)
+00906                                                                 {
+00907                                                                         // Get the parent
+00908                                                                         CForm *parentPtr = form->getParent (parent);
+00909                                                                         nlassert (parentPtr);
+00910 
+00911                                                                         // Get the virtual node by name
+00912                                                                         UFormElm *uelm;
+00913                                                                         if (parentPtr->getRootNode ().getNodeByName (&uelm, formName.c_str (), NULL, verbose, round+1) && uelm)
+00914                                                                         {
+00915                                                                                 // Value node ?
+00916                                                                                 if (uelm->isVirtualStruct ())
+00917                                                                                 {
+00918                                                                                         // Get a virtual struct pointer
+00919                                                                                         CFormElmVirtualStruct *vStructParent = safe_cast<CFormElmVirtualStruct*> (uelm);
+00920 
+00921                                                                                         // Copy the DFN filename
+00922                                                                                         vStruct->DfnFilename = vStructParent->DfnFilename;
+00923 
+00924                                                                                         // Build it
+00925                                                                                         vStruct->build (vStructParent->FormDfn);
+00926 
+00927                                                                                         // Set the current DFN
+00928                                                                                         *nodeDfn = vStruct->FormDfn;
+00929 
+00930                                                                                         // Stop looking for parent
+00931                                                                                         break;
+00932                                                                                 }
+00933                                                                                 else
+00934                                                                                 {
+00935                                                                                         // Error message
+00936                                                                                         smprintf (error, 512, "Internal node parsing error.");
+00937                                                                                         goto exit;
+00938                                                                                 }
+00939                                                                         }
+00940                                                                 }
+00941                                                         }
+00942 
+00943                                                         // Still no DFN ?
+00944                                                         if (*nodeDfn == NULL)
+00945                                                         {
+00946                                                                 // Error message
+00947                                                                 smprintf (error, 512, "Empty virtual struct element. Can't look into it while it is not defined.");
+00948                                                                 goto exit;
+00949                                                         }
+00950                                                 }
+00951 
+00952                                                 // Must hjave a nodeDfn here
+00953                                                 nlassert (*nodeDfn);
+00954 
+00955                                                 // Look for the element
+00956                                                 //                                              uint elementCount = (*nodeDfn)->getNumEntry ();
+00957 
+00958                                                 // Get the parents
+00959                                                 vector<const CFormDfn*> arrayDfn;
+00960                                                 arrayDfn.reserve ((*nodeDfn)->countParentDfn ());
+00961                                                 (*nodeDfn)->getParentDfn (arrayDfn);
+00962 
+00963                                                 // For each parent
+00964                                                 uint i;
+00965                                                 uint formElm = 0;
+00966                                                 for (i=0; i<arrayDfn.size(); i++)
+00967                                                 {
+00968                                                         // The dfn
+00969                                                         const CFormDfn &dfn = *(arrayDfn[i]);
+00970 
+00971                                                         // For each elements
+00972                                                         uint element;
+00973                                                         for (element=0; element<dfn.Entries.size(); element++)
+00974                                                         {
+00975                                                                 // Good name ?
+00976                                                                 if (dfn.Entries[element].Name == token)
+00977                                                                 {
+00978                                                                         // Good one.
+00979                                                                         *parentDfn = &dfn;
+00980                                                                         indexDfn = element;
+00981                                                                         *nodeDfn = dfn.Entries[element].Dfn;
+00982                                                                         *nodeType = dfn.Entries[element].Type;
+00983                                                                         type = dfn.Entries[element].TypeElement;
+00984                                                                         array = dfn.Entries[element].Array;
+00985                                                                         wantArrayIndex = array;
+00986 
+00987                                                                         // Next node
+00988                                                                         if (*node)
+00989                                                                         {
+00990                                                                                 // Get next node
+00991                                                                                 CFormElmStruct *nodeStruct = safe_cast<CFormElmStruct*> (*node);
+00992                                                                                 CFormElm *nextElt = nodeStruct->Elements[formElm].Element;
+00993                                                                                 
+00994                                                                                 // If no next node, watch for parent node
+00995                                                                                 *node = nextElt;
+00996 
+00997                                                                                 // Create node
+00998                                                                                 if ( (action == Create) && (*node == NULL) )
+00999                                                                                 {
+01000                                                                                         // Is an array ?
+01001                                                                                         if (array)
+01002                                                                                         {
+01003                                                                                                 // Create an atom
+01004                                                                                                 CFormElmArray *atom = new CFormElmArray (form, *nodeDfn, *nodeType, nodeStruct, *parentDfn, indexDfn);
+01005                                                                                                 *node = atom;
+01006                                                                                         }
+01007                                                                                         else
+01008                                                                                         {
+01009                                                                                                 // What kind of node ?
+01010                                                                                                 switch (type)
+01011                                                                                                 {
+01012                                                                                                 case UFormDfn::EntryType:
+01013                                                                                                         {
+01014                                                                                                                 // Create an atom
+01015                                                                                                                 CFormElmAtom *atom = new CFormElmAtom (form, nodeStruct, *parentDfn, indexDfn);
+01016                                                                                                                 *node = atom;
+01017                                                                                                         }
+01018                                                                                                         break;
+01019                                                                                                 case UFormDfn::EntryDfn:
+01020                                                                                                         {
+01021                                                                                                                 CFormElmStruct *_struct = new CFormElmStruct (form, nodeStruct, *parentDfn, indexDfn);
+01022                                                                                                                 _struct->build (*nodeDfn);
+01023                                                                                                                 *node = _struct;
+01024                                                                                                         }
+01025                                                                                                         break;
+01026                                                                                                 case UFormDfn::EntryVirtualDfn:
+01027                                                                                                         *node = new CFormElmVirtualStruct (form, nodeStruct, *parentDfn, indexDfn);
+01028                                                                                                         break;
+01029                                                                                                 default:
+01030                                                                                                         nlstop;
+01031                                                                                                 }
+01032                                                                                         }
+01033 
+01034                                                                                         // Node created
+01035                                                                                         created = true;
+01036 
+01037                                                                                         // Set the node in parent
+01038                                                                                         nodeStruct->Elements[formElm].Element = *node;
+01039                                                                                 }
+01040 
+01041                                                                                 // Is a virtual DFN ?
+01042                                                                                 if ((*node) && (*node)->isVirtualStruct ())
+01043                                                                                 {
+01044                                                                                         // Should be NULL
+01045                                                                                         nlassert (*nodeDfn == NULL);
+01046 
+01047                                                                                         // Set the current dfn
+01048                                                                                         *nodeDfn = safe_cast<const CFormElmVirtualStruct*> (*node)->FormDfn;
+01049                                                                                 }
+01050 
+01051                                                                                 // Save last struct
+01052                                                                                 lastStructElm = nodeStruct;
+01053                                                                                 lastStructIndex = formElm;
+01054                                                                         }
+01055                                                                         else
+01056                                                                         {
+01057                                                                                 // Save last struct
+01058                                                                           //                                                                            CFormElmStruct *lastStructElm = NULL;
+01059                                                                           //uint lastStructIndex = 0xffffffff;
+01060 
+01061                                                                                 *node = NULL;
+01062                                                                         }
+01063 
+01064                                                                         break;
+01065                                                                 }
+01066                                                                 formElm++;
+01067                                                         }
+01068 
+01069                                                         // Breaked ?
+01070                                                         if (element!=dfn.Entries.size())
+01071                                                                 break;
+01072                                                 }
+01073 
+01074                                                 // Breaked ?
+01075                                                 if (i==arrayDfn.size())
+01076                                                 {
+01077                                                         // Not found
+01078                                                         smprintf (error, 512, "Struct does not contain element named (%s).", token.c_str());
+01079                                                         goto exit;
+01080                                                 }
+01081                                         }
+01082                                         else
+01083                                         {
+01084                                                 // Error message
+01085                                                 smprintf (error, 512, "Not a struct element. Can't open the node (%s).", token.c_str());
+01086                                                 goto exit;
+01087                                         }
+01088                                 }
+01089                                 break;
+01090                         case TokenPoint:
+01091                                 {
+01092                                         // Need an array index array ?
+01093                                         if (wantArrayIndex)
+01094                                         {
+01095                                                 // Error message
+01096                                                 smprintf (error, 512, "Token (%s) should be an array index.", token.c_str());
+01097                                                 goto exit;
+01098                                         }
+01099 
+01100                                         // Are we a struct ?
+01101                                         if ((type != UFormDfn::EntryDfn) && (type != UFormDfn::EntryVirtualDfn))
+01102                                         {
+01103                                                 // Error message
+01104                                                 smprintf (error, 512, "Not a struct element. Can't open the node (%s).", token.c_str());
+01105                                                 goto exit;
+01106                                         }
+01107                                 }
+01108                                 break;
+01109                         case TokenArrayBegin:
+01110                                 {
+01111                                         // Are we an array ?
+01112                                         if (!array)
+01113                                         {
+01114                                                 // Error message
+01115                                                 smprintf (error, 512, "Not an array element. Can't open the node (%s).", token.c_str());
+01116                                                 goto exit;
+01117                                         }
+01118                                         inArrayIndex = true;
+01119                                         arrayIndex = 0xffffffff;
+01120                                 }
+01121                                 break;
+01122                         default:
+01123                                 {
+01124                                         // Error message
+01125                                         smprintf (error, 512, "Syntax error at keyword (%s).", token.c_str ());
+01126                                         goto exit;
+01127                                 }
+01128                                 break;
+01129                         }
+01130                 }
+01131                 else
+01132                 {
+01133                         switch (code)
+01134                         {
+01135                         case TokenString:
+01136                                 {
+01137                                         // To int
+01138                                         if (sscanf (token.c_str(), "%d", &arrayIndex)!=1)
+01139                                         {
+01140                                                 // Error message
+01141                                                 smprintf (error, 512, "Keyword (%s) is not an array index.", token.c_str());
+01142                                                 goto exit;
+01143                                         }
+01144 
+01145                                         // Is it a parent virtual DFN ?
+01146                                         if (*node == NULL)
+01147                                                 parentVDfnArray = true;
+01148 
+01149                                         // Should have an array defined
+01150                                         if (*node)
+01151                                         {
+01152                                                 // Check index
+01153                                                 uint arraySize;
+01154                                                 nlverify ((*node)->getArraySize (arraySize));
+01155                                                 if (arrayIndex>=arraySize)
+01156                                                 {
+01157                                                         // Create mode ?
+01158                                                         if (action == Create)
+01159                                                         {
+01160                                                                 // Must be in the same form
+01161                                                                 nlassert ((*node)->Form == form);
+01162 
+01163                                                                 // The array pointer
+01164                                                                 CFormElmArray *array = safe_cast<CFormElmArray*>(*node);
+01165                                                                 uint oldSize = array->Elements.size ();
+01166                                                                 array->Elements.resize (arrayIndex+1);
+01167 
+01168                                                                 // Insert empty element
+01169                                                                 uint i;
+01170                                                                 for (i=oldSize; i<array->Elements.size (); i++)
+01171                                                                 {
+01172                                                                         // The new element
+01173                                                                         CFormElm *newelm = NULL;
+01174                                                                         switch (type)
+01175                                                                         {
+01176                                                                         case UFormDfn::EntryType:
+01177                                                                                 {
+01178                                                                                         // Create an atom
+01179                                                                                         CFormElmAtom *atom = new CFormElmAtom (form, array, *parentDfn, indexDfn);
+01180                                                                                         newelm = atom;
+01181                                                                                 }
+01182                                                                                 break;
+01183                                                                         case UFormDfn::EntryDfn:
+01184                                                                                 {
+01185                                                                                         CFormElmStruct *_struct = new CFormElmStruct (form, array, *parentDfn, indexDfn);
+01186                                                                                         _struct->build (*nodeDfn);
+01187                                                                                         newelm = _struct;
+01188                                                                                 }
+01189                                                                                 break;
+01190                                                                         case UFormDfn::EntryVirtualDfn:
+01191                                                                                 // todo array of virtual struct
+01192                                                                                 //newelm = new CFormElmVirtualStruct (form, array, *parentDfn, indexDfn);
+01193                                                                                 break;
+01194                                                                         default:
+01195                                                                                 nlstop;
+01196                                                                         }
+01197 
+01198                                                                         nlassert (newelm);
+01199 
+01200                                                                         // Node created
+01201                                                                         created = true;
+01202 
+01203                                                                         // Set the element pointer
+01204                                                                         array->Elements[i].Element = newelm;
+01205                                                                 }
+01206                                                         }
+01207                                                         else
+01208                                                         {
+01209                                                                 // Error message
+01210                                                                 smprintf (error, 512, "Out of array bounds (%d >= %d).", arrayIndex, arraySize);
+01211                                                                 goto exit;
+01212                                                         }
+01213                                                 }
+01214                                         }
+01215                                         else
+01216                                         {
+01217                                                 // Error message
+01218                                                 smprintf (error, 512, "Array is not defined.");
+01219                                                 goto exit;
+01220                                         }
+01221                                 }
+01222                                 break;
+01223                         case TokenArrayEnd:
+01224                                 {
+01225                                         // No need of an array index any more
+01226                                         wantArrayIndex = false;
+01227 
+01228                                         // Index found ?
+01229                                         if (arrayIndex == 0xffffffff)
+01230                                         {
+01231                                                 // Error message
+01232                                                 smprintf (error, 512, "Missing array index.");
+01233                                         }
+01234                                         else
+01235                                         {
+01236                                                 // Let the parent DFN
+01237                                                 nlassert (*parentDfn);
+01238 
+01239                                                 // New current node
+01240                                                 CFormElmArray *parentNode = safe_cast<CFormElmArray*> (*node);
+01241 
+01242                                                 // Get the element
+01243                                                 *node = parentNode->Elements[arrayIndex].Element;
+01244 
+01245                                                 // Is a dfn ?
+01246                                                 *nodeDfn = (*parentDfn)->getEntry (indexDfn).getDfnPtr ();
+01247 
+01248                                                 // Is a type ?
+01249                                                 *nodeType = (*parentDfn)->getEntry (indexDfn).getTypePtr ();
+01250 
+01251                                                 // Type ?
+01252                                                 type = (*parentDfn)->getEntry (indexDfn).getType ();
+01253                                                 
+01254                                                 // Can't be an array of array
+01255                                                 array = false;
+01256 
+01257                                                 // Not any more in index
+01258                                                 inArrayIndex = false;
+01259 
+01260                                                 // What kind of node ?
+01261                                                 if ( (action == Create) && ( *node == NULL) )
+01262                                                 {
+01263                                                         switch (type)
+01264                                                         {
+01265                                                         case UFormDfn::EntryType:
+01266                                                                 {
+01267                                                                         // Create an atom
+01268                                                                         CFormElmAtom *atom = new CFormElmAtom (form, parentNode, *parentDfn, indexDfn);
+01269                                                                         *node = atom;
+01270                                                                 }
+01271                                                                 break;
+01272                                                         case UFormDfn::EntryDfn:
+01273                                                                 {
+01274                                                                         CFormElmStruct *_struct = new CFormElmStruct (form, parentNode, *parentDfn, indexDfn);
+01275                                                                         _struct->build (*nodeDfn);
+01276                                                                         *node = _struct;
+01277                                                                 }
+01278                                                                 break;
+01279                                                         case UFormDfn::EntryVirtualDfn:
+01280                                                                 // todo array of virtual struct
+01281                                                                 // *node = new CFormElmVirtualStruct (form, parentNode, *parentDfn, indexDfn);
+01282                                                                 break;
+01283                                                         default:
+01284                                                                 nlstop;
+01285                                                         }
+01286 
+01287                                                         nlassert (*node);
+01288 
+01289                                                         // Node created
+01290                                                         created = true;
+01291 
+01292                                                         // Set the element pointer
+01293                                                         parentNode->Elements[arrayIndex].Element = *node;
+01294                                                 }
+01295 
+01296                                                 // Is a virtual DFN ?
+01297                                                 if ((*node) && (*node)->isVirtualStruct ())
+01298                                                 {
+01299                                                         // Should be NULL
+01300                                                         nlassert (*nodeDfn == NULL);
+01301 
+01302                                                         // Set the current dfn
+01303                                                         *nodeDfn = safe_cast<const CFormElmVirtualStruct*> (*node)->FormDfn;
+01304                                                 }
+01305                                         }
+01306                                 }
+01307                                 break;
+01308                         default:
+01309                                 {
+01310                                         // Error message
+01311                                         smprintf (error, 512, "Keyword (%s) is not an array index.", token.c_str());
+01312                                         goto exit;
+01313                                 }
+01314                         }
+01315                 }
+01316 
+01317                 // Concat current adress
+01318                 currentName += token;
+01319                 startToken = endToken;
+01320         }
+01321 exit:;
+01322 
+01323         // Error ?
+01324         bool errorAppend = endToken != NULL;
+01325 
+01326         // Continue ?
+01327         if (!errorAppend)
+01328         {
+01329                 // Delete the node ?
+01330                 if ( (action == Delete) && (*node) )
+01331                 {
+01332                         // Get its parent
+01333                         CFormElm *parent = safe_cast<CFormElm*> ((*node)->getParent ());
+01334 
+01335                         // Don't erase the root structure
+01336                         if (parent && !parent->isArray ())
+01337                         {
+01338                                 // Unlink the primitive from its parent
+01339                                 parent->unlink (*node);
+01340 
+01341                                 // Erase the node
+01342                                 delete (*node);
+01343                                 *node = parent;
+01344                                 parent = (CFormElm*) (parent->getParent ());
+01345 
+01346                                 // For each parent
+01347                                 while (parent && !(*node)->isUsed (form) && !parent->isArray ())
+01348                                 {
+01349                                         // Unlink the primitive from its parent
+01350                                         parent->unlink (*node);
+01351 
+01352                                         // Erase it and get next parent
+01353                                         delete (*node);
+01354                                         *node = parent;
+01355                                         parent = (CFormElm*) (parent->getParent ());
+01356                                 }
+01357 
+01358                                 // No more node
+01359                                 *node = NULL;
+01360                         }
+01361                 }
+01362         }
+01363 
+01364         // Node not found in get node ? Look in parents !
+01365         if ( ((*node) == NULL) && (action == Return) && backupFirstElm )
+01366         {
+01367                 // Get the path name
+01368                 string formName;
+01369                 backupFirstElm->getFormName (formName);
+01370                 uint formNameSize = formName.size ();
+01371                 if ((formNameSize > 0) && (formName[formNameSize-1] != '.') && (formName[formNameSize-1] != '['))
+01372                         formName += ".";
+01373                 formName += name;
+01374 
+01375                 // Backup first parent default value
+01376                 bool defaultValue = false;
+01377                 const CFormDfn *defaultParentDfnParent=0;
+01378                 uint defaultIndexDfnParent=0;
+01379                 const CFormDfn *defaultNodeDfnParent=0;
+01380                 const CType *defaultNodeTypeParent=0;
+01381                 CFormElm *defaultNodeParent=0;
+01382                 UFormDfn::TEntryType defaultTypeParent = UFormDfn::EntryType;
+01383                 bool defaultArrayParent=false;
+01384                 bool defaultCreatedParent=false;
+01385                 bool defaultParentVDfnArray=false;
+01386 
+01387                 // Look in parent form
+01388                 for (uint parent=0; parent<form->getParentCount (); parent++)
+01389                 {
+01390                         // Get the parent
+01391                         CForm *parentPtr = form->getParent (parent);
+01392                         nlassert (parentPtr);
+01393 
+01394                         // Get the node by name in the parent
+01395                         const CFormDfn *parentDfnParent = NULL;
+01396                         uint indexDfnParent = 0xffffffff;
+01397                         const CFormDfn *nodeDfnParent = NULL;
+01398                         const CType *nodeTypeParent = NULL;
+01399                         CFormElm *nodeParent = (CFormElm*)&parentPtr->getRootNode ();
+01400                         UFormDfn::TEntryType typeParent;
+01401                         bool arrayParent;
+01402                         bool createdParent;
+01403                         bool parentVDfnArray;
+01404                         if (getIternalNodeByName (parentPtr, formName.c_str (), &parentDfnParent, indexDfnParent, &nodeDfnParent, &nodeTypeParent, &nodeParent, typeParent, arrayParent, action, createdParent, parentVDfnArray, false, round+1))
+01405                         {
+01406                                 // Node found ?
+01407                                 if (nodeParent)
+01408                                 {
+01409                                         // Found copy return values
+01410                                         *parentDfn = parentDfnParent;
+01411                                         indexDfn = indexDfnParent;
+01412                                         *nodeDfn = nodeDfnParent;
+01413                                         *nodeType = nodeTypeParent;
+01414                                         *node = nodeParent;
+01415                                         type = typeParent;
+01416                                         array = arrayParent;
+01417                                         created = createdParent;
+01418 
+01419                                         return true;
+01420                                 }
+01421                                 else 
+01422                                 {
+01423                                         // Backup the first parent default value found
+01424                                         if (!defaultValue)
+01425                                         {
+01426                                                 defaultParentDfnParent = parentDfnParent;
+01427                                                 defaultIndexDfnParent = indexDfnParent;
+01428                                                 defaultNodeDfnParent = nodeDfnParent;
+01429                                                 defaultNodeTypeParent = nodeTypeParent;
+01430                                                 defaultNodeParent = nodeParent;
+01431                                                 defaultTypeParent = typeParent;
+01432                                                 defaultArrayParent = arrayParent;
+01433                                                 defaultCreatedParent = createdParent;
+01434                                                 defaultParentVDfnArray = parentVDfnArray;
+01435                                                 defaultValue = true;
+01436                                         }
+01437                                 }
+01438                         }
+01439                 }
+01440 
+01441                 // Default value available ?
+01442                 if (defaultValue)
+01443                 {
+01444                         *parentDfn = defaultParentDfnParent;
+01445                         indexDfn = defaultIndexDfnParent;
+01446                         *nodeDfn = defaultNodeDfnParent;
+01447                         *nodeType = defaultNodeTypeParent;
+01448                         *node = defaultNodeParent;
+01449                         type = defaultTypeParent;
+01450                         array = defaultArrayParent;
+01451                         created = defaultCreatedParent;
+01452                         return true;
+01453                 }
+01454         }
+01455 
+01456         // Recurce warning !
+01457         if (*node)
+01458         {
+01459                 if (round > NLGEORGES_MAX_RECURSION)
+01460                 {
+01461                         // Turn around..
+01462                         string formName;
+01463                         (*node)->getFormName (formName);
+01464                         warning (false, formName.c_str (), form->getFilename ().c_str(), "getIternalNodeByName", "Recurcive call on the same node (%s), look for loop references or inheritances.", name);
+01465                         return false;
+01466                 }
+01467         }
+01468 
+01469         if (verbose && errorAppend)
+01470         {
+01471                 nlassert (*error);
+01472 
+01473                 // Get the best form name
+01474                 warning (false, currentName.c_str (), form->getFilename ().c_str(), "getIternalNodeByName", "Getting the node (%s) : %s", name, error);
+01475         }
+01476 
+01477         return !errorAppend;
+01478 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getNodeByName const char *  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 [inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 629 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::Form, NLGEORGES::CFormElm::getIternalNodeByName(), NLGEORGES::CFormElm::ParentDfn, NLGEORGES::CFormElm::ParentIndex, NLGEORGES::CFormElm::Return, type, uint, and uint32. +

+

00633 {
+00634         *parentDfn = ParentDfn;
+00635         indexDfn = ParentIndex;
+00636         *nodeDfn = NULL;
+00637         *nodeType = NULL;
+00638         *node = (CFormElm*)this;
+00639         bool created;
+00640         return getIternalNodeByName (Form, name, parentDfn, indexDfn, nodeDfn, nodeType, node, type, array, Return, created, parentVDfnArray, verbose, round);
+00641 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getNodeByName UFormElm **  result,
const char *  name,
TWhereIsNode where,
bool  verbose,
uint32  round = 0
[virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 360 of file form_elm.cpp. +

+References uint32. +

+

00361 {
+00362         const UFormElm *resultConst = NULL;
+00363         if (((const UFormElm*)this)->getNodeByName (&resultConst, name, where, verbose, round))
+00364         {
+00365                 *result = const_cast<UFormElm*> (resultConst);
+00366                 return true;
+00367         }
+00368         return false;
+00369 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getNodeByName const UFormElm **  result,
const char *  name,
TWhereIsNode where,
bool  verbose,
uint32  round = 0
const [virtual, inherited]
+
+ + + + + +
+   + + +

+Return a node pointer with its name.

+

Parameters:
+ + + + +
result will be filled with the node pointer. Can be NULL if the node doesn't exist.
name is the form node name
where is a pointer on the information flag of the value. If Where is not NULL, it is filled with the position where the node has been found. If result is NULL, where is undefined.
+
+
Returns:
true if the result has been filled, false if the node is not referenced.
+About the node existance

+An atom node exist if its value are defined. A struct node exist if one of its children exist. An array node exist if one of its children exist. If the node doesn't exist, you can't have a pointer on it with getNodeByName(). It returns NULL. But, you can evaluate the value of non-existant atom nodes with getValueByName().

+About the form name:

+Struct elements name must be separeted by '.' Struct indexes must be between '[' and ']'

+Exemple: "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 +

+Implements NLGEORGES::UFormElm. +

+Definition at line 373 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::Form, type, uint, and uint32. +

+Referenced by NLGEORGES::CFormElm::getValueByName(). +

+

00374 {
+00375         // The parent Dfn
+00376         const CFormDfn *parentDfn;
+00377         const CFormDfn *nodeDfn;
+00378         const CType *nodeType;
+00379         CFormElm *node;
+00380         uint indexDfn;
+00381         bool array;
+00382         bool parentVDfnArray;
+00383         UFormDfn::TEntryType type;
+00384 
+00385         // Search for the node
+00386         if (getNodeByName (name, &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, verbose, round))
+00387         {
+00388                 // Set the result
+00389                 *result = node;
+00390 
+00391                 // Where ?
+00392                 if (where && node)
+00393                 {
+00394                         *where = (node->getForm () == Form) ? NodeForm : NodeParentForm;
+00395                 }
+00396 
+00397                 // Ok 
+00398                 return true;
+00399         }
+00400 
+00401         return false;
+00402 }
+
+

+ + + + +
+ + + + + + + + + +
UFormElm * NLGEORGES::CFormElm::getParent  )  const [virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 589 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::ParentNode. +

+

00590 {
+00591         return ParentNode;
+00592 }
+
+

+ + + + +
+ + + + + + + + + +
virtual UFormDfn* NLGEORGES::CFormElm::getStructDfn  )  [inline, virtual, inherited]
+
+ + + + + +
+   + + +

+Return the struct dfn. +

+ +

+Implements NLGEORGES::UFormElm. +

+Reimplemented in NLGEORGES::CFormElmStruct. +

+Definition at line 134 of file form_elm.h. +

+

00134 { return NULL; }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getStructNode uint  element,
UFormElm **  result
[virtual, inherited]
+
+ + + + + +
+   + + +

+Return a mutable element pointer. Can be NULL if the node doesn't exist. +

+ +

+Implements NLGEORGES::UFormElm. +

+Reimplemented in NLGEORGES::CFormElmStruct. +

+Definition at line 225 of file form_elm.cpp. +

+References uint, and NLGEORGES::CFormElm::warning(). +

+

00226 { 
+00227         warning (false, "getStructNode", "This node is not a struct.");
+00228         return false; 
+00229 };
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getStructNode uint  element,
const UFormElm **  result
const [virtual, inherited]
+
+ + + + + +
+   + + +

+Return a const element pointer. Can be NULL if the node doesn't exist. +

+ +

+Implements NLGEORGES::UFormElm. +

+Reimplemented in NLGEORGES::CFormElmStruct. +

+Definition at line 217 of file form_elm.cpp. +

+References uint, and NLGEORGES::CFormElm::warning(). +

+

00218 { 
+00219         warning (false, "getStructNode", "This node is not a struct.");
+00220         return false; 
+00221 };
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getStructNodeName uint  element,
std::string &  result
const [virtual, inherited]
+
+ + + + + +
+   + + +

+Return the element name. +

+ +

+Implements NLGEORGES::UFormElm. +

+Reimplemented in NLGEORGES::CFormElmStruct. +

+Definition at line 209 of file form_elm.cpp. +

+References uint, and NLGEORGES::CFormElm::warning(). +

+

00210 { 
+00211         warning (false, "getStructNodeName", "This node is not a struct.");
+00212         return false; 
+00213 };
+
+

+ + + + +
+ + + + + + + + + + +
bool NLGEORGES::CFormElm::getStructSize uint size  )  const [virtual, inherited]
+
+ + + + + +
+   + + +

+Return the struct size. +

+ +

+Implements NLGEORGES::UFormElm. +

+Reimplemented in NLGEORGES::CFormElmStruct. +

+Definition at line 201 of file form_elm.cpp. +

+References size, uint, and NLGEORGES::CFormElm::warning(). +

+

00202 { 
+00203         warning (false, "getStructSize", "This node is not a struct.");
+00204         return false; 
+00205 };
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValue NLMISC::CRGBA resultname,
TEval  evaluate
const [virtual, inherited]
+
+ + + + + +
+   + + +

+Warning, only R, G and B members are filled, not A. +

+ +

+Implements NLGEORGES::UFormElm. +

+Reimplemented in NLGEORGES::CFormElmAtom. +

+Definition at line 320 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::warning(). +

+

00321 {
+00322         warning (false, "getValue", "This node is not an atom."); 
+00323         return false; 
+00324 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValue bool &  resultname,
TEval  evaluate
const [virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Reimplemented in NLGEORGES::CFormElmAtom. +

+Definition at line 312 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::warning(). +

+

00313 {
+00314         warning (false, "getValue", "This node is not an atom."); 
+00315         return false; 
+00316 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValue double &  resultname,
TEval  evaluate
const [virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Reimplemented in NLGEORGES::CFormElmAtom. +

+Definition at line 304 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::warning(). +

+

00305 {
+00306         warning (false, "getValue", "This node is not an atom."); 
+00307         return false; 
+00308 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValue float &  resultname,
TEval  evaluate
const [virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Reimplemented in NLGEORGES::CFormElmAtom. +

+Definition at line 296 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::warning(). +

+

00297 {
+00298         warning (false, "getValue", "This node is not an atom.");
+00299         return false; 
+00300 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValue uint32 resultname,
TEval  evaluate
const [virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Reimplemented in NLGEORGES::CFormElmAtom. +

+Definition at line 288 of file form_elm.cpp. +

+References uint32, and NLGEORGES::CFormElm::warning(). +

+

00289 {
+00290         warning (false, "getValue", "This node is not an atom.");
+00291         return false; 
+00292 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValue sint32 resultname,
TEval  evaluate
const [virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Reimplemented in NLGEORGES::CFormElmAtom. +

+Definition at line 280 of file form_elm.cpp. +

+References sint32, and NLGEORGES::CFormElm::warning(). +

+

00281 {
+00282         warning (false, "getValue", "This node is not an atom.");
+00283         return false; 
+00284 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValue uint16 resultname,
TEval  evaluate
const [virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Reimplemented in NLGEORGES::CFormElmAtom. +

+Definition at line 272 of file form_elm.cpp. +

+References uint16, and NLGEORGES::CFormElm::warning(). +

+

00273 {
+00274         warning (false, "getValue", "This node is not an atom.");
+00275         return false; 
+00276 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValue sint16 resultname,
TEval  evaluate
const [virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Reimplemented in NLGEORGES::CFormElmAtom. +

+Definition at line 264 of file form_elm.cpp. +

+References sint16, and NLGEORGES::CFormElm::warning(). +

+

00265 {
+00266         warning (false, "getValue", "This node is not an atom.");
+00267         return false; 
+00268 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValue uint8 resultname,
TEval  evaluate
const [virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Reimplemented in NLGEORGES::CFormElmAtom. +

+Definition at line 256 of file form_elm.cpp. +

+References uint8, and NLGEORGES::CFormElm::warning(). +

+

00257 {
+00258         warning (false, "getValue", "This node is not an atom.");
+00259         return false; 
+00260 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValue sint8 resultname,
TEval  evaluate
const [virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Reimplemented in NLGEORGES::CFormElmAtom. +

+Definition at line 248 of file form_elm.cpp. +

+References sint8, and NLGEORGES::CFormElm::warning(). +

+

00249 {
+00250         warning (false, "getValue", "This node is not an atom.");
+00251         return false; 
+00252 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValue std::string &  resultname,
TEval  evaluate
const [virtual, inherited]
+
+ + + + + +
+   + + +

+Return the atom value. The numbers are clamped to the type limit values.

+

Parameters:
+ + + +
result is the reference on the value to fill with result
evaluate must be true if you want to have an evaluated value, false if you want the formula value.
+
+ +

+Implements NLGEORGES::UFormElm. +

+Reimplemented in NLGEORGES::CFormElmAtom. +

+Definition at line 240 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::warning(). +

+

00241 { 
+00242         warning (false, "getValue", "This node is not an atom.");
+00243         return false; 
+00244 };
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValueByName NLMISC::CRGBA result,
const char *  name,
TEval  evaluate,
TWhereIsValue where,
uint32  round = 0
const [virtual, inherited]
+
+ + + + + +
+   + + +

+Warning, only R, G and B members are filled, not A. +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 575 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::convertValue(), NLGEORGES::CFormElm::getValueByName(), uint32, and value. +

+

00576 {
+00577         // Get the string value
+00578         string value;
+00579         if (getValueByName (value, name, evaluate, where, round))
+00580         {
+00581                 return convertValue (result, value.c_str ());
+00582         }
+00583 
+00584         return false;
+00585 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValueByName bool &  result,
const char *  name,
TEval  evaluate,
TWhereIsValue where,
uint32  round = 0
const [virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 561 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::convertValue(), NLGEORGES::CFormElm::getValueByName(), uint32, and value. +

+

00562 {
+00563         // Get the string value
+00564         string value;
+00565         if (getValueByName (value, name, evaluate, where, round))
+00566         {
+00567                 return convertValue (result, value.c_str ());
+00568         }
+00569 
+00570         return false;
+00571 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValueByName double &  result,
const char *  name,
TEval  evaluate,
TWhereIsValue where,
uint32  round = 0
const [virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 547 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::convertValue(), NLGEORGES::CFormElm::getValueByName(), uint32, and value. +

+

00548 {
+00549         // Get the string value
+00550         string value;
+00551         if (getValueByName (value, name, evaluate, where, round))
+00552         {
+00553                 return convertValue (result, value.c_str ());
+00554         }
+00555 
+00556         return false;
+00557 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValueByName float &  result,
const char *  name,
TEval  evaluate,
TWhereIsValue where,
uint32  round = 0
const [virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 533 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::convertValue(), NLGEORGES::CFormElm::getValueByName(), uint32, and value. +

+

00534 {
+00535         // Get the string value
+00536         string value;
+00537         if (getValueByName (value, name, evaluate, where, round))
+00538         {
+00539                 return convertValue (result, value.c_str ());
+00540         }
+00541 
+00542         return false;
+00543 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValueByName uint32 result,
const char *  name,
TEval  evaluate,
TWhereIsValue where,
uint32  round = 0
const [virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 519 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::convertValue(), NLGEORGES::CFormElm::getValueByName(), uint32, and value. +

+

00520 {
+00521         // Get the string value
+00522         string value;
+00523         if (getValueByName (value, name, evaluate, where, round))
+00524         {
+00525                 return convertValue (result, value.c_str ());
+00526         }
+00527 
+00528         return false;
+00529 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValueByName sint32 result,
const char *  name,
TEval  evaluate,
TWhereIsValue where,
uint32  round = 0
const [virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 505 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::convertValue(), NLGEORGES::CFormElm::getValueByName(), sint32, uint32, and value. +

+

00506 {
+00507         // Get the string value
+00508         string value;
+00509         if (getValueByName (value, name, evaluate, where, round))
+00510         {
+00511                 return convertValue (result, value.c_str ());
+00512         }
+00513 
+00514         return false;
+00515 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValueByName uint16 result,
const char *  name,
TEval  evaluate,
TWhereIsValue where,
uint32  round = 0
const [virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 491 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::convertValue(), NLGEORGES::CFormElm::getValueByName(), uint16, uint32, and value. +

+

00492 {
+00493         // Get the string value
+00494         string value;
+00495         if (getValueByName (value, name, evaluate, where, round))
+00496         {
+00497                 return convertValue (result, value.c_str ());
+00498         }
+00499 
+00500         return false;
+00501 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValueByName sint16 result,
const char *  name,
TEval  evaluate,
TWhereIsValue where,
uint32  round = 0
const [virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 477 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::convertValue(), NLGEORGES::CFormElm::getValueByName(), sint16, uint32, and value. +

+

00478 {
+00479         // Get the string value
+00480         string value;
+00481         if (getValueByName (value, name, evaluate, where, round))
+00482         {
+00483                 return convertValue (result, value.c_str ());
+00484         }
+00485 
+00486         return false;
+00487 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValueByName uint8 result,
const char *  name,
TEval  evaluate,
TWhereIsValue where,
uint32  round = 0
const [virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 463 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::convertValue(), NLGEORGES::CFormElm::getValueByName(), uint32, uint8, and value. +

+

00464 {
+00465         // Get the string value
+00466         string value;
+00467         if (getValueByName (value, name, evaluate, where, round))
+00468         {
+00469                 return convertValue (result, value.c_str ());
+00470         }
+00471 
+00472         return false;
+00473 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValueByName sint8 result,
const char *  name,
TEval  evaluate,
TWhereIsValue where,
uint32  round = 0
const [virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 449 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::convertValue(), NLGEORGES::CFormElm::getValueByName(), sint8, uint32, and value. +

+

00450 {
+00451         // Get the string value
+00452         string value;
+00453         if (getValueByName (value, name, evaluate, where, round))
+00454         {
+00455                 return convertValue (result, value.c_str ());
+00456         }
+00457 
+00458         return false;
+00459 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::getValueByName std::string &  result,
const char *  name,
TEval  evaluate,
TWhereIsValue where,
uint32  round = 0
const [virtual, inherited]
+
+ + + + + +
+   + + +

+Get a form value with its name. The numbers are clamped to the type limit values.

+

Parameters:
+ + + + + +
result is a reference on the value to fill with the result.
name is the form name of the value to found.
evaluate must be true if you want to have an evaluated value, false if you want the formula value.
where is a pointer on the information flag of the value. If Where is not NULL, it is filled with the position where the value has been found.
+
+
Returns:
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 also:
getNodeByName ()
+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 406 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::Form, NLGEORGES::CFormElm::getNodeByName(), NLGEORGES::CType::getValue(), nlassert, type, uint, uint32, and NLGEORGES::CFormElm::warning(). +

+Referenced by NLGEORGES::CFormElm::getValueByName(). +

+

00407 {
+00408         // The parent Dfn
+00409         const CFormDfn *parentDfn;
+00410         const CFormDfn *nodeDfn;
+00411         const CType *nodeType;
+00412         CFormElm *node;
+00413         uint parentIndex;
+00414         bool array;
+00415         bool parentVDfnArray;
+00416         UFormDfn::TEntryType type;
+00417 
+00418         // Search for the node
+00419         if (getNodeByName (name, &parentDfn, parentIndex, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, round))
+00420         {
+00421                 // End, return the current index
+00422                 if (type == UFormDfn::EntryType)
+00423                 {
+00424                         // The atom
+00425                         const CFormElmAtom *atom = node ? safe_cast<const CFormElmAtom*> (node) : NULL;
+00426 
+00427                         // Evale
+00428                         nlassert (nodeType);
+00429                         return (nodeType->getValue (result, Form, atom, *parentDfn, parentIndex, evaluate, (uint32*)where, round, name));
+00430                 }
+00431                 else
+00432                 {
+00433                         // Error message
+00434                         warning (false, "getValueByName", "The node (%s) is not an atom element. Can't return a value.", name);
+00435                 }
+00436         }
+00437         else
+00438         {
+00439                 // Error message
+00440                 warning (false, "getValueByName", "Can't find the node (%s).", name);
+00441         }
+00442 
+00443         // Error
+00444         return false;
+00445 }
+
+

+ + + + +
+ + + + + + + + + +
bool NLGEORGES::CFormElmArray::isArray  )  const [virtual]
+
+ + + + + +
+   + + +

+Return true if the element is an array. +

+ +

+Reimplemented from NLGEORGES::CFormElm. +

+Definition at line 2278 of file form_elm.cpp. +

+

02279 {
+02280         return true;
+02281 };
+
+

+ + + + +
+ + + + + + + + + +
bool NLGEORGES::CFormElm::isAtom  )  const [virtual, inherited]
+
+ + + + + +
+   + + +

+Return true if the element is an atom. +

+ +

+Implements NLGEORGES::UFormElm. +

+Reimplemented in NLGEORGES::CFormElmAtom. +

+Definition at line 233 of file form_elm.cpp. +

+

00234 { 
+00235         return false; 
+00236 };
+
+

+ + + + +
+ + + + + + + + + +
bool NLGEORGES::CFormElm::isStruct  )  const [virtual, inherited]
+
+ + + + + +
+   + + +

+Return true if the element is a struct or a virtual struct. +

+ +

+Implements NLGEORGES::UFormElm. +

+Reimplemented in NLGEORGES::CFormElmStruct. +

+Definition at line 180 of file form_elm.cpp. +

+

00181 { 
+00182         return false; 
+00183 };
+
+

+ + + + +
+ + + + + + + + + + +
bool NLGEORGES::CFormElmArray::isUsed const CForm form  )  const [virtual]
+
+ + + + + +
+   + + +

+ +

+Reimplemented from NLGEORGES::CFormElm. +

+Definition at line 2700 of file form_elm.cpp. +

+Referenced by write(). +

+

02701 {       
+02702         /*for (uint i=0; i<Elements.size(); i++)
+02703         {
+02704                 if (Elements[i] && Elements[i]->isUsed (form))
+02705                         return true;
+02706         }*/
+02707         return form == Form;
+02708 }
+
+

+ + + + +
+ + + + + + + + + +
bool NLGEORGES::CFormElm::isVirtualStruct  )  const [virtual, inherited]
+
+ + + + + +
+   + + +

+Return true if the element is a virtual struct. +

+ +

+Implements NLGEORGES::UFormElm. +

+Reimplemented in NLGEORGES::CFormElmVirtualStruct. +

+Definition at line 187 of file form_elm.cpp. +

+

00188 { 
+00189         return false; 
+00190 };
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NLGEORGES::CFormElmArray::read xmlNodePtr  node,
CFormLoader loader,
CForm form
+
+ + + + + +
+   + + +

+ +

+Definition at line 2594 of file form_elm.cpp. +

+References clean(), nlassert, NLGEORGES::CFormElmStruct::read(), NLGEORGES::CFormElmAtom::read(), and uint. +

+Referenced by NLGEORGES::CFormElmStruct::read(). +

+

02595 {
+02596         // Clean the form
+02597         clean ();
+02598 
+02599         // Count child
+02600         if (node)
+02601         {
+02602                 // Type of DFN array
+02603                 if (Type)
+02604                 {
+02605                         nlassert (FormDfn == NULL);
+02606 
+02607                         // Count children
+02608                         uint childCount = CIXml::countChildren (node, "ATOM");
+02609 
+02610                         // Resize the table
+02611                         Elements.resize (childCount);
+02612 
+02613                         // For each children
+02614                         uint childNum=0;
+02615                         xmlNodePtr child = CIXml::getFirstChildNode (node, "ATOM");
+02616                         while (child)
+02617                         {
+02618                                 // Get node name
+02619                                 const char *name = (const char*)xmlGetProp (child, (xmlChar*)"Name");
+02620 
+02621                                 // Create a new node
+02622                                 CFormElmAtom *newElt = new CFormElmAtom (form, this, ParentDfn, ParentIndex);
+02623                                 Elements[childNum].Element = newElt;
+02624                                 if (name)
+02625                                 {
+02626                                         Elements[childNum].Name = name;
+02627                                         xmlFree ((void*)name);
+02628                                 }
+02629                                 newElt->read (child, loader, Type, form);
+02630 
+02631                                 // Next child
+02632                                 child = CIXml::getNextChildNode (child, "ATOM");
+02633                                 childNum++;
+02634                         }
+02635                 }
+02636                 else
+02637                 {
+02638                         nlassert (FormDfn);
+02639                         nlassert (Type == NULL);
+02640 
+02641                         // Count children
+02642                         uint childCount = CIXml::countChildren (node, "STRUCT");
+02643 
+02644                         // Resize the table
+02645                         Elements.resize (childCount);
+02646 
+02647                         // For each children
+02648                         uint childNum=0;
+02649                         xmlNodePtr child = CIXml::getFirstChildNode (node, "STRUCT");
+02650                         while (child)
+02651                         {
+02652                                 // Get node name
+02653                                 const char *name = (const char*)xmlGetProp (child, (xmlChar*)"Name");
+02654 
+02655                                 // Create a new node
+02656                                 CFormElmStruct *newElt = new CFormElmStruct (form, this, ParentDfn, ParentIndex);
+02657                                 Elements[childNum].Element = newElt;
+02658                                 if (name)
+02659                                 {
+02660                                         Elements[childNum].Name = name;
+02661                                         xmlFree ((void*)name);
+02662                                 }
+02663                                 newElt->read (child, loader, FormDfn, form);
+02664 
+02665                                 // Next child
+02666                                 child = CIXml::getNextChildNode (child, "STRUCT");
+02667                                 childNum++;
+02668                         }
+02669                 }
+02670         }
+02671 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NLGEORGES::CFormElmArray::setParent CFormElm parent  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 2675 of file form_elm.cpp. +

+

02676 {
+02677         return true;
+02678 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::setValueByName NLMISC::CRGBA  value,
const char *  name,
bool *  created
[virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 1647 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::setValueByName(), NLMISC::smprintf(), and value. +

+

01648 {       
+01649         char tmp[512];
+01650         smprintf (tmp, 512, "%d,%d,%d", value.R, value.G, value.B);
+01651         return setValueByName (tmp, name, created);
+01652 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::setValueByName bool  value,
const char *  name,
bool *  created
[virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 1640 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::setValueByName(), NLMISC::toString(), and value. +

+

01641 {
+01642         return setValueByName (toString (value).c_str (), name, created);
+01643 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::setValueByName double  value,
const char *  name,
bool *  created
[virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 1633 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::setValueByName(), NLMISC::toString(), and value. +

+

01634 {
+01635         return setValueByName (toString (value).c_str (), name, created);
+01636 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::setValueByName float  value,
const char *  name,
bool *  created
[virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 1626 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::setValueByName(), NLMISC::toString(), and value. +

+

01627 {
+01628         return setValueByName (toString (value).c_str (), name, created);
+01629 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::setValueByName uint32  value,
const char *  name,
bool *  created
[virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 1619 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::setValueByName(), NLMISC::toString(), uint32, and value. +

+

01620 {
+01621         return setValueByName (toString (value).c_str (), name, created);
+01622 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::setValueByName sint32  value,
const char *  name,
bool *  created
[virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 1612 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::setValueByName(), sint32, NLMISC::toString(), and value. +

+

01613 {
+01614         return setValueByName (toString (value).c_str (), name, created);
+01615 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::setValueByName uint16  value,
const char *  name,
bool *  created
[virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 1605 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::setValueByName(), NLMISC::toString(), uint16, and value. +

+

01606 {
+01607         return setValueByName (toString (value).c_str (), name, created);
+01608 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::setValueByName sint16  value,
const char *  name,
bool *  created
[virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 1598 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::setValueByName(), sint16, NLMISC::toString(), and value. +

+

01599 {
+01600         return setValueByName (toString (value).c_str (), name, created);
+01601 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::setValueByName uint8  value,
const char *  name,
bool *  created
[virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 1591 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::setValueByName(), NLMISC::toString(), uint8, and value. +

+

01592 {
+01593         return setValueByName (toString (value).c_str (), name, created);
+01594 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::setValueByName sint8  value,
const char *  name,
bool *  created
[virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 1584 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::setValueByName(), sint8, NLMISC::toString(), and value. +

+

01585 {
+01586         return setValueByName (toString (value).c_str (), name, created);
+01587 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormElm::setValueByName const char *  value,
const char *  name,
bool *  created
[virtual, inherited]
+
+ + + + + +
+   + + +

+Set a form value with its name. If the node doesn't exist, it is created.

+

Parameters:
+ + + + + +
value is a reference on the value to set in the form.
name is the form name of the value to set or create.
where is a pointer on the information flag of the value. If Where is not NULL, it is filled with the position where the value has been found.
created is a pointer on the creatation flag. If created is not NULL, it is filled with true if the value has been created, false it the value has been filled.
+
+
Returns:
true if the value has been set, false if the value has not been found or hasn't been created.
+ +

+Implements NLGEORGES::UFormElm. +

+Definition at line 1532 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::createNodeByName(), nlassert, NLGEORGES::CFormElmAtom::setValue(), type, uint, value, and NLGEORGES::CFormElm::warning(). +

+Referenced by NLGEORGES::CFormElm::setValueByName(). +

+

01533 {
+01534         // The parent Dfn
+01535         const CFormDfn *parentDfn;
+01536         const CFormDfn *nodeDfn;
+01537         const CType *nodeType;
+01538         CFormElm *node;
+01539         uint indexDfn;
+01540         bool array;
+01541         bool _created;
+01542         UFormDfn::TEntryType type;
+01543 
+01544         // Search for the node
+01545         if (createNodeByName (name, &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, _created))
+01546         {
+01547                 // Is this a type ?
+01548                 if (type == UFormDfn::EntryType)
+01549                 {
+01550                         // The atom
+01551                         CFormElmAtom *atom = node ? safe_cast<CFormElmAtom*> (node) : NULL;
+01552 
+01553                         // Evale
+01554                         nlassert (nodeType);
+01555                         atom->setValue (value);
+01556 
+01557                         // Created flag
+01558                         if (created)
+01559                                 *created = _created;
+01560                         return true;
+01561                 }
+01562                 else
+01563                 {
+01564                         // Error message
+01565                         warning (false, "setValueByName", "The node (%s) is not an atom element. Can't set the value.", name);
+01566                 }
+01567         }
+01568         else
+01569         {
+01570                 // Error message
+01571                 warning (false, "setValueByName", "Can't created / set the node (%s).", name);
+01572 
+01573                 // Created flag
+01574                 if (created)
+01575                         *created = false;
+01576         }
+01577 
+01578         // Error
+01579         return false;
+01580 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
const char * NLGEORGES::CFormElm::tokenize const char *  name,
std::string &  str,
uint errorIndex,
uint code
[static, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 1482 of file form_elm.cpp. +

+References NLGEORGES::CFormElm::TokenArrayBegin, NLGEORGES::CFormElm::TokenArrayEnd, NLGEORGES::CFormElm::TokenPoint, NLGEORGES::CFormElm::TokenString, and uint. +

+Referenced by NLGEORGES::CFormElm::getIternalNodeByName(). +

+

01483 {
+01484         if (*name == 0)
+01485         {
+01486                 return NULL;
+01487         }
+01488 
+01489         if (*name == '[')
+01490         {
+01491                 code = TokenArrayBegin;
+01492                 str = "[";
+01493                 return name+1;
+01494         }
+01495 
+01496         if (*name == ']')
+01497         {
+01498                 code = TokenArrayEnd;
+01499                 str = "]";
+01500                 return name+1;
+01501         }
+01502 
+01503         if (*name == '.')
+01504         {
+01505                 code = TokenPoint;
+01506                 str = ".";
+01507                 return name+1;
+01508         }
+01509 
+01510         str = "";
+01511         while ( (*name != '.') && (*name != '[') && (*name != ']') && (*name != 0) )
+01512         {
+01513                 // Add a char
+01514                 str += *name;
+01515                 name++;
+01516         }
+01517 
+01518         code = TokenString;
+01519         return name;
+01520 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLGEORGES::CFormElmArray::unlink CFormElm child  )  [virtual]
+
+ + + + + +
+   + + +

+Unlink a child +

+Reimplemented from NLGEORGES::CFormElm. +

+Definition at line 2682 of file form_elm.cpp. +

+References nlassert, and uint. +

+

02683 {
+02684   uint i;
+02685         for (i=0; i<Elements.size (); i++)
+02686         {
+02687                 if (Elements[i].Element == child)
+02688                 {
+02689                         Elements[i].Element = NULL;
+02690                         break;
+02691                 }
+02692         }
+02693 
+02694         // Element not found!
+02695         nlassert (i != Elements.size ());
+02696 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NLGEORGES::CFormElm::warning bool  exception,
const char *  formName,
const char *  formFileName,
const char *  function,
const char *  format,
... 
[static, protected, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 1656 of file form_elm.cpp. +

+References buffer, format, and NLGEORGES::warning(). +

+Referenced by NLGEORGES::CFormElm::convertValue(), NLGEORGES::CFormElm::getArrayNode(), NLGEORGES::CFormElm::getArrayNodeName(), NLGEORGES::CFormElm::getArraySize(), NLGEORGES::CFormElm::getArrayValue(), NLGEORGES::CFormElm::getIternalNodeByName(), NLGEORGES::CFormElm::getStructNode(), NLGEORGES::CFormElm::getStructNodeName(), NLGEORGES::CFormElm::getStructSize(), NLGEORGES::CFormElm::getValue(), NLGEORGES::CFormElm::getValueByName(), NLGEORGES::CFormElm::setValueByName(), and NLGEORGES::CFormElm::warning(). +

+

01657 {
+01658         // Make a buffer string
+01659         va_list args;
+01660         va_start( args, format );
+01661         char buffer[1024];
+01662         vsnprintf( buffer, 1024, format, args );
+01663         va_end( args );
+01664 
+01665         // Set the warning
+01666         NLGEORGES::warning (exception, "(CFormElm::%s) on node (%s) in form (%s) : %s", function, formName, formFileName, buffer);
+01667 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NLGEORGES::CFormElmArray::warning bool  exception,
const char *  function,
const char *  format,
... 
const [virtual]
+
+ + + + + +
+   + + +

+ +

+Reimplemented from NLGEORGES::CFormElm. +

+Definition at line 2754 of file form_elm.cpp. +

+References buffer, format, NLGEORGES::CForm::getFilename(), getFormName(), and NLGEORGES::warning(). +

+Referenced by getArrayNode(), getArrayNodeName(), getArrayValue(), and getFormName(). +

+

02755 {
+02756         // Make a buffer string
+02757         va_list args;
+02758         va_start( args, format );
+02759         char buffer[1024];
+02760         vsnprintf( buffer, 1024, format, args );
+02761         va_end( args );
+02762 
+02763         // Set the warning
+02764         string formName;
+02765         getFormName (formName, NULL);
+02766         NLGEORGES::warning (exception, "(CFormElmArray::%s) on node (%s) in form (%s) : %s", function, formName.c_str (), Form->getFilename ().c_str (), buffer);
+02767 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
xmlNodePtr NLGEORGES::CFormElmArray::write xmlNodePtr  node,
const CForm form,
const char *  structName,
bool  forceWrite = false
const [virtual]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::CFormElm. +

+Definition at line 2561 of file form_elm.cpp. +

+References isUsed(), and uint. +

+

02562 {       
+02563         // Arrau is used ?
+02564         if (isUsed (form) || forceWrite)
+02565         {
+02566                 // *** Header
+02567                 xmlNodePtr node = xmlNewChild ( root, NULL, (const xmlChar*)"ARRAY", NULL);
+02568 
+02569                 // Element name
+02570                 if (structName != NULL)
+02571                 {
+02572                         // Struct name
+02573                         xmlSetProp (node, (const xmlChar*)"Name", (const xmlChar*)structName);
+02574                 }
+02575 
+02576                 // For each elements of the structure
+02577                 uint elm;
+02578                 for (elm=0; elm<Elements.size(); elm++)
+02579                 {
+02580                         // Create a node
+02581                         if (Elements[elm].Element)
+02582                                 Elements[elm].Element->write (node, form, Elements[elm].Name.empty ()?NULL:Elements[elm].Name.c_str (), true);
+02583                 }
+02584 
+02585                 // Return the new node
+02586                 return node;
+02587         }
+02588 
+02589         return NULL;
+02590 }
+
+


Field Documentation

+

+ + + + +
+ + +
std::vector<CElement> NLGEORGES::CFormElmArray::Elements +
+
+ + + + + +
+   + + +

+ +

+Definition at line 414 of file form_elm.h. +

+Referenced by NLGEORGES::CFormElm::arrayDeleteNodeByName(), NLGEORGES::CFormElm::arrayInsertNodeByName(), and NLGEORGES::CFormElm::getIternalNodeByName().

+

+ + + + +
+ + +
CForm* NLGEORGES::CFormElm::Form [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 231 of file form_elm.h. +

+Referenced by NLGEORGES::CFormElm::arrayDeleteNodeByName(), NLGEORGES::CFormElm::arrayInsertNodeByName(), NLGEORGES::CFormElm::CFormElm(), NLGEORGES::CFormElm::createNodeByName(), NLGEORGES::CFormElm::deleteNodeByName(), NLGEORGES::CFormElm::getForm(), NLGEORGES::CFormElm::getNodeByName(), NLGEORGES::CFormElm::getValueByName(), and NLGEORGES::CFormElm::isUsed().

+

+ + + + +
+ + +
NLMISC::CSmartPtr<CFormDfn> NLGEORGES::CFormElmArray::FormDfn +
+
+ + + + + +
+   + + +

+ +

+Definition at line 364 of file form_elm.h.

+

+ + + + +
+ + +
const CFormDfn* NLGEORGES::CFormElm::ParentDfn [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 237 of file form_elm.h. +

+Referenced by NLGEORGES::CFormElm::arrayDeleteNodeByName(), NLGEORGES::CFormElm::arrayInsertNodeByName(), NLGEORGES::CFormElm::CFormElm(), NLGEORGES::CFormElm::createNodeByName(), NLGEORGES::CFormElm::deleteNodeByName(), and NLGEORGES::CFormElm::getNodeByName().

+

+ + + + +
+ + +
uint NLGEORGES::CFormElm::ParentIndex [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 240 of file form_elm.h. +

+Referenced by NLGEORGES::CFormElm::arrayDeleteNodeByName(), NLGEORGES::CFormElm::arrayInsertNodeByName(), NLGEORGES::CFormElm::CFormElm(), NLGEORGES::CFormElm::createNodeByName(), NLGEORGES::CFormElm::deleteNodeByName(), and NLGEORGES::CFormElm::getNodeByName().

+

+ + + + +
+ + +
CFormElm* NLGEORGES::CFormElm::ParentNode [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 234 of file form_elm.h. +

+Referenced by NLGEORGES::CFormElm::CFormElm(), and NLGEORGES::CFormElm::getParent().

+

+ + + + +
+ + +
uint32 NLGEORGES::CFormElm::Round [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 243 of file form_elm.h.

+

+ + + + +
+ + +
const CType* NLGEORGES::CFormElmArray::Type +
+
+ + + + + +
+   + + +

+ +

+Definition at line 367 of file form_elm.h.

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 12:42:42 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1