| The Gaudi Framework v29r0 (ff2e7097)

- 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 43 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 47 of file AttribStringParser.h.

47 : m_it( it ), m_expandVars( expand_vars )
48 {
49 // i_setAttrib();
50 }
Gaudi::Utils::AttribStringParser::Iterator::m_it
boost::sregex_iterator m_it
Wrapped boost::sregex_iterator instance.
Definition: AttribStringParser.h:74
Gaudi::Utils::AttribStringParser::Iterator::m_expandVars
bool m_expandVars
Definition: AttribStringParser.h:75

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

Definition at line 51 of file AttribStringParser.h.

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

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

Definition at line 52 of file AttribStringParser.h.

52 : m_it( std::move( other.m_it ) ), m_expandVars( other.m_expandVars ) {}
Gaudi::Utils::AttribStringParser::Iterator::m_it
boost::sregex_iterator m_it
Wrapped boost::sregex_iterator instance.
Definition: AttribStringParser.h:74
Gaudi::Utils::AttribStringParser::Iterator::m_expandVars
bool m_expandVars
Definition: AttribStringParser.h:75
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 80 of file AttribStringParser.h.

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

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

Definition at line 70 of file AttribStringParser.h.

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

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

Definition at line 64 of file AttribStringParser.h.

65 {
66 i_setAttrib();
67 return m_attrib;
68 }
Gaudi::Utils::AttribStringParser::Iterator::m_attrib
Attrib m_attrib
Cached Attrib instance.
Definition: AttribStringParser.h:77
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:80

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

Definition at line 53 of file AttribStringParser.h.

54 {
55 ++m_it;
56 return *this;
57 }
Gaudi::Utils::AttribStringParser::Iterator::m_it
boost::sregex_iterator m_it
Wrapped boost::sregex_iterator instance.
Definition: AttribStringParser.h:74

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

Definition at line 58 of file AttribStringParser.h.

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

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

Definition at line 69 of file AttribStringParser.h.

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

## Member Data Documentation

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

Cached Attrib instance.

Definition at line 77 of file AttribStringParser.h.

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

Definition at line 75 of file AttribStringParser.h.

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

Wrapped boost::sregex_iterator instance.

Definition at line 74 of file AttribStringParser.h.

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

- GaudiKernel/GaudiKernel/AttribStringParser.h