TypeNameString.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_TYPENAMESTRING_H
2 #define GAUDIKERNEL_TYPENAMESTRING_H
3 #include <string>
4 #include <ostream>
5 
6 namespace Gaudi {
7  namespace Utils {
9  class TypeNameString {
10  std::string m_type, m_name;
11  bool m_haveType;
12  void init(const std::string& tn, const std::string& deftyp) {
13  const std::string::size_type slash_pos = tn.find_first_of("/");
14  m_haveType = slash_pos != std::string::npos;
15  m_name = (m_haveType) ? tn.substr( slash_pos + 1) : tn;
16  m_type = (m_haveType) ? tn.substr( 0, slash_pos ) : deftyp;
17  }
18  public:
19  TypeNameString(const char tn[]): m_haveType(false) { init(tn, tn); }
20  TypeNameString(const std::string& tn): m_haveType(false) { init(tn, tn); }
21  TypeNameString(const std::string& tn, const std::string& deftyp) { init(tn, deftyp); m_haveType = true; }
22  const std::string& type() const { return m_type; }
23  const std::string& name() const { return m_name; }
24  bool haveType() const { return m_haveType; }
25  };
26 
28  inline std::ostream& operator<< (std::ostream& s, const TypeNameString& tn) {
29  return s << tn.type() << '/' << tn.name();
30  }
31  }
32 }
33 
34 
35 #endif // GAUDIKERNEL_TYPENAMESTRING_H
return false
Definition: Bootstrap.cpp:338
std::ostream & operator<<(std::ostream &s, const TypeNameString &tn)
Output stream operator for TypeNameString instances.
TypeNameString(const char tn[])
void init(const std::string &tn, const std::string &deftyp)
const std::string & type() const
string s
Definition: gaudirun.py:244
const std::string & name() const
Helper functions to set/get the application return code.
Definition: __init__.py:1