1 #ifndef VALUES_FILE_H 2 #define VALUES_FILE_H 3 4 #include "SourcePos.h" 5 #include "Configuration.h" 6 #include "XMLHandler.h" 7 #include "Values.h" 8 9 #include <string> 10 #include <set> 11 12 using namespace std; 13 14 extern const XMLNamespaceMap ANDROID_NAMESPACES; 15 16 class ValuesFile 17 { 18 public: 19 ValuesFile(const Configuration& config); 20 21 static ValuesFile* ParseFile(const string& filename, const Configuration& config, 22 int version, const string& versionString); 23 static ValuesFile* ParseString(const string& filename, const string& text, 24 const Configuration& config, 25 int version, const string& versionString); 26 ~ValuesFile(); 27 28 const Configuration& GetConfiguration() const; 29 30 void AddString(const StringResource& str); 31 set<StringResource> GetStrings() const; 32 33 // exports this file as a n XMLNode, you own this object 34 XMLNode* ToXMLNode() const; 35 36 // writes the ValuesFile out to a string in the canonical format (i.e. writes the contents of 37 // ToXMLNode()). 38 string ToString() const; 39 40 private: 41 class ParseState; 42 friend class ValuesFile::ParseState; 43 friend class StringHandler; 44 45 ValuesFile(); 46 47 Configuration m_config; 48 set<StringResource> m_strings; 49 map<string,set<StringResource> > m_arrays; 50 }; 51 52 #endif // VALUES_FILE_H 53