|
Code_TYMPAN
4.4.0
Industrial site acoustic simulation
|
#include <OXMLTreeManager.h>
Public Types | |
| enum | FIELDTYPE { INTEGER , FLOAT , STRING } |
Public Member Functions | |
| OXMLTreeManager () | |
| virtual | ~OXMLTreeManager () |
| bool | create (const QString &docname) |
| virtual bool | load (const QString &filename) |
| bool | load (const QByteArray &bytearray) |
| virtual bool | save (const QString &filename) |
| bool | isFieldPresent (const QString &field) |
| bool | getFieldType (const QString &field, FIELDTYPE &type) |
| bool | addField (const QString &field, long value) |
| bool | addField (const QString &field, float value) |
| bool | addField (const QString &field, const QString &value) |
| bool | getFieldLongValue (const QString &field, long &value) |
| bool | getFieldFloatValue (const QString &field, float &value) |
| bool | getFieldStringValue (const QString &field, QString &value) |
| bool | setFieldLongValue (const QString &field, long value) |
| bool | setFieldFloatValue (const QString &field, float value) |
| bool | setFieldStringValue (const QString &field, const QString &value) |
| bool | isDirectoryPresent (const QString &directory, bool absolute=false, int index=0) |
| bool | setCurrentDirectory (const QString &directory, bool absolute=false, int index=0) |
| bool | setCurrentSubDirectory (int index) |
| bool | setCurrentDirectoryUp () |
| QString | getCurrentDirectory () |
| QString | getCurrentSubDirectory () |
| unsigned long | getSubDirectoryCount (const QString &directory=QString()) |
| unsigned long | getFieldCount () |
| bool | addDirectory (const QString &directory) |
| bool | remDirectory (const QString &directory) |
Private Member Functions | |
| void | setCurrentDomNode (const QDomNode &node) |
| QDomNode | getCurrentDomNode () |
| QDomNode | getRootDomNode () |
| bool | findDirectory (const QString &directory, QDomNode &foundnode, bool absolute, int index=0) |
| bool | findField (const QString &field, const QDomNode ¤tnode, QDomAttr &attribute) |
Static Private Member Functions | |
| static bool | isRoot (const QDomNode &node) |
Private Attributes | |
| QDomDocument * | m_pDomDocument |
| QDomNode | m_CurrentDomNode |
This class is used to read an write miscellanous information in XML files. It can sort information in a hierarchy like files on a hard drive. It can store 3 types of data : text strings (encoded using the encoding of the xml file, integer decimal values. A "directory" corresponds to an element in a XML file. A "field" corresponds to an attribute in a XML file. Other objects than elements and attributes in the XML norm are correctly loaded and saved with this class but they are not accessible.
Definition at line 38 of file OXMLTreeManager.h.
Type of data stored in a filed.
| Enumerator | |
|---|---|
| INTEGER | |
| FLOAT | |
| STRING | |
Definition at line 76 of file OXMLTreeManager.h.
| OXMLTreeManager::OXMLTreeManager | ( | ) |
Default constructor.
Definition at line 48 of file OXMLTreeManager.cpp.
|
virtual |
Destructor.
Definition at line 54 of file OXMLTreeManager.cpp.
| bool OXMLTreeManager::addDirectory | ( | const QString & | directory | ) |
Adds a directory in the current directory. Retuns FALSE if it fails.
Definition at line 459 of file OXMLTreeManager.cpp.

| bool OXMLTreeManager::addField | ( | const QString & | field, |
| const QString & | value | ||
| ) |
Adds a field in the current directory to store a string. Retuns FALSE if it fails.
Definition at line 242 of file OXMLTreeManager.cpp.

| bool OXMLTreeManager::addField | ( | const QString & | field, |
| float | value | ||
| ) |
Adds a field in the current directory to store an floating point value. Retuns FALSE if it fails.
Definition at line 228 of file OXMLTreeManager.cpp.

| bool OXMLTreeManager::addField | ( | const QString & | field, |
| long | value | ||
| ) |
Adds a field in the current directory to store an integer value. Retuns FALSE if it fails.
Definition at line 214 of file OXMLTreeManager.cpp.

| bool OXMLTreeManager::create | ( | const QString & | docname | ) |
Reset all internal information and creates a doctype (for saving all the information stored in a OXMLTreeManager object in a XML file
Definition at line 64 of file OXMLTreeManager.cpp.

|
private |
Definition at line 497 of file OXMLTreeManager.cpp.


|
private |
| QString OXMLTreeManager::getCurrentDirectory | ( | ) |
Returns the "absolute path" name of the current directory.
Definition at line 392 of file OXMLTreeManager.cpp.

|
inlineprivate |
| QString OXMLTreeManager::getCurrentSubDirectory | ( | ) |
Returns the name of the current directory.
Definition at line 409 of file OXMLTreeManager.cpp.

| unsigned long OXMLTreeManager::getFieldCount | ( | ) |
Returns the number of fields in the current directory.
Definition at line 451 of file OXMLTreeManager.cpp.

| bool OXMLTreeManager::getFieldFloatValue | ( | const QString & | field, |
| float & | value | ||
| ) |
Gets the floating point value stored in the field in the current directory.
| field | Field name |
| value | Reference to return a value Retuns FALSE if it fails. |
Definition at line 270 of file OXMLTreeManager.cpp.

| bool OXMLTreeManager::getFieldLongValue | ( | const QString & | field, |
| long & | value | ||
| ) |
Gets the integer value stored in the field in the current directory.
| field | Field name |
| value | Reference to return a value Retuns FALSE if it fails. |
Definition at line 256 of file OXMLTreeManager.cpp.

| bool OXMLTreeManager::getFieldStringValue | ( | const QString & | field, |
| QString & | value | ||
| ) |
Gets the string stored in the field in the current directory.
| field | Field name |
| value | Reference to return a value Retuns FALSE if it fails. |
Definition at line 284 of file OXMLTreeManager.cpp.


| bool OXMLTreeManager::getFieldType | ( | const QString & | field, |
| FIELDTYPE & | type | ||
| ) |
returns the FIEDTYPE of the field whose name is stored in the QString object is present in the current directory.
Definition at line 185 of file OXMLTreeManager.cpp.

|
inlineprivate |
| unsigned long OXMLTreeManager::getSubDirectoryCount | ( | const QString & | directory = QString() | ) |
Returns the number of directories whose name are stored in the directory parameter. if a QString::null is passed, than this method returns the whole number of directories.
Definition at line 425 of file OXMLTreeManager.cpp.


| bool OXMLTreeManager::isDirectoryPresent | ( | const QString & | directory, |
| bool | absolute = false, |
||
| int | index = 0 |
||
| ) |
Returns TRUE if the directory whose name is store in the directory parameter is present. This method behaves exactly like the SetCurrentDirectory() except it just check for the presence of a directory object.
Definition at line 325 of file OXMLTreeManager.cpp.

| bool OXMLTreeManager::isFieldPresent | ( | const QString & | field | ) |
returns TRUE if the field whose name is stored in the QString object is present in the current directory.
Definition at line 178 of file OXMLTreeManager.cpp.

|
inlinestaticprivate |
| bool OXMLTreeManager::load | ( | const QByteArray & | bytearray | ) |
Loads a XML file from memory using the QByteArray object the access the file previously loaded. Returns FALSE, if the XML file is badly formed.
Definition at line 124 of file OXMLTreeManager.cpp.

|
virtual |
Loads a XML file from a disk using the filename parameter to access the file. Returns FALSE, if the loading of the file fails or if the XML file is badly formed.
Definition at line 88 of file OXMLTreeManager.cpp.


| bool OXMLTreeManager::remDirectory | ( | const QString & | directory | ) |
Remove a directory in the current directory. Retuns FALSE if it fails.
Definition at line 479 of file OXMLTreeManager.cpp.

|
virtual |
Save in an XML file all the information stored in this OXMLTreeManager object. Returns FALSE if the saving fails.
Definition at line 148 of file OXMLTreeManager.cpp.
| bool OXMLTreeManager::setCurrentDirectory | ( | const QString & | directory, |
| bool | absolute = false, |
||
| int | index = 0 |
||
| ) |
Sets the current directory to a sub directory using a name an index. Once found, the index is used. As several directories can have the same name (in relative access mode) the index can be used to select more precisely a directory.
| directory | : Directory name to select (can be relative or absolute). |
| absolute | : indicate if absolute or note (false by default) |
| index | : start index (0 by default) |
Definition at line 332 of file OXMLTreeManager.cpp.


| bool OXMLTreeManager::setCurrentDirectoryUp | ( | ) |
Sets the current directory to the upper directory.
Definition at line 379 of file OXMLTreeManager.cpp.


|
inlineprivate |
| bool OXMLTreeManager::setCurrentSubDirectory | ( | int | index | ) |
Sets the current directory to a sub directory using an index.
Definition at line 345 of file OXMLTreeManager.cpp.

| bool OXMLTreeManager::setFieldFloatValue | ( | const QString & | field, |
| float | value | ||
| ) |
Sets the floating point value stored in the field in the current directory.
| field | Field name |
| value | New floating point value for the field Retuns FALSE if it fails. |
Definition at line 307 of file OXMLTreeManager.cpp.

| bool OXMLTreeManager::setFieldLongValue | ( | const QString & | field, |
| long | value | ||
| ) |
Sets the integer value stored in the field in the current directory.
| field | Field name |
| value | New integer value for the field Retuns FALSE if it fails. |
Definition at line 298 of file OXMLTreeManager.cpp.

| bool OXMLTreeManager::setFieldStringValue | ( | const QString & | field, |
| const QString & | value | ||
| ) |
Sets the string stored in the field in the current directory.
| field | Field name |
| value | New string to be store in the field Retuns FALSE if it fails. |
Definition at line 316 of file OXMLTreeManager.cpp.

|
private |
Definition at line 225 of file OXMLTreeManager.h.
|
private |
Definition at line 224 of file OXMLTreeManager.h.