#include <header.h>
Public Types | |
| enum | TState { Modified = 0, Checked, StateCount } |
Public Member Functions | |
| void | addLog (const char *log) |
| Add a log. | |
| CFileHeader () | |
| Default constructor. | |
| void | read (xmlNodePtr root) |
| ** IO functions | |
| void | setComments (const char *comments) |
| Set the comment. | |
| void | warning (bool exception, const char *function, const char *format,...) const |
| void | write (xmlNodePtr node, bool georges4CVS) const |
Static Public Member Functions | |
| const char * | getStateString (TState state) |
Data Fields | |
| std::string | Comments |
| Comments of the form. | |
| std::string | Log |
| Log of the form. | |
| uint32 | MajorVersion |
| Major version number. | |
| uint32 | MinorVersion |
| Minor version number. | |
| std::string | Revision |
| CVS Revision string. | |
| TState | State |
| State of the form. | |
|
|
Definition at line 41 of file header.h.
00042 {
00043 Modified =0,
00044 Checked,
00045 StateCount,
00046 };
|
|
|
Default constructor.
Definition at line 44 of file header.cpp. References MajorVersion, MinorVersion, and Revision.
00045 {
00046 MajorVersion = 0;
00047 MinorVersion = 0;
00048 State = Modified;
00049 Revision = "$R";
00050 Revision += "evision$";
00051 }
|
|
|
Add a log.
Definition at line 98 of file header.cpp.
|
|
|
Definition at line 240 of file header.cpp.
00241 {
00242 if (state == Modified)
00243 return "Modified";
00244 else
00245 return "Checked";
00246 }
|
|
|
** IO functions
Definition at line 121 of file header.cpp. References Checked, Comments, Log, MajorVersion, MinorVersion, Revision, value, and warning(). Referenced by NLGEORGES::CType::read(), NLGEORGES::CFormDfn::read(), and NLGEORGES::CForm::read().
00122 {
00123 // Get the version
00124 const char *value = (const char*)xmlGetProp (root, (xmlChar*)"Version");
00125 if (value)
00126 {
00127 // Read the version
00128 if (sscanf (value, "%d.%d", &MajorVersion, &MinorVersion) != 2)
00129 {
00130 // Delete the value
00131 xmlFree ((void*)value);
00132
00133 // Throw exception
00134 warning (true, "read", "XML Syntax error in TYPE block line %d, the Version argument is invalid.",
00135 (int)root->content);
00136 }
00137
00138 // Delete the value
00139 xmlFree ((void*)value);
00140 }
00141 else
00142 {
00143 // Set default
00144 MajorVersion = 0;
00145 MinorVersion = 0;
00146 }
00147
00148 // Get the revision
00149 value = (const char*)xmlGetProp (root, (xmlChar*)"Revision");
00150 if (value)
00151 {
00152 // Set the value
00153 Revision = value;
00154
00155 // Delete the value
00156 xmlFree ((void*)value);
00157 }
00158 else
00159 {
00160 // Set default
00161 Revision = "$R";
00162 Revision += "evision$";
00163 }
00164
00165 // Get the version
00166 value = (const char*)xmlGetProp (root, (xmlChar*)"State");
00167 if (value)
00168 {
00169 // Read the version
00170 if (strcmp (value, "modified") == 0)
00171 {
00172 State = Modified;
00173 }
00174 else if (strcmp (value, "checked") == 0)
00175 {
00176 State = Checked;
00177 }
00178 else
00179 {
00180 // Delete the value
00181 xmlFree ((void*)value);
00182
00183 // Throw exception
00184 warning (true, "read", "XML Syntax error in TYPE block line %d, the State argument is invalid.",
00185 (int)root->content);
00186 }
00187
00188 // Delete the value
00189 xmlFree ((void*)value);
00190 }
00191 else
00192 {
00193 // Set default
00194 State = Modified;
00195 }
00196
00197 // Look for the comment node
00198 Comments = "";
00199 xmlNodePtr node = CIXml::getFirstChildNode (root, "COMMENTS");
00200 if (node)
00201 {
00202 // Get a text node
00203 if ((node = CIXml::getFirstChildNode (node, XML_TEXT_NODE)))
00204 {
00205 // Get content
00206 const char *comments = (const char*)xmlNodeGetContent (node);
00207 if (comments)
00208 {
00209 Comments = comments;
00210
00211 // Delete the value
00212 xmlFree ((void*)comments);
00213 }
00214 }
00215 }
00216
00217 // Look for the log node
00218 Log = "";
00219 node = CIXml::getFirstChildNode (root, "LOG");
00220 if (node)
00221 {
00222 // Get a text node
00223 if ((node = CIXml::getFirstChildNode (node, XML_TEXT_NODE)))
00224 {
00225 // Get content
00226 const char *log = (const char*)xmlNodeGetContent (node);
00227 if (log)
00228 {
00229 Log = log;
00230
00231 // Delete the value
00232 xmlFree ((void*)log);
00233 }
00234 }
00235 }
00236 }
|
|
|
Set the comment.
Definition at line 114 of file header.cpp. References Comments.
00115 {
00116 Comments = comments;
00117 }
|
|
||||||||||||||||||||
|
Definition at line 250 of file header.cpp. References buffer, format, and NLGEORGES::warning(). Referenced by read().
00251 {
00252 // Make a buffer string
00253 va_list args;
00254 va_start( args, format );
00255 char buffer[1024];
00256 vsnprintf( buffer, 1024, format, args );
00257 va_end( args );
00258
00259 // Set the warning
00260 NLGEORGES::warning (exception, "(CFileHeader::%s) : %s", function, buffer);
00261 }
|
|
||||||||||||
|
Definition at line 55 of file header.cpp. References Comments, Log, MajorVersion, MinorVersion, Revision, and NLMISC::smprintf(). Referenced by NLGEORGES::CType::write(), NLGEORGES::CFormDfn::write(), and NLGEORGES::CForm::write().
00056 {
00057 // Version for CVS ?
00058 if (georges4CVS)
00059 {
00060 // Georges version system
00061 xmlSetProp (node, (const xmlChar*)"Revision", (const xmlChar*)Revision.c_str ());
00062 }
00063 else
00064 {
00065 // Georges version system
00066 char tmp[512];
00067 smprintf (tmp, 512, "%d.%d", MajorVersion, MinorVersion);
00068 xmlSetProp (node, (const xmlChar*)"Version", (const xmlChar*)tmp);
00069 }
00070
00071 // State
00072 if (State == Modified)
00073 xmlSetProp (node, (const xmlChar*)"State", (const xmlChar*)"modified");
00074 else
00075 xmlSetProp (node, (const xmlChar*)"State", (const xmlChar*)"checked");
00076
00077 // Comments of the form
00078 if (!Comments.empty ())
00079 {
00080 // Create a new node
00081 xmlNodePtr child = xmlNewChild ( node, NULL, (const xmlChar*)"COMMENTS", NULL);
00082 xmlNodePtr textNode = xmlNewText ((const xmlChar *)Comments.c_str());
00083 xmlAddChild (child, textNode);
00084 }
00085
00086 // Logs
00087 if (!Log.empty ())
00088 {
00089 // Create a new node
00090 xmlNodePtr child = xmlNewChild ( node, NULL, (const xmlChar*)"LOG", NULL);
00091 xmlNodePtr textNode = xmlNewText ((const xmlChar *)Log.c_str());
00092 xmlAddChild (child, textNode);
00093 }
00094 }
|
|
|
Comments of the form.
Definition at line 67 of file header.h. Referenced by NLGEORGES::CType::getComment(), NLGEORGES::CFormDfn::getComment(), NLGEORGES::CForm::getComment(), read(), setComments(), and write(). |
|
|
Log of the form.
|
|
|
Major version number.
Definition at line 55 of file header.h. Referenced by CFileHeader(), read(), and write(). |
|
|
Minor version number.
Definition at line 58 of file header.h. Referenced by CFileHeader(), read(), and write(). |
|
|
CVS Revision string.
Definition at line 64 of file header.h. Referenced by CFileHeader(), read(), and write(). |
|
|
State of the form.
|
1.3.6