Gaudi Framework, version v22r1

Home   Generated: Mon Feb 28 2011
Public Member Functions | Private Attributes

XmlCode Class Reference

XmlCode contains methods to write out XML tags. More...

#include <DataListenerSvc/XmlCode.h>

Collaboration diagram for XmlCode:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 XmlCode ()
 Standard constructor.
virtual ~XmlCode ()
 Destructor.
std::string tagBegin (std::string data, int level, std::string attribute, std::string val)
 returns an opening XML tag
std::string tagBegin (std::string data, int level)
 return an opening XML tag
std::string tagEnd (std::string data, int level)
 return a closing XML tag
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

Detailed Description

XmlCode contains methods to write out XML tags.

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.

Author:
Ben King
Date:
2006-07-06

Definition at line 21 of file XmlCode.h.


Constructor & Destructor Documentation

XmlCode::XmlCode (  ) [inline]

Standard constructor.

Definition at line 25 of file XmlCode.h.

{};
virtual XmlCode::~XmlCode (  ) [inline, virtual]

Destructor.

Definition at line 28 of file XmlCode.h.

{};

Member Function Documentation

std::string XmlCode::data ( std::string  data ) [inline]

Return just the data given to the function.

Definition at line 85 of file XmlCode.h.

  {
    return data; // Data will come after a string so no new line
  }
std::string XmlCode::declaration ( std::string  vers,
std::string  cod,
std::string  stand 
) [inline]

XML declaration.

Parameters:
versXML version number
codXML encoding
standXML standalone

Definition at line 99 of file XmlCode.h.

  {
    return "<?xml version=\"" + vers + "\" encoding=\"" + cod + "\" standalone=\"" + stand + "\"?>";
  }
std::string XmlCode::tagBegin ( std::string  data,
int  level 
) [inline]

return an opening XML tag

Definition at line 51 of file XmlCode.h.

  {
    std::string indent="";
    
    for (int i=0; i<level; i++){
      indent = indent + "  ";
    }
    
    return "\n" + indent + "<" + data + ">"; // A start tag will start a line
  }
std::string XmlCode::tagBegin ( std::string  data,
int  level,
std::string  attribute,
std::string  val 
) [inline]

returns an opening XML tag

Parameters:
dataName of the tag
levelAmount of indenting to print, i.e. what generation of tag
attributeAttribute to include in tag (if used)
valValue of the Attribute (if used) with this class. Return an opening XML tag which takes "attribute:value" pair

Definition at line 39 of file XmlCode.h.

  {
    std::string indent="";
    
    for (int i=0; i<level; i++){
      indent = indent + "  ";
    }
    
    return "\n" + indent + "<" + data + " " + attribute + "=\"" + val + "\">"; // A start tag will start a line
  }
std::string XmlCode::tagEnd ( std::string  data,
int  level 
) [inline]

return a closing XML tag

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.

  {

    if (level != 0) {
      std::string indent="";
    
      for (int i=0; i<level; i++){
        indent = indent + "  ";
      }

      return "\n" + indent + "</" + data + ">\n";
    }
    else {
      return "</" + data + ">"; // An end tag will end a line
    }

  }

Member Data Documentation

Definition at line 112 of file XmlCode.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Mon Feb 28 2011 18:28:29 for Gaudi Framework, version v22r1 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004