HepMC event record
Public Types | Public Member Functions | Static Public Member Functions | Data Fields | Static Public Attributes
XMLTag Struct Reference

Detailed Description

The XMLTag struct is used to represent all information within an XML tag. It contains the attributes as a map, any sub-tags as a vector of pointers to other XMLTag objects, and any other information as a single string.

Definition at line 75 of file build/outputs/include/HepMC/LHEF.h.

#include <LHEF.h>

+ Collaboration diagram for XMLTag:

Public Types

typedef std::string::size_type pos_t
 
typedef std::map< std::string, std::string > AttributeMap
 
typedef std::string::size_type pos_t
 
typedef std::map< std::string, std::string > AttributeMap
 

Public Member Functions

 XMLTag ()
 
 ~XMLTag ()
 
bool getattr (std::string n, double &v) const
 
bool getattr (std::string n, bool &v) const
 
bool getattr (std::string n, long &v) const
 
bool getattr (std::string n, int &v) const
 
bool getattr (std::string n, std::string &v) const
 
void print (std::ostream &os) const
 
 XMLTag ()
 
 ~XMLTag ()
 
bool getattr (std::string n, double &v) const
 
bool getattr (std::string n, bool &v) const
 
bool getattr (std::string n, long &v) const
 
bool getattr (std::string n, int &v) const
 
bool getattr (std::string n, std::string &v) const
 
void print (std::ostream &os) const
 

Static Public Member Functions

static std::vector< XMLTag * > findXMLTags (std::string str, std::string *leftover=0)
 
static void deleteAll (std::vector< XMLTag *> &tags)
 
static std::vector< XMLTag * > findXMLTags (std::string str, std::string *leftover=0)
 
static void deleteAll (std::vector< XMLTag *> &tags)
 

Data Fields

std::string name
 
AttributeMap attr
 
std::vector< XMLTag * > tags
 
std::string contents
 

Static Public Attributes

static const pos_t end = std::string::npos
 

Member Typedef Documentation

◆ AttributeMap [1/2]

typedef std::map<std::string,std::string> AttributeMap

Convenient typdef.

Definition at line 85 of file build/outputs/include/HepMC/LHEF.h.

◆ AttributeMap [2/2]

typedef std::map<std::string,std::string> AttributeMap

Convenient typdef.

Definition at line 85 of file include/HepMC/LHEF.h.

◆ pos_t [1/2]

typedef std::string::size_type pos_t

Convenient typdef.

Definition at line 80 of file include/HepMC/LHEF.h.

◆ pos_t [2/2]

typedef std::string::size_type pos_t

Convenient typdef.

Definition at line 80 of file build/outputs/include/HepMC/LHEF.h.

Constructor & Destructor Documentation

◆ XMLTag() [1/2]

XMLTag ( )
inline

Default constructor.

Definition at line 95 of file build/outputs/include/HepMC/LHEF.h.

◆ ~XMLTag() [1/2]

~XMLTag ( )
inline

The destructor also destroys any sub-tags.

Definition at line 100 of file build/outputs/include/HepMC/LHEF.h.

References XMLTag::tags.

◆ XMLTag() [2/2]

XMLTag ( )
inline

Default constructor.

Definition at line 95 of file include/HepMC/LHEF.h.

◆ ~XMLTag() [2/2]

~XMLTag ( )
inline

The destructor also destroys any sub-tags.

Definition at line 100 of file include/HepMC/LHEF.h.

References XMLTag::tags.

Member Function Documentation

◆ deleteAll() [1/2]

static void deleteAll ( std::vector< XMLTag *> &  tags)
inlinestatic

Delete all tags in a vector.

Definition at line 281 of file build/outputs/include/HepMC/LHEF.h.

References XMLTag::tags.

◆ deleteAll() [2/2]

static void deleteAll ( std::vector< XMLTag *> &  tags)
inlinestatic

Delete all tags in a vector.

Definition at line 281 of file include/HepMC/LHEF.h.

References XMLTag::tags.

◆ findXMLTags() [1/2]

static std::vector<XMLTag*> findXMLTags ( std::string  str,
std::string *  leftover = 0 
)
inlinestatic

Scan the given string and return all XML tags found as a vector of pointers to XMLTag objects. Text which does not belong to any tag is stored in tags without name and in the string pointed to by leftover (if not null).

Definition at line 186 of file build/outputs/include/HepMC/LHEF.h.

References XMLTag::end, XMLTag::name, XMLTag::tags, and XMLTag::XMLTag().

◆ findXMLTags() [2/2]

static std::vector<XMLTag*> findXMLTags ( std::string  str,
std::string *  leftover = 0 
)
inlinestatic

Scan the given string and return all XML tags found as a vector of pointers to XMLTag objects. Text which does not belong to any tag is stored in tags without name and in the string pointed to by leftover (if not null).

Definition at line 186 of file include/HepMC/LHEF.h.

References XMLTag::end, XMLTag::findXMLTags(), XMLTag::name, XMLTag::tags, and XMLTag::XMLTag().

◆ getattr() [1/10]

bool getattr ( std::string  n,
double &  v 
) const
inline

Find an attribute named n and set the double variable v to the corresponding value.

Returns
false if no attribute was found.

Definition at line 128 of file include/HepMC/LHEF.h.

References XMLTag::attr.

◆ getattr() [2/10]

bool getattr ( std::string  n,
double &  v 
) const
inline

Find an attribute named n and set the double variable v to the corresponding value.

Returns
false if no attribute was found.

Definition at line 128 of file build/outputs/include/HepMC/LHEF.h.

References XMLTag::attr.

◆ getattr() [3/10]

bool getattr ( std::string  n,
bool &  v 
) const
inline

Find an attribute named n and set the bool variable v to true if the corresponding value is "yes".

Returns
false if no attribute was found.

Definition at line 140 of file build/outputs/include/HepMC/LHEF.h.

References XMLTag::attr.

◆ getattr() [4/10]

bool getattr ( std::string  n,
bool &  v 
) const
inline

Find an attribute named n and set the bool variable v to true if the corresponding value is "yes".

Returns
false if no attribute was found.

Definition at line 140 of file include/HepMC/LHEF.h.

References XMLTag::attr.

◆ getattr() [5/10]

bool getattr ( std::string  n,
long &  v 
) const
inline

Find an attribute named n and set the long variable v to the corresponding value.

Returns
false if no attribute was found.

Definition at line 151 of file include/HepMC/LHEF.h.

References XMLTag::attr.

◆ getattr() [6/10]

bool getattr ( std::string  n,
long &  v 
) const
inline

Find an attribute named n and set the long variable v to the corresponding value.

Returns
false if no attribute was found.

Definition at line 151 of file build/outputs/include/HepMC/LHEF.h.

References XMLTag::attr.

◆ getattr() [7/10]

bool getattr ( std::string  n,
int &  v 
) const
inline

Find an attribute named n and set the long variable v to the corresponding value.

Returns
false if no attribute was found.

Definition at line 162 of file build/outputs/include/HepMC/LHEF.h.

References XMLTag::attr.

◆ getattr() [8/10]

bool getattr ( std::string  n,
int &  v 
) const
inline

Find an attribute named n and set the long variable v to the corresponding value.

Returns
false if no attribute was found.

Definition at line 162 of file include/HepMC/LHEF.h.

References XMLTag::attr.

◆ getattr() [9/10]

bool getattr ( std::string  n,
std::string &  v 
) const
inline

Find an attribute named n and set the string variable v to the corresponding value.

Returns
false if no attribute was found.

Definition at line 173 of file build/outputs/include/HepMC/LHEF.h.

References XMLTag::attr.

◆ getattr() [10/10]

bool getattr ( std::string  n,
std::string &  v 
) const
inline

Find an attribute named n and set the string variable v to the corresponding value.

Returns
false if no attribute was found.

Definition at line 173 of file include/HepMC/LHEF.h.

References XMLTag::attr.

◆ print() [1/2]

void print ( std::ostream &  os) const
inline

Print out this tag to a stream.

Definition at line 290 of file build/outputs/include/HepMC/LHEF.h.

References XMLTag::attr, XMLTag::contents, XMLTag::name, and XMLTag::tags.

◆ print() [2/2]

void print ( std::ostream &  os) const
inline

Print out this tag to a stream.

Definition at line 290 of file include/HepMC/LHEF.h.

References XMLTag::attr, XMLTag::contents, XMLTag::name, XMLTag::print(), and XMLTag::tags.

Field Documentation

◆ attr

The attributes of this tag.

Definition at line 112 of file build/outputs/include/HepMC/LHEF.h.

◆ contents

std::string contents

The contents of this tag.

Definition at line 122 of file build/outputs/include/HepMC/LHEF.h.

◆ end

static const pos_t end = std::string::npos
static

Convenient alias for npos.

Definition at line 90 of file build/outputs/include/HepMC/LHEF.h.

◆ name

std::string name

The name of this tag.

Definition at line 107 of file build/outputs/include/HepMC/LHEF.h.

◆ tags

std::vector< XMLTag * > tags

A vector of sub-tags.

Definition at line 117 of file build/outputs/include/HepMC/LHEF.h.


The documentation for this struct was generated from the following file: