| The Gaudi Framework v28r2p1 (f1a77ff4)

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Gaudi::Utils::AttribStringParser Class Reference

Parse attribute strings allowing iteration over the various attributes. More...

`#include <GaudiKernel/AttribStringParser.h>`

Collaboration diagram for Gaudi::Utils::AttribStringParser:
[legend]

## Classes
struct | Attrib
| Simple class to wrap tag/value pairs. More...
class | Iterator
| Iterator to loop over the tag/value pairs in the attribute string. More...

## Public Member Functions
| AttribStringParser (std::string data, bool expand_vars=true)
| Initialize the parsing of an attribute string. More...

## Private Member Functions
boost::sregex_iterator | parse () const

## Private Attributes
std::string | m_data
bool | m_expandVars

## Friends
Iterator | begin (const AttribStringParser &)

## Detailed Description

Parse attribute strings allowing iteration over the various attributes.

Example of usage:

using Parser = Gaudi::Utils::AttribStringParser;
std::string input{"key1='value1' key2='value2'"};
for(auto attrib: Parser(input)) {
std::cout << attrib.tag << " -> " << attrib.value << std::endl;
}

Definition at line 30 of file AttribStringParser.h.

## Constructor & Destructor Documentation

Gaudi::Utils::AttribStringParser::AttribStringParser | ( | std::string | data,
|  | bool | expand_vars = `true`
| ) |  |
| inline

Initialize the parsing of an attribute string.

Parameters

  data | attribute string
  expand_vars | if true (default) expand environment variables in values

Definition at line 119 of file AttribStringParser.h.

119 :
120 m_data(data),
121 m_expandVars(expand_vars) {
122 }
Gaudi::Utils::AttribStringParser::m_expandVars
bool m_expandVars
Definition: AttribStringParser.h:126
Gaudi::Utils::AttribStringParser::m_data
std::string m_data
Definition: AttribStringParser.h:125

## Member Function Documentation

boost::sregex_iterator Gaudi::Utils::AttribStringParser::parse | ( |  | ) | const
| inline private

Definition at line 128 of file AttribStringParser.h.

128 {
129 static const boost::regex exp{"[[:space:]]*([^[:space:]]+)[[:space:]]*=[[:space:]]*'(.*?)'"};
130 return boost::sregex_iterator(begin(m_data), end(m_data), exp);
131 }
Gaudi::Utils::end
AttribStringParser::Iterator end(const AttribStringParser &)
Definition: AttribStringParser.h:137
std::exp
T exp(T...args)
Gaudi::Utils::AttribStringParser::begin
friend Iterator begin(const AttribStringParser &)
Definition: AttribStringParser.h:134
Gaudi::Utils::AttribStringParser::m_data
std::string m_data
Definition: AttribStringParser.h:125

## Friends And Related Function Documentation

Iterator begin | ( | const AttribStringParser & | parser | ) |
| friend

Definition at line 134 of file AttribStringParser.h.

134 {
135 return AttribStringParser::Iterator(parser.parse(), parser.m_expandVars);
136 }
gaudirun.parser
parser
Definition: gaudirun.py:122
Iterator
boost::spirit::classic::position_iterator2< ForwardIterator > Iterator
Definition: Iterator.h:18

## Member Data Documentation

std::string Gaudi::Utils::AttribStringParser::m_data
| private

Definition at line 125 of file AttribStringParser.h.

bool Gaudi::Utils::AttribStringParser::m_expandVars
| private

Definition at line 126 of file AttribStringParser.h.

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

- GaudiKernel/GaudiKernel/AttribStringParser.h