| The Gaudi Framework v32r1 (f65d50dc)

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

## ◆ Iterator() [1/4]

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

## ◆ Iterator() [2/4]

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

Definition at line 43 of file AttribStringParser.h.

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

## ◆ Iterator() [3/4]

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

Definition at line 46 of file AttribStringParser.h.

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

## ◆ Iterator() [4/4]

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

Definition at line 47 of file AttribStringParser.h.

47 : 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:66
Gaudi::Utils::AttribStringParser::Iterator::m_expandVars
bool m_expandVars
Definition: AttribStringParser.h:67
std::move
T move(T... args)

## Member Function Documentation

## ◆ i_setAttrib()

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

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

## ◆ operator *()

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

Definition at line 57 of file AttribStringParser.h.

57 {
58 i_setAttrib();
59 return m_attrib;
60 }
Gaudi::Utils::AttribStringParser::Iterator::m_attrib
Attrib m_attrib
Cached Attrib instance.
Definition: AttribStringParser.h:69
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:72

## ◆ operator!=()

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

Definition at line 62 of file AttribStringParser.h.

62 { 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:66

## ◆ operator++() [1/2]

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

Definition at line 48 of file AttribStringParser.h.

48 {
49 ++m_it;
50 return *this;
51 }
Gaudi::Utils::AttribStringParser::Iterator::m_it
boost::sregex_iterator m_it
Wrapped boost::sregex_iterator instance.
Definition: AttribStringParser.h:66

## ◆ operator++() [2/2]

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

Definition at line 52 of file AttribStringParser.h.

52 {
53 auto old = *this;
54 ++m_it;
55 return old;
56 }
Gaudi::Utils::AttribStringParser::Iterator::m_it
boost::sregex_iterator m_it
Wrapped boost::sregex_iterator instance.
Definition: AttribStringParser.h:66

## ◆ operator==()

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

Definition at line 61 of file AttribStringParser.h.

61 { 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:66

## Member Data Documentation

## ◆ m_attrib

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

Cached Attrib instance.

Definition at line 69 of file AttribStringParser.h.

## ◆ m_expandVars

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

Definition at line 67 of file AttribStringParser.h.

## ◆ m_it

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

Wrapped boost::sregex_iterator instance.

Definition at line 66 of file AttribStringParser.h.

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

- GaudiKernel/GaudiKernel/AttribStringParser.h