1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2014 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
6 // Copyright (C) 2014-2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
8 // This program is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU Affero General Public License as
10 // published by the Free Software Foundation, either version 3 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU Affero General Public License for more details.
18 // You should have received a copy of the GNU Affero General Public License
19 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "stdgeorges.h"
24 #include "nel/misc/o_xml.h"
25 #include "nel/misc/i_xml.h"
27 #include "nel/georges/form.h"
28 #include "nel/georges/form_elm.h"
29 #include "nel/georges/form_loader.h"
30 #include "nel/georges/type.h"
36 using namespace NLMISC
;
42 // ***************************************************************************
44 // ***************************************************************************
46 // ***************************************************************************
48 void warning (bool exception
, const char *format
, ... );
50 // ***************************************************************************
52 bool CFormElm::isArray () const
57 // ***************************************************************************
59 bool CFormElm::getArraySize (uint
&/* size */) const
61 warning (false, "getArraySize", "This node is not an array.");
65 // ***************************************************************************
67 bool CFormElm::getArrayNode (const UFormElm
** /* result */, uint
/* arrayIndex */) const
69 warning (false, "getArrayNode", "This node is not an array.");
73 // ***************************************************************************
75 bool CFormElm::getArrayNode (UFormElm
** /* result */, uint
/* arrayIndex */)
77 warning (false, "getArrayNode", "This node is not an array.");
81 // ***************************************************************************
83 bool CFormElm::getArrayNodeName (std::string
&/* result */, uint
/* arrayIndex */) const
85 warning (false, "getArrayNodeName", "This node is not an array.");
89 // ***************************************************************************
91 bool CFormElm::getArrayValue (std::string
&/* result */, uint
/* arrayIndex */, TEval
/* evaluate */, TWhereIsValue
* /* where */) const
93 warning (false, "getArrayNode", "This node is not an array.");
97 // ***************************************************************************
99 bool CFormElm::getArrayValue (sint8
&/* result */, uint
/* arrayIndex */, TEval
/* evaluate */, TWhereIsValue
* /* where */) const
101 warning (false, "getArrayValue", "This node is not an array.");
105 // ***************************************************************************
107 bool CFormElm::getArrayValue (uint8
&/* result */, uint
/* arrayIndex */, TEval
/* evaluate */, TWhereIsValue
* /* where */) const
109 warning (false, "getArrayValue", "This node is not an array.");
113 // ***************************************************************************
115 bool CFormElm::getArrayValue (sint16
&/* result */, uint
/* arrayIndex */, TEval
/* evaluate */, TWhereIsValue
* /* where */) const
117 warning (false, "getArrayValue", "This node is not an array.");
121 // ***************************************************************************
123 bool CFormElm::getArrayValue (uint16
&/* result */, uint
/* arrayIndex */, TEval
/* evaluate */, TWhereIsValue
* /* where */) const
125 warning (false, "getArrayValue", "This node is not an array.");
129 // ***************************************************************************
131 bool CFormElm::getArrayValue (sint32
&/* result */, uint
/* arrayIndex */, TEval
/* evaluate */, TWhereIsValue
* /* where */) const
133 warning (false, "getArrayValue", "This node is not an array.");
137 // ***************************************************************************
139 bool CFormElm::getArrayValue (uint32
&/* result */, uint
/* arrayIndex */, TEval
/* evaluate */, TWhereIsValue
* /* where */) const
141 warning (false, "getArrayValue", "This node is not an array.");
145 // ***************************************************************************
147 bool CFormElm::getArrayValue (float &/* result */, uint
/* arrayIndex */, TEval
/* evaluate */, TWhereIsValue
* /* where */) const
149 warning (false, "getArrayValue", "This node is not an array.");
153 // ***************************************************************************
155 bool CFormElm::getArrayValue (double &/* result */, uint
/* arrayIndex */, TEval
/* evaluate */, TWhereIsValue
* /* where */) const
157 warning (false, "getArrayValue", "This node is not an array.");
161 // ***************************************************************************
163 bool CFormElm::getArrayValue (bool &/* result */, uint
/* arrayIndex */, TEval
/* evaluate */, TWhereIsValue
* /* where */) const
165 warning (false, "getArrayValue", "This node is not an array.");
169 // ***************************************************************************
171 bool CFormElm::getArrayValue (NLMISC::CRGBA
&/* result */, uint
/* arrayIndex */, TEval
/* evaluate */, TWhereIsValue
* /* where */) const
173 warning (false, "getArrayValue", "This node is not an array.");
177 // ***************************************************************************
179 bool CFormElm::isStruct () const
184 // ***************************************************************************
186 bool CFormElm::isVirtualStruct () const
191 // ***************************************************************************
193 bool CFormElm::getDfnName (std::string
&/* dfnName */ ) const
198 // ***************************************************************************
200 bool CFormElm::getStructSize (uint
&/* size */) const
202 warning (false, "getStructSize", "This node is not a struct.");
206 // ***************************************************************************
208 bool CFormElm::getStructNodeName (uint
/* element */, string
&/* result */) const
210 warning (false, "getStructNodeName", "This node is not a struct.");
214 // ***************************************************************************
216 bool CFormElm::getStructNode (uint
/* element */, const UFormElm
** /* result */) const
218 warning (false, "getStructNode", "This node is not a struct.");
222 // ***************************************************************************
224 bool CFormElm::getStructNode (uint
/* element */, UFormElm
** /* result */)
226 warning (false, "getStructNode", "This node is not a struct.");
230 // ***************************************************************************
232 bool CFormElm::isAtom () const
237 // ***************************************************************************
239 const CType
* CFormElm::getType ()
241 warning (false, "getType", "This node is not an atom.");
245 // ***************************************************************************
247 bool CFormElm::getValue (string
&/* result */, TEval
/* evaluate */) const
249 warning (false, "getValue", "This node is not an atom.");
253 // ***************************************************************************
255 bool CFormElm::getValue (sint8
&/* result */, TEval
/* evaluate */) const
257 warning (false, "getValue", "This node is not an atom.");
261 // ***************************************************************************
263 bool CFormElm::getValue (uint8
&/* result */, TEval
/* evaluate */) const
265 warning (false, "getValue", "This node is not an atom.");
269 // ***************************************************************************
271 bool CFormElm::getValue (sint16
&/* result */, TEval
/* evaluate */) const
273 warning (false, "getValue", "This node is not an atom.");
277 // ***************************************************************************
279 bool CFormElm::getValue (uint16
&/* result */, TEval
/* evaluate */) const
281 warning (false, "getValue", "This node is not an atom.");
285 // ***************************************************************************
287 bool CFormElm::getValue (sint32
&/* result */, TEval
/* evaluate */) const
289 warning (false, "getValue", "This node is not an atom.");
293 // ***************************************************************************
295 bool CFormElm::getValue (uint32
&/* result */, TEval
/* evaluate */) const
297 warning (false, "getValue", "This node is not an atom.");
301 // ***************************************************************************
303 bool CFormElm::getValue (float &/* result */, TEval
/* evaluate */) const
305 warning (false, "getValue", "This node is not an atom.");
309 // ***************************************************************************
311 bool CFormElm::getValue (double &/* result */, TEval
/* evaluate */) const
313 warning (false, "getValue", "This node is not an atom.");
317 // ***************************************************************************
319 bool CFormElm::getValue (bool &/* result */, TEval
/* evaluate */) const
321 warning (false, "getValue", "This node is not an atom.");
325 // ***************************************************************************
327 bool CFormElm::getValue (NLMISC::CRGBA
&/* result */, TEval
/* evaluate */) const
329 warning (false, "getValue", "This node is not an atom.");
333 // ***************************************************************************
335 CFormElm::CFormElm (CForm
*form
, CFormElm
*parentNode
, const CFormDfn
*parentDfn
, uint parentIndex
)
338 ParentNode
= parentNode
;
339 ParentDfn
= parentDfn
;
340 ParentIndex
= parentIndex
;
344 // ***************************************************************************
346 CFormElm::~CFormElm ()
348 clean(); // it's virtual
351 // ***************************************************************************
353 bool CFormElm::isUsed (const CForm
*form
) const
358 // ***************************************************************************
360 CForm
*CFormElm::getForm () const
365 // ***************************************************************************
367 bool CFormElm::getNodeByName (UFormElm
**result
, const std::string
&name
, TWhereIsNode
*where
, bool verbose
, uint32 round
)
369 const UFormElm
*resultConst
= NULL
;
370 if (((const UFormElm
*)this)->getNodeByName (&resultConst
, name
, where
, verbose
, round
))
372 *result
= const_cast<UFormElm
*> (resultConst
);
378 // ***************************************************************************
380 bool CFormElm::getNodeByName (const UFormElm
**result
, const std::string
&name
, TWhereIsNode
*where
, bool verbose
, uint32 round
) const
383 const CFormDfn
*parentDfn
;
384 const CFormDfn
*nodeDfn
;
385 const CType
*nodeType
;
389 bool parentVDfnArray
;
390 UFormDfn::TEntryType type
;
392 // Search for the node
393 if (getNodeByName (name
, &parentDfn
, indexDfn
, &nodeDfn
, &nodeType
, &node
, type
, array
, parentVDfnArray
, verbose
, round
))
401 *where
= (node
->getForm () == Form
) ? NodeForm
: NodeParentForm
;
411 // ***************************************************************************
413 bool CFormElm::getValueByName (string
& result
, const std::string
&name
, TEval evaluate
, TWhereIsValue
*where
, uint32 round
) const
416 const CFormDfn
*parentDfn
;
417 const CFormDfn
*nodeDfn
;
418 const CType
*nodeType
;
422 bool parentVDfnArray
;
423 UFormDfn::TEntryType type
;
425 // Search for the node
426 if (getNodeByName (name
, &parentDfn
, parentIndex
, &nodeDfn
, &nodeType
, &node
, type
, array
, parentVDfnArray
, true, round
))
428 // End, return the current index
429 if (type
== UFormDfn::EntryType
)
432 const CFormElmAtom
*atom
= node
? safe_cast
<const CFormElmAtom
*> (node
) : NULL
;
436 return (nodeType
->getValue (result
, Form
, atom
, *parentDfn
, parentIndex
, evaluate
, (uint32
*)where
, round
, name
));
441 warning (false, "getValueByName", "The node (%s) is not an atom element. Can't return a value.", name
.c_str());
447 warning (false, "getValueByName", "Can't find the node (%s).", name
.c_str());
454 // ***************************************************************************
456 bool CFormElm::getValueByName (sint8
&result
, const std::string
&name
, TEval evaluate
, TWhereIsValue
*where
, uint32 round
) const
458 // Get the string value
460 if (getValueByName (value
, name
, evaluate
, where
, round
))
462 return convertValue (result
, value
);
468 // ***************************************************************************
470 bool CFormElm::getValueByName (uint8
&result
, const std::string
&name
, TEval evaluate
, TWhereIsValue
*where
, uint32 round
) const
472 // Get the string value
474 if (getValueByName (value
, name
, evaluate
, where
, round
))
476 return convertValue (result
, value
);
482 // ***************************************************************************
484 bool CFormElm::getValueByName (sint16
&result
, const std::string
&name
, TEval evaluate
, TWhereIsValue
*where
, uint32 round
) const
486 // Get the string value
488 if (getValueByName (value
, name
, evaluate
, where
, round
))
490 return convertValue (result
, value
);
496 // ***************************************************************************
498 bool CFormElm::getValueByName (uint16
&result
, const std::string
&name
, TEval evaluate
, TWhereIsValue
*where
, uint32 round
) const
500 // Get the string value
502 if (getValueByName (value
, name
, evaluate
, where
, round
))
504 return convertValue (result
, value
);
510 // ***************************************************************************
512 bool CFormElm::getValueByName (sint32
&result
, const std::string
&name
, TEval evaluate
, TWhereIsValue
*where
, uint32 round
) const
514 // Get the string value
516 if (getValueByName (value
, name
, evaluate
, where
, round
))
518 return convertValue (result
, value
);
524 // ***************************************************************************
526 bool CFormElm::getValueByName (uint32
&result
, const std::string
&name
, TEval evaluate
, TWhereIsValue
*where
, uint32 round
) const
528 // Get the string value
530 if (getValueByName (value
, name
, evaluate
, where
, round
))
532 return convertValue (result
, value
);
538 // ***************************************************************************
540 bool CFormElm::getValueByName (float &result
, const std::string
&name
, TEval evaluate
, TWhereIsValue
*where
, uint32 round
) const
542 // Get the string value
544 if (getValueByName (value
, name
, evaluate
, where
, round
))
546 return convertValue (result
, value
);
552 // ***************************************************************************
554 bool CFormElm::getValueByName(double &result
, const std::string
&name
, TEval evaluate
, TWhereIsValue
*where
, uint32 round
) const
556 // Get the string value
558 if (getValueByName (value
, name
, evaluate
, where
, round
))
560 return convertValue (result
, value
);
566 // ***************************************************************************
568 bool CFormElm::getValueByName (bool &result
, const std::string
&name
, TEval evaluate
, TWhereIsValue
*where
, uint32 round
) const
570 // Get the string value
572 if (getValueByName (value
, name
, evaluate
, where
, round
))
574 return convertValue (result
, value
);
580 // ***************************************************************************
582 bool CFormElm::getValueByName (NLMISC::CRGBA
&result
, const std::string
&name
, TEval evaluate
, TWhereIsValue
*where
, uint32 round
) const
584 // Get the string value
586 if (getValueByName (value
, name
, evaluate
, where
, round
))
588 return convertValue (result
, value
);
594 // ***************************************************************************
596 UFormElm
*CFormElm::getParent () const
601 // ***************************************************************************
603 bool CFormElm::createNodeByName (const std::string
&name
, const CFormDfn
**parentDfn
, uint
&indexDfn
,
604 const CFormDfn
**nodeDfn
, const CType
**nodeType
,
605 CFormElm
**node
, UFormDfn::TEntryType
&type
,
606 bool &array
, bool &created
)
608 *parentDfn
= ParentDfn
;
609 indexDfn
= ParentIndex
;
613 bool parentVDfnArray
;
614 return getInternalNodeByName (Form
, name
, parentDfn
, indexDfn
, nodeDfn
, nodeType
, node
, type
, array
, Create
, created
, parentVDfnArray
, true, NLGEORGES_FIRST_ROUND
);
617 // ***************************************************************************
619 bool CFormElm::deleteNodeByName (const std::string
&name
, const CFormDfn
**parentDfn
, uint
&indexDfn
,
620 const CFormDfn
**nodeDfn
, const CType
**nodeType
,
621 CFormElm
**node
, UFormDfn::TEntryType
&type
,
624 *parentDfn
= ParentDfn
;
625 indexDfn
= ParentIndex
;
630 bool parentVDfnArray
;
631 return getInternalNodeByName (Form
, name
, parentDfn
, indexDfn
, nodeDfn
, nodeType
, node
, type
, array
, Delete
, created
, parentVDfnArray
, true, NLGEORGES_FIRST_ROUND
);
634 // ***************************************************************************
636 bool CFormElm::getNodeByName (const std::string
&name
, const CFormDfn
**parentDfn
, uint
&indexDfn
,
637 const CFormDfn
**nodeDfn
, const CType
**nodeType
,
638 CFormElm
**node
, UFormDfn::TEntryType
&type
,
639 bool &array
, bool &parentVDfnArray
, bool verbose
, uint32 round
) const
641 *parentDfn
= ParentDfn
;
642 indexDfn
= ParentIndex
;
645 *node
= (CFormElm
*)this;
647 return getInternalNodeByName (Form
, name
, parentDfn
, indexDfn
, nodeDfn
, nodeType
, node
, type
, array
, Return
, created
, parentVDfnArray
, verbose
, round
);
650 // ***************************************************************************
652 bool CFormElm::arrayInsertNodeByName (const std::string
&name
, const CFormDfn
**parentDfn
, uint
&indexDfn
,
653 const CFormDfn
**nodeDfn
, const CType
**nodeType
,
654 CFormElm
**node
, UFormDfn::TEntryType
&type
,
655 bool &array
, bool verbose
, uint arrayIndex
) const
657 // Get the node by name
658 *parentDfn
= ParentDfn
;
659 indexDfn
= ParentIndex
;
662 *node
= (CFormElm
*)this;
664 bool parentVDfnArray
;
665 if (getInternalNodeByName (Form
, name
, parentDfn
, indexDfn
, nodeDfn
, nodeType
, node
, type
, array
, Create
, created
, parentVDfnArray
, verbose
, NLGEORGES_FIRST_ROUND
))
667 // Must be in the same form
668 nlassert ((*node
) && ((*node
)->Form
== Form
));
671 CFormElm
*parentNode
= (*node
)->ParentNode
;
672 if (parentNode
->isArray ())
675 CFormElmArray
*array
= safe_cast
<CFormElmArray
*>(parentNode
);
678 if (arrayIndex
<array
->Elements
.size ())
680 // Insert the element
681 array
->Elements
.insert (array
->Elements
.begin() + arrayIndex
, CFormElmArray::CElement());
683 // Create a new element
686 CFormElm
*newelm
= NULL
;
689 case UFormDfn::EntryType
:
692 CFormElmAtom
*atom
= new CFormElmAtom (Form
, array
, *parentDfn
, indexDfn
);
696 case UFormDfn::EntryDfn
:
698 CFormElmStruct
*_struct
= new CFormElmStruct (Form
, array
, *parentDfn
, indexDfn
);
699 _struct
->build (*nodeDfn
);
703 case UFormDfn::EntryVirtualDfn
:
704 // todo array of virtual struct
705 //newelm = new CFormElmVirtualStruct (Form, array, *parentDfn, indexDfn);
713 // Set the element pointer
714 array
->Elements
[arrayIndex
].Element
= newelm
;
724 // ***************************************************************************
726 bool CFormElm::arrayDeleteNodeByName (const std::string
&name
, const CFormDfn
**parentDfn
, uint
&indexDfn
,
727 const CFormDfn
**nodeDfn
, const CType
**nodeType
,
728 CFormElm
**node
, UFormDfn::TEntryType
&type
,
729 bool &array
, bool verbose
, uint arrayIndex
) const
731 // Get the node by name
732 *parentDfn
= ParentDfn
;
733 indexDfn
= ParentIndex
;
736 *node
= (CFormElm
*)this;
738 bool parentVDfnArray
;
739 if (getInternalNodeByName (Form
, name
, parentDfn
, indexDfn
, nodeDfn
, nodeType
, node
, type
, array
, Create
, created
, parentVDfnArray
, verbose
, NLGEORGES_FIRST_ROUND
))
741 // Must be in the same form
742 nlassert ((*node
) && ((*node
)->Form
== Form
));
745 CFormElm
*parentNode
= (*node
)->ParentNode
;
746 if (parentNode
->isArray ())
749 CFormElmArray
*array
= safe_cast
<CFormElmArray
*>(parentNode
);
752 if (arrayIndex
<array
->Elements
.size ())
754 // Insert the element
755 if (array
->Elements
[arrayIndex
].Element
)
756 delete array
->Elements
[arrayIndex
].Element
;
759 array
->Elements
.erase (array
->Elements
.begin () + arrayIndex
);
769 // ***************************************************************************
771 bool CFormElm::getInternalNodeByName (CForm
*form
, const std::string
&name
, const CFormDfn
**parentDfn
, uint
&indexDfn
, const CFormDfn
**nodeDfn
, const CType
**nodeType
, CFormElm
**node
, UFormDfn::TEntryType
&type
, bool &array
, TNodeAction action
, bool &created
, bool &parentVDfnArray
, bool verbose
, uint32 round
)
773 // *** Init output variables
775 parentVDfnArray
= false;
777 // ParentDfn or Node..
778 nlassert ( (*parentDfn
) || (*node
) );
787 const CFormDfn::CEntry
&theEntry
= (*parentDfn
)->getEntry (indexDfn
);
790 type
= theEntry
.getType ();
791 *nodeType
= theEntry
.getTypePtr ();
792 if (type
== UFormDfn::EntryVirtualDfn
)
795 *nodeDfn
= safe_cast
<CFormElmVirtualStruct
*> (*node
)->FormDfn
;
800 *nodeDfn
= theEntry
.getDfnPtr ();
801 array
= theEntry
.getArrayFlag ();
805 nlassert (!(*node
)->isArray ());
806 indexDfn
= 0xffffffff;
807 *nodeType
= (*node
)->isAtom () ? safe_cast
<CFormElmAtom
*>(*node
)->Type
: NULL
;
808 *nodeDfn
= (*node
)->isStruct () ? (const CFormDfn
*)(safe_cast
<CFormElmStruct
*>(*node
)->FormDfn
) : NULL
;
809 type
= (*node
)->isAtom () ? UFormDfn::EntryType
: (*node
)->isVirtualStruct () ? UFormDfn::EntryVirtualDfn
: UFormDfn::EntryDfn
;
813 // Check node pointer
814 if (action
== Create
)
817 nlassert ((*node
)->getForm () == form
);
820 // Backup current node
821 CFormElm
*backupFirstElm
= *node
;
823 // *** Parsing variables
825 // Current token start and end
826 const char *startToken
= name
.c_str();
827 const char *endToken
;
829 // Current token start
835 (*node
)->getFormName (currentName
);
843 // Are we parsing an array ?
844 bool inArrayIndex
= false;
846 // Index in the array
849 // Bool next token must be an array index
850 bool wantArrayIndex
= false;
853 CFormElmStruct
*lastStructElm
= ((*node
)->ParentNode
&& (*node
)->ParentNode
->isStruct ()) ? safe_cast
<CFormElmStruct
*> ((*node
)->ParentNode
) : NULL
;
854 uint lastStructIndex
= 0;
857 // Look for node in the parent
858 for (; lastStructIndex
<lastStructElm
->Elements
.size (); lastStructIndex
++)
861 if (lastStructElm
->Elements
[lastStructIndex
].Element
== (*node
))
865 // Must have been found
866 nlassert (lastStructIndex
<lastStructElm
->Elements
.size ());
869 // While there is tokens
870 while ((endToken
= tokenize (startToken
, token
, errorIndex
, code
)))
872 // Ready an array index ?
880 // Need an array index array ?
884 smprintf (error
, 512, "Token (%s) should be an array index.", token
.c_str());
889 if ( ((type
== UFormDfn::EntryDfn
) || (type
== UFormDfn::EntryVirtualDfn
)) /*&& (!array)*/ )
891 // Check the virtual DFN is not empty..
892 if ( (type
== UFormDfn::EntryVirtualDfn
) && (*nodeDfn
== NULL
) )
894 // Is it a parent virtual DFN ?
895 if ( (type
== UFormDfn::EntryVirtualDfn
) && (*node
== NULL
) )
896 parentVDfnArray
= true;
899 if (action
== Create
)
901 // Should have a valid node
902 nlassert (*node
&& lastStructElm
);
904 // Get the current virtual dfn
905 CFormElmVirtualStruct
*vStruct
= safe_cast
<CFormElmVirtualStruct
*> (*node
);
907 // Get the form name of the current node
909 vStruct
->getFormName (formName
, NULL
);
911 // Get the parent node if available
912 for (uint parent
=0; parent
<form
->getParentCount (); parent
++)
915 CForm
*parentPtr
= form
->getParent (parent
);
916 nlassert (parentPtr
);
918 // Get the virtual node by name
920 if (parentPtr
->getRootNode ().getNodeByName (&uelm
, formName
, NULL
, verbose
, round
+1) && uelm
)
923 if (uelm
->isVirtualStruct ())
925 // Get a virtual struct pointer
926 CFormElmVirtualStruct
*vStructParent
= safe_cast
<CFormElmVirtualStruct
*> (uelm
);
928 // Copy the DFN filename
929 vStruct
->DfnFilename
= vStructParent
->DfnFilename
;
932 vStruct
->build (vStructParent
->FormDfn
);
934 // Set the current DFN
935 *nodeDfn
= vStruct
->FormDfn
;
937 // Stop looking for parent
943 smprintf (error
, 512, "Internal node parsing error.");
951 if (*nodeDfn
== NULL
)
954 smprintf (error
, 512, "Empty virtual struct element. Can't look into it while it is not defined.");
959 // Must have a nodeDfn here
962 // Look for the element
963 // uint elementCount = (*nodeDfn)->getNumEntry ();
966 vector
<const CFormDfn
*> arrayDfn
;
967 arrayDfn
.reserve ((*nodeDfn
)->countParentDfn ());
968 (*nodeDfn
)->getParentDfn (arrayDfn
);
973 for (i
=0; i
<arrayDfn
.size(); i
++)
976 const CFormDfn
&dfn
= *(arrayDfn
[i
]);
980 for (element
=0; element
<dfn
.Entries
.size(); element
++)
983 if (dfn
.Entries
[element
].Name
== token
)
988 *nodeDfn
= dfn
.Entries
[element
].Dfn
;
989 *nodeType
= dfn
.Entries
[element
].Type
;
990 type
= dfn
.Entries
[element
].TypeElement
;
991 array
= dfn
.Entries
[element
].Array
;
992 wantArrayIndex
= array
;
998 CFormElmStruct
*nodeStruct
= safe_cast
<CFormElmStruct
*> (*node
);
999 CFormElm
*nextElt
= nodeStruct
->Elements
[formElm
].Element
;
1001 // If no next node, watch for parent node
1005 if ( (action
== Create
) && (*node
== NULL
) )
1011 CFormElmArray
*atom
= new CFormElmArray (form
, *nodeDfn
, *nodeType
, nodeStruct
, *parentDfn
, indexDfn
);
1016 // What kind of node ?
1019 case UFormDfn::EntryType
:
1022 CFormElmAtom
*atom
= new CFormElmAtom (form
, nodeStruct
, *parentDfn
, indexDfn
);
1026 case UFormDfn::EntryDfn
:
1028 CFormElmStruct
*_struct
= new CFormElmStruct (form
, nodeStruct
, *parentDfn
, indexDfn
);
1029 _struct
->build (*nodeDfn
);
1033 case UFormDfn::EntryVirtualDfn
:
1034 *node
= new CFormElmVirtualStruct (form
, nodeStruct
, *parentDfn
, indexDfn
);
1044 // Set the node in parent
1045 nodeStruct
->Elements
[formElm
].Element
= *node
;
1048 // Is a virtual DFN ?
1049 if ((*node
) && (*node
)->isVirtualStruct ())
1052 nlassert (*nodeDfn
== NULL
);
1054 // Set the current dfn
1055 *nodeDfn
= safe_cast
<const CFormElmVirtualStruct
*> (*node
)->FormDfn
;
1059 lastStructElm
= nodeStruct
;
1060 lastStructIndex
= formElm
;
1065 // CFormElmStruct *lastStructElm = NULL;
1066 //uint lastStructIndex = 0xffffffff;
1077 if (element
!=dfn
.Entries
.size())
1082 if (i
==arrayDfn
.size())
1085 smprintf (error
, 512, "Struct does not contain element named (%s).", token
.c_str());
1092 smprintf (error
, 512, "Not a struct element. Can't open the node (%s).", token
.c_str());
1099 // Need an array index array ?
1103 smprintf (error
, 512, "Token (%s) should be an array index.", token
.c_str());
1107 // Are we a struct ?
1108 if ((type
!= UFormDfn::EntryDfn
) && (type
!= UFormDfn::EntryVirtualDfn
))
1111 smprintf (error
, 512, "Not a struct element. Can't open the node (%s).", token
.c_str());
1116 case TokenArrayBegin
:
1118 // Are we an array ?
1122 smprintf (error
, 512, "Not an array element. Can't open the node (%s).", token
.c_str());
1125 inArrayIndex
= true;
1126 arrayIndex
= 0xffffffff;
1132 smprintf (error
, 512, "Syntax error at keyword (%s).", token
.c_str ());
1145 if (!fromString(token
, arrayIndex
))
1148 smprintf (error
, 512, "Keyword (%s) is not an array index.", token
.c_str());
1152 // Is it a parent virtual DFN ?
1154 parentVDfnArray
= true;
1156 // Should have an array defined
1161 nlverify ((*node
)->getArraySize (arraySize
));
1162 if (arrayIndex
>=arraySize
)
1165 if (action
== Create
)
1167 // Must be in the same form
1168 nlassert ((*node
)->Form
== form
);
1170 // The array pointer
1171 CFormElmArray
*array
= safe_cast
<CFormElmArray
*>(*node
);
1172 uint oldSize
= (uint
)array
->Elements
.size ();
1173 array
->Elements
.resize (arrayIndex
+1);
1175 // Insert empty element
1177 for (i
=oldSize
; i
<array
->Elements
.size (); i
++)
1180 CFormElm
*newelm
= NULL
;
1183 case UFormDfn::EntryType
:
1186 CFormElmAtom
*atom
= new CFormElmAtom (form
, array
, *parentDfn
, indexDfn
);
1190 case UFormDfn::EntryDfn
:
1192 CFormElmStruct
*_struct
= new CFormElmStruct (form
, array
, *parentDfn
, indexDfn
);
1193 _struct
->build (*nodeDfn
);
1197 case UFormDfn::EntryVirtualDfn
:
1198 // todo array of virtual struct
1199 //newelm = new CFormElmVirtualStruct (form, array, *parentDfn, indexDfn);
1210 // Set the element pointer
1211 array
->Elements
[i
].Element
= newelm
;
1217 smprintf (error
, 512, "Out of array bounds (%d >= %d).", arrayIndex
, arraySize
);
1225 smprintf (error
, 512, "Array is not defined.");
1232 // No need of an array index any more
1233 wantArrayIndex
= false;
1236 if (arrayIndex
== 0xffffffff)
1239 smprintf (error
, 512, "Missing array index.");
1243 // Let the parent DFN
1244 nlassert (*parentDfn
);
1247 CFormElmArray
*parentNode
= safe_cast
<CFormElmArray
*> (*node
);
1250 *node
= parentNode
->Elements
[arrayIndex
].Element
;
1253 *nodeDfn
= (*parentDfn
)->getEntry (indexDfn
).getDfnPtr ();
1256 *nodeType
= (*parentDfn
)->getEntry (indexDfn
).getTypePtr ();
1259 type
= (*parentDfn
)->getEntry (indexDfn
).getType ();
1261 // Can't be an array of array
1264 // Not any more in index
1265 inArrayIndex
= false;
1267 // What kind of node ?
1268 if ( (action
== Create
) && ( *node
== NULL
) )
1272 case UFormDfn::EntryType
:
1275 CFormElmAtom
*atom
= new CFormElmAtom (form
, parentNode
, *parentDfn
, indexDfn
);
1279 case UFormDfn::EntryDfn
:
1281 CFormElmStruct
*_struct
= new CFormElmStruct (form
, parentNode
, *parentDfn
, indexDfn
);
1282 _struct
->build (*nodeDfn
);
1286 case UFormDfn::EntryVirtualDfn
:
1287 // todo array of virtual struct
1288 // *node = new CFormElmVirtualStruct (form, parentNode, *parentDfn, indexDfn);
1299 // Set the element pointer
1300 parentNode
->Elements
[arrayIndex
].Element
= *node
;
1303 // Is a virtual DFN ?
1304 if ((*node
) && (*node
)->isVirtualStruct ())
1307 nlassert (*nodeDfn
== NULL
);
1309 // Set the current dfn
1310 *nodeDfn
= safe_cast
<const CFormElmVirtualStruct
*> (*node
)->FormDfn
;
1318 smprintf (error
, 512, "Keyword (%s) is not an array index.", token
.c_str());
1324 // Concat current address
1325 currentName
+= token
;
1326 startToken
= endToken
;
1331 bool errorAppend
= endToken
!= NULL
;
1336 // Delete the node ?
1337 if ( (action
== Delete
) && (*node
) )
1340 CFormElm
*parent
= safe_cast
<CFormElm
*> ((*node
)->getParent ());
1342 // Don't erase the root structure
1343 if (parent
&& !parent
->isArray ())
1345 // Unlink the primitive from its parent
1346 parent
->unlink (*node
);
1351 parent
= (CFormElm
*) (parent
->getParent ());
1354 while (parent
&& !(*node
)->isUsed (form
) && !parent
->isArray ())
1356 // Unlink the primitive from its parent
1357 parent
->unlink (*node
);
1359 // Erase it and get next parent
1362 parent
= (CFormElm
*) (parent
->getParent ());
1371 // Node not found in get node ? Look in parents !
1372 if ( ((*node
) == NULL
) && (action
== Return
) && backupFirstElm
)
1374 // Get the path name
1376 backupFirstElm
->getFormName (formName
);
1377 uint formNameSize
= (uint
)formName
.size ();
1378 if ((formNameSize
> 0) && (formName
[formNameSize
-1] != '.') && (formName
[formNameSize
-1] != '['))
1382 // Backup first parent default value
1383 bool defaultValue
= false;
1384 const CFormDfn
*defaultParentDfnParent
=0;
1385 uint defaultIndexDfnParent
=0;
1386 const CFormDfn
*defaultNodeDfnParent
=0;
1387 const CType
*defaultNodeTypeParent
=0;
1388 CFormElm
*defaultNodeParent
=0;
1389 UFormDfn::TEntryType defaultTypeParent
= UFormDfn::EntryType
;
1390 bool defaultArrayParent
=false;
1391 bool defaultCreatedParent
=false;
1392 bool defaultParentVDfnArray
=false;
1394 // Look in parent form
1395 for (uint parent
=0; parent
<form
->getParentCount (); parent
++)
1398 CForm
*parentPtr
= form
->getParent (parent
);
1399 nlassert (parentPtr
);
1401 if (parentPtr
->getFilename() == form
->getFilename())
1403 nlerror("parent is identical to current sheet %s!", form
->getFilename().c_str());
1407 // Get the node by name in the parent
1408 const CFormDfn
*parentDfnParent
= NULL
;
1409 uint indexDfnParent
= 0xffffffff;
1410 const CFormDfn
*nodeDfnParent
= NULL
;
1411 const CType
*nodeTypeParent
= NULL
;
1412 CFormElm
*nodeParent
= (CFormElm
*)&parentPtr
->getRootNode ();
1413 UFormDfn::TEntryType typeParent
;
1416 bool parentVDfnArray
;
1417 if (getInternalNodeByName (parentPtr
, formName
, &parentDfnParent
, indexDfnParent
, &nodeDfnParent
, &nodeTypeParent
, &nodeParent
, typeParent
, arrayParent
, action
, createdParent
, parentVDfnArray
, false, round
+1))
1422 // Found copy return values
1423 *parentDfn
= parentDfnParent
;
1424 indexDfn
= indexDfnParent
;
1425 *nodeDfn
= nodeDfnParent
;
1426 *nodeType
= nodeTypeParent
;
1429 array
= arrayParent
;
1430 created
= createdParent
;
1436 // Backup the first parent default value found
1439 defaultParentDfnParent
= parentDfnParent
;
1440 defaultIndexDfnParent
= indexDfnParent
;
1441 defaultNodeDfnParent
= nodeDfnParent
;
1442 defaultNodeTypeParent
= nodeTypeParent
;
1443 defaultNodeParent
= nodeParent
;
1444 defaultTypeParent
= typeParent
;
1445 defaultArrayParent
= arrayParent
;
1446 defaultCreatedParent
= createdParent
;
1447 defaultParentVDfnArray
= parentVDfnArray
;
1448 defaultValue
= true;
1454 // Default value available ?
1457 *parentDfn
= defaultParentDfnParent
;
1458 indexDfn
= defaultIndexDfnParent
;
1459 *nodeDfn
= defaultNodeDfnParent
;
1460 *nodeType
= defaultNodeTypeParent
;
1461 *node
= defaultNodeParent
;
1462 type
= defaultTypeParent
;
1463 array
= defaultArrayParent
;
1464 created
= defaultCreatedParent
;
1469 // Recurse warning !
1472 if (round
> NLGEORGES_MAX_RECURSION
)
1476 (*node
)->getFormName (formName
);
1477 warning (false, formName
, form
->getFilename (), "getInternalNodeByName", "Recursive call on the same node (%s), look for loop references or inheritances.", name
.c_str());
1482 if (verbose
&& errorAppend
)
1486 // Get the best form name
1487 warning (false, currentName
, form
->getFilename (), "getInternalNodeByName", "Getting the node (%s) : %s", name
.c_str(), error
);
1490 return !errorAppend
;
1493 // ***************************************************************************
1495 const char* CFormElm::tokenize (const char *name
, string
&str
, uint
&/* errorIndex */, uint
&code
)
1504 code
= TokenArrayBegin
;
1511 code
= TokenArrayEnd
;
1524 while ( (*name
!= '.') && (*name
!= '[') && (*name
!= ']') && (*name
!= 0) )
1535 // ***************************************************************************
1537 void CFormElm::unlink (CFormElm
* /* child */)
1543 // ***************************************************************************
1545 bool CFormElm::setValueByName(const std::string
&value
, const std::string
&name
, bool *created
)
1548 const CFormDfn
*parentDfn
;
1549 const CFormDfn
*nodeDfn
;
1550 const CType
*nodeType
;
1555 UFormDfn::TEntryType type
;
1557 // Search for the node
1558 if (createNodeByName (name
, &parentDfn
, indexDfn
, &nodeDfn
, &nodeType
, &node
, type
, array
, _created
))
1561 if (type
== UFormDfn::EntryType
)
1564 CFormElmAtom
*atom
= node
? safe_cast
<CFormElmAtom
*> (node
) : NULL
;
1567 nlassert (nodeType
);
1568 atom
->setValue (value
);
1572 *created
= _created
;
1578 warning (false, "setValueByName", "The node (%s) is not an atom element. Can't set the value.", name
.c_str());
1584 warning (false, "setValueByName", "Can't created / set the node (%s).", name
.c_str());
1595 // ***************************************************************************
1597 bool CFormElm::setValueByName (sint8 value
, const std::string
&name
, bool *created
)
1599 return setValueByName (toString (value
), name
, created
);
1602 // ***************************************************************************
1604 bool CFormElm::setValueByName (uint8 value
, const std::string
&name
, bool *created
)
1606 return setValueByName (toString (value
), name
, created
);
1609 // ***************************************************************************
1611 bool CFormElm::setValueByName (sint16 value
, const std::string
&name
, bool *created
)
1613 return setValueByName (toString (value
), name
, created
);
1616 // ***************************************************************************
1618 bool CFormElm::setValueByName (uint16 value
, const std::string
&name
, bool *created
)
1620 return setValueByName (toString (value
), name
, created
);
1623 // ***************************************************************************
1625 bool CFormElm::setValueByName(sint32 value
, const std::string
&name
, bool *created
)
1627 return setValueByName (toString (value
), name
, created
);
1630 // ***************************************************************************
1632 bool CFormElm::setValueByName (uint32 value
, const std::string
&name
, bool *created
)
1634 return setValueByName (toString (value
), name
, created
);
1637 // ***************************************************************************
1639 bool CFormElm::setValueByName (float value
, const std::string
&name
, bool *created
)
1641 return setValueByName (toString (value
), name
, created
);
1644 // ***************************************************************************
1646 bool CFormElm::setValueByName (double value
, const std::string
&name
, bool *created
)
1648 return setValueByName (toString (value
), name
, created
);
1651 // ***************************************************************************
1653 bool CFormElm::setValueByName (bool value
, const std::string
&name
, bool *created
)
1655 return setValueByName (toString (value
), name
, created
);
1658 // ***************************************************************************
1660 bool CFormElm::setValueByName (NLMISC::CRGBA value
, const std::string
&name
, bool *created
)
1663 smprintf (tmp
, 512, "%d,%d,%d", value
.R
, value
.G
, value
.B
);
1664 return setValueByName(std::string(tmp
), name
, created
);
1667 // ***************************************************************************
1669 void CFormElm::warning (bool exception
, const std::string
&formName
, const std::string
&formFileName
, const std::string
&function
, const char *format
, ... )
1671 // Make a buffer string
1673 va_start( args
, format
);
1675 vsnprintf( buffer
, 1024, format
, args
);
1679 NLGEORGES::warning (exception
, "(CFormElm::%s) on node (%s) in form (%s) : %s", function
.c_str(), formName
.c_str(), formFileName
.c_str(), buffer
);
1682 // ***************************************************************************
1684 void CFormElm::warning (bool exception
, const std::string
&function
, const char *format
, ... ) const
1687 va_start( args
, format
);
1690 getFormName (formName
);
1691 warning (exception
, formName
, getForm ()->getFilename (), function
, format
, args
);
1696 // ***************************************************************************
1697 // class CFormElmStruct
1698 // ***************************************************************************
1700 CFormElmStruct::CFormElmStruct (CForm
*form
, CFormElm
*parentNode
, const CFormDfn
*parentDfn
, uint parentIndex
) : CFormElm (form
, parentNode
, parentDfn
, parentIndex
)
1705 // ***************************************************************************
1707 CFormElmStruct::~CFormElmStruct ()
1709 // Job done in clean()
1713 // ***************************************************************************
1715 void CFormElmStruct::clean ()
1717 // For each element of the array
1719 for (elm
=0; elm
<Elements
.size(); elm
++)
1721 delete Elements
[elm
].Element
;
1722 Elements
[elm
].Element
= NULL
;
1727 // ***************************************************************************
1729 bool CFormElmStruct::isStruct () const
1734 // ***************************************************************************
1736 bool CFormElmStruct::getStructSize (uint
&size
) const
1738 size
= (uint
)Elements
.size();
1742 // ***************************************************************************
1744 bool CFormElmStruct::getStructNodeName (uint element
, string
&result
) const
1746 if (element
<Elements
.size())
1748 result
= Elements
[element
].Name
;
1753 warning (false, "getStructNodeName", "Index (%u) out of bound (%u).", element
, (uint
)Elements
.size() );
1758 // ***************************************************************************
1760 bool CFormElmStruct::getStructNode (uint element
, const UFormElm
**result
) const
1762 if (element
<Elements
.size())
1764 *result
= Elements
[element
].Element
;
1769 warning (false, "getStructNode", "Index (%u) out of bound (%u).", element
, (uint
)Elements
.size() );
1774 // ***************************************************************************
1776 UFormDfn
*CFormElmStruct::getStructDfn ()
1778 return (CFormDfn
*)FormDfn
;
1781 // ***************************************************************************
1783 bool CFormElmStruct::getStructNode (uint element
, UFormElm
**result
)
1785 if (element
<Elements
.size())
1787 *result
= Elements
[element
].Element
;
1792 warning (false, "getStructNode", "Index (%u) out of bound (%u).", element
, (uint
)Elements
.size() );
1797 // ***************************************************************************
1799 xmlNodePtr
CFormElmStruct::write (xmlNodePtr root
, const CForm
*form
, const std::string
&structName
, bool forceWrite
) const
1802 if (isUsed (form
) || forceWrite
)
1805 xmlNodePtr node
= xmlNewChild ( root
, NULL
, (const xmlChar
*)"STRUCT", NULL
);
1808 if (!structName
.empty())
1811 xmlSetProp (node
, (const xmlChar
*)"Name", (const xmlChar
*)structName
.c_str());
1814 // For each elements of the structure
1816 for (elm
=0; elm
<Elements
.size(); elm
++)
1818 // Create a node if it exist
1819 if (Elements
[elm
].Element
)
1820 Elements
[elm
].Element
->write (node
, form
, Elements
[elm
].Name
);
1823 // Return the new node
1829 // ***************************************************************************
1831 void CFormElmStruct::read (xmlNodePtr node
, CFormLoader
&loader
, const CFormDfn
*dfn
, CForm
*form
)
1833 // Get the smart pointer on the dfn
1834 FormDfn
= (CFormDfn
*)dfn
;
1840 uint dfnCount
= dfn
->countParentDfn ();
1843 std::vector
<const CFormDfn
*> dfnArray
;
1844 dfnArray
.reserve (dfnCount
);
1845 dfn
->getParentDfn (dfnArray
);
1850 for (dfnId
=0; dfnId
<dfnCount
; dfnId
++)
1852 // Lookup for the name in the DFN
1854 for (elm
=0; elm
<dfnArray
[dfnId
]->Entries
.size(); elm
++)
1857 // bool found = false;
1860 xmlNodePtr child
= NULL
;
1864 child
= node
->children
;
1869 const char *name
= (const char*)xmlGetProp (child
, (xmlChar
*)"Name");
1870 if (name
&& (dfnArray
[dfnId
]->Entries
[elm
].getName () == name
) )
1879 if (strcmp ((const char*)child
->name
, "ATOM") == 0)
1884 else if (strcmp ((const char*)child
->name
, "STRUCT") == 0)
1889 else if (strcmp ((const char*)child
->name
, "VSTRUCT") == 0)
1894 else if (strcmp ((const char*)child
->name
, "ARRAY") == 0)
1900 if (atom
|| _struct
|| vStruct
|| array
)
1904 (atom
&& (dfnArray
[dfnId
]->Entries
[elm
].getType ()==UFormDfn::EntryType
) && (!dfnArray
[dfnId
]->Entries
[elm
].getArrayFlag ()) ) ||
1905 (array
&& dfnArray
[dfnId
]->Entries
[elm
].getArrayFlag () && ( (dfnArray
[dfnId
]->Entries
[elm
].getType () == UFormDfn::EntryType
) || (dfnArray
[dfnId
]->Entries
[elm
].getType () == UFormDfn::EntryDfn
) ) ) ||
1906 (_struct
&& (dfnArray
[dfnId
]->Entries
[elm
].getType () == UFormDfn::EntryDfn
) && (!dfnArray
[dfnId
]->Entries
[elm
].getArrayFlag ()) ) ||
1907 (vStruct
&& (dfnArray
[dfnId
]->Entries
[elm
].getType () == UFormDfn::EntryVirtualDfn
) && (!dfnArray
[dfnId
]->Entries
[elm
].getArrayFlag ()) )
1911 xmlFree((void*) name
);
1916 // Make a warning message
1917 warning (false, "read", "In block line %u, node (%s) type in DFN have changed.",
1918 (uint
)child
->line
, child
->name
);
1926 xmlFree ((void*)name
);
1930 warning (true, "read", "XML Syntax error in block line %u, node (%s) name should be STRUCT, ATOM or ARRAY.",
1931 (uint
)child
->line
, child
->name
);
1938 xmlFree ((void*)name
);
1942 child
= child
->next
;
1948 // Create a new element
1949 if (dfnArray
[dfnId
]->Entries
[elm
].getArrayFlag ())
1952 CFormElmArray
*newElm
= NULL
;
1953 if (dfnArray
[dfnId
]->Entries
[elm
].getType () == UFormDfn::EntryType
)
1955 // Load the new element
1956 newElm
= new CFormElmArray (form
, NULL
, dfnArray
[dfnId
]->Entries
[elm
].getTypePtr (), this, dfnArray
[dfnId
], elm
);
1959 else if (dfnArray
[dfnId
]->Entries
[elm
].getType () == UFormDfn::EntryDfn
)
1961 newElm
= new CFormElmArray (form
, dfnArray
[dfnId
]->Entries
[elm
].getDfnPtr (), NULL
, this, dfnArray
[dfnId
], elm
);
1964 // Should be created
1966 Elements
[elmIndex
].Element
= newElm
;
1967 newElm
->read (child
, loader
, form
);
1969 else if (dfnArray
[dfnId
]->Entries
[elm
].getType () == UFormDfn::EntryType
)
1971 // Load the new element
1972 CFormElmAtom
*newElm
= new CFormElmAtom (form
, this, dfnArray
[dfnId
], elm
);
1973 Elements
[elmIndex
].Element
= newElm
;
1974 newElm
->read (child
, loader
, dfnArray
[dfnId
]->Entries
[elm
].getTypePtr (), form
);
1976 else if (dfnArray
[dfnId
]->Entries
[elm
].getType () == UFormDfn::EntryDfn
)
1978 // Load the new element
1979 CFormElmStruct
*newElm
= new CFormElmStruct (form
, this, dfnArray
[dfnId
], elm
);
1980 Elements
[elmIndex
].Element
= newElm
;
1981 newElm
->read (child
, loader
, dfnArray
[dfnId
]->Entries
[elm
].getDfnPtr (), form
);
1983 else // if dfnArray[dfnId]->Entries[elm].getType () == CFormDfn::CEntry::EntryVirtualDfn)
1985 // Should be a struct
1986 nlassert (dfnArray
[dfnId
]->Entries
[elm
].getType () == UFormDfn::EntryVirtualDfn
);
1988 // Load the new element
1989 CFormElmVirtualStruct
*newElm
= new CFormElmVirtualStruct (form
, this, dfnArray
[dfnId
], elm
);
1990 Elements
[elmIndex
].Element
= newElm
;
1991 newElm
->read (child
, loader
, form
);
1995 Elements
[elmIndex
].Element
= NULL
;
2002 // ***************************************************************************
2004 bool CFormElmStruct::isUsed (const CForm
*form
) const
2006 for (uint i
=0; i
<Elements
.size(); i
++)
2008 if (Elements
[i
].Element
&& Elements
[i
].Element
->isUsed (form
))
2014 // ***************************************************************************
2016 void CFormElmStruct::build (const CFormDfn
*dfn
)
2022 FormDfn
= (CFormDfn
*)dfn
;
2025 vector
<const CFormDfn
*> arrayDfn
;
2026 arrayDfn
.reserve (dfn
->countParentDfn ());
2027 dfn
->getParentDfn (arrayDfn
);
2030 uint elementCount
= 0;
2032 for (dfnIndex
=0; dfnIndex
<arrayDfn
.size(); dfnIndex
++)
2034 elementCount
+= arrayDfn
[dfnIndex
]->getNumEntry();
2037 // Resize the element array
2038 Elements
.resize (elementCount
);
2041 for (dfnIndex
=0; dfnIndex
<arrayDfn
.size(); dfnIndex
++)
2044 for (uint elm
=0; elm
<arrayDfn
[dfnIndex
]->Entries
.size(); elm
++)
2047 Elements
[elementCount
].Name
= arrayDfn
[dfnIndex
]->Entries
[elm
].Name
;
2053 // ***************************************************************************
2055 void CFormElmStruct::unlink (CFormElm
*child
)
2058 for (i
=0; i
<Elements
.size (); i
++)
2060 if (Elements
[i
].Element
== child
)
2062 Elements
[i
].Element
= NULL
;
2067 // Element not found!
2068 nlassert (i
!= Elements
.size ());
2071 // ***************************************************************************
2073 void CFormElmStruct::getFormName (std::string
&result
, const CFormElm
*child
) const
2079 result
.reserve (50);
2082 // Get parent form name
2084 ParentNode
->getFormName (result
, this);
2089 // Look for the child
2091 for (i
=0; i
<Elements
.size (); i
++)
2094 if (Elements
[i
].Element
== child
)
2096 // Add the field name
2098 result
+= Elements
[i
].Name
;
2103 // Draw some warning
2104 if (i
==Elements
.size ())
2106 warning (false, "getFormName", "Child node not found.");
2111 // ***************************************************************************
2113 void CFormElmStruct::warning (bool exception
, const std::string
&function
, const char *format
, ... ) const
2115 // Make a buffer string
2117 va_start( args
, format
);
2119 vsnprintf( buffer
, 1024, format
, args
);
2124 getFormName (formName
, NULL
);
2125 NLGEORGES::warning (exception
, "(CFormElmStruct::%s) on node (%s) in form (%s) : %s", function
.c_str(), formName
.c_str (), Form
->getFilename ().c_str (), buffer
);
2128 // ***************************************************************************
2130 void CFormElmStruct::getDependencies (std::set
<std::string
> &dependencies
) const
2134 FormDfn
->getDependencies (dependencies
);
2137 for (uint i
=0; i
<Elements
.size (); i
++)
2139 if (Elements
[i
].Element
)
2140 Elements
[i
].Element
->getDependencies (dependencies
);
2144 // ***************************************************************************
2145 // class CFormElmVirtualStruct
2146 // ***************************************************************************
2148 CFormElmVirtualStruct::CFormElmVirtualStruct (CForm
*form
, CFormElm
*parentNode
, const CFormDfn
*parentDfn
, uint parentIndex
) : CFormElmStruct (form
, parentNode
, parentDfn
, parentIndex
)
2152 // ***************************************************************************
2154 xmlNodePtr
CFormElmVirtualStruct::write (xmlNodePtr root
, const CForm
*form
, const std::string
&structName
, bool forceWrite
) const
2157 if (isUsed (form
) || forceWrite
)
2160 xmlNodePtr node
= xmlNewChild ( root
, NULL
, (const xmlChar
*)"VSTRUCT", NULL
);
2162 // Write the DFN filename in the node
2163 xmlSetProp (node
, (const xmlChar
*)"DfnName", (const xmlChar
*)DfnFilename
.c_str());
2166 if (!structName
.empty())
2169 xmlSetProp (node
, (const xmlChar
*)"Name", (const xmlChar
*)structName
.c_str());
2172 // For each elements of the structure
2174 for (elm
=0; elm
<Elements
.size(); elm
++)
2176 // Create a node if it exist
2177 if (Elements
[elm
].Element
)
2178 Elements
[elm
].Element
->write (node
, form
, Elements
[elm
].Name
);
2181 // Return the new node
2187 // ***************************************************************************
2189 void CFormElmVirtualStruct::read (xmlNodePtr node
, CFormLoader
&loader
, CForm
*form
)
2191 // Get the DFN filename
2192 const char *filename
= (const char*)xmlGetProp (node
, (xmlChar
*)"DfnName");
2196 DfnFilename
= filename
;
2199 xmlFree ((void*)filename
);
2202 FormDfn
= loader
.loadFormDfn (DfnFilename
, false);
2206 warning (true, "read", "Can't find DFN filename (%s).", DfnFilename
.c_str ());
2212 warning (true, "read", "XML Syntax error in virtual struct in block line %u, should have a DfnName property.",
2217 CFormElmStruct::read (node
, loader
, FormDfn
, form
);
2220 // ***************************************************************************
2222 bool CFormElmVirtualStruct::isVirtualStruct () const
2227 // ***************************************************************************
2229 bool CFormElmVirtualStruct::getDfnName (std::string
&dfnName
) const
2231 dfnName
= DfnFilename
;
2235 // ***************************************************************************
2237 bool CFormElmVirtualStruct::isUsed (const CForm
* /* form */) const
2242 // ***************************************************************************
2244 void CFormElmVirtualStruct::warning (bool exception
, const std::string
&function
, const char *format
, ... ) const
2246 // Make a buffer string
2248 va_start( args
, format
);
2250 vsnprintf( buffer
, 1024, format
, args
);
2255 getFormName (formName
, NULL
);
2256 NLGEORGES::warning (exception
, "(CFormElmVirtualStruct::%s) on node (%s) in form (%s) : %s", function
.c_str(), formName
.c_str (), Form
->getFilename ().c_str (), buffer
);
2259 // ***************************************************************************
2260 // class CFormElmArray
2261 // ***************************************************************************
2263 CFormElmArray::CFormElmArray (CForm
*form
, const CFormDfn
*formDfn
, const CType
*type
, CFormElm
*parentNode
, const CFormDfn
*parentDfn
, uint parentIndex
) : CFormElm (form
, parentNode
, parentDfn
, parentIndex
)
2265 FormDfn
= (CFormDfn
*)formDfn
;
2269 // ***************************************************************************
2271 CFormElmArray::~CFormElmArray ()
2273 // Job done in clean()
2277 // ***************************************************************************
2279 void CFormElmArray::clean ()
2281 // For each element of the array
2283 for (elm
=0; elm
<Elements
.size(); elm
++)
2285 delete Elements
[elm
].Element
;
2286 Elements
[elm
].Element
= NULL
;
2291 // ***************************************************************************
2293 bool CFormElmArray::isArray () const
2298 // ***************************************************************************
2300 bool CFormElmArray::getArraySize (uint
&size
) const
2302 size
= (uint
)Elements
.size ();
2306 // ***************************************************************************
2308 bool CFormElmArray::getArrayNode (const UFormElm
**result
, uint arrayIndex
) const
2310 if (arrayIndex
<Elements
.size())
2312 *result
= Elements
[arrayIndex
].Element
;
2317 warning (false, "getArrayNode", "Index (%u) out of bound (%u).", arrayIndex
, (uint
)Elements
.size() );
2322 // ***************************************************************************
2324 bool CFormElmArray::getArrayNodeName (std::string
&result
, uint arrayIndex
) const
2326 if (arrayIndex
<Elements
.size())
2328 if (Elements
[arrayIndex
].Name
.empty ())
2329 result
= "#" + toString (arrayIndex
);
2331 result
= Elements
[arrayIndex
].Name
;
2336 warning (false, "getArrayNodeName", "Index (%u) out of bound (%u).", arrayIndex
, (uint
)Elements
.size() );
2341 // ***************************************************************************
2343 bool CFormElmArray::getArrayNode (UFormElm
**result
, uint arrayIndex
)
2345 if (arrayIndex
<Elements
.size())
2347 *result
= Elements
[arrayIndex
].Element
;
2352 warning (false, "getArrayNode", "Index (%u) out of bound (%u).", arrayIndex
, (uint
)Elements
.size() );
2358 // ***************************************************************************
2360 bool CFormElmArray::getArrayValue (std::string
&result
, uint arrayIndex
, TEval evaluate
, TWhereIsValue
*where
) const
2362 if (arrayIndex
>= Elements
.size())
2364 warning (false, "getArrayValue", "Access out of bound, trying to access array index %u, array size is %u.", arrayIndex
, (uint
)Elements
.size());
2368 return (Type
->getValue (result
, Form
, safe_cast
<const CFormElmAtom
*> (Elements
[arrayIndex
].Element
), *ParentDfn
, ParentIndex
, evaluate
, (uint32
*)where
, NLGEORGES_FIRST_ROUND
, ""));
2372 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
2378 // ***************************************************************************
2380 bool CFormElmArray::getArrayValue (sint8
&result
, uint arrayIndex
, TEval evaluate
, TWhereIsValue
*where
) const
2385 if (Type
->getValue (str
, Form
, safe_cast
<const CFormElmAtom
*> (Elements
[arrayIndex
].Element
), *ParentDfn
, ParentIndex
, evaluate
, (uint32
*)where
, NLGEORGES_FIRST_ROUND
, ""))
2387 return convertValue (result
, str
);
2392 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
2398 // ***************************************************************************
2400 bool CFormElmArray::getArrayValue (uint8
&result
, uint arrayIndex
, TEval evaluate
, TWhereIsValue
*where
) const
2405 if (Type
->getValue (str
, Form
, safe_cast
<const CFormElmAtom
*> (Elements
[arrayIndex
].Element
), *ParentDfn
, ParentIndex
, evaluate
, (uint32
*)where
, NLGEORGES_FIRST_ROUND
, ""))
2407 return convertValue (result
, str
);
2412 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
2418 // ***************************************************************************
2420 bool CFormElmArray::getArrayValue (sint16
&result
, uint arrayIndex
, TEval evaluate
, TWhereIsValue
*where
) const
2425 if (Type
->getValue (str
, Form
, safe_cast
<const CFormElmAtom
*> (Elements
[arrayIndex
].Element
), *ParentDfn
, ParentIndex
, evaluate
, (uint32
*)where
, NLGEORGES_FIRST_ROUND
, ""))
2427 return convertValue (result
, str
);
2432 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
2438 // ***************************************************************************
2440 bool CFormElmArray::getArrayValue (uint16
&result
, uint arrayIndex
, TEval evaluate
, TWhereIsValue
*where
) const
2445 if (Type
->getValue (str
, Form
, safe_cast
<const CFormElmAtom
*> (Elements
[arrayIndex
].Element
), *ParentDfn
, ParentIndex
, evaluate
, (uint32
*)where
, NLGEORGES_FIRST_ROUND
, ""))
2447 return convertValue (result
, str
);
2452 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
2458 // ***************************************************************************
2460 bool CFormElmArray::getArrayValue (sint32
&result
, uint arrayIndex
, TEval evaluate
, TWhereIsValue
*where
) const
2465 if (Type
->getValue (str
, Form
, safe_cast
<const CFormElmAtom
*> (Elements
[arrayIndex
].Element
), *ParentDfn
, ParentIndex
, evaluate
, (uint32
*)where
, NLGEORGES_FIRST_ROUND
, ""))
2467 return convertValue (result
, str
);
2472 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
2478 // ***************************************************************************
2480 bool CFormElmArray::getArrayValue (uint32
&result
, uint arrayIndex
, TEval evaluate
, TWhereIsValue
*where
) const
2485 if (Type
->getValue (str
, Form
, safe_cast
<const CFormElmAtom
*> (Elements
[arrayIndex
].Element
), *ParentDfn
, ParentIndex
, evaluate
, (uint32
*)where
, NLGEORGES_FIRST_ROUND
, ""))
2487 return convertValue (result
, str
);
2492 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
2498 // ***************************************************************************
2500 bool CFormElmArray::getArrayValue (float &result
, uint arrayIndex
, TEval evaluate
, TWhereIsValue
*where
) const
2505 if (Type
->getValue (str
, Form
, safe_cast
<const CFormElmAtom
*> (Elements
[arrayIndex
].Element
), *ParentDfn
, ParentIndex
, evaluate
, (uint32
*)where
, NLGEORGES_FIRST_ROUND
, ""))
2507 return convertValue (result
, str
);
2512 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
2518 // ***************************************************************************
2520 bool CFormElmArray::getArrayValue (double &result
, uint arrayIndex
, TEval evaluate
, TWhereIsValue
*where
) const
2525 if (Type
->getValue (str
, Form
, safe_cast
<const CFormElmAtom
*> (Elements
[arrayIndex
].Element
), *ParentDfn
, ParentIndex
, evaluate
, (uint32
*)where
, NLGEORGES_FIRST_ROUND
, ""))
2527 return convertValue (result
, str
);
2532 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
2538 // ***************************************************************************
2540 bool CFormElmArray::getArrayValue (bool &result
, uint arrayIndex
, TEval evaluate
, TWhereIsValue
*where
) const
2545 if (Type
->getValue (str
, Form
, safe_cast
<const CFormElmAtom
*> (Elements
[arrayIndex
].Element
), *ParentDfn
, ParentIndex
, evaluate
, (uint32
*)where
, NLGEORGES_FIRST_ROUND
, ""))
2547 return convertValue (result
, str
);
2552 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
2558 // ***************************************************************************
2560 bool CFormElmArray::getArrayValue (NLMISC::CRGBA
&result
, uint arrayIndex
, TEval evaluate
, TWhereIsValue
*where
) const
2565 if (Type
->getValue (str
, Form
, safe_cast
<const CFormElmAtom
*> (Elements
[arrayIndex
].Element
), *ParentDfn
, ParentIndex
, evaluate
, (uint32
*)where
, NLGEORGES_FIRST_ROUND
, ""))
2567 return convertValue (result
, str
);
2572 warning (false, "getArrayValue", "This array is not an array of atom. This is an array of structure.");
2578 // ***************************************************************************
2580 xmlNodePtr
CFormElmArray::write (xmlNodePtr root
, const CForm
*form
, const std::string
&structName
, bool forceWrite
) const
2583 if (isUsed (form
) || forceWrite
)
2586 xmlNodePtr node
= xmlNewChild ( root
, NULL
, (const xmlChar
*)"ARRAY", NULL
);
2589 if (!structName
.empty())
2592 xmlSetProp (node
, (const xmlChar
*)"Name", (const xmlChar
*)structName
.c_str());
2595 // For each elements of the structure
2597 for (elm
=0; elm
<Elements
.size(); elm
++)
2600 if (Elements
[elm
].Element
)
2601 Elements
[elm
].Element
->write (node
, form
, Elements
[elm
].Name
, true);
2604 // Return the new node
2611 // ***************************************************************************
2613 void CFormElmArray::read (xmlNodePtr node
, CFormLoader
&loader
, CForm
*form
)
2621 // Type of DFN array
2624 nlassert (FormDfn
== NULL
);
2627 uint childCount
= CIXml::countChildren (node
, "ATOM");
2630 Elements
.resize (childCount
);
2632 // For each children
2634 xmlNodePtr child
= CIXml::getFirstChildNode (node
, "ATOM");
2638 const char *name
= (const char*)xmlGetProp (child
, (xmlChar
*)"Name");
2640 // Create a new node
2641 CFormElmAtom
*newElt
= new CFormElmAtom (form
, this, ParentDfn
, ParentIndex
);
2642 Elements
[childNum
].Element
= newElt
;
2645 Elements
[childNum
].Name
= name
;
2646 xmlFree ((void*)name
);
2648 newElt
->read (child
, loader
, Type
, form
);
2651 child
= CIXml::getNextChildNode (child
, "ATOM");
2658 nlassert (Type
== NULL
);
2661 uint childCount
= CIXml::countChildren (node
, "STRUCT");
2664 Elements
.resize (childCount
);
2666 // For each children
2668 xmlNodePtr child
= CIXml::getFirstChildNode (node
, "STRUCT");
2672 const char *name
= (const char*)xmlGetProp (child
, (xmlChar
*)"Name");
2674 // Create a new node
2675 CFormElmStruct
*newElt
= new CFormElmStruct (form
, this, ParentDfn
, ParentIndex
);
2676 Elements
[childNum
].Element
= newElt
;
2679 Elements
[childNum
].Name
= name
;
2680 xmlFree ((void*)name
);
2682 newElt
->read (child
, loader
, FormDfn
, form
);
2685 child
= CIXml::getNextChildNode (child
, "STRUCT");
2692 // ***************************************************************************
2694 bool CFormElmArray::setParent (CFormElm
* /* parent */)
2699 // ***************************************************************************
2701 void CFormElmArray::unlink (CFormElm
*child
)
2704 for (i
=0; i
<Elements
.size (); i
++)
2706 if (Elements
[i
].Element
== child
)
2708 Elements
[i
].Element
= NULL
;
2713 // Element not found!
2714 nlassert (i
!= Elements
.size ());
2717 // ***************************************************************************
2719 bool CFormElmArray::isUsed (const CForm
*form
) const
2721 /*for (uint i=0; i<Elements.size(); i++)
2723 if (Elements[i] && Elements[i]->isUsed (form))
2726 return form
== Form
;
2729 // ***************************************************************************
2731 void CFormElmArray::getFormName (std::string
&result
, const CFormElm
*child
) const
2737 result
.reserve (50);
2740 // Get parent form name
2742 ParentNode
->getFormName (result
, this);
2747 // Look for the child
2749 for (i
=0; i
<Elements
.size (); i
++)
2752 if (Elements
[i
].Element
== child
)
2755 smprintf (name
, 512, "[%d]", i
);
2757 // Add the field name
2763 // Draw some warning
2764 if (i
==Elements
.size ())
2766 warning (false, "getFormName", "Child node not found.");
2771 // ***************************************************************************
2773 void CFormElmArray::warning (bool exception
, const std::string
&function
, const char *format
, ... ) const
2775 // Make a buffer string
2777 va_start( args
, format
);
2779 vsnprintf( buffer
, 1024, format
, args
);
2784 getFormName (formName
, NULL
);
2785 NLGEORGES::warning (exception
, "(CFormElmArray::%s) on node (%s) in form (%s) : %s", function
.c_str(), formName
.c_str (), Form
->getFilename ().c_str (), buffer
);
2788 // ***************************************************************************
2790 void CFormElmArray::getDependencies (std::set
<std::string
> &dependencies
) const
2795 FormDfn
->getDependencies (dependencies
);
2797 // Add each elements
2798 for (uint i
=0; i
<Elements
.size (); i
++)
2800 Elements
[i
].Element
->getDependencies (dependencies
);
2807 Type
->getDependencies (dependencies
);
2811 // ***************************************************************************
2813 // ***************************************************************************
2815 CFormElmAtom::CFormElmAtom (CForm
*form
, CFormElm
*parentNode
, const CFormDfn
*parentDfn
, uint parentIndex
) : CFormElm (form
, parentNode
, parentDfn
, parentIndex
)
2820 // ***************************************************************************
2822 bool CFormElmAtom::isAtom () const
2827 // ***************************************************************************
2829 const CType
* CFormElmAtom::getType ()
2834 // ***************************************************************************
2836 void CFormElmAtom::getDependencies (std::set
<std::string
> &/* dependencies */) const
2840 // ***************************************************************************
2842 bool CFormElmAtom::getValue (string
&result
, TEval evaluate
) const
2847 return Type
->getValue (result
, Form
, this, *ParentDfn
, ParentIndex
, evaluate
, NULL
, NLGEORGES_FIRST_ROUND
, "");
2850 // ***************************************************************************
2852 bool CFormElmAtom::getValue (sint8
&result
, TEval evaluate
) const
2854 // Get the string value
2856 if (getValue (value
, evaluate
))
2858 return convertValue (result
, value
.c_str ());
2864 // ***************************************************************************
2866 bool CFormElmAtom::getValue (uint8
&result
, TEval evaluate
) const
2868 // Get the string value
2870 if (getValue (value
, evaluate
))
2872 return convertValue (result
, value
.c_str ());
2878 // ***************************************************************************
2880 bool CFormElmAtom::getValue (sint16
&result
, TEval evaluate
) const
2882 // Get the string value
2884 if (getValue (value
, evaluate
))
2886 return convertValue (result
, value
.c_str ());
2892 // ***************************************************************************
2894 bool CFormElmAtom::getValue (uint16
&result
, TEval evaluate
) const
2896 // Get the string value
2898 if (getValue (value
, evaluate
))
2900 return convertValue (result
, value
.c_str ());
2906 // ***************************************************************************
2908 bool CFormElmAtom::getValue (sint32
&result
, TEval evaluate
) const
2910 // Get the string value
2912 if (getValue (value
, evaluate
))
2914 return convertValue (result
, value
.c_str ());
2920 // ***************************************************************************
2922 bool CFormElmAtom::getValue (uint32
&result
, TEval evaluate
) const
2924 // Get the string value
2926 if (getValue (value
, evaluate
))
2928 return convertValue (result
, value
.c_str ());
2934 // ***************************************************************************
2936 bool CFormElmAtom::getValue (float &result
, TEval evaluate
) const
2938 // Get the string value
2940 if (getValue (value
, evaluate
))
2942 return convertValue (result
, value
.c_str ());
2948 // ***************************************************************************
2950 bool CFormElmAtom::getValue (double &result
, TEval evaluate
) const
2952 // Get the string value
2954 if (getValue (value
, evaluate
))
2956 return convertValue (result
, value
.c_str ());
2962 // ***************************************************************************
2964 bool CFormElmAtom::getValue (bool &result
, TEval evaluate
) const
2966 // Get the string value
2968 if (getValue (value
, evaluate
))
2970 return convertValue (result
, value
.c_str ());
2976 // ***************************************************************************
2978 bool CFormElmAtom::getValue (NLMISC::CRGBA
&result
, TEval evaluate
) const
2980 // Get the string value
2982 if (getValue (value
, evaluate
))
2984 return convertValue (result
, value
.c_str ());
2990 // ***************************************************************************
2992 xmlNodePtr
CFormElmAtom::write (xmlNodePtr root
, const CForm
*form
, const std::string
&structName
, bool forceWrite
) const
2995 if (isUsed (form
) || forceWrite
)
2998 xmlNodePtr node
= xmlNewChild ( root
, NULL
, (const xmlChar
*)"ATOM", NULL
);
3001 if (!structName
.empty())
3004 xmlSetProp (node
, (const xmlChar
*)"Name", (const xmlChar
*)structName
.c_str());
3008 if (!Value
.empty ())
3010 if (COXml::isStringValidForProperties (Value
))
3011 xmlSetProp (node
, (const xmlChar
*)"Value", (const xmlChar
*)Value
.c_str());
3014 xmlNodePtr textNode
= xmlNewText ((const xmlChar
*)Value
.c_str ());
3015 xmlAddChild (node
, textNode
);
3019 // Return the new node
3025 // ***************************************************************************
3027 void CFormElmAtom::read (xmlNodePtr node
, CFormLoader
&/* loader */, const CType
*type
, CForm
* /* form */)
3036 const char *value
= (const char*)xmlGetProp (node
, (xmlChar
*)"Value");
3043 xmlFree ((void*)value
);
3048 const char *valueText
= (const char*)xmlNodeGetContent (node
);
3051 setValue (valueText
);
3054 xmlFree ((void*)valueText
);
3060 // ***************************************************************************
3062 void CFormElmAtom::setValue (const std::string
&value
)
3067 // ***************************************************************************
3069 void CFormElmAtom::getValue (std::string
&result
) const
3074 // ***************************************************************************
3076 void CFormElmAtom::getFormName (std::string
&result
, const CFormElm
*child
) const
3079 nlassert (child
== NULL
);
3081 result
.reserve (50);
3083 // Get parent form name
3085 ParentNode
->getFormName (result
, this);
3088 // ***************************************************************************
3090 void CFormElmAtom::warning (bool exception
, const std::string
&function
, const char *format
, ... ) const
3092 // Make a buffer string
3094 va_start( args
, format
);
3096 vsnprintf( buffer
, 1024, format
, args
);
3101 getFormName (formName
, NULL
);
3102 NLGEORGES::warning (exception
, "(CFormElmAtom::%s) on node (%s) in form (%s) : %s", function
.c_str(), formName
.c_str (), Form
->getFilename ().c_str (), buffer
);
3105 // ***************************************************************************