| The Gaudi Framework v28r2-patches (bc4ad17a)

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

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

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

Iterator to loop over the tag/value pairs in the attribute string. More...

`#include <GaudiKernel/AttribStringParser.h>`

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

## Public Member Functions
| Iterator ()=default
| Iterator (const boost::sregex_iterator &it, bool expand_vars)
| Iterator (const Iterator &other)
| Iterator (Iterator &&other)
Iterator | operator++ (int)
Iterator | operator++ ()
reference | operator* ()
bool | operator== (const Iterator &other)
bool | operator!= (const Iterator &other)

## Private Member Functions
void | i_setAttrib ()
| Helper method used to update the cached Attrib instance when dereferencing the iterator. More...

## Private Attributes
boost::sregex_iterator | m_it
| Wrapped boost::sregex_iterator instance. More...
bool | m_expandVars = false
Attrib | m_attrib
| Cached Attrib instance. More...

## Detailed Description

Iterator to loop over the tag/value pairs in the attribute string.

Definition at line 40 of file AttribStringParser.h.

## Constructor & Destructor Documentation

Gaudi::Utils::AttribStringParser::Iterator::Iterator | ( |  | ) |
| default

Gaudi::Utils::AttribStringParser::Iterator::Iterator | ( | const boost::sregex_iterator & | it,
|  | bool | expand_vars
| ) |  |
| inline

Definition at line 43 of file AttribStringParser.h.

43 :
44 m_it(it),
45 m_expandVars(expand_vars)
46 {
47 //i_setAttrib();
48 }
Gaudi::Utils::AttribStringParser::Iterator::m_it
boost::sregex_iterator m_it
Wrapped boost::sregex_iterator instance.
Definition: AttribStringParser.h:78
Gaudi::Utils::AttribStringParser::Iterator::m_expandVars
bool m_expandVars
Definition: AttribStringParser.h:79

Gaudi::Utils::AttribStringParser::Iterator::Iterator | ( | const Iterator & | other | ) |
| inline

Definition at line 49 of file AttribStringParser.h.

49 : Iterator(other.m_it, other.m_expandVars)
50 {
51 }
Gaudi::Utils::AttribStringParser::Iterator::Iterator
Iterator()=default

Gaudi::Utils::AttribStringParser::Iterator::Iterator | ( | Iterator && | other | ) |
| inline

Definition at line 52 of file AttribStringParser.h.

52 :
53 m_it(std::move(other.m_it)),
54 m_expandVars(other.m_expandVars)
55 {
56 }
Gaudi::Utils::AttribStringParser::Iterator::m_it
boost::sregex_iterator m_it
Wrapped boost::sregex_iterator instance.
Definition: AttribStringParser.h:78
Gaudi::Utils::AttribStringParser::Iterator::m_expandVars
bool m_expandVars
Definition: AttribStringParser.h:79
std::move
T move(T...args)

## Member Function Documentation

void Gaudi::Utils::AttribStringParser::Iterator::i_setAttrib | ( |  | ) |
| inline private

Helper method used to update the cached Attrib instance when dereferencing the iterator.

Definition at line 84 of file AttribStringParser.h.

84 {
85 static const boost::sregex_iterator endmark;
86 if (m_it != endmark) {
87 // if we have a match, we cache the values
88 m_attrib = Attrib{(*m_it)[1], (*m_it)[2]};
89 if (m_expandVars && m_attrib.value.find("${") != std::string::npos) {
90 static const boost::regex varexp{"\\$\\{([^}]+)\\}"};
91 auto i = 1;
92 while (i) {
93 i = 0;
94 m_attrib.value = boost::regex_replace(m_attrib.value,
95 varexp, [&i] (const boost::smatch& m) -> std::string {
96 const std::string name = m[1];
97 const char* cname = name.c_str();
98 if (System::isEnvSet(cname)) {
99 ++i;
100 return System::getEnv(cname);
101 }
102 return m[0]; // do not expand unknown vars
103 },
104 boost::match_default | boost::format_all);
105 }
106 }
107 } else {
108 // otherwise we clean the cache
109 m_attrib = Attrib();
110 }
111 }
std::string
STL class.
Gaudi::Units::m
constexpr double m
Definition: SystemOfUnits.h:93
Gaudi::Utils::AttribStringParser::Iterator::m_it
boost::sregex_iterator m_it
Wrapped boost::sregex_iterator instance.
Definition: AttribStringParser.h:78
Gaudi::Utils::AttribStringParser::Iterator::m_expandVars
bool m_expandVars
Definition: AttribStringParser.h:79
Gaudi::Utils::AttribStringParser::Attrib::value
std::string value
Definition: AttribStringParser.h:35
std::string::find
T find(T...args)
Gaudi::Utils::AttribStringParser::Iterator::m_attrib
Attrib m_attrib
Cached Attrib instance.
Definition: AttribStringParser.h:81

bool Gaudi::Utils::AttribStringParser::Iterator::operator!= | ( | const Iterator & | other | ) |
| inline

Definition at line 73 of file AttribStringParser.h.

73 {
74 return m_it != other.m_it;
75 }
Gaudi::Utils::AttribStringParser::Iterator::m_it
boost::sregex_iterator m_it
Wrapped boost::sregex_iterator instance.
Definition: AttribStringParser.h:78

reference Gaudi::Utils::AttribStringParser::Iterator::operator* | ( |  | ) |
| inline

Definition at line 66 of file AttribStringParser.h.

66 {
67 i_setAttrib();
68 return m_attrib;
69 }
Gaudi::Utils::AttribStringParser::Iterator::m_attrib
Attrib m_attrib
Cached Attrib instance.
Definition: AttribStringParser.h:81
Gaudi::Utils::AttribStringParser::Iterator::i_setAttrib
void i_setAttrib()
Helper method used to update the cached Attrib instance when dereferencing the iterator.
Definition: AttribStringParser.h:84

Iterator Gaudi::Utils::AttribStringParser::Iterator::operator++ | ( | int |  | ) |
| inline

Definition at line 57 of file AttribStringParser.h.

57 {
58 ++m_it;
59 return *this;
60 }
Gaudi::Utils::AttribStringParser::Iterator::m_it
boost::sregex_iterator m_it
Wrapped boost::sregex_iterator instance.
Definition: AttribStringParser.h:78

Iterator Gaudi::Utils::AttribStringParser::Iterator::operator++ | ( |  | ) |
| inline

Definition at line 61 of file AttribStringParser.h.

61 {
62 auto old = *this;
63 ++m_it;
64 return old;
65 }
Gaudi::Utils::AttribStringParser::Iterator::m_it
boost::sregex_iterator m_it
Wrapped boost::sregex_iterator instance.
Definition: AttribStringParser.h:78

bool Gaudi::Utils::AttribStringParser::Iterator::operator== | ( | const Iterator & | other | ) |
| inline

Definition at line 70 of file AttribStringParser.h.

70 {
71 return m_it == other.m_it;
72 }
Gaudi::Utils::AttribStringParser::Iterator::m_it
boost::sregex_iterator m_it
Wrapped boost::sregex_iterator instance.
Definition: AttribStringParser.h:78

## Member Data Documentation

Attrib Gaudi::Utils::AttribStringParser::Iterator::m_attrib
| private

Cached Attrib instance.

Definition at line 81 of file AttribStringParser.h.

bool Gaudi::Utils::AttribStringParser::Iterator::m_expandVars = false
| private

Definition at line 79 of file AttribStringParser.h.

boost::sregex_iterator Gaudi::Utils::AttribStringParser::Iterator::m_it
| private

Wrapped boost::sregex_iterator instance.

Definition at line 78 of file AttribStringParser.h.

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

- GaudiKernel/GaudiKernel/AttribStringParser.h