14#ifndef TrigInDetAnalysisExample_ChainString_H
15#define TrigInDetAnalysisExample_ChainString_H
35 const std::string&
roi()
const {
return m_roi; }
36 const std::string&
vtx()
const {
return m_vtx; }
42 const std::string&
raw()
const {
return m_raw; }
47 std::string
value(
const std::string& key )
const {
54 std::string
postvalue(
const std::string& key )
const {
60 const std::vector<std::string>&
keys()
const {
return m_keys; }
62 std::string
pre()
const {
return m_raw.substr( 0,
m_raw.find(
":post") ); }
67 std::string
subs( std::string s )
const;
72 static std::string
chop(std::string& s1,
const std::string& s2) {
73 std::string::size_type pos = s1.find_first_of(s2);
75 if ( pos == std::string::npos ) {
77 s1.erase(0, s1.size());
80 s3 = s1.substr(0, pos);
89 static std::string
chomp(std::string& s1,
const std::string& s2) {
91 std::string::size_type pos = s1.find_first_of(s2);
93 if ( pos == std::string::npos )
return "";
95 s3 = s1.substr(pos+1, s1.size());
96 s1.erase(pos, s1.size());
102 static char toupper(
char c ) {
return ( c>=
'a' && c<=
'z' ? c+
'A'-
'a' : c ); }
105 static std::string
toupper(
const std::string& s ) {
106 const char* c = s.c_str();
109 while (( *tp++ =
toupper(*c++) ));
114 static char tolower(
char c ) {
return ( c>=
'A' && c<=
'Z' ? c-
'A'+
'a' : c ); }
117 static std::string
tolower(
const std::string& s ) {
118 const char* c = s.c_str();
121 while (( *tp++ =
tolower(*c++) ));
129 void parse( std::string s );
132 for (
int i=
m_keys.size() ; i-- ; )
if ( key==
m_keys[i] )
return i;
bool operator==(const ChainString &cs, const ChainString &s)
const std::string & extra() const
static std::string toupper(const std::string &s)
convert to upper case
const std::vector< std::string > & keys() const
const std::string & roi() const
std::string subs(std::string s) const
ChainString(const std::string &s)
const std::string & post() const
const std::vector< std::string > & values() const
void parse(std::string s)
parse the full specification string
const std::string & raw() const
std::vector< std::string > m_keys
const std::string & head() const
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...
static char tolower(char c)
convert to lower case
ChainString & operator=(const ChainString &)=default
const std::string & tail() const
std::string postvalue(const std::string &key) const
same here regarding returning a reference
int findkey(const std::string &key) const
static std::string chop(std::string &s1, const std::string &s2)
static std::string tolower(const std::string &s)
convert to lower case
static std::string chomp(std::string &s1, const std::string &s2)
std::vector< std::string > m_values
static char toupper(char c)
convert to upper case
const std::string & vtx() const
const std::string & element() const