form.h
Go to the documentation of this file.00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef NL_FORM_H
00025 #define NL_FORM_H
00026
00027 #include "nel/misc/types_nl.h"
00028 #include "nel/georges/u_form.h"
00029 #include "form_elm.h"
00030 #include "header.h"
00031
00032 extern bool convertFormFile (const char *oldFileName, const char *newFileName);
00033
00034 namespace NLGEORGES
00035 {
00036
00037 class UFormElm;
00038
00042 class CForm : public UForm
00043 {
00044 friend class CFormLoader;
00045 friend bool convertFormFile (const char *oldFileName, const char *newFileName);
00046 public:
00047
00048 enum { HeldElementCount = 4 };
00049
00050
00051 UFormElm& getRootNode ();
00052 const UFormElm& getRootNode () const;
00053 const std::string &getComment () const;
00054 void write (class NLMISC::IStream &stream, bool georges4CVS);
00055 void getDependencies (std::set<std::string> &dependencies) const;
00056 uint getNumParent () const;
00057 UForm *getParentForm (uint parent) const;
00058
00059 #ifdef NL_OS_WINDOWS
00060 # pragma warning (disable : 4355)
00061 #endif
00062 CForm ();
00063 ~CForm ();
00064
00065
00066 void clean ();
00067
00068
00069
00070
00071 CFileHeader Header;
00072
00073
00074
00076 CFormElmStruct Elements;
00077
00079 CFormElmStruct *HeldElements[HeldElementCount];
00080
00081
00082
00083 void write (xmlDocPtr doc, const char *filename, bool georges4CVS);
00084
00085
00086
00087
00088 bool insertParent (uint before, const char *filename, CForm *parent);
00089
00090
00091 void removeParent (uint parent);
00092
00093
00094 CForm * getParent (uint parent) const;
00095 const std::string &getParentFilename (uint parent) const;
00096
00097
00098 uint getParentCount () const;
00099
00100
00101 void clearParents ();
00102
00103
00104 const std::string &getFilename () const;
00105
00106
00107 void warning (bool exception, const char *function, const char *format, ... ) const;
00108
00109 private:
00110
00111
00112 class CParent
00113 {
00114 public:
00115 std::string ParentFilename;
00116 NLMISC::CSmartPtr<CForm> Parent;
00117 };
00118
00120 std::vector<CParent> ParentList;
00121
00122
00123
00124 void read (xmlNodePtr node, CFormLoader &loader, CFormDfn *dfn, const char *filename);
00125
00126
00127 void readParent (const char *parent, CFormLoader &loader);
00128
00129
00130 std::string _Filename;
00131 };
00132
00133 }
00134
00135 #endif // NL_FORM_H