Dash.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /*
00003  * This file is part of the libmspub project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  */
00009 
00010 #ifndef __DASH_H__
00011 #define __DASH_H__
00012 
00013 #include <boost/optional.hpp>
00014 #include <vector>
00015 
00016 namespace libmspub
00017 {
00018 enum DotStyle
00019 {
00020   RECT_DOT,
00021   ROUND_DOT
00022 };
00023 enum MSPUBDashStyle
00024 {
00025   MSPUB_DS_SOLID,
00026   DASH_SYS,
00027   DOT_SYS,
00028   DASH_DOT_SYS,
00029   DASH_DOT_DOT_SYS,
00030   DOT_GEL,
00031   DASH_GEL,
00032   LONG_DASH_GEL,
00033   DASH_DOT_GEL,
00034   LONG_DASH_DOT_GEL,
00035   LONG_DASH_DOT_DOT_GEL
00036 };
00037 struct Dot
00038 {
00039   boost::optional<double> m_length;
00040   unsigned m_count;
00041   Dot(unsigned count) : m_length(), m_count(count)
00042   {
00043   }
00044   Dot(unsigned count, double length) : m_length(length), m_count(count)
00045   {
00046   }
00047 };
00048 struct Dash
00049 {
00050   double m_distance;
00051   DotStyle m_dotStyle;
00052   std::vector<Dot> m_dots; // empty vector is interpreted as solid line
00053   Dash(double distance, DotStyle dotStyle) : m_distance(distance),
00054     m_dotStyle(dotStyle), m_dots()
00055   {
00056   }
00057 };
00058 bool operator!=(const Dot &lhs, const Dot &rhs);
00059 bool operator==(const Dot &lhs, const Dot &rhs);
00060 bool operator==(const Dash &lhs, const Dash &rhs);
00061 Dash getDash(MSPUBDashStyle style, unsigned shapeLineWidthInEmu,
00062              DotStyle dotStyle);
00063 } // namespace libmspub
00064 
00065 #endif /* __DASH_H__ */
00066 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */