summaryrefslogtreecommitdiff
path: root/src/lib/Dash.h
blob: 6079c5924a494e49c020d838bb6461974f15ca3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
 * This file is part of the libmspub project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#ifndef INCLUDED_DASH_H
#define INCLUDED_DASH_H

#include <vector>

#include <boost/optional.hpp>

namespace libmspub
{
enum DotStyle
{
  RECT_DOT,
  ROUND_DOT
};
enum MSPUBDashStyle
{
  MSPUB_DS_SOLID,
  DASH_SYS,
  DOT_SYS,
  DASH_DOT_SYS,
  DASH_DOT_DOT_SYS,
  DOT_GEL,
  DASH_GEL,
  LONG_DASH_GEL,
  DASH_DOT_GEL,
  LONG_DASH_DOT_GEL,
  LONG_DASH_DOT_DOT_GEL
};
struct Dot
{
  boost::optional<double> m_length;
  unsigned m_count;
  Dot(unsigned count) : m_length(), m_count(count)
  {
  }
  Dot(unsigned count, double length) : m_length(length), m_count(count)
  {
  }
};
struct Dash
{
  double m_distance;
  DotStyle m_dotStyle;
  std::vector<Dot> m_dots; // empty vector is interpreted as solid line
  Dash(double distance, DotStyle dotStyle) : m_distance(distance),
    m_dotStyle(dotStyle), m_dots()
  {
  }
};
bool operator!=(const Dot &lhs, const Dot &rhs);
bool operator==(const Dot &lhs, const Dot &rhs);
bool operator==(const Dash &lhs, const Dash &rhs);
Dash getDash(MSPUBDashStyle style, unsigned shapeLineWidthInEmu,
             DotStyle dotStyle);
} // namespace libmspub

#endif /* INCLUDED_DASH_H */
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */