Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef MWAW_RSRC_PARSER_H
00035 #define MWAW_RSRC_PARSER_H
00036
00037 #include <map>
00038 #include <string>
00039 #include <vector>
00040
00041 #include "libmwaw_internal.hxx"
00042 #include "MWAWDebug.hxx"
00043
00046 class MWAWRSRCParser
00047 {
00048 public:
00049 struct Version;
00050
00052 MWAWRSRCParser(MWAWInputStreamPtr input);
00054 ~MWAWRSRCParser();
00055
00057 bool parse();
00058
00060 MWAWInputStreamPtr getInput()
00061 {
00062 return m_input;
00063 }
00064
00066 MWAWEntry getEntry(std::string type, int id) const;
00067
00069 std::multimap<std::string, MWAWEntry> &getEntriesMap()
00070 {
00071 if (!m_parsed)
00072 parse();
00073 return m_entryMap;
00074 }
00076 std::multimap<std::string, MWAWEntry> const &getEntriesMap() const
00077 {
00078 if (!m_parsed)
00079 const_cast<MWAWRSRCParser *>(this)->parse();
00080 return m_entryMap;
00081 }
00082
00084 bool parseSTR(MWAWEntry const &entry, std::string &str);
00085
00087 bool parseSTRList(MWAWEntry const &entry, std::vector<std::string> &list);
00088
00090 bool parsePICT(MWAWEntry const &entry, librevenge::RVNGBinaryData &pict);
00091
00093 bool parseClut(MWAWEntry const &entry, std::vector<MWAWColor> &list);
00094
00096 bool parseVers(MWAWEntry const &entry, Version &vers);
00097
00099 void setAsciiName(char const *name)
00100 {
00101 m_asciiName = name;
00102 }
00104 std::string const &asciiName() const
00105 {
00106 return m_asciiName;
00107 }
00109 libmwaw::DebugFile &ascii()
00110 {
00111 return m_asciiFile;
00112 }
00113 protected:
00115 bool parseMap(MWAWEntry const &entry, long dataBegin);
00116
00118 MWAWInputStreamPtr m_input;
00120 std::multimap<std::string, MWAWEntry> m_entryMap;
00122 bool m_parsed;
00124 libmwaw::DebugFile m_asciiFile;
00126 std::string m_asciiName;
00127 private:
00128 MWAWRSRCParser(MWAWRSRCParser const &orig);
00129 MWAWRSRCParser &operator=(MWAWRSRCParser const &orig);
00130
00131 public:
00133 struct Version {
00134 Version() : m_majorVersion(-1), m_minorVersion(0), m_countryCode(0),
00135 m_string(""), m_versionString(""), m_extra("")
00136 {
00137 }
00139 friend std::ostream &operator<< (std::ostream &o, Version const &vers);
00141 int m_majorVersion;
00143 int m_minorVersion;
00145 int m_countryCode;
00147 std::string m_string;
00149 std::string m_versionString;
00151 std::string m_extra;
00152 };
00153
00154 };
00155
00156 #endif
00157