RagTime5Parser.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2 
3 /* libmwaw
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33 
34 #ifndef RAG_TIME_5_PARSER
35 # define RAG_TIME_5_PARSER
36 
37 #include <string>
38 
39 #include "MWAWDebug.hxx"
40 #include "MWAWInputStream.hxx"
41 
42 #include "MWAWParser.hxx"
43 
44 namespace RagTime5ParserInternal
45 {
46 struct State;
47 struct Zone;
48 class SubDocument;
49 }
50 
57 {
59 
60 public:
63 
67  virtual ~RagTime5Parser();
68 
70  bool checkHeader(MWAWHeader *header, bool strict=false);
71 
72  // the main parse function
73  void parse(librevenge::RVNGTextInterface *documentInterface);
74 
75 protected:
77  void init();
78 
79  //
80  // interface
81  //
82 
84  bool getColor(int colId, MWAWColor &color, int listId=-1) const;
85 
87  void createDocument(librevenge::RVNGTextInterface *documentInterface);
89  bool sendZones();
90 
92  void newPage(int number);
93 
95  bool createZones();
97  bool findDataZones(MWAWEntry const &entry);
100 
102  bool unpackZone(RagTime5ParserInternal::Zone &zone, MWAWEntry const &entry, std::vector<unsigned char> &data);
105 
107  bool readCompressedLong(MWAWInputStreamPtr &input, long endPos, long &val);
109  bool readString(RagTime5ParserInternal::Zone &zone, std::string &string);
116 
122  bool readPictureList(RagTime5ParserInternal::Zone &zone, std::vector<int> &listIds);
124  bool readPictureMatch(RagTime5ParserInternal::Zone &zone, bool color);
125 
127  void flushExtra();
128 
129 protected:
130  //
131  // data
132  //
134  shared_ptr<RagTime5ParserInternal::State> m_state;
135 };
136 #endif
137 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:56
bool readPictureMatch(RagTime5ParserInternal::Zone &zone, bool color)
try to read a picture match zone
Definition: RagTime5Parser.cxx:1307
void parse(librevenge::RVNGTextInterface *documentInterface)
virtual function used to parse the input
Definition: RagTime5Parser.cxx:464
void init()
inits all internal variables
Definition: RagTime5Parser.cxx:418
Definition: RagTime5Parser.hxx:62
RagTime5Parser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header)
constructor
Definition: RagTime5Parser.cxx:408
void createDocument(librevenge::RVNGTextInterface *documentInterface)
creates the listener which will be associated to the document
Definition: RagTime5Parser.cxx:500
bool getColor(int colId, MWAWColor &color, int listId=-1) const
returns the ith color ( if possible)
Definition: RagTime5Parser.cxx:429
PictureType
enum used to defined list of classical pict
Definition: RagTime5Parser.hxx:62
bool readPictureList(RagTime5ParserInternal::Zone &zone, std::vector< int > &listIds)
try to read a picture list
Definition: RagTime5Parser.cxx:1266
the class to store a color
Definition: libmwaw_internal.hxx:166
bool readListZone(RagTime5ParserInternal::Zone &zone)
try to read a list of unknown zone
Definition: RagTime5Parser.cxx:943
Internal: the structures of a RagTime5Parser.
Definition: RagTime5Parser.cxx:64
Internal: the subdocument of a RagTime5Parser.
Definition: RagTime5Parser.cxx:355
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:411
bool readItemCluster(RagTime5ParserInternal::Zone &zone)
try to read a cluster of item
Definition: RagTime5Parser.cxx:817
bool findDataZones(MWAWEntry const &entry)
try to create the main data zones list
Definition: RagTime5Parser.cxx:1486
Definition: RagTime5Parser.hxx:62
bool readUnicodeString(RagTime5ParserInternal::Zone &zone)
try to read a unicode string zone
Definition: RagTime5Parser.cxx:785
Definition: RagTime5Parser.hxx:62
void newPage(int number)
adds a new page
Definition: RagTime5Parser.cxx:448
virtual class which defines the ancestor of all text zone parser
Definition: MWAWParser.hxx:284
the main class to read a RagTime v5 file
Definition: RagTime5Parser.hxx:56
bool readDocumentVersion(RagTime5ParserInternal::Zone &zone)
try to read the document version zone
Definition: RagTime5Parser.cxx:1217
Definition: RagTime5Parser.hxx:62
Definition: RagTime5Parser.hxx:62
bool readCompressedLong(MWAWInputStreamPtr &input, long endPos, long &val)
try to read a compressed long
Definition: RagTime5Parser.cxx:739
bool readPicture(RagTime5ParserInternal::Zone &zone, MWAWEntry &entry, PictureType type)
try to read a picture zone
Definition: RagTime5Parser.cxx:1370
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:401
bool unpackZone(RagTime5ParserInternal::Zone &zone, MWAWEntry const &entry, std::vector< unsigned char > &data)
try to unpack a zone
Definition: RagTime5Parser.cxx:1074
bool createZones()
finds the different objects zones
Definition: RagTime5Parser.cxx:532
Definition: RagTime5Parser.hxx:62
Definition: RagTime5Parser.hxx:62
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
bool update(RagTime5ParserInternal::Zone &zone)
try to update a zone: create a new input if the zone is stored in different positions, ...
Definition: RagTime5Parser.cxx:1004
Internal: a zone of a RagTime5Parser.
Definition: RagTime5Parser.cxx:118
virtual ~RagTime5Parser()
destructor
Definition: RagTime5Parser.cxx:414
bool checkHeader(MWAWHeader *header, bool strict=false)
checks if the document header is correct (or not)
Definition: RagTime5Parser.cxx:1643
bool readString(RagTime5ParserInternal::Zone &zone, std::string &string)
try to read a string zone ( zone with id1=21,id2=23:24)
Definition: RagTime5Parser.cxx:755
void flushExtra()
flush unsent zone (debugging function)
Definition: RagTime5Parser.cxx:1714
bool sendZones()
try to send the different zones
shared_ptr< RagTime5ParserInternal::State > m_state
the state
Definition: RagTime5Parser.hxx:134
Definition: RagTime5Parser.hxx:62

Generated on Tue Oct 28 2014 13:12:05 for libmwaw by doxygen 1.8.8