Source-highlight Library
|
00001 // 00002 // Author: Lorenzo Bettini <http://www.lorenzobettini.it>, (C) 2004 00003 // 00004 // Copyright: See COPYING file that comes with this distribution 00005 // 00006 // 00007 #ifndef LANGMAP_H 00008 #define LANGMAP_H 00009 00010 #include <string> 00011 #include <map> 00012 #include <set> 00013 00014 namespace srchilite { 00015 00029 class LangMap { 00030 typedef std::map<std::string, std::string> Map; 00031 00032 Map langmap; 00033 00035 bool isOpen; 00036 00038 std::string path; 00039 00041 std::string filename; 00042 00043 public: 00050 LangMap(const std::string &path, const std::string &filename); 00051 00057 LangMap(const std::string &filename); 00058 00059 ~LangMap(); 00060 00061 typedef Map::const_iterator const_iterator; 00062 00063 const_iterator begin() { 00064 return langmap.begin(); 00065 } 00066 00067 const_iterator end() { 00068 return langmap.end(); 00069 } 00070 00075 void print(); 00076 00083 void open(); 00084 00096 const std::string getFileName(const std::string &lang) { 00097 return langmap[lang]; 00098 } 00099 00111 const std::string getMappedFileName(const std::string &lang); 00112 00139 const std::string getMappedFileNameFromFileName(const std::string &fileName); 00140 00146 std::set<std::string> getLangNames() const; 00147 00153 std::set<std::string> getMappedFileNames() const; 00154 00161 void reload(const std::string &path, const std::string &filename); 00162 00163 }; 00164 00165 } 00166 00167 #endif