| # Gaudi Framework, version v21r9 |

Home |  | Generated: 3 May 2010

# TypeNameString.h

Go to the documentation of this file.

    00001 // $Id: ListItem.h,v 1.2 2007/01/17 14:17:08 hmd Exp $
    00002 #ifndef GAUDIKERNEL_TYPENAMESTRING_H
    00003 #define GAUDIKERNEL_TYPENAMESTRING_H
    00004 #include <string>
    00005
    00006 namespace Gaudi {
    00007   namespace Utils {
    00009     class TypeNameString {
    00010       std::string m_type, m_name;
    00011       bool m_haveType;
    00012       void init(const std::string& tn, const std::string& deftyp)    {
    00013         const std::string::size_type slash_pos = tn.find_first_of("/");
    00014         m_haveType = slash_pos != std::string::npos;
    00015         m_name = (m_haveType) ? tn.substr( slash_pos + 1) : tn;
    00016         m_type = (m_haveType) ? tn.substr( 0, slash_pos ) : deftyp;
    00017       }
    00018     public:
    00019       TypeNameString(const char tn[]): m_haveType(false) { init(tn, tn); }
    00020       TypeNameString(const std::string& tn): m_haveType(false) { init(tn, tn); }
    00021       TypeNameString(const std::string& tn, const std::string& deftyp) { init(tn, deftyp); m_haveType = true; }
    00022       const std::string& type() const { return m_type; }
    00023       const std::string& name() const { return m_name; }
    00024       bool haveType() const { return m_haveType; }
    00025     };
    00026   }
    00027 }
    00028
    00029 #endif // GAUDIKERNEL_TYPENAMESTRING_H