#include <ChainString.h>
|
| static std::string | chop (std::string &s1, const std::string &s2) |
|
| static std::string | chomp (std::string &s1, const std::string &s2) |
| static char | toupper (char c) |
| | convert to upper case
|
| static std::string | toupper (const std::string &s) |
| | convert to upper case
|
| static char | tolower (char c) |
| | convert to lower case
|
| static std::string | tolower (const std::string &s) |
| | convert to lower case
|
Definition at line 23 of file ChainString.h.
◆ ChainString() [1/2]
| ChainString::ChainString |
( |
const std::string & | s | ) |
|
Definition at line 16 of file ChainString.cxx.
16 :
17 std::string(s),
20 if (
s.find(
":post")!=std::string::npos )
m_post =
s.substr(
s.find(
":post")+6,
s.size() );
22}
void parse(std::string s)
parse the full specification string
◆ ChainString() [2/2]
Definition at line 25 of file ChainString.cxx.
25 :
26 std::string(s),
33}
std::vector< std::string > m_keys
std::vector< std::string > m_values
◆ chomp()
| std::string ChainString::chomp |
( |
std::string & | s1, |
|
|
const std::string & | s2 ) |
|
inlinestaticprotected |
Definition at line 100 of file ChainString.h.
100 {
101
102 std::string::size_type
pos =
s1.find_first_of(s2);
104 if ( pos == std::string::npos ) return "";
105
106 s3 =
s1.substr(pos+1,
s1.size());
107 s1.erase(pos,
s1.size());
108
110 }
◆ chop()
| std::string ChainString::chop |
( |
std::string & | s1, |
|
|
const std::string & | s2 ) |
|
inlinestatic |
Definition at line 83 of file ChainString.h.
83 {
84 std::string::size_type
pos =
s1.find_first_of(s2);
86 if ( pos == std::string::npos ) {
88 s1.erase(0,
s1.size());
89 }
90 else {
91 s3 =
s1.substr(0, pos);
93 }
95 }
◆ element()
| const std::string & ChainString::element |
( |
| ) |
const |
|
inline |
◆ extra()
| const std::string & ChainString::extra |
( |
| ) |
const |
|
inline |
◆ findkey()
| int ChainString::findkey |
( |
const std::string & | key | ) |
const |
|
inlineprotected |
◆ head()
| const std::string & ChainString::head |
( |
| ) |
const |
|
inline |
◆ keys()
| const std::vector< std::string > & ChainString::keys |
( |
| ) |
const |
|
inline |
◆ operator=()
◆ parse()
| void ChainString::parse |
( |
std::string | s | ) |
|
|
protected |
parse the full specification string
replace the string by a parsed basic string
overwrite with the parsed string
Definition at line 38 of file ChainString.cxx.
38 {
39
40 std::vector<std::string>
fields;
41
42 while ( !
s.empty() )
fields.push_back(
chop( s,
":" ) );
43
44 bool postkeys = false;
45
46 size_t keycount = 0;
47
49
50 for (
size_t i=1 ;
i<
fields.size() ;
i++ ) {
51 std::string dte =
chomp( fields[i],
";" );
52 if ( !postkeys && dte==
"DTE" )
m_passed =
false;
53 if ( fields[i]==
"DTE" )
m_passed =
false;
54 else if ( fields[i]=="post" ) postkeys = true;
55 else {
57 std::string
key =
chop( f,
"=" );
58 if ( f=="" ) {
61 }
63 else keycount++;
66 }
67 }
68
69 std::string
tags[5] = {
"key",
"roi",
"vtx",
"te",
"extra" };
70 bool tagged[5] = { false, false, false, false, false };
71
73
74 for (
size_t i=0 ;
i<keycount &&
i<5 ;
i++ ) {
76 if ( tagged[i] ) std::cerr <<
"tag already allocated : " <<
tags[
i] <<
" with value " << *
values[
i] << std::endl;
78 }
79 else {
80 bool unset = true;
81 for (
int j=0 ;
j<5 ;
j++ ) {
83 if ( tagged[j] ) std::cerr <<
"tag already allocated : " <<
tags[
j] <<
" with value " << *
values[
j] << std::endl;
84 else {
86 unset = false;
88 }
89 }
90 }
91 if ( unset ) std::cerr <<
"no such tag: " <<
m_keys[
i] << std::endl;
92 }
93 }
94
95#if 0
96 std::cout <<
"head: " <<
m_head << std::endl;
97 std::cout <<
"key: " <<
m_tail << std::endl;
98 std::cout <<
"roi: " <<
m_roi << std::endl;
99 std::cout <<
"vtx: " <<
m_vtx << std::endl;
100 std::cout <<
"te: " <<
m_element << std::endl;
101 std::cout <<
"ind: " <<
m_extra << std::endl;
102 std::cout <<
"pass: " <<
m_passed << std::endl;
103#endif
104
106
110
112 *
static_cast<std::string*
>(
this) =
raw;
113
117
119
121
122}
const std::vector< std::string > & values() const
const std::string & raw() const
static char tolower(char c)
convert to lower case
static std::string chop(std::string &s1, const std::string &s2)
static std::string chomp(std::string &s1, const std::string &s2)
std::vector< std::string > tags
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
◆ passed()
| bool ChainString::passed |
( |
| ) |
const |
|
inline |
◆ post()
| const std::string & ChainString::post |
( |
| ) |
const |
|
inline |
◆ postcount()
| size_t ChainString::postcount |
( |
| ) |
const |
|
inline |
◆ postvalue()
| std::string ChainString::postvalue |
( |
const std::string & | key | ) |
const |
|
inline |
same here regarding returning a reference
Definition at line 65 of file ChainString.h.
65 {
67 return "";
68 }
std::string value(const std::string &key) const
can't make this return a reference in case there is no such key - could throw an exception then it wo...
◆ pre()
| std::string ChainString::pre |
( |
| ) |
const |
|
inline |
◆ raw()
| const std::string & ChainString::raw |
( |
| ) |
const |
|
inline |
◆ roi()
| const std::string & ChainString::roi |
( |
| ) |
const |
|
inline |
◆ subs()
| std::string ChainString::subs |
( |
std::string | s | ) |
const |
Definition at line 127 of file ChainString.cxx.
127 {
128
129 std::string
tags[5] = {
"key=",
"roi=",
"vtx=",
"te=",
"extra=" };
130
132
135
137
139}
◆ tail()
| const std::string & ChainString::tail |
( |
| ) |
const |
|
inline |
◆ tolower() [1/2]
| char ChainString::tolower |
( |
char | c | ) |
|
|
inlinestaticprotected |
convert to lower case
Definition at line 125 of file ChainString.h.
125{ return ( c>='A' && c<='Z' ? c-'A'+'a' : c ); }
◆ tolower() [2/2]
| std::string ChainString::tolower |
( |
const std::string & | s | ) |
|
|
inlinestaticprotected |
convert to lower case
Definition at line 128 of file ChainString.h.
128 {
129 const char*
c =
s.c_str();
132 while (( *tp++ =
tolower(*c++) ));
134 }
◆ toupper() [1/2]
| char ChainString::toupper |
( |
char | c | ) |
|
|
inlinestaticprotected |
convert to upper case
Definition at line 113 of file ChainString.h.
113{ return ( c>='a' && c<='z' ? c+'A'-'a' : c ); }
◆ toupper() [2/2]
| std::string ChainString::toupper |
( |
const std::string & | s | ) |
|
|
inlinestaticprotected |
convert to upper case
Definition at line 116 of file ChainString.h.
116 {
117 const char*
c =
s.c_str();
120 while (( *tp++ =
toupper(*c++) ));
122 }
static char toupper(char c)
convert to upper case
◆ value() [1/2]
| std::string ChainString::value |
( |
const std::string & | key | ) |
const |
|
inline |
can't make this return a reference in case there is no such key - could throw an exception then it would work, but that is far too excessive
Definition at line 47 of file ChainString.h.
47 {
50 return "";
51 }
int findkey(const std::string &key) const
◆ value() [2/2]
| std::string ChainString::value |
( |
size_t | i | ) |
const |
|
inline |
as above - should really return a const std::string& but we don't want to have to throw an exception for an out of range, or force clients to check the vector size unless they really need to
Definition at line 57 of file ChainString.h.
◆ values()
| const std::vector< std::string > & ChainString::values |
( |
| ) |
const |
|
inline |
◆ vsize()
| size_t ChainString::vsize |
( |
| ) |
const |
|
inline |
◆ vtx()
| const std::string & ChainString::vtx |
( |
| ) |
const |
|
inline |
◆ m_element
| std::string ChainString::m_element |
|
private |
◆ m_extra
| std::string ChainString::m_extra |
|
private |
◆ m_head
| std::string ChainString::m_head |
|
private |
◆ m_keys
| std::vector<std::string> ChainString::m_keys |
|
private |
◆ m_passed
| bool ChainString::m_passed |
|
private |
◆ m_post
| std::string ChainString::m_post |
|
private |
◆ m_postcount
| size_t ChainString::m_postcount |
|
private |
◆ m_raw
| std::string ChainString::m_raw |
|
private |
◆ m_roi
| std::string ChainString::m_roi |
|
private |
◆ m_tail
| std::string ChainString::m_tail |
|
private |
◆ m_values
| std::vector<std::string> ChainString::m_values |
|
private |
◆ m_vtx
| std::string ChainString::m_vtx |
|
private |
The documentation for this class was generated from the following files: