VSDCharacterList.h Source File documentation

VSDCharacterList.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 libvisio 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 __VSDCHARACTERLIST_H__
11 #define __VSDCHARACTERLIST_H__
12
13 #include <memory>
14 #include <vector>
15 #include <map>
16 #include "VSDTypes.h"
17 #include "VSDStyles.h"
18
19 namespace libvisio
20 {
21
22 class VSDCharacterListElement;
23 class VSDCollector;
24
25 class VSDCharacterList
26 {
27 public:
28 VSDCharacterList();
29 VSDCharacterList(const VSDCharacterList &charList);
30 ~VSDCharacterList();
31 VSDCharacterList &operator=(const VSDCharacterList &charList);
32 void addCharIX(unsigned id, unsigned level, unsigned charCount, const boost::optional<VSDName> &font,
33 const boost::optional<Colour> &fontColour, const boost::optional<double> &fontSize, const boost::optional<bool> &bold,
34 const boost::optional<bool> &italic, const boost::optional<bool> &underline, const boost::optional<bool> &doubleunderline,
35 const boost::optional<bool> &strikeout, const boost::optional<bool> &doublestrikeout, const boost::optional<bool> &allcaps,
36 const boost::optional<bool> &initcaps, const boost::optional<bool> &smallcaps, const boost::optional<bool> &superscript,
37 const boost::optional<bool> &subscript, const boost::optional<double> &scaleWidth);
38 void addCharIX(unsigned id, unsigned level, const VSDOptionalCharStyle &style);
39 unsigned getCharCount(unsigned id) const;
40 void setCharCount(unsigned id, unsigned charCount);
41 void resetCharCount();
42 unsigned getLevel() const;
43
44 void setElementsOrder(const std::vector<unsigned> &m_elementsOrder);
45 void handle(VSDCollector *collector) const;
46 void clear();
47 bool empty() const
48 {
49 return (m_elements.empty());
50 }
51 private:
52 std::map<unsigned, std::unique_ptr<VSDCharacterListElement>> m_elements;
53 std::vector<unsigned> m_elementsOrder;
54 };
55
56 } // namespace libvisio
57
58 #endif // __VSDCHARACTERLIST_H__
59 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
VSDCharacterList.h
libvisio::VSDCharacterList::addCharIX
void addCharIX(unsigned id, unsigned level, unsigned charCount, const boost::optional< VSDName > &font, const boost::optional< Colour > &fontColour, const boost::optional< double > &fontSize, const boost::optional< bool > &bold, const boost::optional< bool > &italic, const boost::optional< bool > &underline, const boost::optional< bool > &doubleunderline, const boost::optional< bool > &strikeout, const boost::optional< bool > &doublestrikeout, const boost::optional< bool > &allcaps, const boost::optional< bool > &initcaps, const boost::optional< bool > &smallcaps, const boost::optional< bool > &superscript, const boost::optional< bool > &subscript, const boost::optional< double > &scaleWidth)
Definition: VSDCharacterList.cpp:107
libvisio::VSDCharIX::clone
VSDCharacterListElement * clone() override
Definition: VSDCharacterList.cpp:67
libvisio::VSDCharacterListElement::handle
virtual void handle(VSDCollector *collector) const =0
libvisio::VSDCharacterList::empty
bool empty() const
Definition: VSDCharacterList.h:47
libvisio::VSDCharacterList::resetCharCount
void resetCharCount()
Definition: VSDCharacterList.cpp:148
libvisio::VSDOptionalCharStyle::subscript
boost::optional< bool > subscript
Definition: VSDStyles.h:263
libvisio::VSDCollector
Definition: VSDCollector.h:20
libvisio::VSDCharacterListElement::m_level
unsigned m_level
Definition: VSDCharacterList.cpp:27
libvisio::VSDCharacterList::clear
void clear()
Definition: VSDCharacterList.cpp:189
libvisio::VSDOptionalCharStyle::allcaps
boost::optional< bool > allcaps
Definition: VSDStyles.h:259
libvisio::VSDCharacterListElement::clone
virtual VSDCharacterListElement * clone()=0
libvisio::VSDCharacterList::VSDCharacterList
VSDCharacterList()
Definition: VSDCharacterList.cpp:76
libvisio::VSDCharIX
Definition: VSDCharacterList.cpp:30
libvisio::VSDCharacterList::getCharCount
unsigned getCharCount(unsigned id) const
Definition: VSDCharacterList.cpp:132
libvisio::VSDOptionalCharStyle::charCount
unsigned charCount
Definition: VSDStyles.h:249
libvisio::VSDCharacterListElement::VSDCharacterListElement
VSDCharacterListElement(unsigned id, unsigned level)
Definition: VSDCharacterList.cpp:20
libvisio::VSDOptionalCharStyle::colour
boost::optional< Colour > colour
Definition: VSDStyles.h:251
libvisio::clone
std::unique_ptr< T > clone(const std::unique_ptr< T > &other)
Definition: libvisio_utils.h:65
libvisio::VSDCharacterListElement
Definition: VSDCharacterList.cpp:17
libvisio::VSDCharacterList::setCharCount
void setCharCount(unsigned id, unsigned charCount)
Definition: VSDCharacterList.cpp:141
libvisio::VSDCharacterList::operator=
VSDCharacterList & operator=(const VSDCharacterList &charList)
Definition: VSDCharacterList.cpp:90
libvisio::VSDCharacterList
Definition: VSDCharacterList.h:25
VSDStyles.h
libvisio::VSDCharacterList::getLevel
unsigned getLevel() const
Definition: VSDCharacterList.cpp:154
libvisio::VSDCharacterList::m_elementsOrder
std::vector< unsigned > m_elementsOrder
Definition: VSDCharacterList.h:53
VSDTypes.h
libvisio::VSDOptionalCharStyle::initcaps
boost::optional< bool > initcaps
Definition: VSDStyles.h:260
VSDCollector.h
libvisio::VSDOptionalCharStyle::font
boost::optional< VSDName > font
Definition: VSDStyles.h:250
libvisio::VSDCharIX::handle
void handle(VSDCollector *collector) const override
Definition: VSDCharacterList.cpp:59
libvisio::VSDCharacterListElement::getCharCount
virtual unsigned getCharCount() const =0
libvisio::VSDOptionalCharStyle
Definition: VSDStyles.h:208
libvisio::VSDCharacterList::~VSDCharacterList
~VSDCharacterList()
Definition: VSDCharacterList.cpp:102
libvisio::VSDCharIX::~VSDCharIX
~VSDCharIX() override
Definition: VSDCharacterList.cpp:42
libvisio::VSDOptionalCharStyle::superscript
boost::optional< bool > superscript
Definition: VSDStyles.h:262
libvisio::VSDOptionalCharStyle::italic
boost::optional< bool > italic
Definition: VSDStyles.h:254
libvisio::VSDCharIX::VSDCharIX
VSDCharIX(unsigned id, unsigned level, const VSDOptionalCharStyle &style)
Definition: VSDCharacterList.cpp:41
libvisio::VSDCharacterListElement::~VSDCharacterListElement
virtual ~VSDCharacterListElement()
Definition: VSDCharacterList.cpp:21
libvisio::VSDCharIX::m_style
VSDOptionalCharStyle m_style
Definition: VSDCharacterList.cpp:54
libvisio::VSDCharacterList::setElementsOrder
void setElementsOrder(const std::vector< unsigned > &m_elementsOrder)
Definition: VSDCharacterList.cpp:161
libvisio::VSDCharIX::getCharCount
unsigned getCharCount() const override
Definition: VSDCharacterList.cpp:45
libvisio::VSDOptionalCharStyle::underline
boost::optional< bool > underline
Definition: VSDStyles.h:255
libvisio::VSDCharacterListElement::setCharCount
virtual void setCharCount(unsigned charCount)=0
libvisio::VSDCollector::collectCharIX
virtual void collectCharIX(unsigned id, unsigned level, unsigned charCount, const boost::optional< VSDName > &font, const boost::optional< Colour > &fontColour, const boost::optional< double > &fontSize, const boost::optional< bool > &bold, const boost::optional< bool > &italic, const boost::optional< bool > &underline, const boost::optional< bool > &doubleunderline, const boost::optional< bool > &strikeout, const boost::optional< bool > &doublestrikeout, const boost::optional< bool > &allcaps, const boost::optional< bool > &initcaps, const boost::optional< bool > &smallcaps, const boost::optional< bool > &superscript, const boost::optional< bool > &subscript, const boost::optional< double > &scaleWidth)=0
libvisio::VSDOptionalCharStyle::doublestrikeout
boost::optional< bool > doublestrikeout
Definition: VSDStyles.h:258
libvisio::VSDOptionalCharStyle::strikeout
boost::optional< bool > strikeout
Definition: VSDStyles.h:257
libvisio::VSDOptionalCharStyle::smallcaps
boost::optional< bool > smallcaps
Definition: VSDStyles.h:261
libvisio::VSDCharIX::setCharCount
void setCharCount(unsigned charCount) override
Definition: VSDCharacterList.cpp:49
libvisio::VSDCharacterListElement::m_id
unsigned m_id
Definition: VSDCharacterList.cpp:27
MINUS_ONE
#define MINUS_ONE
Definition: VSDTypes.h:18
libvisio::VSDOptionalCharStyle::scaleWidth
boost::optional< double > scaleWidth
Definition: VSDStyles.h:264
libvisio::VSDCharIX::VSDCharIX
VSDCharIX(unsigned id, unsigned level, unsigned charCount, const boost::optional< VSDName > &font, const boost::optional< Colour > &fontColour, const boost::optional< double > &fontSize, const boost::optional< bool > &bold, const boost::optional< bool > &italic, const boost::optional< bool > &underline, const boost::optional< bool > &doubleunderline, const boost::optional< bool > &strikeout, const boost::optional< bool > &doublestrikeout, const boost::optional< bool > &allcaps, const boost::optional< bool > &initcaps, const boost::optional< bool > &smallcaps, const boost::optional< bool > &superscript, const boost::optional< bool > &subscript, const boost::optional< double > &scaleWidth)
Definition: VSDCharacterList.cpp:33
libvisio::VSDCharacterList::m_elements
std::map< unsigned, std::unique_ptr< VSDCharacterListElement > > m_elements
Definition: VSDCharacterList.h:52
libvisio::VSDCharacterList::handle
void handle(VSDCollector *collector) const
Definition: VSDCharacterList.cpp:168
libvisio::VSDOptionalCharStyle::size
boost::optional< double > size
Definition: VSDStyles.h:252
libvisio::VSDOptionalCharStyle::bold
boost::optional< bool > bold
Definition: VSDStyles.h:253
libvisio
Definition: libvisio_utils.h:48
libvisio::VSDOptionalCharStyle::doubleunderline
boost::optional< bool > doubleunderline
Definition: VSDStyles.h:256