1 #ifndef GAUDIKERNEL_STRINGKEY_H
2 #define GAUDIKERNEL_STRINGKEY_H 1
40 StringKey (
const std::string& key =
"" ) ;
45 const std::string&
str()
const {
return m_str ; }
47 operator const std::string&()
const {
return str() ; }
49 bool empty ()
const {
return m_str.empty() ; }
63 bool operator == (
const std::string& o )
const {
return m_str == o ; }
70 bool operator!=(
const std::string& o )
const {
return !(*
this==o) ; }
117 std::string __str__ ()
const ;
119 std::string __repr__ ()
const ;
121 bool __eq__ (
const StringKey& right )
const ;
123 bool __eq__ (
const std::string& right )
const ;
125 bool __neq__ (
const StringKey& right )
const ;
127 bool __neq__ (
const std::string& right )
const ;
147 template <
unsigned int N>
148 inline bool operator==
149 (
const Gaudi::StringKey& key1 ,
150 const char (&key2)[
N] )
153 key1.str().size() ==
N &&
154 std::equal ( key2 , key2 +
N , key1.str().begin() ) ;
161 template <
unsigned int N>
162 inline bool operator!=
163 (
const Gaudi::StringKey& key1 ,
164 const char (&key2)[
N] )
165 {
return ! ( key1 == key2 ) ; }
171 inline bool operator==
172 (
const std::string& key1 ,
173 const Gaudi::StringKey& key2 )
174 {
return key2 == key1 ; }
180 template <
unsigned int N>
181 inline bool operator==
182 (
const char (&key1 )[
N] ,
183 const Gaudi::StringKey& key2 )
184 {
return key2 == key1 ; }
190 inline bool operator!=
191 (
const std::string& key1 ,
192 const Gaudi::StringKey& key2 )
193 {
return key2 != key1 ; }
199 template <
unsigned int N>
200 inline bool operator!=
201 (
const char (&key1)[
N] ,
202 const Gaudi::StringKey& key2 ) {
return key2 != key1 ; }
214 inline std::size_t
hash_value (
const Gaudi::StringKey& key )
215 {
return key.__hash__ () ; }
238 (
const Gaudi::StringKey& key ,
248 inline std::ostream&
operator<<
250 const Gaudi::StringKey& key ) {
return o << key.str() ; }
272 ( Gaudi::StringKey& result ,
273 const std::string& input ) ;
285 ( std::vector<Gaudi::StringKey>& result ,
286 const std::string& input ) ;
294 #endif // GAUDIKERNEL_STRINGKEY_H