00001
00002 #ifndef GAUDIKERNEL_LISTITEM_H
00003 #define GAUDIKERNEL_LISTITEM_H
00004
00007 #include <string>
00008
00009 class ListItem {
00010 std::string m_type, m_name;
00011 void init(const std::string& itm, const std::string& deftyp) {
00012 int slash_pos = itm.find_first_of("/");
00013 m_name = (slash_pos > 0) ? itm.substr( slash_pos + 1) : itm;
00014 m_type = (slash_pos > 0) ? itm.substr( 0, slash_pos ) : deftyp;
00015 }
00016 public:
00017 ListItem(const std::string& itm) {
00018 init(itm, itm);
00019 }
00020 ListItem(const std::string& itm, const std::string& deftyp) {
00021 init(itm, deftyp);
00022 }
00023 const std::string& type() const {
00024 return m_type;
00025 }
00026 const std::string& name() const {
00027 return m_name;
00028 }
00029 };
00030 #endif // GAUDIKERNEL_LISTITEM_H