| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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