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/a02546.html | 2702 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2702 insertions(+) create mode 100644 docs/doxygen/nel/a02546.html (limited to 'docs/doxygen/nel/a02546.html') diff --git a/docs/doxygen/nel/a02546.html b/docs/doxygen/nel/a02546.html new file mode 100644 index 00000000..44aabfb0 --- /dev/null +++ b/docs/doxygen/nel/a02546.html @@ -0,0 +1,2702 @@ + + +NeL: NLGEORGES::CFormDfn class Reference + + + +
+

NLGEORGES::CFormDfn Class Reference

#include <form_dfn.h> +

+

Inheritance diagram for NLGEORGES::CFormDfn: +

+ +NLGEORGES::UFormDfn +NLMISC::CRefCount + +

Detailed Description

+This class is the defnition for a familly of from. +

+ +

+Definition at line 46 of file form_dfn.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Types

enum  TEntryType { EntryType, +EntryDfn, +EntryVirtualDfn + }

Public Member Functions

 CFormDfn ()
uint countParentDfn (uint32 round=0) const
const std::string & getComment () const
void getDependencies (std::set< std::string > &dependencies) const
CEntrygetEntry (uint entry)
const CEntrygetEntry (uint entry) const
bool getEntryByName (const std::string &name, CFormDfn::CEntry **entry)
bool getEntryDfn (uint entry, UFormDfn **dfn)
bool getEntryDfnByName (const std::string &name, UFormDfn **dfn)
bool getEntryFilename (uint entry, std::string &filename) const
bool getEntryFilenameExt (uint entry, std::string &filename) const
bool getEntryIndexByName (uint &entry, const std::string &name) const
bool getEntryName (uint entry, std::string &name) const
bool getEntryType (uint entry, UType **type)
bool getEntryType (uint entry, TEntryType &type, bool &array) const
uint getNumEntry () const
uint getNumParent () const
uint getNumParents () const
bool getParent (uint parent, UFormDfn **parentRet)
CFormDfngetParent (uint parent) const
void getParentDfn (std::vector< const CFormDfn * > &array, uint32 round=0) const
void getParentDfn (std::vector< CFormDfn * > &array, uint32 round=0)
bool getParentFilename (uint parent, std::string &filename) const
const std::string & getParentFilename (uint parent) const
const sintgetRefCount () const
const CFormDfngetSubDfn (uint index, uint &dfnIndex) const
CFormDfngetSubDfn (uint index, uint &dfnIndex)
bool isAnArrayEntryByName (const std::string &name) const
void setNumEntry (uint size)
void setNumParent (uint size)
void setParent (uint parent, CFormLoader &loader, const char *filename)
void warning (bool exception, const char *function, const char *format,...) const
void write (xmlDocPtr root, const char *filename, bool georges4CVS)
virtual ~CFormDfn ()

Data Fields

sint crefs
CFileHeader Header
CPtrInfo * pinfo

Static Public Attributes

CPtrInfo NullPtrInfo

Private Member Functions

void read (xmlNodePtr doc, CFormLoader &loader, bool forceLoad, const char *filename)

Private Attributes

std::string _Filename
std::vector< CEntryEntries
std::vector< CParentParents
uint32 Round

Friends

class CForm
class CFormElm
class CFormElmStruct
class CFormLoader
bool convertDfnFile (const char *oldFileName, const char *newFileName)
struct CPtrInfo
class CType
+


Member Enumeration Documentation

+

+ + + + +
+ + +
enum NLGEORGES::UFormDfn::TEntryType [inherited] +
+
+ + + + + +
+   + + +

+

Enumeration values:
+ + + + +
EntryType  +
EntryDfn  +
EntryVirtualDfn  +
+
+ +

+Definition at line 56 of file u_form_dfn.h. +

+

00057         {
+00058                 EntryType,
+00059                 EntryDfn,
+00060                 EntryVirtualDfn,
+00061         };
+
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NLGEORGES::CFormDfn::CFormDfn  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 57 of file form_dfn.h. +

+References Round. +

+

00058         {
+00059                 Round = 0xffffffff;
+00060         }
+
+

+ + + + +
+ + + + + + + + + +
virtual NLGEORGES::CFormDfn::~CFormDfn  )  [inline, virtual]
+
+ + + + + +
+   + + +

+ +

+Definition at line 62 of file form_dfn.h. +

+

00062 { }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
uint NLGEORGES::CFormDfn::countParentDfn uint32  round = 0  )  const
+
+ + + + + +
+   + + +

+ +

+Definition at line 337 of file form_dfn.cpp. +

+References count, NLGEORGES_MAX_RECURSION, Parents, uint, uint32, and warning(). +

+Referenced by NLGEORGES::CFormElmStruct::build(), getSubDfn(), and NLGEORGES::CFormElmStruct::read(). +

+

00338 {
+00339         // Checkout recurcive calls
+00340         if (round > NLGEORGES_MAX_RECURSION)
+00341         {
+00342                 // Turn around..
+00343                 warning (false, "countParentDfn", "Recurcive call on the same DFN, look for loop inheritances.");
+00344                 return 0;
+00345         }
+00346 
+00347         uint count = 0;
+00348         uint i;
+00349         for (i=0; i<Parents.size (); i++)
+00350         {
+00351                 count += Parents[i].Parent->countParentDfn (round+1);
+00352         }
+00353         return count+1;
+00354 }
+
+

+ + + + +
+ + + + + + + + + +
const std::string & NLGEORGES::CFormDfn::getComment  )  const [virtual]
+
+ + + + + +
+   + + +

+Get the comment +

+Implements NLGEORGES::UFormDfn. +

+Definition at line 827 of file form_dfn.cpp. +

+References NLGEORGES::CFileHeader::Comments. +

+

00828 {
+00829         return Header.Comments;
+00830 }
+
+

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

+Get dependency files +

+Implements NLGEORGES::UFormDfn. +

+Definition at line 863 of file form_dfn.cpp. +

+References Entries, Parents, NLMISC::strlwr(), and uint. +

+

00864 {
+00865         // Scan only if not already inserted
+00866         if (dependencies.insert (strlwr (CFile::getFilename (_Filename))).second)
+00867         {
+00868                 // Add parents
+00869                 uint i;
+00870                 for (i=0; i<Parents.size (); i++)
+00871                 {
+00872                         Parents[i].Parent->getDependencies (dependencies);
+00873                 }
+00874 
+00875                 // Add entries
+00876                 for (i=0; i<Entries.size (); i++)
+00877                 {
+00878                         if (Entries[i].getDfnPtr ())
+00879                                 Entries[i].getDfnPtr ()->getDependencies (dependencies);
+00880                         if (Entries[i].getTypePtr ())
+00881                         {
+00882                                 dependencies.insert (strlwr (CFile::getFilename (Entries[i].getFilename())));
+00883                         }
+00884                 }
+00885         }
+00886 }
+
+

+ + + + +
+ + + + + + + + + + +
CFormDfn::CEntry & NLGEORGES::CFormDfn::getEntry uint  entry  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 442 of file form_dfn.cpp. +

+References Entries, and uint. +

+

00443 {
+00444         return Entries[entry];
+00445 }
+
+

+ + + + +
+ + + + + + + + + + +
const CFormDfn::CEntry & NLGEORGES::CFormDfn::getEntry uint  entry  )  const
+
+ + + + + +
+   + + +

+ +

+Definition at line 435 of file form_dfn.cpp. +

+References Entries, and uint. +

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

+

00436 {
+00437         return Entries[entry];
+00438 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormDfn::getEntryByName const std::string &  name,
CFormDfn::CEntry **  entry
+
+ + + + + +
+   + + +

+ +

+Definition at line 734 of file form_dfn.cpp. +

+References Entries, and NLGEORGES::CFormDfn::CEntry::getName(). +

+Referenced by getEntryDfnByName(). +

+

00735 {
+00736         int     entryIndex=Entries.size ()-1;
+00737         while (entryIndex>=0)
+00738         {
+00739                 CEntry  *entryPtr=&Entries[entryIndex];
+00740                 if (entryPtr->getName()==name)
+00741                 {
+00742                         *entry=entryPtr;
+00743                         return  true;
+00744                 }
+00745                 entryIndex--;
+00746         }
+00747         *entry=NULL;
+00748         return  false;  
+00749 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormDfn::getEntryDfn uint  entry,
UFormDfn **  dfn
[virtual]
+
+ + + + + +
+   + + +

+Return the entry DFN pointer Doesn't look in parents DFN.

+

Parameters:
+ + + +
entry is the entry id to get the dfn pointer.
dfn will be filled with the DFN pointer.
+
+
Returns:
true if successed, false if the entry doesn't exist or is not a DFN.
+ +

+Implements NLGEORGES::UFormDfn. +

+Definition at line 718 of file form_dfn.cpp. +

+References Entries, uint, and warning(). +

+

00719 {
+00720         if (entry < Entries.size ())
+00721         {
+00722                 if (Entries[entry].TypeElement == EntryDfn)
+00723                 {
+00724                         *dfn = Entries[entry].Dfn;
+00725                         return true;
+00726                 }
+00727                 else
+00728                         warning (false, "getEntryDfn", "This entry is not a DFN.");
+00729         }
+00730         warning (false, "getEntryDfn", "Wrong entry ID.");
+00731         return false;
+00732 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormDfn::getEntryDfnByName const std::string &  name,
UFormDfn **  dfn
[virtual]
+
+ + + + + +
+   + + +

+Return the entry DFN pointer Doesn't look in parents DFN.

+

Parameters:
+ + + +
name is the supposed name of the dfn.
dfn will be filled with the DFN pointer.
+
+
Returns:
true if successed, false if the entry doesn't exist or is not a DFN.
+ +

+Implements NLGEORGES::UFormDfn. +

+Definition at line 751 of file form_dfn.cpp. +

+References NLGEORGES::CFormDfn::CEntry::getDfnPtr(), and getEntryByName(). +

+

00752 {
+00753         CFormDfn::CEntry        *entry;
+00754         if      (getEntryByName (name, &entry))
+00755         {
+00756                 *dfn=entry->getDfnPtr();
+00757                 return  true;
+00758         }
+00759         *dfn=NULL;
+00760         return  false;
+00761 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormDfn::getEntryFilename uint  entry,
std::string &  filename
const [virtual]
+
+ + + + + +
+   + + +

+Return the filename of the type or the DFN. Doesn't look in parents DFN.

+

Parameters:
+ + + +
entry is the entry id to get the dfn pointer.
name will be filled with the entry filename.
+
+
Returns:
true if successed, false if the entry doesn't exist or is a virtual DFN.
+ +

+Implements NLGEORGES::UFormDfn. +

+Definition at line 656 of file form_dfn.cpp. +

+References Entries, uint, and warning(). +

+

00657 {
+00658         if (entry < Entries.size ())
+00659         {
+00660                 if (Entries[entry].TypeElement != EntryVirtualDfn)
+00661                 {
+00662                         filename = Entries[entry].Filename;
+00663                         return true;
+00664                 }
+00665                 warning (false, "getEntryFilename", "The entry is a virtual DFN.");
+00666                 return false;
+00667         }
+00668         warning (false, "getEntryFilename", "Wrong entry ID.");
+00669         return false;
+00670 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormDfn::getEntryFilenameExt uint  entry,
std::string &  filename
const [virtual]
+
+ + + + + +
+   + + +

+Return the filename extension used by the DFN entry. Doesn't look in parents DFN.

+

Parameters:
+ + + +
entry is the entry id to get the dfn pointer.
name will be filled with the entry filename.
+
+
Returns:
true if successed, false if the entry doesn't exist or is a virtual DFN.
+ +

+Implements NLGEORGES::UFormDfn. +

+Definition at line 674 of file form_dfn.cpp. +

+References Entries, uint, and warning(). +

+

00675 {
+00676         if (entry < Entries.size ())
+00677         {
+00678                 filename = Entries[entry].FilenameExt;
+00679                 return true;
+00680         }
+00681         warning (false, "getEntryFilenameExt", "Wrong entry ID.");
+00682         return false;
+00683 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormDfn::getEntryIndexByName uint entry,
const std::string &  name
const [virtual]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormDfn. +

+Definition at line 687 of file form_dfn.cpp. +

+References Entries, and uint. +

+

00688 {
+00689         uint    entryIndex=0;
+00690         while   (entryIndex<Entries.size ())
+00691         {
+00692                 if (Entries[entryIndex].Name==name)
+00693                 {
+00694                         entry=entryIndex;
+00695                         return  true;
+00696                 }
+00697                 entryIndex++;
+00698         }
+00699         entry=~0;
+00700         return  false;
+00701 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormDfn::getEntryName uint  entry,
std::string &  name
const [virtual]
+
+ + + + + +
+   + + +

+Return the entry name Doesn't look in parents DFN.

+

Parameters:
+ + + +
entry is the entry id to get the dfn pointer.
name will be filled with the entry name.
+
+
Returns:
true if successed, false if the entry doesn't exist.
+ +

+Implements NLGEORGES::UFormDfn. +

+Definition at line 705 of file form_dfn.cpp. +

+References Entries, uint, and warning(). +

+

00706 {
+00707         if (entry < Entries.size ())
+00708         {
+00709                 name = Entries[entry].Name;
+00710                 return true;
+00711         }
+00712         warning (false, "getEntryName", "Wrong entry ID.");
+00713         return false;
+00714 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormDfn::getEntryType uint  entry,
UType **  type
[virtual]
+
+ + + + + +
+   + + +

+Return the entry Type pointer Doesn't look in parents DFN.

+

Parameters:
+ + + +
entry is the entry id to get the dfn pointer.
type will be filled with the TYPE pointer.
+
+
Returns:
true if successed, false if the entry doesn't exist or is not a Type.
+ +

+Implements NLGEORGES::UFormDfn. +

+Definition at line 775 of file form_dfn.cpp. +

+References Entries, type, uint, and warning(). +

+

00776 {
+00777         if (entry < Entries.size ())
+00778         {
+00779                 if (Entries[entry].TypeElement == EntryType)
+00780                 {
+00781                         *type = Entries[entry].Type;
+00782                         return true;
+00783                 }
+00784                 else
+00785                         warning (false, "getEntryType", "This entry is not a type."); 
+00786         }
+00787         warning (false, "getEntryType", "Wrong entry ID."); 
+00788         return false;
+00789 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormDfn::getEntryType uint  entry,
TEntryType type,
bool &  array
const [virtual]
+
+ + + + + +
+   + + +

+Return the entry type. Doesn't look in parents DFN.

+

Parameters:
+ + + + +
entry is the entry id to get the type.
type will be filled with the entry type.
array is true if the entry is an array, else false.
+
+
Returns:
true if successed, false if the entry doesn't exist.
+ +

+Implements NLGEORGES::UFormDfn. +

+Definition at line 642 of file form_dfn.cpp. +

+References Entries, type, uint, and warning(). +

+

00643 {
+00644         if (entry < Entries.size ())
+00645         {
+00646                 type = Entries[entry].TypeElement;
+00647                 array = Entries[entry].Array;
+00648                 return true;
+00649         }
+00650         warning (false, "getEntryType", "Wrong entry ID.");
+00651         return false;
+00652 }
+
+

+ + + + +
+ + + + + + + + + +
uint NLGEORGES::CFormDfn::getNumEntry  )  const [virtual]
+
+ + + + + +
+   + + +

+Return the number of entry in this DFN +

+Implements NLGEORGES::UFormDfn. +

+Definition at line 421 of file form_dfn.cpp. +

+References Entries, and uint. +

+

00422 {
+00423         return Entries.size();
+00424 }
+
+

+ + + + +
+ + + + + + + + + +
uint NLGEORGES::CFormDfn::getNumParent  )  const
+
+ + + + + +
+   + + +

+ +

+Definition at line 400 of file form_dfn.cpp. +

+References Parents, and uint. +

+

00401 {
+00402         return Parents.size ();
+00403 }
+
+

+ + + + +
+ + + + + + + + + +
uint NLGEORGES::CFormDfn::getNumParents  )  const [virtual]
+
+ + + + + +
+   + + +

+Get the number of parent DFN. Doesn't look in parents DFN for parents. +

+Implements NLGEORGES::UFormDfn. +

+Definition at line 793 of file form_dfn.cpp. +

+References Parents, and uint. +

+

00794 {
+00795         return Parents.size ();
+00796 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormDfn::getParent uint  parent,
UFormDfn **  parentRet
[virtual]
+
+ + + + + +
+   + + +

+Get a parent.

+

Parameters:
+ + + +
entry is the entry id to get the dfn pointer.
parent will be filled with the parent pointer.
+
+
Returns:
true if successed, false if the parent doesn't exist.
+ +

+Implements NLGEORGES::UFormDfn. +

+Definition at line 800 of file form_dfn.cpp. +

+References Parents, uint, and warning(). +

+

00801 {
+00802         if (parent < Parents.size ())
+00803         {
+00804                 *parentRet = Parents[parent].Parent;
+00805                 return true;
+00806         }
+00807         warning (false, "getParent", "Wrong parent ID."); 
+00808         return false;
+00809 }
+
+

+ + + + +
+ + + + + + + + + + +
CFormDfn * NLGEORGES::CFormDfn::getParent uint  parent  )  const
+
+ + + + + +
+   + + +

+ +

+Definition at line 407 of file form_dfn.cpp. +

+References Parents, and uint. +

+

00408 {
+00409         return Parents[parent].Parent;
+00410 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLGEORGES::CFormDfn::getParentDfn std::vector< const CFormDfn * > &  array,
uint32  round = 0
const
+
+ + + + + +
+   + + +

+ +

+Definition at line 379 of file form_dfn.cpp. +

+References NLGEORGES_MAX_RECURSION, Parents, uint, uint32, and warning(). +

+

00380 {
+00381         // Checkout recurcive calls
+00382         if (round > NLGEORGES_MAX_RECURSION)
+00383         {
+00384                 // Turn around..
+00385                 warning (false, "getParentDfn", "Recurcive call on the same DFN, look for loop inheritances.");
+00386                 return;
+00387         }
+00388 
+00389         //uint count = 0;
+00390         uint i;
+00391         for (i=0; i<Parents.size (); i++)
+00392         {
+00393                 Parents[i].Parent->getParentDfn (array, round+1);
+00394         }
+00395         array.push_back (this);
+00396 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLGEORGES::CFormDfn::getParentDfn std::vector< CFormDfn * > &  array,
uint32  round = 0
+
+ + + + + +
+   + + +

+ +

+Definition at line 358 of file form_dfn.cpp. +

+References NLGEORGES_MAX_RECURSION, Parents, uint, uint32, and warning(). +

+Referenced by NLGEORGES::CFormElmStruct::build(), getSubDfn(), and NLGEORGES::CFormElmStruct::read(). +

+

00359 {
+00360         // Checkout recurcive calls
+00361         if (round > NLGEORGES_MAX_RECURSION)
+00362         {
+00363                 // Turn around..
+00364                 warning (false, "getParentDfn", "Recurcive call on the same DFN, look for loop inheritances.");
+00365                 return;
+00366         }
+00367 
+00368         //uint count = 0;
+00369         uint i;
+00370         for (i=0; i<Parents.size (); i++)
+00371         {
+00372                 Parents[i].Parent->getParentDfn (array, round+1);
+00373         }
+00374         array.push_back (this);
+00375 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLGEORGES::CFormDfn::getParentFilename uint  parent,
std::string &  filename
const [virtual]
+
+ + + + + +
+   + + +

+Get a parent filename.

+

Parameters:
+ + + +
entry is the entry id to get the dfn pointer.
parent will be filled with the parent pointer.
+
+
Returns:
true if successed, false if the parent doesn't exist.
+ +

+Implements NLGEORGES::UFormDfn. +

+Definition at line 814 of file form_dfn.cpp. +

+References Parents, uint, and warning(). +

+

00815 {
+00816         if (parent < Parents.size ())
+00817         {
+00818                 filename = Parents[parent].ParentFilename;
+00819                 return true;
+00820         }
+00821         warning (false, "getParentFilename", "Wrong parent ID."); 
+00822         return false;
+00823 }
+
+

+ + + + +
+ + + + + + + + + + +
const string & NLGEORGES::CFormDfn::getParentFilename uint  parent  )  const
+
+ + + + + +
+   + + +

+ +

+Definition at line 414 of file form_dfn.cpp. +

+References Parents, and uint. +

+

00415 {
+00416         return Parents[parent].ParentFilename;
+00417 }
+
+

+ + + + +
+ + + + + + + + + +
const sint& NLMISC::CRefCount::getRefCount  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 70 of file smart_ptr.h. +

+References NLMISC::CRefCount::crefs, and sint. +

+

00071         {
+00072                 return  crefs;
+00073         }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
const CFormDfn * NLGEORGES::CFormDfn::getSubDfn uint  index,
uint dfnIndex
const
+
+ + + + + +
+   + + +

+ +

+Definition at line 615 of file form_dfn.cpp. +

+References countParentDfn(), getParentDfn(), index, nlstop, size, and uint. +

+

00616 {
+00617         // Get the sub DFN
+00618         vector<const CFormDfn*> parentDfn;
+00619         parentDfn.reserve (countParentDfn ());
+00620         getParentDfn (parentDfn);
+00621 
+00622         // For each parent
+00623         uint dfn;
+00624         dfnIndex = index;
+00625         uint parentSize = parentDfn.size();
+00626         for (dfn=0; dfn<parentSize; dfn++)
+00627         {
+00628                 // Good element ?
+00629                 uint size = parentDfn[dfn]->Entries.size ();
+00630                 if (dfnIndex<size)
+00631                         return parentDfn[dfn];
+00632                 dfnIndex -= size;
+00633         }
+00634 
+00635         // Should be found..
+00636         nlstop;
+00637         return NULL;
+00638 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
CFormDfn * NLGEORGES::CFormDfn::getSubDfn uint  index,
uint dfnIndex
+
+ + + + + +
+   + + +

+ +

+Definition at line 588 of file form_dfn.cpp. +

+References countParentDfn(), getParentDfn(), index, nlstop, size, and uint. +

+

00589 {
+00590         // Get the sub DFN
+00591         vector<CFormDfn*> parentDfn;
+00592         parentDfn.reserve (countParentDfn ());
+00593         getParentDfn (parentDfn);
+00594 
+00595         // For each parent
+00596         uint dfn;
+00597         dfnIndex = index;
+00598         uint parentSize = parentDfn.size();
+00599         for (dfn=0; dfn<parentSize; dfn++)
+00600         {
+00601                 // Good element ?
+00602                 uint size = parentDfn[dfn]->Entries.size ();
+00603                 if (dfnIndex<size)
+00604                         return parentDfn[dfn];
+00605                 dfnIndex -= size;
+00606         }
+00607 
+00608         // Should be found..
+00609         nlstop;
+00610         return NULL;
+00611 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NLGEORGES::CFormDfn::isAnArrayEntryByName const std::string &  name  )  const [virtual]
+
+ + + + + +
+   + + +

+ +

+Implements NLGEORGES::UFormDfn. +

+Definition at line 763 of file form_dfn.cpp. +

+References NLGEORGES::CFormDfn::CEntry::getArrayFlag(). +

+

00764 {
+00765         CFormDfn::CEntry        *entry;
+00766         if      (const_cast<CFormDfn*>(this)->getEntryByName (name, &entry))
+00767         {
+00768                 return  entry->getArrayFlag();
+00769         }
+00770         return  false;
+00771 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NLGEORGES::CFormDfn::read xmlNodePtr  doc,
CFormLoader loader,
bool  forceLoad,
const char *  filename
[private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 118 of file form_dfn.cpp. +

+References Entries, NLGEORGES::CFormLoader::loadFormDfn(), NLGEORGES::CFormLoader::loadType(), nlassert, Parents, NLGEORGES::CFileHeader::read(), stricmp, type, uint, value, and warning(). +

+

00119 {
+00120         // Save filename
+00121         _Filename = CFile::getFilename (filename);
+00122 
+00123         // Check node name
+00124         if ( ((const char*)root->name == NULL) || (strcmp ((const char*)root->name, "DFN") != 0) )
+00125         {
+00126                 // Throw exception
+00127                 warning (true, "read", "XML Syntax error in block line %d, node (%s) should be DFN.", (int)root->content, root->name);
+00128         }
+00129 
+00130         // Count the parent
+00131         uint parentCount = CIXml::countChildren (root, "PARENT");
+00132         Parents.resize (parentCount);
+00133 
+00134         // For each element entry
+00135         uint parentNumber = 0;
+00136         xmlNodePtr parent = CIXml::getFirstChildNode (root, "PARENT");
+00137         while (parentNumber<parentCount)
+00138         {
+00139                 // Get the Parent
+00140                 const char *parentFilename = (const char*)xmlGetProp (parent, (xmlChar*)"Name");
+00141                 if (parentFilename)
+00142                 {
+00143                         Parents[parentNumber].ParentFilename = parentFilename;
+00144 
+00145                         // Delete the value
+00146                         xmlFree ((void*)parentFilename);
+00147 
+00148                         // Load the parent
+00149                         Parents[parentNumber].Parent = loader.loadFormDfn (Parents[parentNumber].ParentFilename.c_str (), forceLoad);
+00150                         if ((Parents[parentNumber].Parent == NULL) && !forceLoad)
+00151                         {
+00152                                 // Throw exception
+00153                                 warning (true, "read", "Can't load parent DFN file (%s).", Parents[parentNumber].ParentFilename.c_str ());
+00154                         }
+00155                 }
+00156                 else
+00157                 {
+00158                         // Throw exception
+00159                         warning (true, "read", "XML Syntax error in block (%s) line %d, aguments Name not found.", 
+00160                                 parent->name, (int)parent->content);
+00161                 }
+00162 
+00163                 // Next parent
+00164                 parent = CIXml::getNextChildNode (parent, "PARENT");
+00165                 parentNumber++;
+00166         }
+00167 
+00168         // Count the element children
+00169         uint childCount = CIXml::countChildren (root, "ELEMENT");
+00170 
+00171         // Resize the element table
+00172         Entries.resize (childCount);
+00173 
+00174         // For each element entry
+00175         uint childNumber = 0;
+00176         xmlNodePtr child = CIXml::getFirstChildNode (root, "ELEMENT");
+00177         while (childNumber<childCount)
+00178         {
+00179                 // Checks
+00180                 nlassert (child);
+00181 
+00182                 // Get the name
+00183                 const char *value = (const char*)xmlGetProp (child, (xmlChar*)"Name");
+00184                 if (value)
+00185                 {
+00186                         // Store the value
+00187                         Entries[childNumber].Name = value;
+00188 
+00189                         // Delete the value
+00190                         xmlFree ((void*)value);
+00191 
+00192                         // Reset
+00193                         Entries[childNumber].Dfn = NULL;
+00194                         Entries[childNumber].Type = NULL;
+00195                         Entries[childNumber].Default.clear ();
+00196 
+00197                         const char *filename = (const char*)xmlGetProp (child, (xmlChar*)"Filename");
+00198 
+00199                         if ( filename )
+00200                         {
+00201                                 Entries[childNumber].Filename = filename;
+00202 
+00203                                 // Delete the value
+00204                                 xmlFree ((void*)filename);
+00205                         }
+00206                         else
+00207                         {
+00208                                 Entries[childNumber].Filename.clear ();
+00209                         }
+00210 
+00211                         const char *filenameExt = (const char*)xmlGetProp (child, (xmlChar*)"FilenameExt");
+00212                         if ( filenameExt )
+00213                         {
+00214                                 Entries[childNumber].FilenameExt = filenameExt;
+00215 
+00216                                 // Delete the value
+00217                                 xmlFree ((void*)filenameExt);
+00218                         }
+00219                         else
+00220                         {
+00221                                 Entries[childNumber].FilenameExt = "*.*";
+00222                         }
+00223                         
+00224                         // Read the type
+00225                         const char *typeName = (const char*)xmlGetProp (child, (xmlChar*)"Type");
+00226                         if (typeName)
+00227                         {
+00228                                 bool type = false;
+00229                                 bool dfn = false;
+00230                                 if (stricmp (typeName, "Type") == 0)
+00231                                 {
+00232                                         Entries[childNumber].TypeElement = UFormDfn::EntryType;
+00233                                         type = true;
+00234 
+00235                                         // Load the filename
+00236                                         if (!Entries[childNumber].Filename.empty ())
+00237                                         {
+00238                                                 Entries[childNumber].Type = loader.loadType (Entries[childNumber].Filename.c_str ());
+00239                                                 if ((Entries[childNumber].Type == NULL) && !forceLoad)
+00240                                                 {
+00241                                                         // Throw exception
+00242                                                         warning (true, "read", "In XML block (%s) line %d, file not found %s.", 
+00243                                                                 child->name, (int)child->content, Entries[childNumber].Filename.c_str ());
+00244                                                 }
+00245 
+00246                                                 // Read the default value
+00247                                                 const char *defaultName = (const char*)xmlGetProp (child, (xmlChar*)"Default");
+00248                                                 if (defaultName)
+00249                                                 {
+00250                                                         Entries[childNumber].Default = defaultName;
+00251 
+00252                                                         // Delete the value
+00253                                                         xmlFree ((void*)defaultName);
+00254                                                 }
+00255                                         }
+00256                                         else
+00257                                         {
+00258                                                 // Throw exception
+00259                                                 warning (true, "read", "XML In block (%s) line %d, no filename found for the .typ file.", 
+00260                                                         child->name, (int)child->content, Entries[childNumber].Filename.c_str ());
+00261                                         }
+00262                                 }
+00263                                 else if (stricmp (typeName, "Dfn") == 0)
+00264                                 {
+00265                                         Entries[childNumber].TypeElement = UFormDfn::EntryDfn;
+00266                                         dfn = true;
+00267 
+00268                                         // Load the filename
+00269                                         if (!Entries[childNumber].Filename.empty ())
+00270                                         {
+00271                                                 // Load the filename
+00272                                                 Entries[childNumber].Dfn = loader.loadFormDfn (Entries[childNumber].Filename.c_str (), forceLoad);
+00273                                                 if ((Entries[childNumber].Dfn == NULL) && !forceLoad)
+00274                                                 {
+00275                                                         // Throw exception
+00276                                                         warning (true, "read", "XML In block (%s) line %d, file not found %s.", 
+00277                                                                 child->name, (int)child->content, Entries[childNumber].Filename.c_str ());
+00278                                                 }
+00279                                         }
+00280                                         else
+00281                                         {
+00282                                                 // Throw exception
+00283                                                 warning (true, "read", "XML In block (%s) line %d, no filename found for the .typ file.", 
+00284                                                         child->name, (int)child->content, Entries[childNumber].Filename.c_str ());
+00285                                         }
+00286                                 }
+00287                                 else if (stricmp (typeName, "DfnPointer") == 0)
+00288                                 {
+00289                                         Entries[childNumber].TypeElement = UFormDfn::EntryVirtualDfn;
+00290                                 }
+00291                                 else
+00292                                 {
+00293                                         // Throw exception
+00294                                         warning (true, "read", "XML Syntax error in block (%s) line %d, element has not a valid type name attribut \"Type = %s\".", 
+00295                                                 child->name, (int)child->content, typeName);
+00296                                 }
+00297 
+00298                                 // Delete the value
+00299                                 xmlFree ((void*)typeName);
+00300                         }
+00301                         else
+00302                         {
+00303                                 // Throw exception
+00304                                 warning (true, "read", "XML Syntax error in block (%s) line %d, element has no type name attribut \"Type = [Type][Dfn][DfnPointer]\".", 
+00305                                         child->name, (int)child->content);
+00306                         }
+00307 
+00308                         // Get the array attrib
+00309                         Entries[childNumber].Array = false;
+00310                         const char* arrayFlag = (const char*)xmlGetProp (child, (xmlChar*)"Array");
+00311                         if (arrayFlag)
+00312                         {
+00313                                 Entries[childNumber].Array =  (stricmp (arrayFlag, "true") == 0);
+00314                                         
+00315                                 // Delete the value
+00316                                 xmlFree ((void*)arrayFlag);
+00317                         }
+00318                 }
+00319                 else
+00320                 {
+00321                         // Throw exception
+00322                         warning (true, "read", "XML Syntax error in block (%s) line %d, aguments Name not found.", 
+00323                                 root->name, (int)root->content);
+00324                 }
+00325 
+00326                 // Next child
+00327                 child = CIXml::getNextChildNode (child, "ELEMENT");
+00328                 childNumber++;
+00329         }
+00330 
+00331         // Read the header
+00332         Header.read (root);
+00333 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLGEORGES::CFormDfn::setNumEntry uint  size  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 428 of file form_dfn.cpp. +

+References Entries, size, and uint. +

+

00429 {
+00430         Entries.resize (size);
+00431 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLGEORGES::CFormDfn::setNumParent uint  size  ) 
+
+ + + + + +
+   + + +

+ +

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

+References Parents, size, and uint. +

+

00450 {
+00451         Parents.resize (size);
+00452 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NLGEORGES::CFormDfn::setParent uint  parent,
CFormLoader loader,
const char *  filename
+
+ + + + + +
+   + + +

+ +

+Definition at line 456 of file form_dfn.cpp. +

+References NLGEORGES::CFormLoader::loadFormDfn(), Parents, and uint. +

+

00457 {
+00458         if (strcmp (filename, "")==0)
+00459                 Parents[parent].Parent = NULL;
+00460         else
+00461                 Parents[parent].Parent = loader.loadFormDfn (filename, false);
+00462         Parents[parent].ParentFilename = filename;
+00463 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NLGEORGES::CFormDfn::warning bool  exception,
const char *  function,
const char *  format,
... 
const
+
+ + + + + +
+   + + +

+ +

+Definition at line 848 of file form_dfn.cpp. +

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

+Referenced by countParentDfn(), getEntryDfn(), getEntryFilename(), getEntryFilenameExt(), getEntryName(), getEntryType(), getParent(), getParentDfn(), getParentFilename(), and read(). +

+

00849 {
+00850         // Make a buffer string
+00851         va_list args;
+00852         va_start( args, format );
+00853         char buffer[1024];
+00854         vsnprintf( buffer, 1024, format, args );
+00855         va_end( args );
+00856 
+00857         // Set the warning
+00858         NLGEORGES::warning (exception, "(CFormDfn::%s) in form DFN (%s) : %s", function, _Filename.c_str (), buffer);
+00859 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NLGEORGES::CFormDfn::write xmlDocPtr  root,
const char *  filename,
bool  georges4CVS
+
+ + + + + +
+   + + +

+ +

+Definition at line 53 of file form_dfn.cpp. +

+References Entries, Parents, uint, and NLGEORGES::CFileHeader::write(). +

+

00054 {
+00055         // Save filename
+00056         _Filename = CFile::getFilename (filename);
+00057 
+00058         // Create the first node
+00059         xmlNodePtr node = xmlNewDocNode (doc, NULL, (const xmlChar*)"DFN", NULL);
+00060         xmlDocSetRootElement (doc, node);
+00061 
+00062         // Write elements
+00063         uint parent;
+00064         for (parent=0; parent<Parents.size(); parent++)
+00065         {
+00066                 // Parent name not empty ?
+00067                 if (!Parents[parent].ParentFilename.empty ())
+00068                 {
+00069                         // Parent node
+00070                         xmlNodePtr parentNode = xmlNewChild ( node, NULL, (const xmlChar*)"PARENT", NULL);
+00071 
+00072                         // Save parent
+00073                         xmlSetProp (parentNode, (const xmlChar*)"Name", (const xmlChar*)Parents[parent].ParentFilename.c_str());
+00074                 }
+00075         }
+00076 
+00077         // Write elements
+00078         uint elm;
+00079         for (elm=0; elm<Entries.size(); elm++)
+00080         {
+00081                 // Add a node
+00082                 xmlNodePtr elmPtr = xmlNewChild ( node, NULL, (const xmlChar*)"ELEMENT", NULL);
+00083                 xmlSetProp (elmPtr, (const xmlChar*)"Name", (const xmlChar*)Entries[elm].Name.c_str());
+00084                 
+00085                 // What kind of element
+00086                 switch (Entries[elm].TypeElement)
+00087                 {
+00088                 case UFormDfn::EntryType:
+00089                         xmlSetProp (elmPtr, (const xmlChar*)"Type", (const xmlChar*)"Type");
+00090                         xmlSetProp (elmPtr, (const xmlChar*)"Filename", (const xmlChar*)Entries[elm].Filename.c_str());
+00091                         if ((!Entries[elm].FilenameExt.empty ()) && Entries[elm].FilenameExt != "*.*")
+00092                                 xmlSetProp (elmPtr, (const xmlChar*)"FilenameExt", (const xmlChar*)Entries[elm].FilenameExt.c_str());
+00093                         break;
+00094                 case UFormDfn::EntryDfn:
+00095                         xmlSetProp (elmPtr, (const xmlChar*)"Type", (const xmlChar*)"Dfn");
+00096                         xmlSetProp (elmPtr, (const xmlChar*)"Filename", (const xmlChar*)Entries[elm].Filename.c_str());
+00097                         break;
+00098                 case UFormDfn::EntryVirtualDfn:
+00099                         xmlSetProp (elmPtr, (const xmlChar*)"Type", (const xmlChar*)"DfnPointer");
+00100                         break;
+00101                 }
+00102 
+00103                 // Is an array ?
+00104                 if (Entries[elm].Array)
+00105                         xmlSetProp (elmPtr, (const xmlChar*)"Array", (const xmlChar*)"true");
+00106 
+00107                 // Default value for type
+00108                 if ((Entries[elm].TypeElement == UFormDfn::EntryType) && (!Entries[elm].Default.empty ()))
+00109                         xmlSetProp (elmPtr, (const xmlChar*)"Default", (const xmlChar*)Entries[elm].Default.c_str ());
+00110         }
+00111 
+00112         // Header
+00113         Header.write (node, georges4CVS);
+00114 }
+
+


Friends And Related Function Documentation

+

+ + + + +
+ + +
friend class CForm [friend] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 48 of file form_dfn.h.

+

+ + + + +
+ + +
friend class CFormElm [friend] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 50 of file form_dfn.h.

+

+ + + + +
+ + +
friend class CFormElmStruct [friend] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 52 of file form_dfn.h.

+

+ + + + +
+ + +
friend class CFormLoader [friend] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 51 of file form_dfn.h.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool convertDfnFile const char *  oldFileName,
const char *  newFileName
[friend]
+
+ + + + + +
+   + + +

+

+

+ + + + +
+ + +
friend struct CPtrInfo [friend, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 67 of file smart_ptr.h.

+

+ + + + +
+ + +
friend class CType [friend] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 49 of file form_dfn.h.

+


Field Documentation

+

+ + + + +
+ + +
std::string NLGEORGES::CFormDfn::_Filename [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 251 of file form_dfn.h.

+

+ + + + +
+ + +
sint NLMISC::CRefCount::crefs [mutable, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 79 of file smart_ptr.h. +

+Referenced by NLMISC::CRefCount::CRefCount(), NLMISC::CRefCount::getRefCount(), and NLMISC::CRefCount::~CRefCount().

+

+ + + + +
+ + +
std::vector<CEntry> NLGEORGES::CFormDfn::Entries [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 245 of file form_dfn.h. +

+Referenced by getDependencies(), getEntry(), getEntryByName(), getEntryDfn(), getEntryFilename(), getEntryFilenameExt(), getEntryIndexByName(), getEntryName(), getEntryType(), NLGEORGES::CFormElm::getIternalNodeByName(), getNumEntry(), read(), setNumEntry(), and write().

+

+ + + + +
+ + +
CFileHeader NLGEORGES::CFormDfn::Header +
+
+ + + + + +
+   + + +

+ +

+Definition at line 235 of file form_dfn.h.

+

+ + + + +
+ + +
CRefCount::CPtrInfo NLMISC::CRefCount::NullPtrInfo [static, inherited] +
+
+ + + + + +
+   + + +

+ +

+Referenced by NLMISC::CRefCount::CRefCount().

+

+ + + + +
+ + +
std::vector<CParent> NLGEORGES::CFormDfn::Parents [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 242 of file form_dfn.h. +

+Referenced by countParentDfn(), getDependencies(), getNumParent(), getNumParents(), getParent(), getParentDfn(), getParentFilename(), read(), setNumParent(), setParent(), and write().

+

+ + + + +
+ + +
CPtrInfo* NLMISC::CRefCount::pinfo [mutable, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 80 of file smart_ptr.h. +

+Referenced by NLMISC::CRefCount::CRefCount(), and NLMISC::CRefCount::~CRefCount().

+

+ + + + +
+ + +
uint32 NLGEORGES::CFormDfn::Round [mutable, private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 248 of file form_dfn.h. +

+Referenced by CFormDfn().

+


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