/src/libmwaw/src/lib/libmwaw_internal.hxx
Line | Count | Source |
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 LIBMWAW_INTERNAL_H |
35 | | #define LIBMWAW_INTERNAL_H |
36 | | #ifdef DEBUG |
37 | | #include <stdio.h> |
38 | | #endif |
39 | | |
40 | | #include <math.h> |
41 | | |
42 | | #include <algorithm> |
43 | | #include <cmath> |
44 | | #include <limits> |
45 | | #include <map> |
46 | | #include <memory> |
47 | | #include <ostream> |
48 | | #include <string> |
49 | | #include <vector> |
50 | | |
51 | | #ifndef M_PI |
52 | | #define M_PI 3.14159265358979323846 |
53 | | #endif |
54 | | |
55 | | #include <librevenge-stream/librevenge-stream.h> |
56 | | #include <librevenge/librevenge.h> |
57 | | |
58 | | #if defined(_MSC_VER) || defined(__DJGPP__) |
59 | | |
60 | | typedef signed char int8_t; |
61 | | typedef unsigned char uint8_t; |
62 | | typedef signed short int16_t; |
63 | | typedef unsigned short uint16_t; |
64 | | typedef signed int int32_t; |
65 | | typedef unsigned int uint32_t; |
66 | | typedef unsigned __int64 uint64_t; |
67 | | typedef __int64 int64_t; |
68 | | |
69 | | #else /* !_MSC_VER && !__DJGPP__*/ |
70 | | |
71 | | # ifdef HAVE_CONFIG_H |
72 | | |
73 | | # include <config.h> |
74 | | # ifdef HAVE_STDINT_H |
75 | | # include <stdint.h> |
76 | | # endif |
77 | | # ifdef HAVE_INTTYPES_H |
78 | | # include <inttypes.h> |
79 | | # endif |
80 | | |
81 | | # else |
82 | | |
83 | | // assume that the headers are there inside LibreOffice build when no HAVE_CONFIG_H is defined |
84 | | # include <stdint.h> |
85 | | # include <inttypes.h> |
86 | | |
87 | | # endif |
88 | | |
89 | | #endif /* _MSC_VER || __DJGPP__ */ |
90 | | |
91 | | // define gmtime_r and localtime_r on Windows, so that can use |
92 | | // thread-safe functions on other environments |
93 | | #ifdef _WIN32 |
94 | | # define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0) |
95 | | # define localtime_r(tp,tmp) (localtime(tp)?(*(tmp)=*localtime(tp),(tmp)):0) |
96 | | #endif |
97 | | |
98 | | /* ---------- memory --------------- */ |
99 | | /** an noop deleter used to transform a libwpd pointer in a false std::shared_ptr */ |
100 | | template <class T> |
101 | | struct MWAW_shared_ptr_noop_deleter { |
102 | 20.0M | void operator()(T *) {}MWAW_shared_ptr_noop_deleter<librevenge::RVNGInputStream>::operator()(librevenge::RVNGInputStream*) Line | Count | Source | 102 | 7.44M | void operator()(T *) {} |
MWAW_shared_ptr_noop_deleter<MWAWInputStream>::operator()(MWAWInputStream*) Line | Count | Source | 102 | 1.24M | void operator()(T *) {} |
MWAW_shared_ptr_noop_deleter<libmwaw::DebugFile>::operator()(libmwaw::DebugFile*) Line | Count | Source | 102 | 3.69M | void operator()(T *) {} |
MWAW_shared_ptr_noop_deleter<MacWrtProStructures>::operator()(MacWrtProStructures*) Line | Count | Source | 102 | 11.0k | void operator()(T *) {} |
Unexecuted instantiation: MWAW_shared_ptr_noop_deleter<MWAWGraphicListener>::operator()(MWAWGraphicListener*) MWAW_shared_ptr_noop_deleter<MWAWListener>::operator()(MWAWListener*) Line | Count | Source | 102 | 4.13M | void operator()(T *) {} |
Unexecuted instantiation: MWAW_shared_ptr_noop_deleter<MWAWPresentationListener>::operator()(MWAWPresentationListener*) MWAW_shared_ptr_noop_deleter<MWAWSpreadsheetListener>::operator()(MWAWSpreadsheetListener*) Line | Count | Source | 102 | 80.5k | void operator()(T *) {} |
MWAW_shared_ptr_noop_deleter<MWAWTextListener>::operator()(MWAWTextListener*) Line | Count | Source | 102 | 3.48M | void operator()(T *) {} |
|
103 | | }; |
104 | | |
105 | | #if defined(HAVE_FUNC_ATTRIBUTE_FORMAT) |
106 | | # define LIBMWAW_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg))) |
107 | | #else |
108 | | # define LIBMWAW_ATTRIBUTE_PRINTF(fmt, arg) |
109 | | #endif |
110 | | |
111 | 1.13M | #define MWAW_N_ELEMENTS(m) sizeof(m)/sizeof(m[0]) |
112 | | |
113 | | #if defined(HAVE_CLANG_ATTRIBUTE_FALLTHROUGH) |
114 | 9.19M | # define MWAW_FALLTHROUGH [[clang::fallthrough]] |
115 | | #elif defined(HAVE_GCC_ATTRIBUTE_FALLTHROUGH) |
116 | | # define MWAW_FALLTHROUGH __attribute__((fallthrough)) |
117 | | #else |
118 | | # define MWAW_FALLTHROUGH ((void) 0) |
119 | | #endif |
120 | | |
121 | | /* ---------- debug --------------- */ |
122 | | #ifdef DEBUG |
123 | | namespace libmwaw |
124 | | { |
125 | | void printDebugMsg(const char *format, ...) LIBMWAW_ATTRIBUTE_PRINTF(1,2); |
126 | | } |
127 | | #define MWAW_DEBUG_MSG(M) libmwaw::printDebugMsg M |
128 | | #else |
129 | | #define MWAW_DEBUG_MSG(M) |
130 | | #endif |
131 | | |
132 | | namespace libmwaw |
133 | | { |
134 | | // Various exceptions: |
135 | | class VersionException |
136 | | { |
137 | | }; |
138 | | |
139 | | class FileException |
140 | | { |
141 | | }; |
142 | | |
143 | | class ParseException |
144 | | { |
145 | | }; |
146 | | |
147 | | class GenericException |
148 | | { |
149 | | }; |
150 | | |
151 | | class WrongPasswordException |
152 | | { |
153 | | }; |
154 | | } |
155 | | |
156 | | /* ---------- input ----------------- */ |
157 | | namespace libmwaw |
158 | | { |
159 | | uint8_t readU8(librevenge::RVNGInputStream *input); |
160 | | //! adds an unicode character to a string |
161 | | void appendUnicode(uint32_t val, librevenge::RVNGString &buffer); |
162 | | |
163 | | //! checks whether addition of \c x and \c y would overflow |
164 | | template<typename T> |
165 | | bool checkAddOverflow(T x, T y) |
166 | 3.40G | { |
167 | 3.40G | return (x < 0 && y < std::numeric_limits<T>::lowest() - x) |
168 | 3.40G | || (x > 0 && y > std::numeric_limits<T>::max() - x); |
169 | 3.40G | } bool libmwaw::checkAddOverflow<float>(float, float) Line | Count | Source | 166 | 3.30G | { | 167 | 3.30G | return (x < 0 && y < std::numeric_limits<T>::lowest() - x) | 168 | 3.30G | || (x > 0 && y > std::numeric_limits<T>::max() - x); | 169 | 3.30G | } |
bool libmwaw::checkAddOverflow<int>(int, int) Line | Count | Source | 166 | 104M | { | 167 | 104M | return (x < 0 && y < std::numeric_limits<T>::lowest() - x) | 168 | 104M | || (x > 0 && y > std::numeric_limits<T>::max() - x); | 169 | 104M | } |
Unexecuted instantiation: bool libmwaw::checkAddOverflow<long>(long, long) |
170 | | } |
171 | | |
172 | | /* ---------- small enum/class ------------- */ |
173 | | namespace libmwaw |
174 | | { |
175 | | //! basic position enum |
176 | | enum Position { Left = 0, Right = 1, Top = 2, Bottom = 3, HMiddle = 4, VMiddle = 5 }; |
177 | | //! basic position enum bits |
178 | | enum { LeftBit = 0x01, RightBit = 0x02, TopBit=0x4, BottomBit = 0x08, HMiddleBit = 0x10, VMiddleBit = 0x20 }; |
179 | | |
180 | | enum NumberingType { NONE, BULLET, ARABIC, LOWERCASE, UPPERCASE, LOWERCASE_ROMAN, UPPERCASE_ROMAN }; |
181 | | std::string numberingTypeToString(NumberingType type); |
182 | | std::string numberingValueToString(NumberingType type, int value); |
183 | | |
184 | | //! the different writing mode |
185 | | enum WritingMode { WritingLeftTop, WritingLeftBottom, WritingRightTop, WritingRightBottom, WritingInherited }; |
186 | | //! a function to convert a writing mode in string lt-rb, ... |
187 | | std::string writingModeToString(WritingMode mode); |
188 | | enum SubDocumentType { DOC_NONE, DOC_CHART, DOC_CHART_ZONE, DOC_COMMENT_ANNOTATION, DOC_GRAPHIC_GROUP, DOC_HEADER_FOOTER, DOC_NOTE, DOC_SHEET, DOC_TABLE, DOC_TEXT_BOX }; |
189 | | } |
190 | | |
191 | | //! the class to store a color |
192 | | struct MWAWColor { |
193 | | //! constructor |
194 | | explicit MWAWColor(uint32_t argb=0) |
195 | 12.1G | : m_value(argb) |
196 | 12.1G | { |
197 | 12.1G | } |
198 | | //! constructor from color |
199 | | MWAWColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255) |
200 | 10.7G | : m_value(uint32_t((a<<24)+(r<<16)+(g<<8)+b)) |
201 | 10.7G | { |
202 | 10.7G | } |
203 | | //! copy constructor |
204 | | MWAWColor(MWAWColor const &) = default; |
205 | | //! move assignement |
206 | | MWAWColor(MWAWColor &&) = default; |
207 | | //! operator= |
208 | | MWAWColor &operator=(MWAWColor const &) = default; |
209 | | //! move operator= |
210 | | MWAWColor &operator=(MWAWColor &&) = default; |
211 | | //! operator= |
212 | | MWAWColor &operator=(uint32_t argb) |
213 | 49.2M | { |
214 | 49.2M | m_value = argb; |
215 | 49.2M | return *this; |
216 | 49.2M | } |
217 | | //! return a color from a cmyk color ( basic) |
218 | | static MWAWColor colorFromCMYK(unsigned char c, unsigned char m, unsigned char y, unsigned char k) |
219 | 3.27k | { |
220 | 3.27k | double w=1.-static_cast<double>(k)/255.; |
221 | 3.27k | return MWAWColor |
222 | 3.27k | (static_cast<unsigned char>(255 * (1-static_cast<double>(c)/255) * w), |
223 | 3.27k | static_cast<unsigned char>(255 * (1-static_cast<double>(m)/255) * w), |
224 | 3.27k | static_cast<unsigned char>(255 * (1-static_cast<double>(y)/255) * w) |
225 | 3.27k | ); |
226 | 3.27k | } |
227 | | //! return a color from a hsl color (basic) |
228 | | static MWAWColor colorFromHSL(unsigned char H, unsigned char S, unsigned char L) |
229 | 608 | { |
230 | 608 | double c=(1-((L>=128) ? (2*static_cast<double>(L)-255) : (255-2*static_cast<double>(L)))/255)* |
231 | 608 | static_cast<double>(S)/255; |
232 | 608 | double tmp=std::fmod((static_cast<double>(H)*6/255),2)-1; |
233 | 608 | double x=c*(1-(tmp>0 ? tmp : -tmp)); |
234 | 608 | auto C=static_cast<unsigned char>(255*c); |
235 | 608 | auto M=static_cast<unsigned char>(static_cast<double>(L)-255*c/2); |
236 | 608 | auto X=static_cast<unsigned char>(255*x); |
237 | 608 | if (H<=42) return MWAWColor(static_cast<unsigned char>(M+C),static_cast<unsigned char>(M+X),static_cast<unsigned char>(M)); |
238 | 378 | if (H<=85) return MWAWColor(static_cast<unsigned char>(M+X),static_cast<unsigned char>(M+C),static_cast<unsigned char>(M)); |
239 | 175 | if (H<=127) return MWAWColor(static_cast<unsigned char>(M),static_cast<unsigned char>(M+C),static_cast<unsigned char>(M+X)); |
240 | 170 | if (H<=170) return MWAWColor(static_cast<unsigned char>(M),static_cast<unsigned char>(M+X),static_cast<unsigned char>(M+C)); |
241 | 95 | if (H<=212) return MWAWColor(static_cast<unsigned char>(M+X),static_cast<unsigned char>(M),static_cast<unsigned char>(M+C)); |
242 | 83 | return MWAWColor(static_cast<unsigned char>(M+C),static_cast<unsigned char>(M),static_cast<unsigned char>(M+X)); |
243 | 95 | } |
244 | | //! return the back color |
245 | | static MWAWColor black() |
246 | 6.26G | { |
247 | 6.26G | return MWAWColor(0,0,0); |
248 | 6.26G | } |
249 | | //! return the white color |
250 | | static MWAWColor white() |
251 | 4.40G | { |
252 | 4.40G | return MWAWColor(255,255,255); |
253 | 4.40G | } |
254 | | |
255 | | //! return alpha*colA+beta*colB |
256 | | static MWAWColor barycenter(float alpha, MWAWColor const &colA, |
257 | | float beta, MWAWColor const &colB); |
258 | | //! return the rgba value |
259 | | uint32_t value() const |
260 | 572M | { |
261 | 572M | return m_value; |
262 | 572M | } |
263 | | //! returns the alpha value |
264 | | unsigned char getAlpha() const |
265 | 167k | { |
266 | 167k | return static_cast<unsigned char>((m_value>>24)&0xFF); |
267 | 167k | } |
268 | | //! returns the green value |
269 | | unsigned char getBlue() const |
270 | 795k | { |
271 | 795k | return static_cast<unsigned char>(m_value&0xFF); |
272 | 795k | } |
273 | | //! returns the red value |
274 | | unsigned char getRed() const |
275 | 795k | { |
276 | 795k | return static_cast<unsigned char>((m_value>>16)&0xFF); |
277 | 795k | } |
278 | | //! returns the green value |
279 | | unsigned char getGreen() const |
280 | 795k | { |
281 | 795k | return static_cast<unsigned char>((m_value>>8)&0xFF); |
282 | 795k | } |
283 | | //! return true if the color is black |
284 | | bool isBlack() const |
285 | 49.9M | { |
286 | 49.9M | return (m_value&0xFFFFFF)==0; |
287 | 49.9M | } |
288 | | //! return true if the color is white |
289 | | bool isWhite() const |
290 | 165M | { |
291 | 165M | return (m_value&0xFFFFFF)==0xFFFFFF; |
292 | 165M | } |
293 | | //! operator== |
294 | | bool operator==(MWAWColor const &c) const |
295 | 56.5M | { |
296 | 56.5M | return (c.m_value&0xFFFFFF)==(m_value&0xFFFFFF); |
297 | 56.5M | } |
298 | | //! operator!= |
299 | | bool operator!=(MWAWColor const &c) const |
300 | 1.76M | { |
301 | 1.76M | return !operator==(c); |
302 | 1.76M | } |
303 | | //! operator< |
304 | | bool operator<(MWAWColor const &c) const |
305 | 314M | { |
306 | 314M | return (c.m_value&0xFFFFFF)<(m_value&0xFFFFFF); |
307 | 314M | } |
308 | | //! operator<= |
309 | | bool operator<=(MWAWColor const &c) const |
310 | 313M | { |
311 | 313M | return (c.m_value&0xFFFFFF)<=(m_value&0xFFFFFF); |
312 | 313M | } |
313 | | //! operator> |
314 | | bool operator>(MWAWColor const &c) const |
315 | 313M | { |
316 | 313M | return !operator<=(c); |
317 | 313M | } |
318 | | //! operator>= |
319 | | bool operator>=(MWAWColor const &c) const |
320 | 0 | { |
321 | 0 | return !operator<(c); |
322 | 0 | } |
323 | | //! operator<< in the form \#rrggbb |
324 | | friend std::ostream &operator<< (std::ostream &o, MWAWColor const &c); |
325 | | //! print the color in the form \#rrggbb |
326 | | std::string str() const; |
327 | | protected: |
328 | | //! the argb color |
329 | | uint32_t m_value; |
330 | | }; |
331 | | |
332 | | //! a border |
333 | | struct MWAWBorder { |
334 | | /** the line style */ |
335 | | enum Style { None, Simple, Dot, LargeDot, Dash }; |
336 | | /** the line repetition */ |
337 | | enum Type { Single, Double, Triple }; |
338 | | |
339 | | //! constructor |
340 | | MWAWBorder() |
341 | 394M | : m_style(Simple) |
342 | 394M | , m_type(Single) |
343 | 394M | , m_width(1) |
344 | 394M | , m_widthsList() |
345 | 394M | , m_color(MWAWColor::black()) |
346 | 394M | , m_extra("") { } |
347 | 52.4M | MWAWBorder(MWAWBorder const &) = default; |
348 | 37.1k | MWAWBorder(MWAWBorder &&) = default; |
349 | 120M | MWAWBorder &operator=(MWAWBorder const &) = default; |
350 | 8.29M | MWAWBorder &operator=(MWAWBorder &&) = default; |
351 | | /** add the border property to proplist (if needed ) |
352 | | |
353 | | \note if set which must be equal to "left", "top", ... */ |
354 | | bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const; |
355 | | //! returns true if the border is empty |
356 | | bool isEmpty() const |
357 | 1.65M | { |
358 | 1.65M | return m_style==None || m_width <= 0; |
359 | 1.65M | } |
360 | | //! operator== |
361 | | bool operator==(MWAWBorder const &orig) const |
362 | 0 | { |
363 | 0 | return !operator!=(orig); |
364 | 0 | } |
365 | | //! operator!= |
366 | | bool operator!=(MWAWBorder const &orig) const |
367 | 1.76M | { |
368 | 1.76M | return m_style != orig.m_style || m_type != orig.m_type || |
369 | 1.76M | m_width < orig.m_width || m_width > orig.m_width || m_color != orig.m_color || |
370 | 1.75M | m_widthsList != orig.m_widthsList; |
371 | 1.76M | } |
372 | | //! compare two borders |
373 | | int compare(MWAWBorder const &orig) const; |
374 | | |
375 | | //! operator<< |
376 | | friend std::ostream &operator<< (std::ostream &o, MWAWBorder const &border); |
377 | | //! operator<<: prints data in form "none|dot|..." |
378 | | friend std::ostream &operator<< (std::ostream &o, MWAWBorder::Style const &style); |
379 | | //! the border style |
380 | | Style m_style; |
381 | | |
382 | | // multiple borders |
383 | | |
384 | | //! the border repetition |
385 | | Type m_type; |
386 | | //! the border total width in point |
387 | | double m_width; |
388 | | /** the different length used for each line/sep (if defined) |
389 | | |
390 | | \note when defined, the size of this list must be equal to 2*Type-1*/ |
391 | | std::vector<double> m_widthsList; |
392 | | //! the border color |
393 | | MWAWColor m_color; |
394 | | //! extra data ( if needed) |
395 | | std::string m_extra; |
396 | | }; |
397 | | |
398 | | //! a field |
399 | | struct MWAWField { |
400 | | /** Defines some basic type for field */ |
401 | | enum Type { None, PageCount, PageNumber, Date, Time, Title, Database, BookmarkStart, BookmarkEnd }; |
402 | | |
403 | | /** basic constructor */ |
404 | | explicit MWAWField(Type type) |
405 | 9.93M | : m_type(type) |
406 | 9.93M | , m_numberingType(libmwaw::ARABIC) |
407 | 9.93M | , m_DTFormat("") |
408 | 9.93M | , m_data("") |
409 | 9.93M | { |
410 | 9.93M | } |
411 | | MWAWField(MWAWField &&) = default; |
412 | | MWAWField(MWAWField const &) = default; |
413 | | MWAWField &operator=(MWAWField const &) = default; |
414 | 2.50k | MWAWField &operator=(MWAWField &&) = default; |
415 | | /** add the link property to proplist (if possible) */ |
416 | | bool addTo(librevenge::RVNGPropertyList &propList) const; |
417 | | //! returns a string corresponding to the field (if possible) */ |
418 | | librevenge::RVNGString getString() const; |
419 | | //! the type |
420 | | Type m_type; |
421 | | //! the number type ( for number field ) |
422 | | libmwaw::NumberingType m_numberingType; |
423 | | //! the date/time format using strftime format if defined |
424 | | std::string m_DTFormat; |
425 | | //! the database/link field ( if defined ) or the bookmark name |
426 | | std::string m_data; |
427 | | }; |
428 | | |
429 | | //! a link |
430 | | struct MWAWLink { |
431 | | /** basic constructor */ |
432 | | MWAWLink() |
433 | 0 | : m_HRef("") |
434 | 0 | { |
435 | 0 | } |
436 | | |
437 | | /** add the link property to proplist (if needed ) */ |
438 | | bool addTo(librevenge::RVNGPropertyList &propList) const; |
439 | | |
440 | | //! the href field |
441 | | std::string m_HRef; |
442 | | }; |
443 | | |
444 | | //! a note |
445 | | struct MWAWNote { |
446 | | //! enum to define note type |
447 | | enum Type { FootNote, EndNote }; |
448 | | //! constructor |
449 | | explicit MWAWNote(Type type) |
450 | 5.55M | : m_type(type) |
451 | 5.55M | , m_label("") |
452 | 5.55M | , m_number(-1) |
453 | 5.55M | { |
454 | 5.55M | } |
455 | | //! the note type |
456 | | Type m_type; |
457 | | //! the note label |
458 | | librevenge::RVNGString m_label; |
459 | | //! the note number if defined |
460 | | int m_number; |
461 | | }; |
462 | | |
463 | | /** small class use to define a embedded object |
464 | | |
465 | | \note mainly used to store picture |
466 | | */ |
467 | | struct MWAWEmbeddedObject { |
468 | | //! empty constructor |
469 | | MWAWEmbeddedObject() |
470 | 479M | : m_dataList() |
471 | 479M | , m_typeList() |
472 | 479M | { |
473 | 479M | } |
474 | | //! constructor |
475 | | explicit MWAWEmbeddedObject(librevenge::RVNGBinaryData const &binaryData, |
476 | 11.3M | std::string const &type="image/pict") : m_dataList(), m_typeList() |
477 | 11.3M | { |
478 | 11.3M | add(binaryData, type); |
479 | 11.3M | } |
480 | 318M | MWAWEmbeddedObject(MWAWEmbeddedObject const &)=default; |
481 | 90.1M | MWAWEmbeddedObject &operator=(MWAWEmbeddedObject const &)=default; |
482 | 78.3M | MWAWEmbeddedObject &operator=(MWAWEmbeddedObject &&)=default; |
483 | | //! destructor |
484 | | ~MWAWEmbeddedObject(); |
485 | | //! return true if the picture contains no data |
486 | | bool isEmpty() const |
487 | 59.0M | { |
488 | 59.0M | for (auto const &data : m_dataList) { |
489 | 1.78M | if (!data.empty()) |
490 | 1.78M | return false; |
491 | 1.78M | } |
492 | 57.2M | return true; |
493 | 59.0M | } |
494 | | //! add a picture |
495 | | void add(librevenge::RVNGBinaryData const &binaryData, std::string const &type="image/pict") |
496 | 11.3M | { |
497 | 11.3M | size_t pos=m_dataList.size(); |
498 | 11.3M | if (pos<m_typeList.size()) pos=m_typeList.size(); |
499 | 11.3M | m_dataList.resize(pos+1); |
500 | 11.3M | m_dataList[pos]=binaryData; |
501 | 11.3M | m_typeList.resize(pos+1); |
502 | 11.3M | m_typeList[pos]=type; |
503 | 11.3M | } |
504 | | /** add the link property to proplist */ |
505 | | bool addTo(librevenge::RVNGPropertyList &propList) const; |
506 | | /** operator<<*/ |
507 | | friend std::ostream &operator<<(std::ostream &o, MWAWEmbeddedObject const &pict); |
508 | | /** a comparison function */ |
509 | | int cmp(MWAWEmbeddedObject const &pict) const; |
510 | | |
511 | | //! the picture content: one data by representation |
512 | | std::vector<librevenge::RVNGBinaryData> m_dataList; |
513 | | //! the picture type: one type by representation |
514 | | std::vector<std::string> m_typeList; |
515 | | }; |
516 | | |
517 | | // forward declarations of basic classes and smart pointers |
518 | | struct MWAWStream; |
519 | | class MWAWEntry; |
520 | | class MWAWFont; |
521 | | class MWAWGraphicEncoder; |
522 | | class MWAWGraphicShape; |
523 | | class MWAWGraphicStyle; |
524 | | class MWAWHeader; |
525 | | class MWAWList; |
526 | | class MWAWPageSpan; |
527 | | class MWAWParagraph; |
528 | | class MWAWParser; |
529 | | class MWAWPosition; |
530 | | class MWAWSection; |
531 | | |
532 | | class MWAWFontConverter; |
533 | | class MWAWFontManager; |
534 | | class MWAWGraphicListener; |
535 | | class MWAWInputStream; |
536 | | class MWAWListener; |
537 | | class MWAWListManager; |
538 | | class MWAWParserState; |
539 | | class MWAWPresentationListener; |
540 | | class MWAWRSRCParser; |
541 | | class MWAWSpreadsheetListener; |
542 | | class MWAWSubDocument; |
543 | | class MWAWTextListener; |
544 | | //! a smart pointer of MWAWFontConverter |
545 | | typedef std::shared_ptr<MWAWFontConverter> MWAWFontConverterPtr; |
546 | | //! a smart pointer of MWAWFontManager |
547 | | typedef std::shared_ptr<MWAWFontManager> MWAWFontManagerPtr; |
548 | | //! a smart pointer of MWAWGraphicListener |
549 | | typedef std::shared_ptr<MWAWGraphicListener> MWAWGraphicListenerPtr; |
550 | | //! a smart pointer of MWAWInputStream |
551 | | typedef std::shared_ptr<MWAWInputStream> MWAWInputStreamPtr; |
552 | | //! a smart pointer of MWAWListener |
553 | | typedef std::shared_ptr<MWAWListener> MWAWListenerPtr; |
554 | | //! a smart pointer of MWAWListManager |
555 | | typedef std::shared_ptr<MWAWListManager> MWAWListManagerPtr; |
556 | | //! a smart pointer of MWAWParserState |
557 | | typedef std::shared_ptr<MWAWParserState> MWAWParserStatePtr; |
558 | | //! a smart pointer of MWAWPresentationListener |
559 | | typedef std::shared_ptr<MWAWPresentationListener> MWAWPresentationListenerPtr; |
560 | | //! a smart pointer of MWAWRSRCParser |
561 | | typedef std::shared_ptr<MWAWRSRCParser> MWAWRSRCParserPtr; |
562 | | //! a smart pointer of MWAWSpreadsheetListener |
563 | | typedef std::shared_ptr<MWAWSpreadsheetListener> MWAWSpreadsheetListenerPtr; |
564 | | //! a smart pointer of MWAWSubDocument |
565 | | typedef std::shared_ptr<MWAWSubDocument> MWAWSubDocumentPtr; |
566 | | //! a smart pointer of MWAWTextListener |
567 | | typedef std::shared_ptr<MWAWTextListener> MWAWTextListenerPtr; |
568 | | |
569 | | /** a generic variable template: value + flag to know if the variable is set |
570 | | |
571 | | \note the variable is considered set as soon a new value is set or |
572 | | when its content is acceded by a function which returns a not-const |
573 | | reference... You can use the function setSet to unset it. |
574 | | |
575 | | \note must be replaced by std::optional when we will be comptable with std::c++-17 |
576 | | */ |
577 | | template <class T> struct MWAWVariable { |
578 | | //! constructor |
579 | | MWAWVariable() |
580 | 2.64G | : m_data() |
581 | 6.97G | , m_set(false) {}MWAWVariable<MWAWFont::Script>::MWAWVariable() Line | Count | Source | 580 | 738M | : m_data() | 581 | 738M | , m_set(false) {} |
MWAWVariable<MWAWBorder>::MWAWVariable() Line | Count | Source | 580 | 116M | : m_data() | 581 | 116M | , m_set(false) {} |
MWAWVariable<MWAWColor>::MWAWVariable() Line | Count | Source | 580 | 1.02M | : m_data() | 581 | 1.02M | , m_set(false) {} |
MWAWVariable<FreeHandParserInternal::ScreenMode>::MWAWVariable() Line | Count | Source | 580 | 913k | : m_data() | 581 | 913k | , m_set(false) {} |
MWAWVariable<MWAWVec2<float> >::MWAWVariable() Line | Count | Source | 580 | 116M | : m_data() | 581 | 116M | , m_set(false) {} |
MWAWVariable<MsWrdStruct::ParagraphInfo>::MWAWVariable() Line | Count | Source | 580 | 115M | : m_data() | 581 | 115M | , m_set(false) {} |
MWAWVariable<MsWrdStruct::Font>::MWAWVariable() Line | Count | Source | 580 | 230M | : m_data() | 581 | 230M | , m_set(false) {} |
MWAWVariable<MsWrdStruct::Section>::MWAWVariable() Line | Count | Source | 580 | 115M | : m_data() | 581 | 115M | , m_set(false) {} |
MWAWVariable<MsWrdStruct::Table>::MWAWVariable() Line | Count | Source | 580 | 115M | : m_data() | 581 | 115M | , m_set(false) {} |
MWAWVariable<std::__1::vector<float, std::__1::allocator<float> > >::MWAWVariable() Line | Count | Source | 580 | 230M | : m_data() | 581 | 230M | , m_set(false) {} |
MWAWVariable<MsWrdStruct::Table::Cell>::MWAWVariable() Line | Count | Source | 580 | 118M | : m_data() | 581 | 118M | , m_set(false) {} |
MWAWVariable<std::__1::vector<MWAWTabStop, std::__1::allocator<MWAWTabStop> > >::MWAWVariable() Line | Count | Source | 580 | 370M | : m_data() | 581 | 370M | , m_set(false) {} |
MWAWVariable<MWAWListLevel>::MWAWVariable() Line | Count | Source | 580 | 370M | : m_data() | 581 | 370M | , m_set(false) {} |
MWAWVariable<std::__1::vector<long, std::__1::allocator<long> > >::MWAWVariable() Line | Count | Source | 580 | 511k | : m_data() | 581 | 511k | , m_set(false) {} |
MWAWVariable<int>::MWAWVariable() Line | Count | Source | 581 | 2.10G | , m_set(false) {} |
MWAWVariable<double>::MWAWVariable() Line | Count | Source | 581 | 2.22G | , m_set(false) {} |
|
582 | | //! constructor with a default value |
583 | | explicit MWAWVariable(T const &def) |
584 | 14.6G | : m_data(def) |
585 | 21.9G | , m_set(false) {}MWAWVariable<MWAWColor>::MWAWVariable(MWAWColor const&) Line | Count | Source | 584 | 4.08G | : m_data(def) | 585 | 4.08G | , m_set(false) {} |
MWAWVariable<MWAWFont::Line>::MWAWVariable(MWAWFont::Line const&) Line | Count | Source | 584 | 2.21G | : m_data(def) | 585 | 2.21G | , m_set(false) {} |
MWAWVariable<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::MWAWVariable(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Line | Count | Source | 584 | 738M | : m_data(def) | 585 | 738M | , m_set(false) {} |
MWAWVariable<MWAWBorder>::MWAWVariable(MWAWBorder const&) Line | Count | Source | 584 | 526k | : m_data(def) | 585 | 526k | , m_set(false) {} |
MWAWVariable<MWAWFont>::MWAWVariable(MWAWFont const&) Line | Count | Source | 584 | 234M | : m_data(def) | 585 | 234M | , m_set(false) {} |
MWAWVariable<MWAWVec2<float> >::MWAWVariable(MWAWVec2<float> const&) Line | Count | Source | 584 | 511k | : m_data(def) | 585 | 511k | , m_set(false) {} |
MWAWVariable<MsWrdStruct::Table::Cell>::MWAWVariable(MsWrdStruct::Table::Cell const&) Line | Count | Source | 584 | 23.8k | : m_data(def) | 585 | 23.8k | , m_set(false) {} |
MWAWVariable<int>::MWAWVariable(int const&) Line | Count | Source | 584 | 6.48G | : m_data(def) | 585 | 6.48G | , m_set(false) {} |
MWAWVariable<float>::MWAWVariable(float const&) Line | Count | Source | 584 | 2.92G | : m_data(def) | 585 | 2.92G | , m_set(false) {} |
MWAWVariable<bool>::MWAWVariable(bool const&) Line | Count | Source | 584 | 1.46G | : m_data(def) | 585 | 1.46G | , m_set(false) {} |
MWAWVariable<librevenge::RVNGUnit>::MWAWVariable(librevenge::RVNGUnit const&) Line | Count | Source | 584 | 1.47G | : m_data(def) | 585 | 1.47G | , m_set(false) {} |
MWAWVariable<unsigned int>::MWAWVariable(unsigned int const&) Line | Count | Source | 584 | 738M | : m_data(def) | 585 | 738M | , m_set(false) {} |
MWAWVariable<double>::MWAWVariable(double const&) Line | Count | Source | 584 | 116M | : m_data(def) | 585 | 116M | , m_set(false) {} |
MWAWVariable<MWAWParagraph::Justification>::MWAWVariable(MWAWParagraph::Justification const&) Line | Count | Source | 584 | 485M | : m_data(def) | 585 | 485M | , m_set(false) {} |
MWAWVariable<long>::MWAWVariable(long const&) Line | Count | Source | 584 | 234M | : m_data(def) | 585 | 234M | , m_set(false) {} |
MWAWVariable<MWAWParagraph::LineSpacingType>::MWAWVariable(MWAWParagraph::LineSpacingType const&) Line | Count | Source | 584 | 370M | : m_data(def) | 585 | 370M | , m_set(false) {} |
MWAWVariable<libmwaw::WritingMode>::MWAWVariable(libmwaw::WritingMode const&) Line | Count | Source | 584 | 370M | : m_data(def) | 585 | 370M | , m_set(false) {} |
|
586 | | //! copy constructor |
587 | | MWAWVariable(MWAWVariable const &orig) |
588 | 8.44G | : m_data(orig.m_data) |
589 | 15.5G | , m_set(orig.m_set) {}MWAWVariable<MWAWFont::Script>::MWAWVariable(MWAWVariable<MWAWFont::Script> const&) Line | Count | Source | 588 | 563M | : m_data(orig.m_data) | 589 | 563M | , m_set(orig.m_set) {} |
MWAWVariable<MWAWFont::Line>::MWAWVariable(MWAWVariable<MWAWFont::Line> const&) Line | Count | Source | 588 | 1.69G | : m_data(orig.m_data) | 589 | 1.69G | , m_set(orig.m_set) {} |
MWAWVariable<MWAWColor>::MWAWVariable(MWAWVariable<MWAWColor> const&) Line | Count | Source | 588 | 5.17G | : m_data(orig.m_data) | 589 | 5.17G | , m_set(orig.m_set) {} |
MWAWVariable<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::MWAWVariable(MWAWVariable<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&) Line | Count | Source | 588 | 563M | : m_data(orig.m_data) | 589 | 563M | , m_set(orig.m_set) {} |
MWAWVariable<std::__1::vector<MWAWTabStop, std::__1::allocator<MWAWTabStop> > >::MWAWVariable(MWAWVariable<std::__1::vector<MWAWTabStop, std::__1::allocator<MWAWTabStop> > > const&) Line | Count | Source | 588 | 143M | : m_data(orig.m_data) | 589 | 143M | , m_set(orig.m_set) {} |
MWAWVariable<MWAWListLevel>::MWAWVariable(MWAWVariable<MWAWListLevel> const&) Line | Count | Source | 588 | 143M | : m_data(orig.m_data) | 589 | 143M | , m_set(orig.m_set) {} |
MWAWVariable<MWAWBorder>::MWAWVariable(MWAWVariable<MWAWBorder> const&) Line | Count | Source | 588 | 26.0M | : m_data(orig.m_data) | 589 | 26.0M | , m_set(orig.m_set) {} |
MWAWVariable<MsWrdStruct::ParagraphInfo>::MWAWVariable(MWAWVariable<MsWrdStruct::ParagraphInfo> const&) Line | Count | Source | 588 | 10.7M | : m_data(orig.m_data) | 589 | 10.7M | , m_set(orig.m_set) {} |
MWAWVariable<MWAWVec2<float> >::MWAWVariable(MWAWVariable<MWAWVec2<float> > const&) Line | Count | Source | 588 | 12.6M | : m_data(orig.m_data) | 589 | 12.6M | , m_set(orig.m_set) {} |
MWAWVariable<MsWrdStruct::Font>::MWAWVariable(MWAWVariable<MsWrdStruct::Font> const&) Line | Count | Source | 588 | 21.4M | : m_data(orig.m_data) | 589 | 21.4M | , m_set(orig.m_set) {} |
MWAWVariable<MsWrdStruct::Section>::MWAWVariable(MWAWVariable<MsWrdStruct::Section> const&) Line | Count | Source | 588 | 10.7M | : m_data(orig.m_data) | 589 | 10.7M | , m_set(orig.m_set) {} |
MWAWVariable<MsWrdStruct::Table>::MWAWVariable(MWAWVariable<MsWrdStruct::Table> const&) Line | Count | Source | 588 | 10.7M | : m_data(orig.m_data) | 589 | 10.7M | , m_set(orig.m_set) {} |
MWAWVariable<std::__1::vector<float, std::__1::allocator<float> > >::MWAWVariable(MWAWVariable<std::__1::vector<float, std::__1::allocator<float> > > const&) Line | Count | Source | 588 | 21.4M | : m_data(orig.m_data) | 589 | 21.4M | , m_set(orig.m_set) {} |
MWAWVariable<MsWrdStruct::Table::Cell>::MWAWVariable(MWAWVariable<MsWrdStruct::Table::Cell> const&) Line | Count | Source | 588 | 22.0M | : m_data(orig.m_data) | 589 | 22.0M | , m_set(orig.m_set) {} |
MWAWVariable<MWAWFont>::MWAWVariable(MWAWVariable<MWAWFont> const&) Line | Count | Source | 588 | 26.0M | : m_data(orig.m_data) | 589 | 26.0M | , m_set(orig.m_set) {} |
MWAWVariable<std::__1::vector<long, std::__1::allocator<long> > >::MWAWVariable(MWAWVariable<std::__1::vector<long, std::__1::allocator<long> > > const&) Line | Count | Source | 588 | 260k | : m_data(orig.m_data) | 589 | 260k | , m_set(orig.m_set) {} |
MWAWVariable<int>::MWAWVariable(MWAWVariable<int> const&) Line | Count | Source | 588 | 1.85G | : m_data(orig.m_data) | 589 | 1.85G | , m_set(orig.m_set) {} |
MWAWVariable<float>::MWAWVariable(MWAWVariable<float> const&) Line | Count | Source | 588 | 1.78G | : m_data(orig.m_data) | 589 | 1.78G | , m_set(orig.m_set) {} |
MWAWVariable<bool>::MWAWVariable(MWAWVariable<bool> const&) Line | Count | Source | 588 | 751M | : m_data(orig.m_data) | 589 | 751M | , m_set(orig.m_set) {} |
MWAWVariable<librevenge::RVNGUnit>::MWAWVariable(MWAWVariable<librevenge::RVNGUnit> const&) Line | Count | Source | 588 | 850M | : m_data(orig.m_data) | 589 | 850M | , m_set(orig.m_set) {} |
MWAWVariable<unsigned int>::MWAWVariable(MWAWVariable<unsigned int> const&) Line | Count | Source | 588 | 563M | : m_data(orig.m_data) | 589 | 563M | , m_set(orig.m_set) {} |
MWAWVariable<double>::MWAWVariable(MWAWVariable<double> const&) Line | Count | Source | 588 | 872M | : m_data(orig.m_data) | 589 | 872M | , m_set(orig.m_set) {} |
MWAWVariable<MWAWParagraph::LineSpacingType>::MWAWVariable(MWAWVariable<MWAWParagraph::LineSpacingType> const&) Line | Count | Source | 588 | 143M | : m_data(orig.m_data) | 589 | 143M | , m_set(orig.m_set) {} |
MWAWVariable<MWAWParagraph::Justification>::MWAWVariable(MWAWVariable<MWAWParagraph::Justification> const&) Line | Count | Source | 588 | 154M | : m_data(orig.m_data) | 589 | 154M | , m_set(orig.m_set) {} |
MWAWVariable<libmwaw::WritingMode>::MWAWVariable(MWAWVariable<libmwaw::WritingMode> const&) Line | Count | Source | 588 | 143M | : m_data(orig.m_data) | 589 | 143M | , m_set(orig.m_set) {} |
MWAWVariable<long>::MWAWVariable(MWAWVariable<long> const&) Line | Count | Source | 588 | 26.0M | : m_data(orig.m_data) | 589 | 26.0M | , m_set(orig.m_set) {} |
|
590 | | //! copy operator |
591 | 317M | MWAWVariable &operator=(MWAWVariable const &) = default; MWAWVariable<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::operator=(MWAWVariable<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&) Line | Count | Source | 591 | 232M | MWAWVariable &operator=(MWAWVariable const &) = default; |
MWAWVariable<std::__1::vector<MWAWTabStop, std::__1::allocator<MWAWTabStop> > >::operator=(MWAWVariable<std::__1::vector<MWAWTabStop, std::__1::allocator<MWAWTabStop> > > const&) Line | Count | Source | 591 | 27.2M | MWAWVariable &operator=(MWAWVariable const &) = default; |
MWAWVariable<MWAWListLevel>::operator=(MWAWVariable<MWAWListLevel> const&) Line | Count | Source | 591 | 27.2M | MWAWVariable &operator=(MWAWVariable const &) = default; |
MWAWVariable<MWAWBorder>::operator=(MWAWVariable<MWAWBorder> const&) Line | Count | Source | 591 | 3.50M | MWAWVariable &operator=(MWAWVariable const &) = default; |
MWAWVariable<MsWrdStruct::ParagraphInfo>::operator=(MWAWVariable<MsWrdStruct::ParagraphInfo> const&) Line | Count | Source | 591 | 2.07M | MWAWVariable &operator=(MWAWVariable const &) = default; |
MWAWVariable<MsWrdStruct::Font>::operator=(MWAWVariable<MsWrdStruct::Font> const&) Line | Count | Source | 591 | 4.34M | MWAWVariable &operator=(MWAWVariable const &) = default; |
MWAWVariable<MsWrdStruct::Section>::operator=(MWAWVariable<MsWrdStruct::Section> const&) Line | Count | Source | 591 | 2.37M | MWAWVariable &operator=(MWAWVariable const &) = default; |
MWAWVariable<MsWrdStruct::Table>::operator=(MWAWVariable<MsWrdStruct::Table> const&) Line | Count | Source | 591 | 2.32M | MWAWVariable &operator=(MWAWVariable const &) = default; |
MWAWVariable<std::__1::vector<float, std::__1::allocator<float> > >::operator=(MWAWVariable<std::__1::vector<float, std::__1::allocator<float> > > const&) Line | Count | Source | 591 | 4.65M | MWAWVariable &operator=(MWAWVariable const &) = default; |
MWAWVariable<MsWrdStruct::Table::Cell>::operator=(MWAWVariable<MsWrdStruct::Table::Cell> const&) Line | Count | Source | 591 | 2.59M | MWAWVariable &operator=(MWAWVariable const &) = default; |
MWAWVariable<MWAWFont>::operator=(MWAWVariable<MWAWFont> const&) Line | Count | Source | 591 | 8.54M | MWAWVariable &operator=(MWAWVariable const &) = default; |
MWAWVariable<std::__1::vector<long, std::__1::allocator<long> > >::operator=(MWAWVariable<std::__1::vector<long, std::__1::allocator<long> > > const&) Line | Count | Source | 591 | 166k | MWAWVariable &operator=(MWAWVariable const &) = default; |
|
592 | | //! set a value |
593 | | MWAWVariable &operator=(T const &val) |
594 | 8.58G | { |
595 | 8.58G | m_data = val; |
596 | 8.58G | m_set = true; |
597 | 8.58G | return std::forward<MWAWVariable &>(*this); |
598 | 8.58G | } MWAWVariable<int>::operator=(int const&) Line | Count | Source | 594 | 161M | { | 595 | 161M | m_data = val; | 596 | 161M | m_set = true; | 597 | 161M | return std::forward<MWAWVariable &>(*this); | 598 | 161M | } |
MWAWVariable<float>::operator=(float const&) Line | Count | Source | 594 | 108M | { | 595 | 108M | m_data = val; | 596 | 108M | m_set = true; | 597 | 108M | return std::forward<MWAWVariable &>(*this); | 598 | 108M | } |
MWAWVariable<bool>::operator=(bool const&) Line | Count | Source | 594 | 209M | { | 595 | 209M | m_data = val; | 596 | 209M | m_set = true; | 597 | 209M | return std::forward<MWAWVariable &>(*this); | 598 | 209M | } |
MWAWVariable<librevenge::RVNGUnit>::operator=(librevenge::RVNGUnit const&) Line | Count | Source | 594 | 25.4M | { | 595 | 25.4M | m_data = val; | 596 | 25.4M | m_set = true; | 597 | 25.4M | return std::forward<MWAWVariable &>(*this); | 598 | 25.4M | } |
MWAWVariable<MWAWFont::Script>::operator=(MWAWFont::Script const&) Line | Count | Source | 594 | 101M | { | 595 | 101M | m_data = val; | 596 | 101M | m_set = true; | 597 | 101M | return std::forward<MWAWVariable &>(*this); | 598 | 101M | } |
MWAWVariable<unsigned int>::operator=(unsigned int const&) Line | Count | Source | 594 | 3.71G | { | 595 | 3.71G | m_data = val; | 596 | 3.71G | m_set = true; | 597 | 3.71G | return std::forward<MWAWVariable &>(*this); | 598 | 3.71G | } |
MWAWVariable<MWAWColor>::operator=(MWAWColor const&) Line | Count | Source | 594 | 1.58G | { | 595 | 1.58G | m_data = val; | 596 | 1.58G | m_set = true; | 597 | 1.58G | return std::forward<MWAWVariable &>(*this); | 598 | 1.58G | } |
MWAWVariable<MWAWFont::Line>::operator=(MWAWFont::Line const&) Line | Count | Source | 594 | 24.6M | { | 595 | 24.6M | m_data = val; | 596 | 24.6M | m_set = true; | 597 | 24.6M | return std::forward<MWAWVariable &>(*this); | 598 | 24.6M | } |
MWAWVariable<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::operator=(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Line | Count | Source | 594 | 3.97M | { | 595 | 3.97M | m_data = val; | 596 | 3.97M | m_set = true; | 597 | 3.97M | return std::forward<MWAWVariable &>(*this); | 598 | 3.97M | } |
MWAWVariable<double>::operator=(double const&) Line | Count | Source | 594 | 2.63G | { | 595 | 2.63G | m_data = val; | 596 | 2.63G | m_set = true; | 597 | 2.63G | return std::forward<MWAWVariable &>(*this); | 598 | 2.63G | } |
MWAWVariable<MWAWParagraph::LineSpacingType>::operator=(MWAWParagraph::LineSpacingType const&) Line | Count | Source | 594 | 4.11M | { | 595 | 4.11M | m_data = val; | 596 | 4.11M | m_set = true; | 597 | 4.11M | return std::forward<MWAWVariable &>(*this); | 598 | 4.11M | } |
MWAWVariable<MWAWParagraph::Justification>::operator=(MWAWParagraph::Justification const&) Line | Count | Source | 594 | 3.98M | { | 595 | 3.98M | m_data = val; | 596 | 3.98M | m_set = true; | 597 | 3.98M | return std::forward<MWAWVariable &>(*this); | 598 | 3.98M | } |
MWAWVariable<std::__1::vector<MWAWTabStop, std::__1::allocator<MWAWTabStop> > >::operator=(std::__1::vector<MWAWTabStop, std::__1::allocator<MWAWTabStop> > const&) Line | Count | Source | 594 | 3.25k | { | 595 | 3.25k | m_data = val; | 596 | 3.25k | m_set = true; | 597 | 3.25k | return std::forward<MWAWVariable &>(*this); | 598 | 3.25k | } |
MWAWVariable<MWAWListLevel>::operator=(MWAWListLevel const&) Line | Count | Source | 594 | 7.94k | { | 595 | 7.94k | m_data = val; | 596 | 7.94k | m_set = true; | 597 | 7.94k | return std::forward<MWAWVariable &>(*this); | 598 | 7.94k | } |
MWAWVariable<MWAWBorder>::operator=(MWAWBorder const&) Line | Count | Source | 594 | 2.83M | { | 595 | 2.83M | m_data = val; | 596 | 2.83M | m_set = true; | 597 | 2.83M | return std::forward<MWAWVariable &>(*this); | 598 | 2.83M | } |
MWAWVariable<libmwaw::WritingMode>::operator=(libmwaw::WritingMode const&) Line | Count | Source | 594 | 992k | { | 595 | 992k | m_data = val; | 596 | 992k | m_set = true; | 597 | 992k | return std::forward<MWAWVariable &>(*this); | 598 | 992k | } |
Unexecuted instantiation: MWAWVariable<MWAWFont>::operator=(MWAWFont const&) MWAWVariable<long>::operator=(long const&) Line | Count | Source | 594 | 41.6k | { | 595 | 41.6k | m_data = val; | 596 | 41.6k | m_set = true; | 597 | 41.6k | return std::forward<MWAWVariable &>(*this); | 598 | 41.6k | } |
MWAWVariable<MsWrdStruct::Font>::operator=(MsWrdStruct::Font const&) Line | Count | Source | 594 | 443k | { | 595 | 443k | m_data = val; | 596 | 443k | m_set = true; | 597 | 443k | return std::forward<MWAWVariable &>(*this); | 598 | 443k | } |
MWAWVariable<std::__1::vector<long, std::__1::allocator<long> > >::operator=(std::__1::vector<long, std::__1::allocator<long> > const&) Line | Count | Source | 594 | 9.64k | { | 595 | 9.64k | m_data = val; | 596 | 9.64k | m_set = true; | 597 | 9.64k | return std::forward<MWAWVariable &>(*this); | 598 | 9.64k | } |
MWAWVariable<MWAWVec2<float> >::operator=(MWAWVec2<float> const&) Line | Count | Source | 594 | 4.42k | { | 595 | 4.42k | m_data = val; | 596 | 4.42k | m_set = true; | 597 | 4.42k | return std::forward<MWAWVariable &>(*this); | 598 | 4.42k | } |
|
599 | | //! update the current value if orig is set |
600 | | void insert(MWAWVariable const &orig) |
601 | 17.6M | { |
602 | 17.6M | if (orig.m_set) { |
603 | 2.10M | m_data = orig.m_data; |
604 | 2.10M | m_set = orig.m_set; |
605 | 2.10M | } |
606 | 17.6M | } MWAWVariable<int>::insert(MWAWVariable<int> const&) Line | Count | Source | 601 | 6.52M | { | 602 | 6.52M | if (orig.m_set) { | 603 | 558k | m_data = orig.m_data; | 604 | 558k | m_set = orig.m_set; | 605 | 558k | } | 606 | 6.52M | } |
MWAWVariable<float>::insert(MWAWVariable<float> const&) Line | Count | Source | 601 | 2.50M | { | 602 | 2.50M | if (orig.m_set) { | 603 | 115k | m_data = orig.m_data; | 604 | 115k | m_set = orig.m_set; | 605 | 115k | } | 606 | 2.50M | } |
MWAWVariable<bool>::insert(MWAWVariable<bool> const&) Line | Count | Source | 601 | 1.03M | { | 602 | 1.03M | if (orig.m_set) { | 603 | 611k | m_data = orig.m_data; | 604 | 611k | m_set = orig.m_set; | 605 | 611k | } | 606 | 1.03M | } |
MWAWVariable<librevenge::RVNGUnit>::insert(MWAWVariable<librevenge::RVNGUnit> const&) Line | Count | Source | 601 | 728k | { | 602 | 728k | if (orig.m_set) { | 603 | 8.87k | m_data = orig.m_data; | 604 | 8.87k | m_set = orig.m_set; | 605 | 8.87k | } | 606 | 728k | } |
MWAWVariable<MWAWFont::Script>::insert(MWAWVariable<MWAWFont::Script> const&) Line | Count | Source | 601 | 116k | { | 602 | 116k | if (orig.m_set) { | 603 | 66.5k | m_data = orig.m_data; | 604 | 66.5k | m_set = orig.m_set; | 605 | 66.5k | } | 606 | 116k | } |
MWAWVariable<MWAWFont::Line>::insert(MWAWVariable<MWAWFont::Line> const&) Line | Count | Source | 601 | 348k | { | 602 | 348k | if (orig.m_set) { | 603 | 31.0k | m_data = orig.m_data; | 604 | 31.0k | m_set = orig.m_set; | 605 | 31.0k | } | 606 | 348k | } |
MWAWVariable<MWAWColor>::insert(MWAWVariable<MWAWColor> const&) Line | Count | Source | 601 | 538k | { | 602 | 538k | if (orig.m_set) { | 603 | 232k | m_data = orig.m_data; | 604 | 232k | m_set = orig.m_set; | 605 | 232k | } | 606 | 538k | } |
MWAWVariable<double>::insert(MWAWVariable<double> const&) Line | Count | Source | 601 | 2.14M | { | 602 | 2.14M | if (orig.m_set) { | 603 | 193k | m_data = orig.m_data; | 604 | 193k | m_set = orig.m_set; | 605 | 193k | } | 606 | 2.14M | } |
MWAWVariable<MWAWParagraph::LineSpacingType>::insert(MWAWVariable<MWAWParagraph::LineSpacingType> const&) Line | Count | Source | 601 | 305k | { | 602 | 305k | if (orig.m_set) { | 603 | 0 | m_data = orig.m_data; | 604 | 0 | m_set = orig.m_set; | 605 | 0 | } | 606 | 305k | } |
MWAWVariable<MWAWParagraph::Justification>::insert(MWAWVariable<MWAWParagraph::Justification> const&) Line | Count | Source | 601 | 313k | { | 602 | 313k | if (orig.m_set) { | 603 | 19.4k | m_data = orig.m_data; | 604 | 19.4k | m_set = orig.m_set; | 605 | 19.4k | } | 606 | 313k | } |
MWAWVariable<libmwaw::WritingMode>::insert(MWAWVariable<libmwaw::WritingMode> const&) Line | Count | Source | 601 | 305k | { | 602 | 305k | if (orig.m_set) { | 603 | 0 | m_data = orig.m_data; | 604 | 0 | m_set = orig.m_set; | 605 | 0 | } | 606 | 305k | } |
MWAWVariable<MWAWListLevel>::insert(MWAWVariable<MWAWListLevel> const&) Line | Count | Source | 601 | 305k | { | 602 | 305k | if (orig.m_set) { | 603 | 0 | m_data = orig.m_data; | 604 | 0 | m_set = orig.m_set; | 605 | 0 | } | 606 | 305k | } |
MWAWVariable<MWAWBorder>::insert(MWAWVariable<MWAWBorder> const&) Line | Count | Source | 601 | 196k | { | 602 | 196k | if (orig.m_set) { | 603 | 92.8k | m_data = orig.m_data; | 604 | 92.8k | m_set = orig.m_set; | 605 | 92.8k | } | 606 | 196k | } |
MWAWVariable<long>::insert(MWAWVariable<long> const&) Line | Count | Source | 601 | 2.12M | { | 602 | 2.12M | if (orig.m_set) { | 603 | 34.4k | m_data = orig.m_data; | 604 | 34.4k | m_set = orig.m_set; | 605 | 34.4k | } | 606 | 2.12M | } |
MWAWVariable<std::__1::vector<float, std::__1::allocator<float> > >::insert(MWAWVariable<std::__1::vector<float, std::__1::allocator<float> > > const&) Line | Count | Source | 601 | 7.65k | { | 602 | 7.65k | if (orig.m_set) { | 603 | 7.56k | m_data = orig.m_data; | 604 | 7.56k | m_set = orig.m_set; | 605 | 7.56k | } | 606 | 7.65k | } |
Unexecuted instantiation: MWAWVariable<MWAWVec2<float> >::insert(MWAWVariable<MWAWVec2<float> > const&) MWAWVariable<MsWrdStruct::ParagraphInfo>::insert(MWAWVariable<MsWrdStruct::ParagraphInfo> const&) Line | Count | Source | 601 | 137k | { | 602 | 137k | if (orig.m_set) { | 603 | 137k | m_data = orig.m_data; | 604 | 137k | m_set = orig.m_set; | 605 | 137k | } | 606 | 137k | } |
|
607 | | //! operator* |
608 | | T const *operator->() const |
609 | 250M | { |
610 | 250M | return &m_data; |
611 | 250M | } MWAWVariable<MWAWFont::Line>::operator->() const Line | Count | Source | 609 | 37.0M | { | 610 | 37.0M | return &m_data; | 611 | 37.0M | } |
MWAWVariable<MWAWColor>::operator->() const Line | Count | Source | 609 | 113M | { | 610 | 113M | return &m_data; | 611 | 113M | } |
MWAWVariable<std::__1::vector<MWAWTabStop, std::__1::allocator<MWAWTabStop> > >::operator->() const Line | Count | Source | 609 | 64.3M | { | 610 | 64.3M | return &m_data; | 611 | 64.3M | } |
MWAWVariable<MWAWBorder>::operator->() const Line | Count | Source | 609 | 278k | { | 610 | 278k | return &m_data; | 611 | 278k | } |
MWAWVariable<std::__1::vector<float, std::__1::allocator<float> > >::operator->() const Line | Count | Source | 609 | 27.7k | { | 610 | 27.7k | return &m_data; | 611 | 27.7k | } |
MWAWVariable<MWAWFont::Script>::operator->() const Line | Count | Source | 609 | 27.5M | { | 610 | 27.5M | return &m_data; | 611 | 27.5M | } |
MWAWVariable<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::operator->() const Line | Count | Source | 609 | 1.28M | { | 610 | 1.28M | return &m_data; | 611 | 1.28M | } |
MWAWVariable<MWAWListLevel>::operator->() const Line | Count | Source | 609 | 5.81M | { | 610 | 5.81M | return &m_data; | 611 | 5.81M | } |
MWAWVariable<std::__1::vector<long, std::__1::allocator<long> > >::operator->() const Line | Count | Source | 609 | 13.5k | { | 610 | 13.5k | return &m_data; | 611 | 13.5k | } |
MWAWVariable<MWAWFont>::operator->() const Line | Count | Source | 609 | 12.7k | { | 610 | 12.7k | return &m_data; | 611 | 12.7k | } |
MWAWVariable<MsWrdStruct::ParagraphInfo>::operator->() const Line | Count | Source | 609 | 188k | { | 610 | 188k | return &m_data; | 611 | 188k | } |
Unexecuted instantiation: MWAWVariable<MsWrdStruct::Font>::operator->() const |
612 | | /** operator* */ |
613 | | T *operator->() |
614 | 74.9M | { |
615 | 74.9M | m_set = true; |
616 | 74.9M | return &m_data; |
617 | 74.9M | } MWAWVariable<MWAWFont::Line>::operator->() Line | Count | Source | 614 | 3.54M | { | 615 | 3.54M | m_set = true; | 616 | 3.54M | return &m_data; | 617 | 3.54M | } |
MWAWVariable<std::__1::vector<MWAWTabStop, std::__1::allocator<MWAWTabStop> > >::operator->() Line | Count | Source | 614 | 34.9M | { | 615 | 34.9M | m_set = true; | 616 | 34.9M | return &m_data; | 617 | 34.9M | } |
MWAWVariable<MWAWListLevel>::operator->() Line | Count | Source | 614 | 8.44k | { | 615 | 8.44k | m_set = true; | 616 | 8.44k | return &m_data; | 617 | 8.44k | } |
Unexecuted instantiation: MWAWVariable<MWAWBorder>::operator->() MWAWVariable<MsWrdStruct::Table>::operator->() Line | Count | Source | 614 | 9.81M | { | 615 | 9.81M | m_set = true; | 616 | 9.81M | return &m_data; | 617 | 9.81M | } |
MWAWVariable<MWAWFont>::operator->() Line | Count | Source | 614 | 8.27M | { | 615 | 8.27M | m_set = true; | 616 | 8.27M | return &m_data; | 617 | 8.27M | } |
MWAWVariable<MsWrdStruct::Font>::operator->() Line | Count | Source | 614 | 950k | { | 615 | 950k | m_set = true; | 616 | 950k | return &m_data; | 617 | 950k | } |
MWAWVariable<MsWrdStruct::ParagraphInfo>::operator->() Line | Count | Source | 614 | 1.22M | { | 615 | 1.22M | m_set = true; | 616 | 1.22M | return &m_data; | 617 | 1.22M | } |
MWAWVariable<std::__1::vector<float, std::__1::allocator<float> > >::operator->() Line | Count | Source | 614 | 112k | { | 615 | 112k | m_set = true; | 616 | 112k | return &m_data; | 617 | 112k | } |
MWAWVariable<MsWrdStruct::Table::Cell>::operator->() Line | Count | Source | 614 | 1.73M | { | 615 | 1.73M | m_set = true; | 616 | 1.73M | return &m_data; | 617 | 1.73M | } |
MWAWVariable<MWAWVec2<float> >::operator->() Line | Count | Source | 614 | 3.84M | { | 615 | 3.84M | m_set = true; | 616 | 3.84M | return &m_data; | 617 | 3.84M | } |
MWAWVariable<MsWrdStruct::Section>::operator->() Line | Count | Source | 614 | 10.4M | { | 615 | 10.4M | m_set = true; | 616 | 10.4M | return &m_data; | 617 | 10.4M | } |
|
618 | | //! operator* |
619 | | T const &operator*() const |
620 | 920M | { |
621 | 920M | return m_data; |
622 | 920M | } MWAWVariable<MWAWColor>::operator*() const Line | Count | Source | 620 | 23.2M | { | 621 | 23.2M | return m_data; | 622 | 23.2M | } |
MWAWVariable<int>::operator*() const Line | Count | Source | 620 | 192M | { | 621 | 192M | return m_data; | 622 | 192M | } |
MWAWVariable<MWAWListLevel>::operator*() const Line | Count | Source | 620 | 5.82M | { | 621 | 5.82M | return m_data; | 622 | 5.82M | } |
Unexecuted instantiation: MWAWVariable<FreeHandParserInternal::ScreenMode>::operator*() const MWAWVariable<double>::operator*() const Line | Count | Source | 620 | 343M | { | 621 | 343M | return m_data; | 622 | 343M | } |
MWAWVariable<std::__1::vector<MWAWTabStop, std::__1::allocator<MWAWTabStop> > >::operator*() const Line | Count | Source | 620 | 16.6M | { | 621 | 16.6M | return m_data; | 622 | 16.6M | } |
MWAWVariable<float>::operator*() const Line | Count | Source | 620 | 402 | { | 621 | 402 | return m_data; | 622 | 402 | } |
MWAWVariable<MWAWBorder>::operator*() const Line | Count | Source | 620 | 322k | { | 621 | 322k | return m_data; | 622 | 322k | } |
MWAWVariable<MWAWVec2<float> >::operator*() const Line | Count | Source | 620 | 234 | { | 621 | 234 | return m_data; | 622 | 234 | } |
MWAWVariable<MWAWParagraph::Justification>::operator*() const Line | Count | Source | 620 | 53.4M | { | 621 | 53.4M | return m_data; | 622 | 53.4M | } |
MWAWVariable<librevenge::RVNGUnit>::operator*() const Line | Count | Source | 620 | 155M | { | 621 | 155M | return m_data; | 622 | 155M | } |
MWAWVariable<MWAWParagraph::LineSpacingType>::operator*() const Line | Count | Source | 620 | 51.4M | { | 621 | 51.4M | return m_data; | 622 | 51.4M | } |
MWAWVariable<bool>::operator*() const Line | Count | Source | 620 | 27.8M | { | 621 | 27.8M | return m_data; | 622 | 27.8M | } |
MWAWVariable<libmwaw::WritingMode>::operator*() const Line | Count | Source | 620 | 49.7M | { | 621 | 49.7M | return m_data; | 622 | 49.7M | } |
MWAWVariable<std::__1::vector<long, std::__1::allocator<long> > >::operator*() const Line | Count | Source | 620 | 6.97k | { | 621 | 6.97k | return m_data; | 622 | 6.97k | } |
MWAWVariable<MsWrdStruct::Table::Cell>::operator*() const Line | Count | Source | 620 | 16.8k | { | 621 | 16.8k | return m_data; | 622 | 16.8k | } |
Unexecuted instantiation: MWAWVariable<std::__1::vector<float, std::__1::allocator<float> > >::operator*() const Unexecuted instantiation: MWAWVariable<MsWrdStruct::ParagraphInfo>::operator*() const MWAWVariable<MsWrdStruct::Font>::operator*() const Line | Count | Source | 620 | 424k | { | 621 | 424k | return m_data; | 622 | 424k | } |
MWAWVariable<MsWrdStruct::Section>::operator*() const Line | Count | Source | 620 | 5.03k | { | 621 | 5.03k | return m_data; | 622 | 5.03k | } |
MWAWVariable<MsWrdStruct::Table>::operator*() const Line | Count | Source | 620 | 7.65k | { | 621 | 7.65k | return m_data; | 622 | 7.65k | } |
|
623 | | //! operator* |
624 | | T &operator*() |
625 | 443M | { |
626 | 443M | m_set = true; |
627 | 443M | return m_data; |
628 | 443M | } MWAWVariable<double>::operator*() Line | Count | Source | 625 | 303M | { | 626 | 303M | m_set = true; | 627 | 303M | return m_data; | 628 | 303M | } |
MWAWVariable<std::__1::vector<MWAWTabStop, std::__1::allocator<MWAWTabStop> > >::operator*() Line | Count | Source | 625 | 104M | { | 626 | 104M | m_set = true; | 627 | 104M | return m_data; | 628 | 104M | } |
Unexecuted instantiation: MWAWVariable<MWAWColor>::operator*() MWAWVariable<int>::operator*() Line | Count | Source | 625 | 34.7M | { | 626 | 34.7M | m_set = true; | 627 | 34.7M | return m_data; | 628 | 34.7M | } |
MWAWVariable<MWAWListLevel>::operator*() Line | Count | Source | 625 | 13.0k | { | 626 | 13.0k | m_set = true; | 627 | 13.0k | return m_data; | 628 | 13.0k | } |
MWAWVariable<FreeHandParserInternal::ScreenMode>::operator*() Line | Count | Source | 625 | 63.5k | { | 626 | 63.5k | m_set = true; | 627 | 63.5k | return m_data; | 628 | 63.5k | } |
MWAWVariable<MWAWFont>::operator*() Line | Count | Source | 625 | 644k | { | 626 | 644k | m_set = true; | 627 | 644k | return m_data; | 628 | 644k | } |
MWAWVariable<MsWrdStruct::Font>::operator*() Line | Count | Source | 625 | 180k | { | 626 | 180k | m_set = true; | 627 | 180k | return m_data; | 628 | 180k | } |
MWAWVariable<MsWrdStruct::Section>::operator*() Line | Count | Source | 625 | 217 | { | 626 | 217 | m_set = true; | 627 | 217 | return m_data; | 628 | 217 | } |
MWAWVariable<librevenge::RVNGUnit>::operator*() Line | Count | Source | 625 | 155k | { | 626 | 155k | m_set = true; | 627 | 155k | return m_data; | 628 | 155k | } |
MWAWVariable<std::__1::vector<float, std::__1::allocator<float> > >::operator*() Line | Count | Source | 625 | 30.4k | { | 626 | 30.4k | m_set = true; | 627 | 30.4k | return m_data; | 628 | 30.4k | } |
|
629 | | //! return the current value |
630 | | T const &get() const |
631 | 11.1G | { |
632 | 11.1G | return m_data; |
633 | 11.1G | } MWAWVariable<MWAWColor>::get() const Line | Count | Source | 631 | 1.35G | { | 632 | 1.35G | return m_data; | 633 | 1.35G | } |
MWAWVariable<int>::get() const Line | Count | Source | 631 | 3.29G | { | 632 | 3.29G | return m_data; | 633 | 3.29G | } |
MWAWVariable<float>::get() const Line | Count | Source | 631 | 1.01G | { | 632 | 1.01G | return m_data; | 633 | 1.01G | } |
MWAWVariable<librevenge::RVNGUnit>::get() const Line | Count | Source | 631 | 274M | { | 632 | 274M | return m_data; | 633 | 274M | } |
MWAWVariable<MWAWFont::Script>::get() const Line | Count | Source | 631 | 159M | { | 632 | 159M | return m_data; | 633 | 159M | } |
MWAWVariable<unsigned int>::get() const Line | Count | Source | 631 | 4.07G | { | 632 | 4.07G | return m_data; | 633 | 4.07G | } |
MWAWVariable<MWAWFont::Line>::get() const Line | Count | Source | 631 | 391M | { | 632 | 391M | return m_data; | 633 | 391M | } |
MWAWVariable<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::get() const Line | Count | Source | 631 | 250M | { | 632 | 250M | return m_data; | 633 | 250M | } |
MWAWVariable<bool>::get() const Line | Count | Source | 631 | 323M | { | 632 | 323M | return m_data; | 633 | 323M | } |
MWAWVariable<double>::get() const Line | Count | Source | 631 | 8.69M | { | 632 | 8.69M | return m_data; | 633 | 8.69M | } |
MWAWVariable<long>::get() const Line | Count | Source | 631 | 644k | { | 632 | 644k | return m_data; | 633 | 644k | } |
MWAWVariable<MsWrdStruct::Table>::get() const Line | Count | Source | 631 | 27.7k | { | 632 | 27.7k | return m_data; | 633 | 27.7k | } |
MWAWVariable<std::__1::vector<float, std::__1::allocator<float> > >::get() const Line | Count | Source | 631 | 48.1k | { | 632 | 48.1k | return m_data; | 633 | 48.1k | } |
MWAWVariable<MsWrdStruct::Table::Cell>::get() const Line | Count | Source | 631 | 16.7k | { | 632 | 16.7k | return m_data; | 633 | 16.7k | } |
MWAWVariable<MWAWBorder>::get() const Line | Count | Source | 631 | 621k | { | 632 | 621k | return m_data; | 633 | 621k | } |
MWAWVariable<MWAWFont>::get() const Line | Count | Source | 631 | 118k | { | 632 | 118k | return m_data; | 633 | 118k | } |
Unexecuted instantiation: MWAWVariable<MsWrdStruct::ParagraphInfo>::get() const MWAWVariable<MsWrdStruct::Font>::get() const Line | Count | Source | 631 | 82.6k | { | 632 | 82.6k | return m_data; | 633 | 82.6k | } |
Unexecuted instantiation: MWAWVariable<MWAWParagraph::LineSpacingType>::get() const Unexecuted instantiation: MWAWVariable<libmwaw::WritingMode>::get() const Unexecuted instantiation: MWAWVariable<MWAWParagraph::Justification>::get() const Unexecuted instantiation: MWAWVariable<MWAWListLevel>::get() const Unexecuted instantiation: MWAWVariable<MsWrdStruct::Section>::get() const |
634 | | //! return true if the variable is set |
635 | | bool isSet() const |
636 | 1.31G | { |
637 | 1.31G | return m_set; |
638 | 1.31G | } MWAWVariable<MWAWColor>::isSet() const Line | Count | Source | 636 | 538M | { | 637 | 538M | return m_set; | 638 | 538M | } |
MWAWVariable<int>::isSet() const Line | Count | Source | 636 | 33.5M | { | 637 | 33.5M | return m_set; | 638 | 33.5M | } |
MWAWVariable<unsigned int>::isSet() const Line | Count | Source | 636 | 48.3M | { | 637 | 48.3M | return m_set; | 638 | 48.3M | } |
MWAWVariable<MWAWFont::Line>::isSet() const Line | Count | Source | 636 | 291M | { | 637 | 291M | return m_set; | 638 | 291M | } |
Unexecuted instantiation: MWAWVariable<FreeHandParserInternal::ScreenMode>::isSet() const MWAWVariable<double>::isSet() const Line | Count | Source | 636 | 629k | { | 637 | 629k | return m_set; | 638 | 629k | } |
MWAWVariable<MWAWBorder>::isSet() const Line | Count | Source | 636 | 1.39M | { | 637 | 1.39M | return m_set; | 638 | 1.39M | } |
MWAWVariable<MsWrdStruct::Table>::isSet() const Line | Count | Source | 636 | 10.1M | { | 637 | 10.1M | return m_set; | 638 | 10.1M | } |
MWAWVariable<std::__1::vector<float, std::__1::allocator<float> > >::isSet() const Line | Count | Source | 636 | 40.0k | { | 637 | 40.0k | return m_set; | 638 | 40.0k | } |
MWAWVariable<float>::isSet() const Line | Count | Source | 636 | 186M | { | 637 | 186M | return m_set; | 638 | 186M | } |
MWAWVariable<MsWrdStruct::Table::Cell>::isSet() const Line | Count | Source | 636 | 50.3k | { | 637 | 50.3k | return m_set; | 638 | 50.3k | } |
MWAWVariable<MWAWVec2<float> >::isSet() const Line | Count | Source | 636 | 48.6k | { | 637 | 48.6k | return m_set; | 638 | 48.6k | } |
MWAWVariable<MsWrdStruct::Font>::isSet() const Line | Count | Source | 636 | 1.62M | { | 637 | 1.62M | return m_set; | 638 | 1.62M | } |
MWAWVariable<MsWrdStruct::Section>::isSet() const Line | Count | Source | 636 | 10.7M | { | 637 | 10.7M | return m_set; | 638 | 10.7M | } |
MWAWVariable<MWAWFont::Script>::isSet() const Line | Count | Source | 636 | 92.9M | { | 637 | 92.9M | return m_set; | 638 | 92.9M | } |
MWAWVariable<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::isSet() const Line | Count | Source | 636 | 92.9M | { | 637 | 92.9M | return m_set; | 638 | 92.9M | } |
MWAWVariable<std::__1::vector<MWAWTabStop, std::__1::allocator<MWAWTabStop> > >::isSet() const Line | Count | Source | 636 | 919k | { | 637 | 919k | return m_set; | 638 | 919k | } |
MWAWVariable<std::__1::vector<long, std::__1::allocator<long> > >::isSet() const Line | Count | Source | 636 | 95.5k | { | 637 | 95.5k | return m_set; | 638 | 95.5k | } |
MWAWVariable<bool>::isSet() const Line | Count | Source | 636 | 102k | { | 637 | 102k | return m_set; | 638 | 102k | } |
MWAWVariable<MWAWFont>::isSet() const Line | Count | Source | 636 | 5.75M | { | 637 | 5.75M | return m_set; | 638 | 5.75M | } |
Unexecuted instantiation: MWAWVariable<MWAWParagraph::Justification>::isSet() const MWAWVariable<MsWrdStruct::ParagraphInfo>::isSet() const Line | Count | Source | 636 | 305k | { | 637 | 305k | return m_set; | 638 | 305k | } |
|
639 | | //! define if the variable is set |
640 | | void setSet(bool newVal) |
641 | 2.61G | { |
642 | 2.61G | m_set=newVal; |
643 | 2.61G | } Unexecuted instantiation: MWAWVariable<MWAWColor>::setSet(bool) MWAWVariable<MsWrdStruct::Font>::setSet(bool) Line | Count | Source | 641 | 916k | { | 642 | 916k | m_set=newVal; | 643 | 916k | } |
MWAWVariable<double>::setSet(bool) Line | Count | Source | 641 | 2.59G | { | 642 | 2.59G | m_set=newVal; | 643 | 2.59G | } |
MWAWVariable<MsWrdStruct::Table::Cell>::setSet(bool) Line | Count | Source | 641 | 23.8k | { | 642 | 23.8k | m_set=newVal; | 643 | 23.8k | } |
MWAWVariable<MsWrdStruct::Section>::setSet(bool) Line | Count | Source | 641 | 9.35M | { | 642 | 9.35M | m_set=newVal; | 643 | 9.35M | } |
MWAWVariable<MsWrdStruct::Table>::setSet(bool) Line | Count | Source | 641 | 8.57M | { | 642 | 8.57M | m_set=newVal; | 643 | 8.57M | } |
|
644 | | protected: |
645 | | //! the value |
646 | | T m_data; |
647 | | //! a flag to know if the variable is set or not |
648 | | bool m_set; |
649 | | }; |
650 | | |
651 | | /* ---------- vec2/box2f ------------- */ |
652 | | /*! \class MWAWVec2 |
653 | | * \brief small class which defines a vector with 2 elements |
654 | | */ |
655 | | template <class T> class MWAWVec2 |
656 | | { |
657 | | public: |
658 | | //! constructor |
659 | | explicit MWAWVec2(T xx=0,T yy=0) |
660 | 8.58G | : m_x(xx) |
661 | 8.58G | , m_y(yy) { }MWAWVec2<float>::MWAWVec2(float, float) Line | Count | Source | 660 | 5.71G | : m_x(xx) | 661 | 5.71G | , m_y(yy) { } |
MWAWVec2<int>::MWAWVec2(int, int) Line | Count | Source | 660 | 2.80G | : m_x(xx) | 661 | 2.80G | , m_y(yy) { } |
MWAWVec2<bool>::MWAWVec2(bool, bool) Line | Count | Source | 660 | 56.8M | : m_x(xx) | 661 | 56.8M | , m_y(yy) { } |
MWAWVec2<long>::MWAWVec2(long, long) Line | Count | Source | 660 | 5.14M | : m_x(xx) | 661 | 5.14M | , m_y(yy) { } |
|
662 | | //! generic copy constructor |
663 | | template <class U> explicit MWAWVec2(MWAWVec2<U> const &p) |
664 | 32.3M | : m_x(T(p.x())) |
665 | 32.3M | , m_y(T(p.y())) {}MWAWVec2<float>::MWAWVec2<int>(MWAWVec2<int> const&) Line | Count | Source | 664 | 24.1M | : m_x(T(p.x())) | 665 | 24.1M | , m_y(T(p.y())) {} |
MWAWVec2<int>::MWAWVec2<float>(MWAWVec2<float> const&) Line | Count | Source | 664 | 8.14M | : m_x(T(p.x())) | 665 | 8.14M | , m_y(T(p.y())) {} |
|
666 | | |
667 | | //! first element |
668 | | T x() const |
669 | 311M | { |
670 | 311M | return m_x; |
671 | 311M | } MWAWVec2<float>::x() const Line | Count | Source | 669 | 117M | { | 670 | 117M | return m_x; | 671 | 117M | } |
Line | Count | Source | 669 | 193M | { | 670 | 193M | return m_x; | 671 | 193M | } |
|
672 | | //! second element |
673 | | T y() const |
674 | 351M | { |
675 | 351M | return m_y; |
676 | 351M | } MWAWVec2<float>::y() const Line | Count | Source | 674 | 175M | { | 675 | 175M | return m_y; | 676 | 175M | } |
Line | Count | Source | 674 | 175M | { | 675 | 175M | return m_y; | 676 | 175M | } |
|
677 | | //! operator[] |
678 | | T operator[](int c) const |
679 | 3.16G | { |
680 | 3.16G | if (c<0 || c>1) throw libmwaw::GenericException(); |
681 | 3.16G | return (c==0) ? m_x : m_y; |
682 | 3.16G | } MWAWVec2<float>::operator[](int) const Line | Count | Source | 679 | 2.32G | { | 680 | 2.32G | if (c<0 || c>1) throw libmwaw::GenericException(); | 681 | 2.32G | return (c==0) ? m_x : m_y; | 682 | 2.32G | } |
MWAWVec2<int>::operator[](int) const Line | Count | Source | 679 | 832M | { | 680 | 832M | if (c<0 || c>1) throw libmwaw::GenericException(); | 681 | 832M | return (c==0) ? m_x : m_y; | 682 | 832M | } |
MWAWVec2<long>::operator[](int) const Line | Count | Source | 679 | 4.56M | { | 680 | 4.56M | if (c<0 || c>1) throw libmwaw::GenericException(); | 681 | 4.56M | return (c==0) ? m_x : m_y; | 682 | 4.56M | } |
MWAWVec2<bool>::operator[](int) const Line | Count | Source | 679 | 4.21M | { | 680 | 4.21M | if (c<0 || c>1) throw libmwaw::GenericException(); | 681 | 4.21M | return (c==0) ? m_x : m_y; | 682 | 4.21M | } |
|
683 | | //! operator[] |
684 | | T &operator[](int c) |
685 | 3.35G | { |
686 | 3.35G | if (c<0 || c>1) throw libmwaw::GenericException(); |
687 | 3.35G | return (c==0) ? m_x : m_y; |
688 | 3.35G | } MWAWVec2<float>::operator[](int) Line | Count | Source | 685 | 1.17G | { | 686 | 1.17G | if (c<0 || c>1) throw libmwaw::GenericException(); | 687 | 1.17G | return (c==0) ? m_x : m_y; | 688 | 1.17G | } |
MWAWVec2<int>::operator[](int) Line | Count | Source | 685 | 2.06G | { | 686 | 2.06G | if (c<0 || c>1) throw libmwaw::GenericException(); | 687 | 2.06G | return (c==0) ? m_x : m_y; | 688 | 2.06G | } |
MWAWVec2<bool>::operator[](int) Line | Count | Source | 685 | 1.46M | { | 686 | 1.46M | if (c<0 || c>1) throw libmwaw::GenericException(); | 687 | 1.46M | return (c==0) ? m_x : m_y; | 688 | 1.46M | } |
MWAWVec2<long>::operator[](int) Line | Count | Source | 685 | 118M | { | 686 | 118M | if (c<0 || c>1) throw libmwaw::GenericException(); | 687 | 118M | return (c==0) ? m_x : m_y; | 688 | 118M | } |
|
689 | | |
690 | | //! resets the two elements |
691 | | void set(T xx, T yy) |
692 | 82.7M | { |
693 | 82.7M | m_x = xx; |
694 | 82.7M | m_y = yy; |
695 | 82.7M | } |
696 | | //! resets the first element |
697 | | void setX(T xx) |
698 | 1.92M | { |
699 | 1.92M | m_x = xx; |
700 | 1.92M | } |
701 | | //! resets the second element |
702 | | void setY(T yy) |
703 | 2.61M | { |
704 | 2.61M | m_y = yy; |
705 | 2.61M | } |
706 | | |
707 | | //! increases the actuals values by \a dx and \a dy |
708 | | void add(T dx, T dy) |
709 | 965M | { |
710 | 965M | if (libmwaw::checkAddOverflow(m_x, dx) || libmwaw::checkAddOverflow(m_y, dy)) |
711 | 63 | throw libmwaw::GenericException(); |
712 | 965M | m_x += dx; |
713 | 965M | m_y += dy; |
714 | 965M | } MWAWVec2<float>::add(float, float) Line | Count | Source | 709 | 938M | { | 710 | 938M | if (libmwaw::checkAddOverflow(m_x, dx) || libmwaw::checkAddOverflow(m_y, dy)) | 711 | 58 | throw libmwaw::GenericException(); | 712 | 938M | m_x += dx; | 713 | 938M | m_y += dy; | 714 | 938M | } |
MWAWVec2<int>::add(int, int) Line | Count | Source | 709 | 26.7M | { | 710 | 26.7M | if (libmwaw::checkAddOverflow(m_x, dx) || libmwaw::checkAddOverflow(m_y, dy)) | 711 | 5 | throw libmwaw::GenericException(); | 712 | 26.7M | m_x += dx; | 713 | 26.7M | m_y += dy; | 714 | 26.7M | } |
Unexecuted instantiation: MWAWVec2<long>::add(long, long) |
715 | | |
716 | | //! operator+= |
717 | | MWAWVec2<T> &operator+=(MWAWVec2<T> const &p) |
718 | 226M | { |
719 | 226M | add(p.m_x, p.m_y); |
720 | 226M | return *this; |
721 | 226M | } MWAWVec2<float>::operator+=(MWAWVec2<float> const&) Line | Count | Source | 718 | 225M | { | 719 | 225M | add(p.m_x, p.m_y); | 720 | 225M | return *this; | 721 | 225M | } |
MWAWVec2<int>::operator+=(MWAWVec2<int> const&) Line | Count | Source | 718 | 1.23M | { | 719 | 1.23M | add(p.m_x, p.m_y); | 720 | 1.23M | return *this; | 721 | 1.23M | } |
|
722 | | //! operator-= |
723 | | MWAWVec2<T> &operator-=(MWAWVec2<T> const &p) |
724 | 738M | { |
725 | | // check if negation of either of the coords will cause overflow |
726 | 738M | const T diff = std::numeric_limits<T>::min() + std::numeric_limits<T>::max(); |
727 | 738M | if (libmwaw::checkAddOverflow(p.m_x, diff) || libmwaw::checkAddOverflow(p.m_y, diff)) |
728 | 11 | throw libmwaw::GenericException(); |
729 | 738M | add(-p.m_x, -p.m_y); |
730 | 738M | return *this; |
731 | 738M | } MWAWVec2<float>::operator-=(MWAWVec2<float> const&) Line | Count | Source | 724 | 713M | { | 725 | | // check if negation of either of the coords will cause overflow | 726 | 713M | const T diff = std::numeric_limits<T>::min() + std::numeric_limits<T>::max(); | 727 | 713M | if (libmwaw::checkAddOverflow(p.m_x, diff) || libmwaw::checkAddOverflow(p.m_y, diff)) | 728 | 11 | throw libmwaw::GenericException(); | 729 | 713M | add(-p.m_x, -p.m_y); | 730 | 713M | return *this; | 731 | 713M | } |
MWAWVec2<int>::operator-=(MWAWVec2<int> const&) Line | Count | Source | 724 | 25.5M | { | 725 | | // check if negation of either of the coords will cause overflow | 726 | 25.5M | const T diff = std::numeric_limits<T>::min() + std::numeric_limits<T>::max(); | 727 | 25.5M | if (libmwaw::checkAddOverflow(p.m_x, diff) || libmwaw::checkAddOverflow(p.m_y, diff)) | 728 | 0 | throw libmwaw::GenericException(); | 729 | 25.5M | add(-p.m_x, -p.m_y); | 730 | 25.5M | return *this; | 731 | 25.5M | } |
Unexecuted instantiation: MWAWVec2<long>::operator-=(MWAWVec2<long> const&) |
732 | | //! generic operator*= |
733 | | template <class U> |
734 | | MWAWVec2<T> &operator*=(U scale) |
735 | 106M | { |
736 | 106M | m_x = T(m_x*scale); |
737 | 106M | m_y = T(m_y*scale); |
738 | 106M | return *this; |
739 | 106M | } MWAWVec2<int>& MWAWVec2<int>::operator*=<int>(int) Line | Count | Source | 735 | 158k | { | 736 | 158k | m_x = T(m_x*scale); | 737 | 158k | m_y = T(m_y*scale); | 738 | 158k | return *this; | 739 | 158k | } |
MWAWVec2<float>& MWAWVec2<float>::operator*=<float>(float) Line | Count | Source | 735 | 106M | { | 736 | 106M | m_x = T(m_x*scale); | 737 | 106M | m_y = T(m_y*scale); | 738 | 106M | return *this; | 739 | 106M | } |
Unexecuted instantiation: MWAWVec2<float>& MWAWVec2<float>::operator*=<double>(double) |
740 | | |
741 | | //! operator+ |
742 | | friend MWAWVec2<T> operator+(MWAWVec2<T> const &p1, MWAWVec2<T> const &p2) |
743 | 208M | { |
744 | 208M | MWAWVec2<T> p(p1); |
745 | 208M | return p+=p2; |
746 | 208M | } operator+(MWAWVec2<float> const&, MWAWVec2<float> const&) Line | Count | Source | 743 | 207M | { | 744 | 207M | MWAWVec2<T> p(p1); | 745 | 207M | return p+=p2; | 746 | 207M | } |
operator+(MWAWVec2<int> const&, MWAWVec2<int> const&) Line | Count | Source | 743 | 1.07M | { | 744 | 1.07M | MWAWVec2<T> p(p1); | 745 | 1.07M | return p+=p2; | 746 | 1.07M | } |
|
747 | | //! operator- |
748 | | friend MWAWVec2<T> operator-(MWAWVec2<T> const &p1, MWAWVec2<T> const &p2) |
749 | 736M | { |
750 | 736M | MWAWVec2<T> p(p1); |
751 | 736M | return p-=p2; |
752 | 736M | } operator-(MWAWVec2<float> const&, MWAWVec2<float> const&) Line | Count | Source | 749 | 710M | { | 750 | 710M | MWAWVec2<T> p(p1); | 751 | 710M | return p-=p2; | 752 | 710M | } |
operator-(MWAWVec2<int> const&, MWAWVec2<int> const&) Line | Count | Source | 749 | 25.4M | { | 750 | 25.4M | MWAWVec2<T> p(p1); | 751 | 25.4M | return p-=p2; | 752 | 25.4M | } |
Unexecuted instantiation: operator-(MWAWVec2<long> const&, MWAWVec2<long> const&) |
753 | | //! generic operator* |
754 | | template <class U> |
755 | | friend MWAWVec2<T> operator*(U scale, MWAWVec2<T> const &p1) |
756 | 106M | { |
757 | 106M | MWAWVec2<T> p(p1); |
758 | 106M | return p *= scale; |
759 | 106M | } MWAWVec2<int> operator*<int>(int, MWAWVec2<int> const&) Line | Count | Source | 756 | 158k | { | 757 | 158k | MWAWVec2<T> p(p1); | 758 | 158k | return p *= scale; | 759 | 158k | } |
MWAWVec2<float> operator*<float>(float, MWAWVec2<float> const&) Line | Count | Source | 756 | 106M | { | 757 | 106M | MWAWVec2<T> p(p1); | 758 | 106M | return p *= scale; | 759 | 106M | } |
Unexecuted instantiation: MWAWVec2<float> operator*<double>(double, MWAWVec2<float> const&) |
760 | | |
761 | | //! comparison== |
762 | | bool operator==(MWAWVec2<T> const &p) const |
763 | 2.35M | { |
764 | 2.35M | return cmpY(p) == 0; |
765 | 2.35M | } MWAWVec2<int>::operator==(MWAWVec2<int> const&) const Line | Count | Source | 763 | 6.70k | { | 764 | 6.70k | return cmpY(p) == 0; | 765 | 6.70k | } |
MWAWVec2<float>::operator==(MWAWVec2<float> const&) const Line | Count | Source | 763 | 2.35M | { | 764 | 2.35M | return cmpY(p) == 0; | 765 | 2.35M | } |
|
766 | | //! comparison!= |
767 | | bool operator!=(MWAWVec2<T> const &p) const |
768 | 424k | { |
769 | 424k | return cmpY(p) != 0; |
770 | 424k | } MWAWVec2<float>::operator!=(MWAWVec2<float> const&) const Line | Count | Source | 768 | 232k | { | 769 | 232k | return cmpY(p) != 0; | 770 | 232k | } |
MWAWVec2<int>::operator!=(MWAWVec2<int> const&) const Line | Count | Source | 768 | 191k | { | 769 | 191k | return cmpY(p) != 0; | 770 | 191k | } |
|
771 | | //! comparison<: sort by y |
772 | | bool operator<(MWAWVec2<T> const &p) const |
773 | 99.7M | { |
774 | 99.7M | return cmpY(p) < 0; |
775 | 99.7M | } MWAWVec2<int>::operator<(MWAWVec2<int> const&) const Line | Count | Source | 773 | 99.7M | { | 774 | 99.7M | return cmpY(p) < 0; | 775 | 99.7M | } |
Unexecuted instantiation: MWAWVec2<float>::operator<(MWAWVec2<float> const&) const |
776 | | //! a comparison function: which first compares x then y |
777 | | int cmp(MWAWVec2<T> const &p) const |
778 | 0 | { |
779 | 0 | if (m_x < p.m_x) return -1; |
780 | 0 | if (m_x > p.m_x) return 1; |
781 | 0 | if (m_y < p.m_y) return -1; |
782 | 0 | if (m_y > p.m_y) return 1; |
783 | 0 | return 0; |
784 | 0 | } Unexecuted instantiation: MWAWVec2<float>::cmp(MWAWVec2<float> const&) const Unexecuted instantiation: MWAWVec2<int>::cmp(MWAWVec2<int> const&) const |
785 | | //! a comparison function: which first compares y then x |
786 | | int cmpY(MWAWVec2<T> const &p) const |
787 | 162M | { |
788 | 162M | if (m_y < p.m_y) return -1; |
789 | 103M | if (m_y > p.m_y) return 1; |
790 | 73.5M | if (m_x < p.m_x) return -1; |
791 | 50.1M | if (m_x > p.m_x) return 1; |
792 | 28.0M | return 0; |
793 | 50.1M | } MWAWVec2<int>::cmpY(MWAWVec2<int> const&) const Line | Count | Source | 787 | 159M | { | 788 | 159M | if (m_y < p.m_y) return -1; | 789 | 101M | if (m_y > p.m_y) return 1; | 790 | 72.7M | if (m_x < p.m_x) return -1; | 791 | 49.4M | if (m_x > p.m_x) return 1; | 792 | 27.4M | return 0; | 793 | 49.4M | } |
MWAWVec2<float>::cmpY(MWAWVec2<float> const&) const Line | Count | Source | 787 | 2.58M | { | 788 | 2.58M | if (m_y < p.m_y) return -1; | 789 | 2.01M | if (m_y > p.m_y) return 1; | 790 | 774k | if (m_x < p.m_x) return -1; | 791 | 730k | if (m_x > p.m_x) return 1; | 792 | 673k | return 0; | 793 | 730k | } |
|
794 | | |
795 | | //! operator<<: prints data in form "XxY" |
796 | | friend std::ostream &operator<< (std::ostream &o, MWAWVec2<T> const &f) |
797 | 49.2k | { |
798 | 49.2k | o << f.m_x << "x" << f.m_y; |
799 | 49.2k | return o; |
800 | 49.2k | } operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, MWAWVec2<float> const&) Line | Count | Source | 797 | 49.2k | { | 798 | 49.2k | o << f.m_x << "x" << f.m_y; | 799 | 49.2k | return o; | 800 | 49.2k | } |
operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, MWAWVec2<int> const&) Line | Count | Source | 797 | 27 | { | 798 | 27 | o << f.m_x << "x" << f.m_y; | 799 | 27 | return o; | 800 | 27 | } |
Unexecuted instantiation: operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, MWAWVec2<long> const&) |
801 | | |
802 | | /*! \struct PosSizeLtX |
803 | | * \brief internal struct used to create sorted map, sorted by X |
804 | | */ |
805 | | struct PosSizeLtX { |
806 | | //! comparaison function |
807 | | bool operator()(MWAWVec2<T> const &s1, MWAWVec2<T> const &s2) const |
808 | | { |
809 | | return s1.cmp(s2) < 0; |
810 | | } |
811 | | }; |
812 | | /*! \typedef MapX |
813 | | * \brief map of MWAWVec2 |
814 | | */ |
815 | | typedef std::map<MWAWVec2<T>, T,struct PosSizeLtX> MapX; |
816 | | |
817 | | /*! \struct PosSizeLtY |
818 | | * \brief internal struct used to create sorted map, sorted by Y |
819 | | */ |
820 | | struct PosSizeLtY { |
821 | | //! comparaison function |
822 | | bool operator()(MWAWVec2<T> const &s1, MWAWVec2<T> const &s2) const |
823 | 59.6M | { |
824 | 59.6M | return s1.cmpY(s2) < 0; |
825 | 59.6M | } |
826 | | }; |
827 | | /*! \typedef MapY |
828 | | * \brief map of MWAWVec2 |
829 | | */ |
830 | | typedef std::map<MWAWVec2<T>, T,struct PosSizeLtY> MapY; |
831 | | protected: |
832 | | T m_x/*! \brief first element */, m_y/*! \brief second element */; |
833 | | }; |
834 | | |
835 | | /*! \brief MWAWVec2 of bool */ |
836 | | typedef MWAWVec2<bool> MWAWVec2b; |
837 | | /*! \brief MWAWVec2 of int */ |
838 | | typedef MWAWVec2<int> MWAWVec2i; |
839 | | /*! \brief MWAWVec2 of long */ |
840 | | typedef MWAWVec2<long> MWAWVec2l; |
841 | | /*! \brief MWAWVec2 of float */ |
842 | | typedef MWAWVec2<float> MWAWVec2f; |
843 | | |
844 | | /*! \class MWAWVec3 |
845 | | * \brief small class which defines a vector with 3 elements |
846 | | */ |
847 | | template <class T> class MWAWVec3 |
848 | | { |
849 | | public: |
850 | | //! constructor |
851 | | explicit MWAWVec3(T xx=0,T yy=0,T zz=0) |
852 | 46.8M | { |
853 | 46.8M | m_val[0] = xx; |
854 | 46.8M | m_val[1] = yy; |
855 | 46.8M | m_val[2] = zz; |
856 | 46.8M | } MWAWVec3<float>::MWAWVec3(float, float, float) Line | Count | Source | 852 | 46.5M | { | 853 | 46.5M | m_val[0] = xx; | 854 | 46.5M | m_val[1] = yy; | 855 | 46.5M | m_val[2] = zz; | 856 | 46.5M | } |
MWAWVec3<int>::MWAWVec3(int, int, int) Line | Count | Source | 852 | 343k | { | 853 | 343k | m_val[0] = xx; | 854 | 343k | m_val[1] = yy; | 855 | 343k | m_val[2] = zz; | 856 | 343k | } |
|
857 | | //! generic copy constructor |
858 | | template <class U> explicit MWAWVec3(MWAWVec3<U> const &p) |
859 | | { |
860 | | for (int c = 0; c < 3; c++) m_val[c] = T(p[c]); |
861 | | } |
862 | | |
863 | | //! first element |
864 | | T x() const |
865 | | { |
866 | | return m_val[0]; |
867 | | } |
868 | | //! second element |
869 | | T y() const |
870 | | { |
871 | | return m_val[1]; |
872 | | } |
873 | | //! third element |
874 | | T z() const |
875 | | { |
876 | | return m_val[2]; |
877 | | } |
878 | | //! operator[] |
879 | | T operator[](int c) const |
880 | 249M | { |
881 | 249M | if (c<0 || c>2) throw libmwaw::GenericException(); |
882 | 249M | return m_val[c]; |
883 | 249M | } MWAWVec3<float>::operator[](int) const Line | Count | Source | 880 | 246M | { | 881 | 246M | if (c<0 || c>2) throw libmwaw::GenericException(); | 882 | 246M | return m_val[c]; | 883 | 246M | } |
MWAWVec3<int>::operator[](int) const Line | Count | Source | 880 | 3.30M | { | 881 | 3.30M | if (c<0 || c>2) throw libmwaw::GenericException(); | 882 | 3.30M | return m_val[c]; | 883 | 3.30M | } |
|
884 | | //! operator[] |
885 | | T &operator[](int c) |
886 | 25.9M | { |
887 | 25.9M | if (c<0 || c>2) throw libmwaw::GenericException(); |
888 | 25.9M | return m_val[c]; |
889 | 25.9M | } MWAWVec3<float>::operator[](int) Line | Count | Source | 886 | 25.4M | { | 887 | 25.4M | if (c<0 || c>2) throw libmwaw::GenericException(); | 888 | 25.4M | return m_val[c]; | 889 | 25.4M | } |
MWAWVec3<int>::operator[](int) Line | Count | Source | 886 | 538k | { | 887 | 538k | if (c<0 || c>2) throw libmwaw::GenericException(); | 888 | 538k | return m_val[c]; | 889 | 538k | } |
|
890 | | |
891 | | //! resets the three elements |
892 | | void set(T xx, T yy, T zz) |
893 | | { |
894 | | m_val[0] = xx; |
895 | | m_val[1] = yy; |
896 | | m_val[2] = zz; |
897 | | } |
898 | | //! resets the first element |
899 | | void setX(T xx) |
900 | | { |
901 | | m_val[0] = xx; |
902 | | } |
903 | | //! resets the second element |
904 | | void setY(T yy) |
905 | | { |
906 | | m_val[1] = yy; |
907 | | } |
908 | | //! resets the third element |
909 | | void setZ(T zz) |
910 | | { |
911 | | m_val[2] = zz; |
912 | | } |
913 | | |
914 | | //! increases the actuals values by \a dx, \a dy, \a dz |
915 | | void add(T dx, T dy, T dz) |
916 | | { |
917 | | m_val[0] += dx; |
918 | | m_val[1] += dy; |
919 | | m_val[2] += dz; |
920 | | } |
921 | | |
922 | | //! operator+= |
923 | | MWAWVec3<T> &operator+=(MWAWVec3<T> const &p) |
924 | | { |
925 | | for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]+p.m_val[c]); |
926 | | return *this; |
927 | | } |
928 | | //! operator-= |
929 | | MWAWVec3<T> &operator-=(MWAWVec3<T> const &p) |
930 | 87.1k | { |
931 | 348k | for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]-p.m_val[c]); |
932 | 87.1k | return *this; |
933 | 87.1k | } |
934 | | //! generic operator*= |
935 | | template <class U> |
936 | | MWAWVec3<T> &operator*=(U scale) |
937 | | { |
938 | | for (auto &c : m_val) c = T(c*scale); |
939 | | return *this; |
940 | | } |
941 | | |
942 | | //! operator+ |
943 | | friend MWAWVec3<T> operator+(MWAWVec3<T> const &p1, MWAWVec3<T> const &p2) |
944 | | { |
945 | | MWAWVec3<T> p(p1); |
946 | | return p+=p2; |
947 | | } |
948 | | //! operator- |
949 | | friend MWAWVec3<T> operator-(MWAWVec3<T> const &p1, MWAWVec3<T> const &p2) |
950 | 87.1k | { |
951 | 87.1k | MWAWVec3<T> p(p1); |
952 | 87.1k | return p-=p2; |
953 | 87.1k | } |
954 | | //! generic operator* |
955 | | template <class U> |
956 | | friend MWAWVec3<T> operator*(U scale, MWAWVec3<T> const &p1) |
957 | | { |
958 | | MWAWVec3<T> p(p1); |
959 | | return p *= scale; |
960 | | } |
961 | | |
962 | | //! comparison== |
963 | | bool operator==(MWAWVec3<T> const &p) const |
964 | 24.0M | { |
965 | 24.0M | return cmp(p) == 0; |
966 | 24.0M | } MWAWVec3<float>::operator==(MWAWVec3<float> const&) const Line | Count | Source | 964 | 23.9M | { | 965 | 23.9M | return cmp(p) == 0; | 966 | 23.9M | } |
MWAWVec3<int>::operator==(MWAWVec3<int> const&) const Line | Count | Source | 964 | 43.5k | { | 965 | 43.5k | return cmp(p) == 0; | 966 | 43.5k | } |
|
967 | | //! comparison!= |
968 | | bool operator!=(MWAWVec3<T> const &p) const |
969 | | { |
970 | | return cmp(p) != 0; |
971 | | } |
972 | | //! comparison<: which first compares x values, then y values then z values. |
973 | | bool operator<(MWAWVec3<T> const &p) const |
974 | 0 | { |
975 | 0 | return cmp(p) < 0; |
976 | 0 | } |
977 | | //! a comparison function: which first compares x values, then y values then z values. |
978 | | int cmp(MWAWVec3<T> const &p) const |
979 | 24.0M | { |
980 | 73.5M | for (int c = 0; c < 3; c++) { |
981 | 57.9M | if (m_val[c]<p.m_val[c]) return -1; |
982 | 53.3M | if (m_val[c]>p.m_val[c]) return 1; |
983 | 53.3M | } |
984 | 15.5M | return 0; |
985 | 24.0M | } MWAWVec3<float>::cmp(MWAWVec3<float> const&) const Line | Count | Source | 979 | 23.9M | { | 980 | 73.3M | for (int c = 0; c < 3; c++) { | 981 | 57.8M | if (m_val[c]<p.m_val[c]) return -1; | 982 | 53.2M | if (m_val[c]>p.m_val[c]) return 1; | 983 | 53.2M | } | 984 | 15.5M | return 0; | 985 | 23.9M | } |
MWAWVec3<int>::cmp(MWAWVec3<int> const&) const Line | Count | Source | 979 | 43.5k | { | 980 | 174k | for (int c = 0; c < 3; c++) { | 981 | 130k | if (m_val[c]<p.m_val[c]) return -1; | 982 | 130k | if (m_val[c]>p.m_val[c]) return 1; | 983 | 130k | } | 984 | 43.5k | return 0; | 985 | 43.5k | } |
|
986 | | |
987 | | //! operator<<: prints data in form "XxYxZ" |
988 | | friend std::ostream &operator<< (std::ostream &o, MWAWVec3<T> const &f) |
989 | | { |
990 | | o << f.m_val[0] << "x" << f.m_val[1] << "x" << f.m_val[2]; |
991 | | return o; |
992 | | } |
993 | | |
994 | | /*! \struct PosSizeLt |
995 | | * \brief internal struct used to create sorted map, sorted by X, Y, Z |
996 | | */ |
997 | | struct PosSizeLt { |
998 | | //! comparaison function |
999 | | bool operator()(MWAWVec3<T> const &s1, MWAWVec3<T> const &s2) const |
1000 | | { |
1001 | | return s1.cmp(s2) < 0; |
1002 | | } |
1003 | | }; |
1004 | | /*! \typedef Map |
1005 | | * \brief map of MWAWVec3 |
1006 | | */ |
1007 | | typedef std::map<MWAWVec3<T>, T,struct PosSizeLt> Map; |
1008 | | |
1009 | | protected: |
1010 | | //! the values |
1011 | | T m_val[3]; |
1012 | | }; |
1013 | | |
1014 | | /*! \brief MWAWVec3 of unsigned char */ |
1015 | | typedef MWAWVec3<unsigned char> MWAWVec3uc; |
1016 | | /*! \brief MWAWVec3 of int */ |
1017 | | typedef MWAWVec3<int> MWAWVec3i; |
1018 | | /*! \brief MWAWVec3 of float */ |
1019 | | typedef MWAWVec3<float> MWAWVec3f; |
1020 | | |
1021 | | /*! \class MWAWBox2 |
1022 | | * \brief small class which defines a 2D Box |
1023 | | */ |
1024 | | template <class T> class MWAWBox2 |
1025 | | { |
1026 | | public: |
1027 | | //! constructor |
1028 | | explicit MWAWBox2(MWAWVec2<T> minPt=MWAWVec2<T>(), MWAWVec2<T> maxPt=MWAWVec2<T>()) |
1029 | 2.38G | : m_data(minPt, maxPt) |
1030 | 2.38G | { |
1031 | 2.38G | } MWAWBox2<int>::MWAWBox2(MWAWVec2<int>, MWAWVec2<int>) Line | Count | Source | 1029 | 748M | : m_data(minPt, maxPt) | 1030 | 748M | { | 1031 | 748M | } |
MWAWBox2<float>::MWAWBox2(MWAWVec2<float>, MWAWVec2<float>) Line | Count | Source | 1029 | 1.63G | : m_data(minPt, maxPt) | 1030 | 1.63G | { | 1031 | 1.63G | } |
MWAWBox2<long>::MWAWBox2(MWAWVec2<long>, MWAWVec2<long>) Line | Count | Source | 1029 | 174k | : m_data(minPt, maxPt) | 1030 | 174k | { | 1031 | 174k | } |
|
1032 | | //! generic constructor |
1033 | | template <class U> explicit MWAWBox2(MWAWBox2<U> const &p) |
1034 | 4.37M | : m_data(MWAWVec2<T>(p.min()), MWAWVec2<T>(p.max())) |
1035 | 4.37M | { |
1036 | 4.37M | } MWAWBox2<float>::MWAWBox2<int>(MWAWBox2<int> const&) Line | Count | Source | 1034 | 4.32M | : m_data(MWAWVec2<T>(p.min()), MWAWVec2<T>(p.max())) | 1035 | 4.32M | { | 1036 | 4.32M | } |
MWAWBox2<int>::MWAWBox2<float>(MWAWBox2<float> const&) Line | Count | Source | 1034 | 47.9k | : m_data(MWAWVec2<T>(p.min()), MWAWVec2<T>(p.max())) | 1035 | 47.9k | { | 1036 | 47.9k | } |
|
1037 | | |
1038 | | //! the minimum 2D point (in x and in y) |
1039 | | MWAWVec2<T> const &min() const |
1040 | 116M | { |
1041 | 116M | return m_data.first; |
1042 | 116M | } MWAWBox2<float>::min() const Line | Count | Source | 1040 | 112M | { | 1041 | 112M | return m_data.first; | 1042 | 112M | } |
MWAWBox2<int>::min() const Line | Count | Source | 1040 | 4.68M | { | 1041 | 4.68M | return m_data.first; | 1042 | 4.68M | } |
Unexecuted instantiation: MWAWBox2<long>::min() const |
1043 | | //! the maximum 2D point (in x and in y) |
1044 | | MWAWVec2<T> const &max() const |
1045 | 100M | { |
1046 | 100M | return m_data.second; |
1047 | 100M | } MWAWBox2<float>::max() const Line | Count | Source | 1045 | 96.2M | { | 1046 | 96.2M | return m_data.second; | 1047 | 96.2M | } |
MWAWBox2<int>::max() const Line | Count | Source | 1045 | 4.64M | { | 1046 | 4.64M | return m_data.second; | 1047 | 4.64M | } |
Unexecuted instantiation: MWAWBox2<long>::max() const |
1048 | | //! the minimum 2D point (in x and in y) |
1049 | | MWAWVec2<T> &min() |
1050 | 17.6M | { |
1051 | 17.6M | return m_data.first; |
1052 | 17.6M | } Line | Count | Source | 1050 | 133k | { | 1051 | 133k | return m_data.first; | 1052 | 133k | } |
Line | Count | Source | 1050 | 17.4M | { | 1051 | 17.4M | return m_data.first; | 1052 | 17.4M | } |
|
1053 | | //! the maximum 2D point (in x and in y) |
1054 | | MWAWVec2<T> &max() |
1055 | 10.5M | { |
1056 | 10.5M | return m_data.second; |
1057 | 10.5M | } Line | Count | Source | 1055 | 1.80k | { | 1056 | 1.80k | return m_data.second; | 1057 | 1.80k | } |
Line | Count | Source | 1055 | 10.5M | { | 1056 | 10.5M | return m_data.second; | 1057 | 10.5M | } |
|
1058 | | /*! \brief the two extremum points which defined the box |
1059 | | * \param c 0 means the minimum and 1 the maximum |
1060 | | */ |
1061 | | MWAWVec2<T> const &operator[](int c) const |
1062 | 1.30G | { |
1063 | 1.30G | if (c<0 || c>1) throw libmwaw::GenericException(); |
1064 | 1.30G | return c==0 ? m_data.first : m_data.second; |
1065 | 1.30G | } MWAWBox2<float>::operator[](int) const Line | Count | Source | 1062 | 1.21G | { | 1063 | 1.21G | if (c<0 || c>1) throw libmwaw::GenericException(); | 1064 | 1.21G | return c==0 ? m_data.first : m_data.second; | 1065 | 1.21G | } |
MWAWBox2<int>::operator[](int) const Line | Count | Source | 1062 | 90.4M | { | 1063 | 90.4M | if (c<0 || c>1) throw libmwaw::GenericException(); | 1064 | 90.4M | return c==0 ? m_data.first : m_data.second; | 1065 | 90.4M | } |
|
1066 | | //! the box size |
1067 | | MWAWVec2<T> size() const |
1068 | 641M | { |
1069 | 641M | return m_data.second-m_data.first; |
1070 | 641M | } MWAWBox2<float>::size() const Line | Count | Source | 1068 | 635M | { | 1069 | 635M | return m_data.second-m_data.first; | 1070 | 635M | } |
MWAWBox2<int>::size() const Line | Count | Source | 1068 | 5.51M | { | 1069 | 5.51M | return m_data.second-m_data.first; | 1070 | 5.51M | } |
Unexecuted instantiation: MWAWBox2<long>::size() const |
1071 | | //! the box center |
1072 | | MWAWVec2<T> center() const |
1073 | 6.91M | { |
1074 | 6.91M | return MWAWVec2<T>((m_data.first.x()+m_data.second.x())/2, |
1075 | 6.91M | (m_data.first.y()+m_data.second.y())/2); |
1076 | 6.91M | } MWAWBox2<float>::center() const Line | Count | Source | 1073 | 5.93M | { | 1074 | 5.93M | return MWAWVec2<T>((m_data.first.x()+m_data.second.x())/2, | 1075 | 5.93M | (m_data.first.y()+m_data.second.y())/2); | 1076 | 5.93M | } |
MWAWBox2<int>::center() const Line | Count | Source | 1073 | 979k | { | 1074 | 979k | return MWAWVec2<T>((m_data.first.x()+m_data.second.x())/2, | 1075 | 979k | (m_data.first.y()+m_data.second.y())/2); | 1076 | 979k | } |
|
1077 | | |
1078 | | //! resets the data to minimum \a x and maximum \a y |
1079 | | void set(MWAWVec2<T> const &x, MWAWVec2<T> const &y) |
1080 | 413k | { |
1081 | 413k | m_data.first = x; |
1082 | 413k | m_data.second = y; |
1083 | 413k | } MWAWBox2<int>::set(MWAWVec2<int> const&, MWAWVec2<int> const&) Line | Count | Source | 1080 | 65.9k | { | 1081 | 65.9k | m_data.first = x; | 1082 | 65.9k | m_data.second = y; | 1083 | 65.9k | } |
MWAWBox2<float>::set(MWAWVec2<float> const&, MWAWVec2<float> const&) Line | Count | Source | 1080 | 347k | { | 1081 | 347k | m_data.first = x; | 1082 | 347k | m_data.second = y; | 1083 | 347k | } |
|
1084 | | //! resets the minimum point |
1085 | | void setMin(MWAWVec2<T> const &x) |
1086 | 109k | { |
1087 | 109k | m_data.first = x; |
1088 | 109k | } MWAWBox2<float>::setMin(MWAWVec2<float> const&) Line | Count | Source | 1086 | 108k | { | 1087 | 108k | m_data.first = x; | 1088 | 108k | } |
MWAWBox2<int>::setMin(MWAWVec2<int> const&) Line | Count | Source | 1086 | 435 | { | 1087 | 435 | m_data.first = x; | 1088 | 435 | } |
|
1089 | | //! resets the maximum point |
1090 | | void setMax(MWAWVec2<T> const &y) |
1091 | 118k | { |
1092 | 118k | m_data.second = y; |
1093 | 118k | } MWAWBox2<float>::setMax(MWAWVec2<float> const&) Line | Count | Source | 1091 | 118k | { | 1092 | 118k | m_data.second = y; | 1093 | 118k | } |
MWAWBox2<int>::setMax(MWAWVec2<int> const&) Line | Count | Source | 1091 | 377 | { | 1092 | 377 | m_data.second = y; | 1093 | 377 | } |
|
1094 | | |
1095 | | //! resize the box keeping the minimum |
1096 | | void resizeFromMin(MWAWVec2<T> const &sz) |
1097 | | { |
1098 | | m_data.second = m_data.first+sz; |
1099 | | } |
1100 | | //! resize the box keeping the maximum |
1101 | | void resizeFromMax(MWAWVec2<T> const &sz) |
1102 | | { |
1103 | | m_data.first = m_data.second-sz; |
1104 | | } |
1105 | | //! resize the box keeping the center |
1106 | | void resizeFromCenter(MWAWVec2<T> const &sz) |
1107 | 689 | { |
1108 | 689 | MWAWVec2<T> centerPt = center(); |
1109 | 689 | MWAWVec2<T> decal(sz.x()/2,sz.y()/2); |
1110 | 689 | m_data.first = centerPt - decal; |
1111 | 689 | m_data.second = centerPt + (sz - decal); |
1112 | 689 | } |
1113 | | |
1114 | | //! scales all points of the box by \a factor |
1115 | | template <class U> void scale(U factor) |
1116 | | { |
1117 | | m_data.first *= factor; |
1118 | | m_data.second *= factor; |
1119 | | } |
1120 | | |
1121 | | //! extends the bdbox by (\a val, \a val) keeping the center |
1122 | | void extend(T val) |
1123 | 2.44M | { |
1124 | 2.44M | m_data.first -= MWAWVec2<T>(val/2,val/2); |
1125 | 2.44M | m_data.second += MWAWVec2<T>(val-(val/2),val-(val/2)); |
1126 | 2.44M | } |
1127 | | |
1128 | | //! returns the union between this and box |
1129 | | MWAWBox2<T> getUnion(MWAWBox2<T> const &box) const |
1130 | 79.3M | { |
1131 | 79.3M | MWAWBox2<T> res; |
1132 | 79.3M | res.m_data.first=MWAWVec2<T>(m_data.first[0]<box.m_data.first[0]?m_data.first[0] : box.m_data.first[0], |
1133 | 79.3M | m_data.first[1]<box.m_data.first[1]?m_data.first[1] : box.m_data.first[1]); |
1134 | 79.3M | res.m_data.second=MWAWVec2<T>(m_data.second[0]>box.m_data.second[0]?m_data.second[0] : box.m_data.second[0], |
1135 | 79.3M | m_data.second[1]>box.m_data.second[1]?m_data.second[1] : box.m_data.second[1]); |
1136 | 79.3M | return res; |
1137 | 79.3M | } MWAWBox2<float>::getUnion(MWAWBox2<float> const&) const Line | Count | Source | 1130 | 79.3M | { | 1131 | 79.3M | MWAWBox2<T> res; | 1132 | 79.3M | res.m_data.first=MWAWVec2<T>(m_data.first[0]<box.m_data.first[0]?m_data.first[0] : box.m_data.first[0], | 1133 | 79.3M | m_data.first[1]<box.m_data.first[1]?m_data.first[1] : box.m_data.first[1]); | 1134 | 79.3M | res.m_data.second=MWAWVec2<T>(m_data.second[0]>box.m_data.second[0]?m_data.second[0] : box.m_data.second[0], | 1135 | 79.3M | m_data.second[1]>box.m_data.second[1]?m_data.second[1] : box.m_data.second[1]); | 1136 | 79.3M | return res; | 1137 | 79.3M | } |
MWAWBox2<int>::getUnion(MWAWBox2<int> const&) const Line | Count | Source | 1130 | 26.0k | { | 1131 | 26.0k | MWAWBox2<T> res; | 1132 | 26.0k | res.m_data.first=MWAWVec2<T>(m_data.first[0]<box.m_data.first[0]?m_data.first[0] : box.m_data.first[0], | 1133 | 26.0k | m_data.first[1]<box.m_data.first[1]?m_data.first[1] : box.m_data.first[1]); | 1134 | 26.0k | res.m_data.second=MWAWVec2<T>(m_data.second[0]>box.m_data.second[0]?m_data.second[0] : box.m_data.second[0], | 1135 | 26.0k | m_data.second[1]>box.m_data.second[1]?m_data.second[1] : box.m_data.second[1]); | 1136 | 26.0k | return res; | 1137 | 26.0k | } |
|
1138 | | //! returns the intersection between this and box |
1139 | | MWAWBox2<T> getIntersection(MWAWBox2<T> const &box) const |
1140 | 468k | { |
1141 | 468k | MWAWBox2<T> res; |
1142 | 468k | res.m_data.first=MWAWVec2<T>(m_data.first[0]>box.m_data.first[0]?m_data.first[0] : box.m_data.first[0], |
1143 | 468k | m_data.first[1]>box.m_data.first[1]?m_data.first[1] : box.m_data.first[1]); |
1144 | 468k | res.m_data.second=MWAWVec2<T>(m_data.second[0]<box.m_data.second[0]?m_data.second[0] : box.m_data.second[0], |
1145 | 468k | m_data.second[1]<box.m_data.second[1]?m_data.second[1] : box.m_data.second[1]); |
1146 | 468k | return res; |
1147 | 468k | } |
1148 | | //! operator== |
1149 | | bool operator==(MWAWBox2<T> const &mat) const |
1150 | 0 | { |
1151 | 0 | return m_data==mat.m_data; |
1152 | 0 | } |
1153 | | //! operator!= |
1154 | | bool operator!=(MWAWBox2<T> const &mat) const |
1155 | 99.8k | { |
1156 | 99.8k | return m_data!=mat.m_data; |
1157 | 99.8k | } MWAWBox2<int>::operator!=(MWAWBox2<int> const&) const Line | Count | Source | 1155 | 2.75k | { | 1156 | 2.75k | return m_data!=mat.m_data; | 1157 | 2.75k | } |
MWAWBox2<float>::operator!=(MWAWBox2<float> const&) const Line | Count | Source | 1155 | 97.0k | { | 1156 | 97.0k | return m_data!=mat.m_data; | 1157 | 97.0k | } |
|
1158 | | //! operator< |
1159 | | bool operator<(MWAWBox2<T> const &mat) const |
1160 | 0 | { |
1161 | 0 | return m_data<mat.m_data; |
1162 | 0 | } Unexecuted instantiation: MWAWBox2<int>::operator<(MWAWBox2<int> const&) const Unexecuted instantiation: MWAWBox2<float>::operator<(MWAWBox2<float> const&) const |
1163 | | //! operator<= |
1164 | | bool operator<=(MWAWBox2<T> const &mat) const |
1165 | | { |
1166 | | return m_data<=mat.m_data; |
1167 | | } |
1168 | | //! operator> |
1169 | | bool operator>(MWAWBox2<T> const &mat) const |
1170 | 0 | { |
1171 | 0 | return m_data>mat.m_data; |
1172 | 0 | } |
1173 | | //! operator>= |
1174 | | bool operator>=(MWAWBox2<T> const &mat) const |
1175 | | { |
1176 | | return m_data>=mat.m_data; |
1177 | | } |
1178 | | //! print data in form X0xY0<->X1xY1 |
1179 | | friend std::ostream &operator<< (std::ostream &o, MWAWBox2<T> const &f) |
1180 | 18.9k | { |
1181 | 18.9k | o << "(" << f.min() << "<->" << f.max() << ")"; |
1182 | 18.9k | return o; |
1183 | 18.9k | } Unexecuted instantiation: operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, MWAWBox2<int> const&) operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, MWAWBox2<float> const&) Line | Count | Source | 1180 | 18.9k | { | 1181 | 18.9k | o << "(" << f.min() << "<->" << f.max() << ")"; | 1182 | 18.9k | return o; | 1183 | 18.9k | } |
Unexecuted instantiation: operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, MWAWBox2<long> const&) |
1184 | | |
1185 | | protected: |
1186 | | //! the data |
1187 | | std::pair<MWAWVec2<T>, MWAWVec2<T> > m_data; |
1188 | | }; |
1189 | | |
1190 | | /*! \brief MWAWBox2 of int */ |
1191 | | typedef MWAWBox2<int> MWAWBox2i; |
1192 | | /*! \brief MWAWBox2 of float */ |
1193 | | typedef MWAWBox2<float> MWAWBox2f; |
1194 | | /*! \brief MWAWBox2 of long */ |
1195 | | typedef MWAWBox2<long> MWAWBox2l; |
1196 | | |
1197 | | /** a transformation which stored the first row of a 3x3 perspective matrix */ |
1198 | | class MWAWTransformation |
1199 | | { |
1200 | | public: |
1201 | | //! constructor |
1202 | | explicit MWAWTransformation(MWAWVec3f const &xRow=MWAWVec3f(1,0,0), MWAWVec3f const &yRow=MWAWVec3f(0,1,0)) |
1203 | 11.2M | : m_data(xRow, yRow) |
1204 | 11.2M | , m_isIdentity(false) |
1205 | 11.2M | { |
1206 | 11.2M | checkIdentity(); |
1207 | 11.2M | } |
1208 | | //! returns true if the matrix is an identity matrix |
1209 | | bool isIdentity() const |
1210 | 2.32M | { |
1211 | 2.32M | return m_isIdentity; |
1212 | 2.32M | } |
1213 | | //! check if a matrix is the identity matrix |
1214 | | void checkIdentity() const |
1215 | 15.5M | { |
1216 | 15.5M | m_isIdentity= m_data.first==MWAWVec3f(1,0,0) && m_data.second==MWAWVec3f(0,1,0); |
1217 | 15.5M | } |
1218 | | /*! \brief the two extremum points which defined the box |
1219 | | * \param c 0 means the minimum and 1 the maximum |
1220 | | */ |
1221 | | MWAWVec3f const &operator[](int c) const |
1222 | 142M | { |
1223 | 142M | if (c<0 || c>1) throw libmwaw::GenericException(); |
1224 | 142M | return c==0 ? m_data.first : m_data.second; |
1225 | 142M | } |
1226 | | //! operator* for vec2f |
1227 | | MWAWVec2f operator*(MWAWVec2f const &pt) const |
1228 | 15.9M | { |
1229 | 15.9M | if (m_isIdentity) return pt; |
1230 | 15.9M | return multiplyDirection(pt)+MWAWVec2f(m_data.first[2],m_data.second[2]); |
1231 | 15.9M | } |
1232 | | //! operator* for direction |
1233 | | MWAWVec2f multiplyDirection(MWAWVec2f const &dir) const |
1234 | 15.9M | { |
1235 | 15.9M | if (m_isIdentity) return dir; |
1236 | 15.9M | MWAWVec2f res; |
1237 | 47.7M | for (int coord=0; coord<2; ++coord) { |
1238 | 31.8M | MWAWVec3f const &row=coord==0 ? m_data.first : m_data.second; |
1239 | 31.8M | float value=0; |
1240 | 95.5M | for (int i=0; i<2; ++i) |
1241 | 63.7M | value+=row[i]*dir[i]; |
1242 | 31.8M | res[coord]=value; |
1243 | 31.8M | } |
1244 | 15.9M | return res; |
1245 | 15.9M | } |
1246 | | //! operator* for box2f |
1247 | | MWAWBox2f operator*(MWAWBox2f const &box) const |
1248 | 273k | { |
1249 | 273k | if (m_isIdentity) return box; |
1250 | 272k | return MWAWBox2f(operator*(box.min()), operator*(box.max())); |
1251 | 273k | } |
1252 | | //! operator* for transform |
1253 | | MWAWTransformation operator*(MWAWTransformation const &mat) const |
1254 | 4.34M | { |
1255 | 4.34M | if (mat.m_isIdentity) return *this; |
1256 | 4.23M | MWAWTransformation res; |
1257 | 12.7M | for (int row=0; row<2; ++row) { |
1258 | 8.47M | MWAWVec3f &resRow=row==0 ? res.m_data.first : res.m_data.second; |
1259 | 33.9M | for (int col=0; col<3; ++col) { |
1260 | 25.4M | float value=0; |
1261 | 101M | for (int i=0; i<3; ++i) |
1262 | 76.3M | value+=(*this)[row][i]*(i==2 ? (col==2 ? 1.f : 0.f) : mat[i][col]); |
1263 | 25.4M | resRow[col]=value; |
1264 | 25.4M | } |
1265 | 8.47M | } |
1266 | 4.23M | res.checkIdentity(); |
1267 | 4.23M | return res; |
1268 | 4.34M | } |
1269 | | //! operator*= |
1270 | | MWAWTransformation &operator*=(MWAWTransformation const &mat) |
1271 | 757k | { |
1272 | 757k | if (!mat.m_isIdentity) |
1273 | 757k | *this=(*this)*mat; |
1274 | 757k | return *this; |
1275 | 757k | } |
1276 | | //! operator== |
1277 | | bool operator==(MWAWTransformation const &mat) const |
1278 | 0 | { |
1279 | 0 | return m_data==mat.m_data; |
1280 | 0 | } |
1281 | | //! operator!= |
1282 | | bool operator!=(MWAWTransformation const &mat) const |
1283 | 0 | { |
1284 | 0 | return m_data!=mat.m_data; |
1285 | 0 | } |
1286 | | //! operator< |
1287 | | bool operator<(MWAWTransformation const &mat) const |
1288 | 0 | { |
1289 | 0 | return m_data<mat.m_data; |
1290 | 0 | } |
1291 | | //! operator<= |
1292 | | bool operator<=(MWAWTransformation const &mat) const |
1293 | 0 | { |
1294 | 0 | return m_data<=mat.m_data; |
1295 | 0 | } |
1296 | | //! operator> |
1297 | | bool operator>(MWAWTransformation const &mat) const |
1298 | 0 | { |
1299 | 0 | return m_data>mat.m_data; |
1300 | 0 | } |
1301 | | //! operator>= |
1302 | | bool operator>=(MWAWTransformation const &mat) const |
1303 | 0 | { |
1304 | 0 | return m_data>=mat.m_data; |
1305 | 0 | } |
1306 | | /** try to decompose the matrix in a rotation + scaling/translation matrix. |
1307 | | |
1308 | | Note: the center of rotation is given before applying the transformation(this) */ |
1309 | | bool decompose(float &rotation, MWAWVec2f &shearing, MWAWTransformation &transform, MWAWVec2f const ¢er) const; |
1310 | | |
1311 | | /** returns a translation transformation */ |
1312 | | static MWAWTransformation translation(MWAWVec2f const &trans) |
1313 | 548k | { |
1314 | 548k | return MWAWTransformation(MWAWVec3f(1, 0, trans[0]), MWAWVec3f(0, 1, trans[1])); |
1315 | 548k | } |
1316 | | /** returns a scaling transformation */ |
1317 | | static MWAWTransformation scale(MWAWVec2f const &trans) |
1318 | 65.2k | { |
1319 | 65.2k | return MWAWTransformation(MWAWVec3f(trans[0], 0, 0), MWAWVec3f(0, trans[1], 0)); |
1320 | 65.2k | } |
1321 | | /** returns a rotation transformation around center. |
1322 | | |
1323 | | \note angle must be given in degree */ |
1324 | | static MWAWTransformation rotation(float angle, MWAWVec2f const ¢er=MWAWVec2f(0,0)); |
1325 | | /** returns a shear transformation letting center invariant, ie. a matrix |
1326 | | ( 1 s[0] -s[0]*center[1], s[1] 1 -s[1]*center[0], 0 0 1) |
1327 | | */ |
1328 | | static MWAWTransformation shear(MWAWVec2f s, MWAWVec2f const ¢er=MWAWVec2f(0,0)) |
1329 | 1.23M | { |
1330 | 1.23M | return MWAWTransformation(MWAWVec3f(1, s[0], -s[0]*center[1]), MWAWVec3f(s[1], 1, -s[1]*center[0])); |
1331 | 1.23M | } |
1332 | | protected: |
1333 | | //! the data |
1334 | | std::pair<MWAWVec3f, MWAWVec3f > m_data; |
1335 | | //! flag to know if this matrix is an identity matrix |
1336 | | mutable bool m_isIdentity; |
1337 | | }; |
1338 | | |
1339 | | // some format function |
1340 | | namespace libmwaw |
1341 | | { |
1342 | | //! convert a DTFormat in a propertyList |
1343 | | bool convertDTFormat(std::string const &dtFormat, librevenge::RVNGPropertyListVector &propVect); |
1344 | | } |
1345 | | |
1346 | | // some geometrical function |
1347 | | namespace libmwaw |
1348 | | { |
1349 | | //! rotate a point around center, angle is given in degree |
1350 | | MWAWVec2f rotatePointAroundCenter(MWAWVec2f const &point, MWAWVec2f const ¢er, float angle); |
1351 | | //! rotate a bdox and returns the final bdbox, angle is given in degree |
1352 | | MWAWBox2f rotateBoxFromCenter(MWAWBox2f const &box, float angle); |
1353 | | } |
1354 | | #endif /* LIBMWAW_INTERNAL_H */ |
1355 | | // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: |