![]() |
|
|
Generated: 18 Jul 2008 |
#include <DataListenerSvc/XmlCode.h>
Collaboration diagram for XmlCode:

It is used in conjunction with DataListenerSvc to create the XML log files which can be subsequently later parsed. Indent levels are specified manually by the user who must make sure everything is consistent.
Definition at line 21 of file XmlCode.h.
Public Member Functions | |
| XmlCode () | |
| Standard constructor. | |
| virtual | ~XmlCode () |
| Destructor. | |
| std::string | tagBegin (std::string data, int level, std::string attribute, std::string val) |
| Return an opening XML tag which takes "attribute:value" pair. | |
| std::string | tagBegin (std::string data, int level) |
| return an opening XML tag | |
| std::string | tagEnd (std::string data, int level) |
| Will return a new line if the tag is given any indent, i.e. | |
| std::string | data (std::string data) |
| Return just the data given to the function. | |
| std::string | declaration (std::string vers, std::string cod, std::string stand) |
| XML declaration. | |
Private Attributes | |
| std::string | tag |
| XmlCode::XmlCode | ( | ) | [inline] |
| virtual XmlCode::~XmlCode | ( | ) | [inline, virtual] |
| std::string XmlCode::tagBegin | ( | std::string | data, | |
| int | level, | |||
| std::string | attribute, | |||
| std::string | val | |||
| ) | [inline] |
Return an opening XML tag which takes "attribute:value" pair.
| data | Name of the tag | |
| level | Amount of indenting to print, i.e. what generation of tag | |
| attribute | Attribute to include in tag (if used) | |
| val | Value of the Attribute (if used) with this class. |
Definition at line 39 of file XmlCode.h.
References data().
Referenced by DataListenerSvc::writeXML().
00040 { 00041 std::string indent=""; 00042 00043 for (int i=0; i<level; i++){ 00044 indent = indent + " "; 00045 } 00046 00047 return "\n" + indent + "<" + data + " " + attribute + "=\"" + val + "\">"; // A start tag will start a line 00048 }
| std::string XmlCode::tagBegin | ( | std::string | data, | |
| int | level | |||
| ) | [inline] |
return an opening XML tag
Definition at line 51 of file XmlCode.h.
References data().
00052 { 00053 std::string indent=""; 00054 00055 for (int i=0; i<level; i++){ 00056 indent = indent + " "; 00057 } 00058 00059 return "\n" + indent + "<" + data + ">"; // A start tag will start a line 00060 }
| std::string XmlCode::tagEnd | ( | std::string | data, | |
| int | level | |||
| ) | [inline] |
Will return a new line if the tag is given any indent, i.e.
it is a parent tag
Definition at line 66 of file XmlCode.h.
References data().
Referenced by DataListenerSvc::writeXML().
00067 { 00068 00069 if (level != 0) { 00070 std::string indent=""; 00071 00072 for (int i=0; i<level; i++){ 00073 indent = indent + " "; 00074 } 00075 00076 return "\n" + indent + "</" + data + ">\n"; 00077 } 00078 else { 00079 return "</" + data + ">"; // An end tag will end a line 00080 } 00081 00082 }
| std::string XmlCode::data | ( | std::string | data | ) | [inline] |
Return just the data given to the function.
Definition at line 85 of file XmlCode.h.
Referenced by tagBegin(), tagEnd(), and DataListenerSvc::writeXML().
00086 { 00087 return data; // Data will come after a string so no new line 00088 }
| std::string XmlCode::declaration | ( | std::string | vers, | |
| std::string | cod, | |||
| std::string | stand | |||
| ) | [inline] |
XML declaration.
| vers | XML version number | |
| cod | XML encoding | |
| stand | XML standalone |
Definition at line 99 of file XmlCode.h.
Referenced by DataListenerSvc::writeXML().
00100 { 00101 return "<?xml version=\"" + vers + "\" encoding=\"" + cod + "\" standalone=\"" + stand + "\"?>"; 00102 }
std::string XmlCode::tag [private] |