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 #ifndef WPS_TEXT_PARSER_H
00027 #define WPS_TEXT_PARSER_H
00028
00029 #include <vector>
00030
00031 #include "libwps_internal.h"
00032
00033 #include "WPSDebug.h"
00034 #include "WPSEntry.h"
00035
00036 class WPSParser;
00037
00039 class WPSTextParser
00040 {
00041 public:
00043 virtual ~WPSTextParser();
00044
00046 int version() const;
00047
00049 RVNGInputStreamPtr &getInput()
00050 {
00051 return m_input;
00052 }
00053
00054 protected:
00056 WPSTextParser(WPSParser &parser, RVNGInputStreamPtr &input);
00057
00059 std::multimap<std::string, WPSEntry> &getNameEntryMap();
00060
00062 std::multimap<std::string, WPSEntry> const &getNameEntryMap() const;
00063
00064 protected:
00066 struct DataFOD
00067 {
00074 enum Type { ATTR_TEXT, ATTR_PARAG, ATTR_PLC, ATTR_UNKN };
00075
00077 DataFOD() : m_type(ATTR_UNKN), m_pos(-1), m_defPos(0), m_id(-1) {}
00078
00080 Type m_type;
00082 long m_pos;
00084 long m_defPos;
00086 int m_id;
00087 };
00088
00091 std::vector<DataFOD> mergeSortedFODLists
00092 (std::vector<DataFOD> const &lst1, std::vector<DataFOD> const &lst2) const;
00093
00099 typedef bool (WPSTextParser::* FDPParser)(long endPos,
00100 int &id, std::string &mess);
00101
00104 bool readFDP(WPSEntry const &entry,
00105 std::vector<DataFOD> &fods, FDPParser parser);
00106
00107 protected:
00109 libwps::DebugFile &ascii()
00110 {
00111 return m_asciiFile;
00112 }
00113
00114 private:
00116 WPSTextParser(WPSTextParser const &parser);
00118 WPSTextParser &operator=(WPSTextParser const &parser);
00119
00120 protected:
00122 mutable int m_version;
00124 RVNGInputStreamPtr m_input;
00126 WPSParser &m_mainParser;
00128 WPSEntry m_textPositions;
00130 std::vector<DataFOD> m_FODList;
00132 libwps::DebugFile &m_asciiFile;
00133 };
00134
00135
00136 #endif
00137