From 9066cfe9886ac131c34d59ed0e2d287b0e3c0087 Mon Sep 17 00:00:00 2001 From: The Android Open Source Project Date: Tue, 3 Mar 2009 19:31:44 -0800 Subject: auto import from //depot/cupcake/@135843 --- tools/localize/ValuesFile.h | 52 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 tools/localize/ValuesFile.h (limited to 'tools/localize/ValuesFile.h') diff --git a/tools/localize/ValuesFile.h b/tools/localize/ValuesFile.h new file mode 100644 index 0000000..752fd78 --- /dev/null +++ b/tools/localize/ValuesFile.h @@ -0,0 +1,52 @@ +#ifndef VALUES_FILE_H +#define VALUES_FILE_H + +#include "SourcePos.h" +#include "Configuration.h" +#include "XMLHandler.h" +#include "Values.h" + +#include +#include + +using namespace std; + +extern const XMLNamespaceMap ANDROID_NAMESPACES; + +class ValuesFile +{ +public: + ValuesFile(const Configuration& config); + + static ValuesFile* ParseFile(const string& filename, const Configuration& config, + int version, const string& versionString); + static ValuesFile* ParseString(const string& filename, const string& text, + const Configuration& config, + int version, const string& versionString); + ~ValuesFile(); + + const Configuration& GetConfiguration() const; + + void AddString(const StringResource& str); + set GetStrings() const; + + // exports this file as a n XMLNode, you own this object + XMLNode* ToXMLNode() const; + + // writes the ValuesFile out to a string in the canonical format (i.e. writes the contents of + // ToXMLNode()). + string ToString() const; + +private: + class ParseState; + friend class ValuesFile::ParseState; + friend class StringHandler; + + ValuesFile(); + + Configuration m_config; + set m_strings; + map > m_arrays; +}; + +#endif // VALUES_FILE_H -- cgit v1.1