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
00044 class WPXBinaryData;
00045
00048 class MWAWRSRCParser
00049 {
00050 public:
00051 struct Version;
00052
00054 MWAWRSRCParser(MWAWInputStreamPtr input);
00056 ~MWAWRSRCParser();
00057
00059 bool parse();
00060
00062 MWAWInputStreamPtr getInput() {
00063 return m_input;
00064 }
00065
00067 MWAWEntry getEntry(std::string type, int id) const;
00068
00070 std::multimap<std::string, MWAWEntry> &getEntriesMap() {
00071 if (!m_parsed)
00072 parse();
00073 return m_entryMap;
00074 }
00076 std::multimap<std::string, MWAWEntry> const &getEntriesMap() const {
00077 if (!m_parsed)
00078 const_cast<MWAWRSRCParser *>(this)->parse();
00079 return m_entryMap;
00080 }
00081
00083 bool parseSTR(MWAWEntry const &entry, std::string &str);
00084
00086 bool parseSTRList(MWAWEntry const &entry, std::vector<std::string> &list);
00087
00089 bool parsePICT(MWAWEntry const &entry, WPXBinaryData &pict);
00090
00092 bool parseClut(MWAWEntry const &entry, std::vector<MWAWColor> &list);
00093
00095 bool parseVers(MWAWEntry const &entry, Version &vers);
00096
00098 void setAsciiName(char const *name) {
00099 m_asciiName = name;
00100 }
00102 std::string const &asciiName() const {
00103 return m_asciiName;
00104 }
00106 libmwaw::DebugFile &ascii() {
00107 return m_asciiFile;
00108 }
00109 protected:
00111 bool parseMap(MWAWEntry const &entry, long dataBegin);
00112
00114 MWAWInputStreamPtr m_input;
00116 std::multimap<std::string, MWAWEntry> m_entryMap;
00118 bool m_parsed;
00120 libmwaw::DebugFile m_asciiFile;
00122 std::string m_asciiName;
00123 private:
00124 MWAWRSRCParser(MWAWRSRCParser const &orig);
00125 MWAWRSRCParser &operator=(MWAWRSRCParser const &orig);
00126
00127 public:
00129 struct Version {
00130 Version() : m_majorVersion(-1), m_minorVersion(0), m_countryCode(0),
00131 m_string(""), m_versionString(""), m_extra("") {
00132 }
00134 friend std::ostream &operator<< (std::ostream &o, Version const &vers);
00136 int m_majorVersion;
00138 int m_minorVersion;
00140 int m_countryCode;
00142 std::string m_string;
00144 std::string m_versionString;
00146 std::string m_extra;
00147 };
00148
00149 };
00150
00151 #endif
00152