ClarisWksStruct.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 CLARIS_WKS_STRUCT
39 # define CLARIS_WKS_STRUCT
40 
41 #include <iostream>
42 #include <set>
43 #include <vector>
44 
45 #include "libmwaw_internal.hxx"
46 
48 namespace ClarisWksStruct
49 {
51 struct DSET {
52  struct Child;
53 
56 
58  DSET() : m_size(0), m_numData(0), m_dataSz(-1), m_headerSz(-1),
61  m_childs(), m_otherChilds(), m_parsed(false), m_internal(0)
62  {
63  for (int i = 0; i < 4; i++) m_flags[i] = 0;
64  }
65 
67  virtual ~DSET() {}
68 
70  bool okChildId(int zoneId) const
71  {
72  return m_validedChildList.find(zoneId) != m_validedChildList.end();
73  }
74 
76  friend std::ostream &operator<<(std::ostream &o, DSET const &doc);
77 
79  long m_size;
80 
82  long m_numData;
83 
85  long m_dataSz;
86 
88  long m_headerSz;
89 
92 
95 
97  int m_id;
98 
100  std::set<int> m_fathersList;
101 
103  std::set<int> m_validedChildList;
104 
107 
110 
113 
115  int m_flags[4];
116 
118  std::vector<Child> m_childs;
119 
121  std::vector<int> m_otherChilds;
122 
124  mutable bool m_parsed;
125 
127  mutable int m_internal;
128 
130  struct Child {
133 
135  Child() : m_type(UNKNOWN), m_id(-1), m_posC(-1), m_box()
136  {
137  }
138 
140  friend std::ostream &operator<<(std::ostream &o, Child const &ch)
141  {
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_beginSelection
the begin of selection ( at least in text header)
Definition: ClarisWksStruct.hxx:106
int m_endSelection
the end of selection ( at least in text header)
Definition: ClarisWksStruct.hxx:109
Definition: ClarisWksStruct.hxx:132
Definition: ClarisWksStruct.hxx:55
Child()
constructor
Definition: ClarisWksStruct.hxx:135
virtual ~DSET()
virtual destructor
Definition: ClarisWksStruct.hxx:67
Definition: ClarisWksStruct.hxx:55
std::set< int > m_fathersList
the list of fathers
Definition: ClarisWksStruct.hxx:100
structure used to define the child of a DSET structure
Definition: ClarisWksStruct.hxx:130
friend std::ostream & operator<<(std::ostream &o, Child const &ch)
operator<<
Definition: ClarisWksStruct.hxx:140
bool okChildId(int zoneId) const
test is a child id is valid
Definition: ClarisWksStruct.hxx:70
long m_size
the size of the DSET header
Definition: ClarisWksStruct.hxx:79
int m_flags[4]
some unknown flag
Definition: ClarisWksStruct.hxx:115
int m_internal
an internal variable used to do some computation
Definition: ClarisWksStruct.hxx:127
long m_numData
the number of header
Definition: ClarisWksStruct.hxx:82
int m_id
the identificator
Definition: ClarisWksStruct.hxx:97
Definition: ClarisWksStruct.hxx:132
int m_textType
the text type (header/footer,footnote, ...)
Definition: ClarisWksStruct.hxx:112
main structure which correspond to a document part
Definition: ClarisWksStruct.hxx:51
Definition: ClarisWksStruct.hxx:132
T y() const
second element
Definition: libmwaw_internal.hxx:495
std::vector< int > m_otherChilds
the list of other child
Definition: ClarisWksStruct.hxx:121
DSET()
constructor
Definition: ClarisWksStruct.hxx:58
Definition: ClarisWksStruct.hxx:55
Definition: ClarisWksStruct.hxx:55
bool m_parsed
a flag to know if the entry is sent or not to the listener
Definition: ClarisWksStruct.hxx:124
T x() const
first element
Definition: libmwaw_internal.hxx:490
int m_fileType
the type ( 0: text, -1: graphic, ...)
Definition: ClarisWksStruct.hxx:94
Definition: ClarisWksStruct.hxx:55
friend std::ostream & operator<<(std::ostream &o, DSET const &doc)
operator<<
Definition: ClarisWksStruct.cxx:50
Type
the different types
Definition: ClarisWksStruct.hxx:132
Definition: ClarisWksStruct.hxx:55
int m_type
the type
Definition: ClarisWksStruct.hxx:168
Type
the document type
Definition: ClarisWksStruct.hxx:55
std::set< int > m_validedChildList
the list of verified child
Definition: ClarisWksStruct.hxx:103
Type m_type
the document type
Definition: ClarisWksStruct.hxx:91
namespace to store the main structure which appears in a Claris Works file
Definition: ClarisWksStruct.cxx:45
long m_dataSz
the data size
Definition: ClarisWksStruct.hxx:85
Definition: ClarisWksStruct.hxx:132
Definition: ClarisWksStruct.hxx:55
std::vector< Child > m_childs
the list of child zone
Definition: ClarisWksStruct.hxx:118
Box2i m_box
the bdbox
Definition: ClarisWksStruct.hxx:174
Vec2< T > size() const
the box size
Definition: libmwaw_internal.hxx:887
long m_posC
a position (used in text zone to store the character )
Definition: ClarisWksStruct.hxx:172
Definition: ClarisWksStruct.hxx:132
int m_id
the identificator
Definition: ClarisWksStruct.hxx:170
long m_headerSz
the header size
Definition: ClarisWksStruct.hxx:88
Definition: ClarisWksStruct.hxx:55

Generated on Sun Oct 26 2014 05:56:30 for libmwaw by doxygen 1.8.8