| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- File List
- File Members

# XmlCode.h

Go to the documentation of this file.

    00001 // $Id: XmlCode.h,v 1.1.1.1 2007/01/15 13:56:38 hmd Exp $
    00002 #ifndef DATALISTENERSVC_XMLCODE_H
    00003 #define DATALISTENERSVC_XMLCODE_H 1
    00004 #include <iostream>
    00005
    00006
    00007 // Include files
    00008
    00018 //template <class Type> class XmlStream {
    00019
    00020
    00021 class XmlCode {
    00022 public:
    00023
    00025   XmlCode() {};
    00026
    00028   virtual ~XmlCode() {};
    00029
    00038
    00039   std::string tagBegin(std::string data, int level, std::string attribute, std::string val)
    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   }
    00049
    00051   std::string tagBegin(std::string data, int level)
    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   }
    00061
    00063
    00066   std::string tagEnd(std::string data, int level)
    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   }
    00083
    00085   std::string data(std::string data)
    00086   {
    00087     return data; // Data will come after a string so no new line
    00088   }
    00089
    00090
    00091   // XML declaration
    00099   std::string declaration(std::string vers, std::string cod, std::string stand)
    00100   {
    00101     return "<?xml version=\"" + vers + "\" encoding=\"" + cod + "\" standalone=\"" + stand + "\"?>";
    00102   }
    00103
    00104
    00105
    00106
    00107
    00108 protected:
    00109
    00110 private:
    00111
    00112   std::string tag;
    00113
    00114
    00115 };
    00116
    00117
    00118 #endif // DATALISTENERSVC_XMLCODE_H