NisusWrtStruct.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 NISUS_WRT_STRUCT
35# define NISUS_WRT_STRUCT
36
37#include <iostream>
38#include <vector>
39
40#include "libmwaw_internal.hxx"
41
42#include "MWAWEntry.hxx"
43
44class NisusWrtParser;
45
47namespace NisusWrtStruct
48{
51
54
56struct Position {
59 {
60 }
62 friend std::ostream &operator<< (std::ostream &o, Position const &pos);
63
65 bool operator==(Position const &p2) const
66 {
67 return cmp(p2)==0;
68 }
70 bool operator!=(Position const &p2) const
71 {
72 return cmp(p2)!=0;
73 }
75 int cmp(Position const &p2) const
76 {
77 if (m_paragraph < p2.m_paragraph) return -1;
78 if (m_paragraph > p2.m_paragraph) return 1;
79 if (m_word < p2.m_word) return -1;
80 if (m_word > p2.m_word) return 1;
81 if (m_char < p2.m_char) return -1;
82 if (m_char > p2.m_char) return 1;
83 return 0;
84 }
88 int m_word;
90 int m_char;
91
93 struct Compare {
95 bool operator()(Position const &p1, Position const &p2) const
96 {
97 return p1.cmp(p2) < 0;
98 }
99 };
100};
101
103// Internal: low level
104
110 {
111 }
113 friend std::ostream &operator<< (std::ostream &o, FootnoteInfo const &fnote);
114
116 bool endNotes() const
117 {
118 return (m_flags&0x8);
119 }
122 {
123 return (m_flags&0x8)==0 && (m_flags&0x10);
124 }
135};
136
139 struct Node;
140 struct Info;
143 m_info(new Info(zone, vType)), m_level(level), m_childList()
144 {
145 }
148 m_info(orig.m_info), m_level(-1), m_childList()
149 {
150 }
153 {
154 if (this != &orig) {
155 m_info = orig.m_info;
156 m_level = orig.m_level;
158 }
159 return *this;
160 }
162 bool read(NisusWrtParser &parser, MWAWEntry const &entry);
163
165 shared_ptr<Info> m_info;
169 std::vector<Node> m_childList;
170
172 struct Info {
175 m_zoneType(zType), m_variableType(vType)
176 {
177 }
182 };
184 struct Node {
187 {
188 }
190 bool isLeaf() const
191 {
192 return !m_data;
193 }
194
200 shared_ptr<RecursifData> m_data;
201 };
202};
203}
204
205#endif
206// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:47
the main class to read a Nisus Writer file
Definition: NisusWrtParser.hxx:60
a namespace used to regroup the different structure used to parse a Nisus File
Definition: NisusWrtStruct.cxx:42
ZoneType
the different zone
Definition: NisusWrtStruct.hxx:50
@ Z_Main
Definition: NisusWrtStruct.hxx:50
@ Z_Footnote
Definition: NisusWrtStruct.hxx:50
@ Z_HeaderFooter
Definition: NisusWrtStruct.hxx:50
VariableType
the different variable type
Definition: NisusWrtStruct.hxx:53
@ V_Version
Definition: NisusWrtStruct.hxx:53
@ V_Variable
Definition: NisusWrtStruct.hxx:53
@ V_None
Definition: NisusWrtStruct.hxx:53
@ V_Numbering
Definition: NisusWrtStruct.hxx:53
Internal: low level a structure helping to store the footnote information.
Definition: NisusWrtStruct.hxx:106
FootnoteInfo()
constructor
Definition: NisusWrtStruct.hxx:108
int m_unknown
a unknown value
Definition: NisusWrtStruct.hxx:134
int m_distSeparator
the distance between two footnotes ( or between a footnote and the line sep)
Definition: NisusWrtStruct.hxx:130
bool endNotes() const
returns true if we have endnote
Definition: NisusWrtStruct.hxx:116
int m_flags
the footnote flags
Definition: NisusWrtStruct.hxx:126
friend std::ostream & operator<<(std::ostream &o, FootnoteInfo const &fnote)
operator<<: prints data
Definition: NisusWrtStruct.cxx:54
bool resetNumberOnNewPage() const
returns true if we have to reset index at the beginning of a page
Definition: NisusWrtStruct.hxx:121
int m_distToDocument
the distance between the footnote and the document
Definition: NisusWrtStruct.hxx:128
int m_separatorLength
the separator length
Definition: NisusWrtStruct.hxx:132
a comparaison structure used to sort the position
Definition: NisusWrtStruct.hxx:93
bool operator()(Position const &p1, Position const &p2) const
comparaison function
Definition: NisusWrtStruct.hxx:95
a position
Definition: NisusWrtStruct.hxx:56
Position()
the constructor
Definition: NisusWrtStruct.hxx:58
int m_paragraph
the paragraph
Definition: NisusWrtStruct.hxx:86
bool operator!=(Position const &p2) const
operator!=
Definition: NisusWrtStruct.hxx:70
int m_char
the character position
Definition: NisusWrtStruct.hxx:90
int cmp(Position const &p2) const
a small compare operator
Definition: NisusWrtStruct.hxx:75
friend std::ostream & operator<<(std::ostream &o, Position const &pos)
operator<<: prints data in form "XxYxZ"
Definition: NisusWrtStruct.cxx:43
bool operator==(Position const &p2) const
operator==
Definition: NisusWrtStruct.hxx:65
int m_word
the word
Definition: NisusWrtStruct.hxx:88
the zone information
Definition: NisusWrtStruct.hxx:172
NisusWrtStruct::ZoneType m_zoneType
the zone id
Definition: NisusWrtStruct.hxx:179
NisusWrtStruct::VariableType m_variableType
the variable type
Definition: NisusWrtStruct.hxx:181
Info(NisusWrtStruct::ZoneType zType, NisusWrtStruct::VariableType vType=NisusWrtStruct::V_None)
the constructor
Definition: NisusWrtStruct.hxx:174
the data data
Definition: NisusWrtStruct.hxx:184
bool isLeaf() const
returns true if the node is a final node
Definition: NisusWrtStruct.hxx:190
Node()
constructor
Definition: NisusWrtStruct.hxx:186
int m_type
the variable type
Definition: NisusWrtStruct.hxx:196
shared_ptr< RecursifData > m_data
the recursif data
Definition: NisusWrtStruct.hxx:200
MWAWEntry m_entry
the entry
Definition: NisusWrtStruct.hxx:198
Internal: low level a structure helping to read recursifList.
Definition: NisusWrtStruct.hxx:138
int m_level
the node level
Definition: NisusWrtStruct.hxx:167
bool read(NisusWrtParser &parser, MWAWEntry const &entry)
read the data
Definition: NisusWrtStruct.cxx:77
RecursifData(RecursifData const &orig)
copy constructor
Definition: NisusWrtStruct.hxx:147
RecursifData(NisusWrtStruct::ZoneType zone, NisusWrtStruct::VariableType vType=NisusWrtStruct::V_None, int level=0)
constructor
Definition: NisusWrtStruct.hxx:142
shared_ptr< Info > m_info
zone information
Definition: NisusWrtStruct.hxx:165
std::vector< Node > m_childList
the list of data entry
Definition: NisusWrtStruct.hxx:169
RecursifData & operator=(RecursifData const &orig)
copy operator
Definition: NisusWrtStruct.hxx:152

Generated on Wed Jan 19 2022 22:23:16 for libmwaw by doxygen 1.9.3