Code_TYMPAN  4.4.0
Industrial site acoustic simulation
Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
OXMLTreeManager Class Reference

#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 &currentnode, QDomAttr &attribute)
 

Static Private Member Functions

static bool isRoot (const QDomNode &node)
 

Private Attributes

QDomDocument * m_pDomDocument
 
QDomNode m_CurrentDomNode
 

Detailed Description

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.

Member Enumeration Documentation

◆ FIELDTYPE

Type of data stored in a filed.

Enumerator
INTEGER 
FLOAT 
STRING 

Definition at line 76 of file OXMLTreeManager.h.

Constructor & Destructor Documentation

◆ OXMLTreeManager()

OXMLTreeManager::OXMLTreeManager ( )

Default constructor.

Definition at line 48 of file OXMLTreeManager.cpp.

◆ ~OXMLTreeManager()

OXMLTreeManager::~OXMLTreeManager ( )
virtual

Destructor.

Definition at line 54 of file OXMLTreeManager.cpp.

Member Function Documentation

◆ addDirectory()

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.

Here is the call graph for this function:

◆ addField() [1/3]

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.

Here is the call graph for this function:

◆ addField() [2/3]

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.

Here is the call graph for this function:

◆ addField() [3/3]

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.

Here is the call graph for this function:

◆ create()

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.

Here is the call graph for this function:

◆ findDirectory()

bool OXMLTreeManager::findDirectory ( const QString &  directory,
QDomNode &  foundnode,
bool  absolute,
int  index = 0 
)
private

Definition at line 497 of file OXMLTreeManager.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findField()

bool OXMLTreeManager::findField ( const QString &  field,
const QDomNode &  currentnode,
QDomAttr &  attribute 
)
private

Definition at line 567 of file OXMLTreeManager.cpp.

Here is the caller graph for this function:

◆ getCurrentDirectory()

QString OXMLTreeManager::getCurrentDirectory ( )

Returns the "absolute path" name of the current directory.

Definition at line 392 of file OXMLTreeManager.cpp.

Here is the call graph for this function:

◆ getCurrentDomNode()

QDomNode OXMLTreeManager::getCurrentDomNode ( )
inlineprivate

Definition at line 233 of file OXMLTreeManager.h.

Here is the caller graph for this function:

◆ getCurrentSubDirectory()

QString OXMLTreeManager::getCurrentSubDirectory ( )

Returns the name of the current directory.

Definition at line 409 of file OXMLTreeManager.cpp.

Here is the call graph for this function:

◆ getFieldCount()

unsigned long OXMLTreeManager::getFieldCount ( )

Returns the number of fields in the current directory.

Definition at line 451 of file OXMLTreeManager.cpp.

Here is the call graph for this function:

◆ getFieldFloatValue()

bool OXMLTreeManager::getFieldFloatValue ( const QString &  field,
float &  value 
)

Gets the floating point value stored in the field in the current directory.

Parameters
fieldField name
valueReference to return a value Retuns FALSE if it fails.

Definition at line 270 of file OXMLTreeManager.cpp.

Here is the call graph for this function:

◆ getFieldLongValue()

bool OXMLTreeManager::getFieldLongValue ( const QString &  field,
long &  value 
)

Gets the integer value stored in the field in the current directory.

Parameters
fieldField name
valueReference to return a value Retuns FALSE if it fails.

Definition at line 256 of file OXMLTreeManager.cpp.

Here is the call graph for this function:

◆ getFieldStringValue()

bool OXMLTreeManager::getFieldStringValue ( const QString &  field,
QString &  value 
)

Gets the string stored in the field in the current directory.

Parameters
fieldField name
valueReference to return a value Retuns FALSE if it fails.

Definition at line 284 of file OXMLTreeManager.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFieldType()

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.

See also
FIELDTYPE

Definition at line 185 of file OXMLTreeManager.cpp.

Here is the call graph for this function:

◆ getRootDomNode()

QDomNode OXMLTreeManager::getRootDomNode ( )
inlineprivate

Definition at line 238 of file OXMLTreeManager.h.

Here is the caller graph for this function:

◆ getSubDirectoryCount()

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isDirectoryPresent()

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.

See also
IsDirectoryPresent().

Definition at line 325 of file OXMLTreeManager.cpp.

Here is the call graph for this function:

◆ isFieldPresent()

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.

Here is the call graph for this function:

◆ isRoot()

static bool OXMLTreeManager::isRoot ( const QDomNode &  node)
inlinestaticprivate

Definition at line 218 of file OXMLTreeManager.h.

Here is the caller graph for this function:

◆ load() [1/2]

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.

Here is the call graph for this function:

◆ load() [2/2]

bool OXMLTreeManager::load ( const QString &  filename)
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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remDirectory()

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.

Here is the call graph for this function:

◆ save()

bool OXMLTreeManager::save ( const QString &  filename)
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.

◆ setCurrentDirectory()

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.

Parameters
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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCurrentDirectoryUp()

bool OXMLTreeManager::setCurrentDirectoryUp ( )

Sets the current directory to the upper directory.

Definition at line 379 of file OXMLTreeManager.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCurrentDomNode()

void OXMLTreeManager::setCurrentDomNode ( const QDomNode &  node)
inlineprivate

Definition at line 228 of file OXMLTreeManager.h.

Here is the caller graph for this function:

◆ setCurrentSubDirectory()

bool OXMLTreeManager::setCurrentSubDirectory ( int  index)

Sets the current directory to a sub directory using an index.

Definition at line 345 of file OXMLTreeManager.cpp.

Here is the call graph for this function:

◆ setFieldFloatValue()

bool OXMLTreeManager::setFieldFloatValue ( const QString &  field,
float  value 
)

Sets the floating point value stored in the field in the current directory.

Parameters
fieldField name
valueNew floating point value for the field Retuns FALSE if it fails.

Definition at line 307 of file OXMLTreeManager.cpp.

Here is the call graph for this function:

◆ setFieldLongValue()

bool OXMLTreeManager::setFieldLongValue ( const QString &  field,
long  value 
)

Sets the integer value stored in the field in the current directory.

Parameters
fieldField name
valueNew integer value for the field Retuns FALSE if it fails.

Definition at line 298 of file OXMLTreeManager.cpp.

Here is the call graph for this function:

◆ setFieldStringValue()

bool OXMLTreeManager::setFieldStringValue ( const QString &  field,
const QString &  value 
)

Sets the string stored in the field in the current directory.

Parameters
fieldField name
valueNew string to be store in the field Retuns FALSE if it fails.

Definition at line 316 of file OXMLTreeManager.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ m_CurrentDomNode

QDomNode OXMLTreeManager::m_CurrentDomNode
private

Definition at line 225 of file OXMLTreeManager.h.

◆ m_pDomDocument

QDomDocument* OXMLTreeManager::m_pDomDocument
private

Definition at line 224 of file OXMLTreeManager.h.


The documentation for this class was generated from the following files: