Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
jlo::XMLTag Class Reference

#include <ServiceLocatedObject.h>

List of all members.

Public Member Functions

int AddChild (XMLTag *child, int position=-1)
void AddProperty (const std::string &name, const std::string &value)
void AddProperty (const std::string &name, const unsigned long &value)
void AddProperty (const std::string &name, const int &value)
void AddProperty (const std::string &name, const double &value)
XMLTagClone () const
unsigned int CountChildren () const
unsigned long date ()
double GetCDataDouble () const
int GetCDataInt () const
std::string GetCDataST () const
XMLTagGetChild (const unsigned int &position)
XMLTagGetChild (const std::string &name)
XMLTagGetChild (const std::string &name, int innerindex)
std::string & GetName ()
std::string GetProperty (const std::string &name)
double GetPropertyDouble (const std::string &name)
int GetPropertyInt (const std::string &name)
void RemoveChild (const unsigned int &position)
void RemoveChild (const std::string &name)
void ReplaceChild (XMLTag *child, int position)
void SetCData (const int &value)
void SetCData (const double &value)
void SetCData (const std::string &value)
virtual void Write (xmlTextWriter *pWriter) const
void WriteToFile (const std::string &stFile, XMLTag **fileReference=NULL) const
char * WriteToString () const
 XMLTag (std::string Name)
virtual ~XMLTag ()

Static Public Member Functions

template<typename T >
static T Load (XMLTag *tag, T *t)
template<typename T >
static std::vector< T > Load (XMLTag *tag, std::vector< T > *)
template<typename T1 , typename T2 >
static std::pair< T1, T2 > Load (XMLTag *tag, std::pair< T1, T2 > *)
static int Load (XMLTag *tag, int *)
static double Load (XMLTag *tag, double *)
static std::string Load (XMLTag *tag, std::string *)
static Matrix Load (XMLTag *tag, Matrix *)
static unsigned int OldTag ()
static XMLTagRead (xmlTextReader *pReader)
static XMLTagReadFromFile (const std::string &stFile)
template<typename T >
static XMLTagTag (std::vector< T > vector, std::string name="")
template<typename T1 , typename T2 >
static XMLTagTag (std::pair< T1, T2 > p, std::string name="")
static XMLTagTag (int n, std::string name="")
static XMLTagTag (double d, std::string name="")
static XMLTagTag (std::string value, std::string name="")
static XMLTagTag (const Matrix &alg, std::string name="")

Private Member Functions

void Touch ()

Private Attributes

std::string m_cData
std::vector< XMLTag * > m_children
unsigned long m_lastChanged
std::string m_name
std::map< std::string,
std::string > 
m_properties

Detailed Description

Definition at line 74 of file ServiceLocatedObject.h.


Constructor & Destructor Documentation

XMLTag::XMLTag ( std::string  Name)

Constructor, sets the tag name

Definition at line 56 of file ServiceInterface.cpp.

XMLTag::~XMLTag ( ) [virtual]

Empty Destructor

Definition at line 122 of file ServiceInterface.cpp.


Member Function Documentation

int XMLTag::AddChild ( XMLTag child,
int  position = -1 
)

AddChild: adds a child node to a tag

Adds a child node to a tag, the position where to put it can be influenced if the position is larger or smaller than the possible range the element will be put at the end of the list.

Parameters:
childpointer to an existing tag, a null child will not be appended
positionposition where to put the cild in the child list
finalposition that was selected, or -1
Remarks:
child = NULL will not be appended and -1 will be returned

Definition at line 366 of file ServiceInterface.cpp.

void XMLTag::AddProperty ( const std::string &  name,
const std::string &  value 
)

AddProperty: adds a property as an attribute to the current tag

adds a property as an attribute to the current tag

Parameters:
namename of the property, works as a key
valuevalue of the property

Definition at line 277 of file ServiceInterface.cpp.

void XMLTag::AddProperty ( const std::string &  name,
const unsigned long &  value 
)

Definition at line 284 of file ServiceInterface.cpp.

void XMLTag::AddProperty ( const std::string &  name,
const int &  value 
)

Definition at line 293 of file ServiceInterface.cpp.

void XMLTag::AddProperty ( const std::string &  name,
const double &  value 
)

Definition at line 302 of file ServiceInterface.cpp.

XMLTag * XMLTag::Clone ( ) const

Clone: clones the current tag and returns it

clone includes recursive copying of all children

Definition at line 219 of file ServiceInterface.cpp.

unsigned int XMLTag::CountChildren ( ) const

CountChildren: counts the childdren-tags of the current tag

Counts the children

Parameters:
numberof children

Definition at line 395 of file ServiceInterface.cpp.

unsigned long XMLTag::date ( )

Definition at line 473 of file ServiceInterface.cpp.

double XMLTag::GetCDataDouble ( ) const

Definition at line 322 of file ServiceInterface.cpp.

int XMLTag::GetCDataInt ( ) const

GetCData*: returns the current content

returns the current content

Parameters:
thecontent or empty("", 0, 0.0)

Definition at line 318 of file ServiceInterface.cpp.

std::string XMLTag::GetCDataST ( ) const

Definition at line 326 of file ServiceInterface.cpp.

XMLTag * XMLTag::GetChild ( const unsigned int &  position)

GetChild: returns a child tag

returns a child tag

Parameters:
position/namedescriptor for the child
achild tag

Definition at line 424 of file ServiceInterface.cpp.

XMLTag * XMLTag::GetChild ( const std::string &  name)

Definition at line 440 of file ServiceInterface.cpp.

XMLTag * XMLTag::GetChild ( const std::string &  name,
int  innerindex 
)

Definition at line 455 of file ServiceInterface.cpp.

std::string& jlo::XMLTag::GetName ( ) [inline]

GetName: returns the name of a tag

The name of the tag (<name></name>)

Definition at line 476 of file ServiceLocatedObject.h.

std::string XMLTag::GetProperty ( const std::string &  name)

GetProperty*: returns the value of a property

Returns the current value of a property

Parameters:
namename of the property
thevalue or empty ("", 0, 0.0)

Definition at line 345 of file ServiceInterface.cpp.

double XMLTag::GetPropertyDouble ( const std::string &  name)

Definition at line 352 of file ServiceInterface.cpp.

int XMLTag::GetPropertyInt ( const std::string &  name)

Definition at line 359 of file ServiceInterface.cpp.

template<typename T >
static T jlo::XMLTag::Load ( XMLTag tag,
T *  t 
) [inline, static]

Load: Load a Type T from a XMLTag

Supported Types are for example: vector, pair, double, int, string, Matrix

Parameters:
tagthe tag that was read from a file or created with a Tag function
T*a pointer that specifies the wished class (necessary for resolving the template)
Exceptions:
char*with an error message in case of failure

Definition at line 249 of file ServiceLocatedObject.h.

template<typename T >
static std::vector<T> jlo::XMLTag::Load ( XMLTag tag,
std::vector< T > *   
) [inline, static]

Definition at line 255 of file ServiceLocatedObject.h.

template<typename T1 , typename T2 >
static std::pair<T1, T2> jlo::XMLTag::Load ( XMLTag tag,
std::pair< T1, T2 > *   
) [inline, static]

Definition at line 274 of file ServiceLocatedObject.h.

static int jlo::XMLTag::Load ( XMLTag tag,
int *   
) [inline, static]

Definition at line 286 of file ServiceLocatedObject.h.

static double jlo::XMLTag::Load ( XMLTag tag,
double *   
) [inline, static]

Definition at line 293 of file ServiceLocatedObject.h.

static std::string jlo::XMLTag::Load ( XMLTag tag,
std::string *   
) [inline, static]

Definition at line 300 of file ServiceLocatedObject.h.

Matrix XMLTag::Load ( XMLTag tag,
Matrix  
) [static]

Definition at line 101 of file ServiceInterface.cpp.

static unsigned int jlo::XMLTag::OldTag ( ) [inline, static]

Definition at line 479 of file ServiceLocatedObject.h.

XMLTag * XMLTag::Read ( xmlTextReader pReader) [static]

Read: Reads an XMLTag from a readeer

Supporting function for ReadFromFile

Parameters:
pReaderpointer to an libxml2 xmlTextReader

Definition at line 233 of file ServiceInterface.cpp.

XMLTag * XMLTag::ReadFromFile ( const std::string &  stFile) [static]

ReadFromFile: Creates a new XMLTag from a file

As constructor this would have had the same function signature as the std. constructor so its a static function

Parameters:
stFileabsolut filename
Remarks:
can return NULL if the file does not contain a tag

Definition at line 200 of file ServiceInterface.cpp.

void XMLTag::RemoveChild ( const unsigned int &  position)

RemoveChild: removes an XMLTag* from the list

Adds a child node to a tag, the position where to put it can be influenced if the position is larger or smaller than the possible range the element will be put at the end of the list.

Parameters:
positionposition where to erase a cild
Remarks:
the tag will not be deleted!

Definition at line 400 of file ServiceInterface.cpp.

void XMLTag::RemoveChild ( const std::string &  name)

Definition at line 409 of file ServiceInterface.cpp.

void XMLTag::ReplaceChild ( XMLTag child,
int  position 
)

Definition at line 380 of file ServiceInterface.cpp.

void XMLTag::SetCData ( const int &  value)

SetCData: sets the current content of the tag

sets the current content of a tag

Parameters:
valuecontent of the tag

Definition at line 331 of file ServiceInterface.cpp.

void XMLTag::SetCData ( const double &  value)

Definition at line 310 of file ServiceInterface.cpp.

void XMLTag::SetCData ( const std::string &  value)

Definition at line 339 of file ServiceInterface.cpp.

template<typename T >
static XMLTag* jlo::XMLTag::Tag ( std::vector< T >  vector,
std::string  name = "" 
) [inline, static]

Tag: creates XMLTags from standard types, like vector pair, int, double, Elem

Parameters:
Tcontains the element that should be saved in the tag
namedefines the name of the node, there are standard names for every implemented tag
Remarks:
pairs and vectors of any supported Type T are allowed, too

Definition at line 202 of file ServiceLocatedObject.h.

template<typename T1 , typename T2 >
static XMLTag* jlo::XMLTag::Tag ( std::pair< T1, T2 >  p,
std::string  name = "" 
) [inline, static]

Definition at line 219 of file ServiceLocatedObject.h.

XMLTag * XMLTag::Tag ( int  n,
std::string  name = "" 
) [static]

Definition at line 62 of file ServiceInterface.cpp.

XMLTag * XMLTag::Tag ( double  d,
std::string  name = "" 
) [static]

Definition at line 69 of file ServiceInterface.cpp.

XMLTag * XMLTag::Tag ( std::string  value,
std::string  name = "" 
) [static]

Definition at line 76 of file ServiceInterface.cpp.

XMLTag * XMLTag::Tag ( const Matrix alg,
std::string  name = "" 
) [static]

Definition at line 84 of file ServiceInterface.cpp.

void XMLTag::Touch ( ) [private]

finction to reset the timestamp

Definition at line 478 of file ServiceInterface.cpp.

void XMLTag::Write ( xmlTextWriter pWriter) const [virtual]

Write: helping function for WriteToFile

Writes an XMLTag to an File,

Parameters:
pWriterpointer to the xmlWriter

Definition at line 180 of file ServiceInterface.cpp.

void XMLTag::WriteToFile ( const std::string &  stFile,
XMLTag **  fileReference = NULL 
) const

Methods WriteToFile: Writes an XMLTag to an File

Writes an XMLTag to an File, can return a XMLTag* that refers the file. Such a file reference will be resolved when it is a child of another node and GetChild is called

Parameters:
stFileabsolut filename

fileReference a pointer that receives the pointer to the new file reference tag

Parameters:
errorcode
Remarks:
file name will not be checked

Definition at line 138 of file ServiceInterface.cpp.

char * XMLTag::WriteToString ( ) const

SetCData: sets the current content of the tag

sets the current content of a tag

Parameters:
valuecontent of the tag

Definition at line 161 of file ServiceInterface.cpp.


Member Data Documentation

std::string jlo::XMLTag::m_cData [private]

Definition at line 497 of file ServiceLocatedObject.h.

std::vector<XMLTag*> jlo::XMLTag::m_children [private]

Definition at line 496 of file ServiceLocatedObject.h.

unsigned long jlo::XMLTag::m_lastChanged [private]

Definition at line 495 of file ServiceLocatedObject.h.

std::string jlo::XMLTag::m_name [private]

Definition at line 498 of file ServiceLocatedObject.h.

std::map<std::string, std::string> jlo::XMLTag::m_properties [private]

Definition at line 499 of file ServiceLocatedObject.h.


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


lo
Author(s): U. Klank
autogenerated on Mon Oct 6 2014 10:44:16