00001 #ifndef __TYPELIB_TYPENAME_H__ 00002 #define __TYPELIB_TYPENAME_H__ 00003 00004 #include <string> 00005 #include <list> 00006 #include <boost/tokenizer.hpp> 00007 00008 namespace Typelib 00009 { 00010 typedef std::string::value_type NamespaceMarkType; 00011 static const NamespaceMarkType NamespaceMark = '/'; 00012 static const NamespaceMarkType TemplateMark = '<'; 00013 static const char* NamespaceMarkString = "/"; 00014 00015 struct NameSeparator : public boost::char_separator<NamespaceMarkType> 00016 { 00017 NameSeparator() 00018 : boost::char_separator<NamespaceMarkType>(NamespaceMarkString, "") {} 00019 }; 00020 typedef boost::tokenizer<NameSeparator> NameTokenizer; 00021 00022 00023 bool isAbsoluteName(const std::string& name); 00024 bool isValidNamespace(const std::string& name, bool absolute); 00025 bool isValidTypename(const std::string& name, bool absolute); 00026 bool isInNamespace(const std::string& type, const std::string& nspace, bool recursive = false); 00027 00032 std::list<std::string> splitTypename(std::string const& name); 00033 00039 std::string getNormalizedNamespace(const std::string& name); 00041 std::string getTypename (const std::string& full_name); 00044 std::string getNamespace(const std::string& full_name); 00051 std::string getRelativeName(std::string const& full_name, std::string const& ns); 00060 std::string getMinimalPathTo(std::string const& full_name, std::string const& ns); 00065 bool nameSort(std::string const& name1, std::string const& name2); 00066 }; 00067 00068 #endif 00069 00070