Dash.h Source File documentation

Dash.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is part of the libmspub project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10 #ifndef INCLUDED_DASH_H
11 #define INCLUDED_DASH_H
12
13 #include <vector>
14
15 #include <boost/optional.hpp>
16
17 namespace libmspub
18 {
19 enum DotStyle
20 {
21 RECT_DOT,
22 ROUND_DOT
23 };
24 enum MSPUBDashStyle
25 {
26 MSPUB_DS_SOLID,
27 DASH_SYS,
28 DOT_SYS,
29 DASH_DOT_SYS,
30 DASH_DOT_DOT_SYS,
31 DOT_GEL,
32 DASH_GEL,
33 LONG_DASH_GEL,
34 DASH_DOT_GEL,
35 LONG_DASH_DOT_GEL,
36 LONG_DASH_DOT_DOT_GEL
37 };
38 struct Dot
39 {
40 boost::optional<double> m_length;
41 unsigned m_count;
42 Dot(unsigned count) : m_length(), m_count(count)
43 {
44 }
45 Dot(unsigned count, double length) : m_length(length), m_count(count)
46 {
47 }
48 };
49 struct Dash
50 {
51 double m_distance;
52 DotStyle m_dotStyle;
53 std::vector<Dot> m_dots; // empty vector is interpreted as solid line
54 Dash(double distance, DotStyle dotStyle) : m_distance(distance),
55 m_dotStyle(dotStyle), m_dots()
56 {
57 }
58 };
59 bool operator!=(const Dot &lhs, const Dot &rhs);
60 bool operator==(const Dot &lhs, const Dot &rhs);
61 bool operator==(const Dash &lhs, const Dash &rhs);
62 Dash getDash(MSPUBDashStyle style, unsigned shapeLineWidthInEmu,
63 DotStyle dotStyle);
64 } // namespace libmspub
65
66 #endif /* INCLUDED_DASH_H */
67 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libmspub::RECT_DOT
@ RECT_DOT
Definition: Dash.h:21
libmspub::operator!=
bool operator!=(const Dot &lhs, const Dot &rhs)
Definition: Dash.cpp:23
MSPUBConstants.h
libmspub::Dot::Dot
Dot(unsigned count, double length)
Definition: Dash.h:45
libmspub::Dash::m_dotStyle
DotStyle m_dotStyle
Definition: Dash.h:52
Dash.h
libmspub::Dash::m_distance
double m_distance
Definition: Dash.h:51
MSPUB_DEBUG_MSG
#define MSPUB_DEBUG_MSG(M)
Definition: libmspub_utils.h:55
libmspub
Definition: Arrow.h:14
libmspub::getDash
Dash getDash(MSPUBDashStyle style, unsigned shapeLineWidthEmu, DotStyle dotStyle)
Definition: Dash.cpp:45
libmspub::LONG_DASH_GEL
@ LONG_DASH_GEL
Definition: Dash.h:33
libmspub::DASH_DOT_DOT_SYS
@ DASH_DOT_DOT_SYS
Definition: Dash.h:30
libmspub_utils.h
libmspub::ROUND_DOT
@ ROUND_DOT
Definition: Dash.h:22
libmspub::DASH_SYS
@ DASH_SYS
Definition: Dash.h:27
libmspub::Dot::m_count
unsigned m_count
Definition: Dash.h:41
libmspub::DASH_GEL
@ DASH_GEL
Definition: Dash.h:32
MSPUB_FALLTHROUGH
#define MSPUB_FALLTHROUGH
Definition: libmspub_utils.h:43
libmspub::Dash::Dash
Dash(double distance, DotStyle dotStyle)
Definition: Dash.h:54
libmspub::LONG_DASH_DOT_DOT_GEL
@ LONG_DASH_DOT_DOT_GEL
Definition: Dash.h:36
libmspub::operator==
bool operator==(const ColorReference &l, const ColorReference &r)
Definition: ColorReference.cpp:52
libmspub::DotStyle
DotStyle
Definition: Dash.h:20
libmspub::DASH_DOT_GEL
@ DASH_DOT_GEL
Definition: Dash.h:34
libmspub::Dash
Definition: Dash.h:50
libmspub::LONG_DASH_DOT_GEL
@ LONG_DASH_DOT_GEL
Definition: Dash.h:35
libmspub::Dash::m_dots
std::vector< Dot > m_dots
Definition: Dash.h:53
libmspub::MSPUBDashStyle
MSPUBDashStyle
Definition: Dash.h:25
libmspub::DASH_DOT_SYS
@ DASH_DOT_SYS
Definition: Dash.h:29
libmspub::DOT_GEL
@ DOT_GEL
Definition: Dash.h:31
libmspub::MSPUB_DS_SOLID
@ MSPUB_DS_SOLID
Definition: Dash.h:26
libmspub::Dot::m_length
boost::optional< double > m_length
Definition: Dash.h:40
libmspub::DOT_SYS
@ DOT_SYS
Definition: Dash.h:28
libmspub::Dot::Dot
Dot(unsigned count)
Definition: Dash.h:42
EMUS_IN_INCH
#define EMUS_IN_INCH
Definition: MSPUBConstants.h:13
libmspub::Dot
Definition: Dash.h:39