CWStruct.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 /*
35  * Structures used by Claris Works parser
36  *
37  */
38 #ifndef CW_MWAW_STRUCT
39 # define CW_MWAW_STRUCT
40 
41 #include <iostream>
42 #include <map>
43 #include <set>
44 #include <string>
45 #include <vector>
46 
47 #include "libmwaw_internal.hxx"
48 
49 class CWParser;
50 
52 namespace CWStruct
53 {
55 struct DSET {
56  struct Child;
57 
60 
62  DSET() : m_size(0), m_numData(0), m_dataSz(-1), m_headerSz(-1),
65  m_childs(), m_otherChilds(), m_parsed(false), m_internal(0) {
66  for (int i = 0; i < 4; i++) m_flags[i] = 0;
67  }
68 
70  virtual ~DSET() {}
71 
73  bool okChildId(int zoneId) const {
74  return m_validedChildList.find(zoneId) != m_validedChildList.end();
75  }
76 
78  friend std::ostream &operator<<(std::ostream &o, DSET const &doc);
79 
81  long m_size;
82 
84  long m_numData;
85 
87  long m_dataSz;
88 
90  long m_headerSz;
91 
94 
97 
99  int m_id;
100 
102  std::set<int> m_fathersList;
103 
105  std::set<int> m_validedChildList;
106 
109 
112 
115 
117  int m_flags[4];
118 
120  std::vector<Child> m_childs;
121 
123  std::vector<int> m_otherChilds;
124 
126  mutable bool m_parsed;
127 
129  mutable int m_internal;
130 
132  struct Child {
135 
137  Child() : m_type(UNKNOWN), m_id(-1), m_posC(-1), m_box() {
138  }
139 
141  friend std::ostream &operator<<(std::ostream &o, Child const &ch) {
142  switch(ch.m_type) {
143  case TEXT:
144  o << "text,";
145  break;
146  case ZONE:
147  o << "zone,";
148  break;
149  case GRAPHIC:
150  o << "graphic,";
151  break;
152  case TABLE:
153  o << "table,";
154  break;
155  case UNKNOWN:
156  o << "#type,";
157  default:
158  break;
159  }
160  if (ch.m_id != -1) o << "id=" << ch.m_id << ",";
161  if (ch.m_posC != -1) o << "posC=" << ch.m_posC << ",";
162  if (ch.m_box.size().x() > 0 || ch.m_box.size().y() > 0)
163  o << "box=" << ch.m_box << ",";
164  return o;
165  }
166 
168  int m_type;
170  int m_id;
172  long m_posC;
175  };
176 };
177 }
178 
179 #endif
180 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
int m_endSelection
the end of selection ( at least in text header)
Definition: CWStruct.hxx:111
Definition: CWStruct.hxx:134
main structure which correspond to a document part
Definition: CWStruct.hxx:55
std::vector< Child > m_childs
the list of child zone
Definition: CWStruct.hxx:120
long m_posC
a position (used in text zone to store the character )
Definition: CWStruct.hxx:172
Definition: CWStruct.hxx:59
Type m_type
the document type
Definition: CWStruct.hxx:93
friend std::ostream & operator<<(std::ostream &o, Child const &ch)
operator&lt;&lt;
Definition: CWStruct.hxx:141
structure used to define the child of a DSET structure
Definition: CWStruct.hxx:132
int m_id
the identificator
Definition: CWStruct.hxx:170
int m_type
the type
Definition: CWStruct.hxx:168
Definition: CWStruct.hxx:59
std::set< int > m_validedChildList
the list of verified child
Definition: CWStruct.hxx:105
int m_id
the identificator
Definition: CWStruct.hxx:99
Definition: CWStruct.hxx:134
Definition: CWStruct.hxx:134
Definition: CWStruct.hxx:59
bool okChildId(int zoneId) const
test is a child id is valid
Definition: CWStruct.hxx:73
int m_textType
the text type (header/footer,footnote, ...)
Definition: CWStruct.hxx:114
friend std::ostream & operator<<(std::ostream &o, DSET const &doc)
operator&lt;&lt;
Definition: CWStruct.cxx:55
Box2i m_box
the bdbox
Definition: CWStruct.hxx:174
Definition: CWStruct.hxx:59
Type
the document type
Definition: CWStruct.hxx:59
Type
the different types
Definition: CWStruct.hxx:134
T y() const
second element
Definition: libmwaw_internal.hxx:448
long m_dataSz
the data size
Definition: CWStruct.hxx:87
DSET()
constructor
Definition: CWStruct.hxx:62
std::set< int > m_fathersList
the list of fathers
Definition: CWStruct.hxx:102
std::vector< int > m_otherChilds
the list of other child
Definition: CWStruct.hxx:123
long m_size
the size of the DSET header
Definition: CWStruct.hxx:81
long m_headerSz
the header size
Definition: CWStruct.hxx:90
T x() const
first element
Definition: libmwaw_internal.hxx:444
Definition: CWStruct.hxx:134
Definition: CWStruct.hxx:59
the main class to read a Claris Works file
Definition: CWParser.hxx:73
long m_numData
the number of header
Definition: CWStruct.hxx:84
virtual ~DSET()
virtual destructor
Definition: CWStruct.hxx:70
int m_fileType
the type ( 0: text, -1: graphic, ...)
Definition: CWStruct.hxx:96
int m_flags[4]
some unknown flag
Definition: CWStruct.hxx:117
Definition: CWStruct.hxx:59
Child()
constructor
Definition: CWStruct.hxx:137
bool m_parsed
a flag to know if the entry is sent or not to the listener
Definition: CWStruct.hxx:126
int m_beginSelection
the begin of selection ( at least in text header)
Definition: CWStruct.hxx:108
int m_internal
an internal variable used to do some computation
Definition: CWStruct.hxx:129
Vec2< T > size() const
the box size
Definition: libmwaw_internal.hxx:792
Definition: CWStruct.hxx:59
Definition: CWStruct.hxx:59
Definition: CWStruct.hxx:134

Generated on Tue Mar 10 2015 17:32:08 for libmwaw by doxygen 1.8.5