00001 #ifndef __TYPELIB_TYPENAME_H__ 00002 #define __TYPELIB_TYPENAME_H__ 00003 00004 #include <string> 00005 #include <boost/tokenizer.hpp> 00006 00007 namespace Typelib 00008 { 00009 typedef std::string::value_type NamespaceMarkType; 00010 static const NamespaceMarkType NamespaceMark = '/'; 00011 static const char* NamespaceMarkString = "/"; 00012 00013 struct NameSeparator : public boost::char_separator<NamespaceMarkType> 00014 { 00015 NameSeparator() 00016 : boost::char_separator<NamespaceMarkType>(NamespaceMarkString, "") {} 00017 }; 00018 typedef boost::tokenizer<NameSeparator> NameTokenizer; 00019 00020 00021 bool isAbsoluteName(const std::string& name); 00022 bool isValidNamespace(const std::string& name, bool absolute); 00023 bool isValidTypename(const std::string& name, bool absolute); 00024 bool isInNamespace(const std::string& type, const std::string& nspace, bool recursive = false); 00025 00028 std::string getNormalizedNamespace(const std::string& name); 00030 std::string getTypename (const std::string& full_name); 00033 std::string getNamespace(const std::string& full_name); 00036 std::string getRelativeName(std::string const& full_name, std::string const& ns); 00037 }; 00038 00039 #endif 00040 00041