VSDFieldList.h Source File documentation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

VSDFieldList.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 __VSDFIELDLIST_H__
11 #define __VSDFIELDLIST_H__
12
13 #include <vector>
14 #include <map>
15 #include <librevenge/librevenge.h>
16 #include "VSDDocumentStructure.h"
17 #include "VSDTypes.h"
18
19 namespace libvisio
20 {
21
22 class VSDCollector;
23
24 class VSDFieldListElement
25 {
26 public:
27 VSDFieldListElement() {}
28 virtual ~VSDFieldListElement() {}
29 virtual void handle(VSDCollector *collector) const = 0;
30 virtual VSDFieldListElement *clone() = 0;
31 virtual librevenge::RVNGString getString(const std::map<unsigned, librevenge::RVNGString> &) = 0;
32 virtual void setNameId(int) = 0;
33 virtual void setFormat(unsigned short) = 0;
34 virtual void setValue(double) = 0;
35 };
36
37 class VSDTextField : public VSDFieldListElement
38 {
39 public:
40 VSDTextField(unsigned id, unsigned level, int nameId, int formatStringId)
41 : m_id(id),
42 m_level(level),
43 m_nameId(nameId),
44 m_formatStringId(formatStringId) {}
45 ~VSDTextField() {}
46 void handle(VSDCollector *collector) const;
47 VSDFieldListElement *clone();
48 librevenge::RVNGString getString(const std::map<unsigned, librevenge::RVNGString> &strVec);
49 void setNameId(int nameId);
50 void setFormat(unsigned short) {}
51 void setValue(double) {}
52 private:
53 unsigned m_id, m_level;
54 int m_nameId, m_formatStringId;
55 };
56
57 class VSDNumericField : public VSDFieldListElement
58 {
59 public:
60 VSDNumericField(unsigned id, unsigned level, unsigned short format, double number, int formatStringId)
61 : m_id(id),
62 m_level(level),
63 m_format(format),
64 m_number(number),
65 m_formatStringId(formatStringId) {}
66 ~VSDNumericField() {}
67 void handle(VSDCollector *collector) const;
68 VSDFieldListElement *clone();
69 librevenge::RVNGString getString(const std::map<unsigned, librevenge::RVNGString> &);
70 void setNameId(int) {}
71 void setFormat(unsigned short format);
72 void setValue(double number);
73 private:
74 librevenge::RVNGString datetimeToString(const char *format, double datetime);
75 unsigned m_id, m_level;
76 unsigned short m_format;
77 double m_number;
78 int m_formatStringId;
79 };
80
81 class VSDFieldList
82 {
83 public:
84 VSDFieldList();
85 VSDFieldList(const VSDFieldList &fieldList);
86 ~VSDFieldList();
87 VSDFieldList &operator=(const VSDFieldList &fieldList);
88 void setElementsOrder(const std::vector<unsigned> &m_elementsOrder);
89 void addFieldList(unsigned id, unsigned level);
90 void addTextField(unsigned id, unsigned level, int nameId, int formatStringId);
91 void addNumericField(unsigned id, unsigned level, unsigned short format, double number, int formatStringId);
92 void addClonedField(unsigned id);
93 void handle(VSDCollector *collector) const;
94 void clear();
95 unsigned long size() const
96 {
97 return (unsigned long)m_elements.size();
98 }
99 bool empty() const
100 {
101 return (m_elements.empty());
102 }
103 VSDFieldListElement *getElement(unsigned index);
104 private:
105 std::map<unsigned, VSDFieldListElement *> m_elements;
106 std::vector<unsigned> m_elementsOrder;
107 unsigned m_id, m_level;
108 };
109
110 } // namespace libvisio
111
112 #endif // __VSDFIELDLIST_H__
113 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libvisio::VSDFieldList::addFieldList
void addFieldList(unsigned id, unsigned level)
Definition: VSDFieldList.cpp:211
libvisio::VSDTextField::m_level
unsigned m_level
Definition: VSDFieldList.h:53
libvisio::VSDNumericField::~VSDNumericField
~VSDNumericField()
Definition: VSDFieldList.h:66
libvisio::VSDNumericField::getString
librevenge::RVNGString getString(const std::map< unsigned, librevenge::RVNGString > &)
Definition: VSDFieldList.cpp:65
libvisio::VSDFieldList::addTextField
void addTextField(unsigned id, unsigned level, int nameId, int formatStringId)
Definition: VSDFieldList.cpp:217
libvisio::VSDFieldList::handle
void handle(VSDCollector *collector) const
Definition: VSDFieldList.cpp:227
libvisio::VSDFieldListElement::setValue
virtual void setValue(double)=0
VSDDocumentStructure.h
libvisio::VSDFieldList::m_id
unsigned m_id
Definition: VSDFieldList.h:107
libvisio::VSDFieldListElement::setFormat
virtual void setFormat(unsigned short)=0
libvisio::VSDFieldListElement::VSDFieldListElement
VSDFieldListElement()
Definition: VSDFieldList.h:27
libvisio::VSDFieldList::addNumericField
void addNumericField(unsigned id, unsigned level, unsigned short format, double number, int formatStringId)
Definition: VSDFieldList.cpp:222
libvisio::VSDFieldList::~VSDFieldList
~VSDFieldList()
Definition: VSDFieldList.cpp:199
libvisio::VSDFieldListElement
Definition: VSDFieldList.h:24
libvisio::VSDNumericField::clone
VSDFieldListElement * clone()
Definition: VSDFieldList.cpp:44
libvisio::VSDFieldList::getElement
VSDFieldListElement * getElement(unsigned index)
Definition: VSDFieldList.cpp:258
libvisio::VSDTextField::setNameId
void setNameId(int nameId)
Definition: VSDFieldList.cpp:33
libvisio::VSDTextField::clone
VSDFieldListElement * clone()
Definition: VSDFieldList.cpp:19
libvisio::VSDTextField::VSDTextField
VSDTextField(unsigned id, unsigned level, int nameId, int formatStringId)
Definition: VSDFieldList.h:40
libvisio::VSDNumericField::datetimeToString
librevenge::RVNGString datetimeToString(const char *format, double datetime)
Definition: VSDFieldList.cpp:51
libvisio::VSDFieldListElement::getString
virtual librevenge::RVNGString getString(const std::map< unsigned, librevenge::RVNGString > &)=0
libvisio::VSDTextField::handle
void handle(VSDCollector *collector) const
Definition: VSDFieldList.cpp:14
libvisio::VSDFieldList::operator=
VSDFieldList & operator=(const VSDFieldList &fieldList)
Definition: VSDFieldList.cpp:184
libvisio::VSDNumericField::m_format
unsigned short m_format
Definition: VSDFieldList.h:76
libvisio::VSDFieldList::addClonedField
void addClonedField(unsigned id)
libvisio::VSDNumericField::setFormat
void setFormat(unsigned short format)
Definition: VSDFieldList.cpp:155
libvisio::VSDNumericField::m_formatStringId
int m_formatStringId
Definition: VSDFieldList.h:78
libvisio::VSDCollector
Definition: VSDCollector.h:20
libvisio::VSDTextField::getString
librevenge::RVNGString getString(const std::map< unsigned, librevenge::RVNGString > &strVec)
Definition: VSDFieldList.cpp:24
libvisio::VSDFieldList
Definition: VSDFieldList.h:81
libvisio::VSDFieldListElement::setNameId
virtual void setNameId(int)=0
libvisio::VSDFieldListElement::handle
virtual void handle(VSDCollector *collector) const =0
libvisio::VSDTextField::setFormat
void setFormat(unsigned short)
Definition: VSDFieldList.h:50
libvisio::VSDTextField::m_nameId
int m_nameId
Definition: VSDFieldList.h:54
libvisio::VSDNumericField::VSDNumericField
VSDNumericField(unsigned id, unsigned level, unsigned short format, double number, int formatStringId)
Definition: VSDFieldList.h:60
VSDTypes.h
libvisio::VSDTextField
Definition: VSDFieldList.h:37
libvisio::VSDNumericField::m_number
double m_number
Definition: VSDFieldList.h:77
libvisio::VSDFieldList::clear
void clear()
Definition: VSDFieldList.cpp:250
libvisio::VSDFieldListElement::clone
virtual VSDFieldListElement * clone()=0
libvisio::VSDNumericField::setNameId
void setNameId(int)
Definition: VSDFieldList.h:70
libvisio::VSDNumericField::m_level
unsigned m_level
Definition: VSDFieldList.h:75
libvisio::VSDFieldList::empty
bool empty() const
Definition: VSDFieldList.h:99
libvisio
Definition: libvisio_utils.h:68
libvisio::VSDFieldList::size
unsigned long size() const
Definition: VSDFieldList.h:95
libvisio::VSDTextField::m_formatStringId
int m_formatStringId
Definition: VSDFieldList.h:54
libvisio::VSDNumericField::setValue
void setValue(double number)
Definition: VSDFieldList.cpp:159
libvisio::VSDNumericField::handle
void handle(VSDCollector *collector) const
Definition: VSDFieldList.cpp:39
libvisio::VSDFieldList::VSDFieldList
VSDFieldList()
Definition: VSDFieldList.cpp:165
libvisio::VSDNumericField
Definition: VSDFieldList.h:57
libvisio::VSDNumericField::m_id
unsigned m_id
Definition: VSDFieldList.h:75
libvisio::VSDFieldList::setElementsOrder
void setElementsOrder(const std::vector< unsigned > &m_elementsOrder)
Definition: VSDFieldList.cpp:204
libvisio::VSDTextField::setValue
void setValue(double)
Definition: VSDFieldList.h:51
libvisio::VSDTextField::m_id
unsigned m_id
Definition: VSDFieldList.h:53
libvisio::VSDFieldListElement::~VSDFieldListElement
virtual ~VSDFieldListElement()
Definition: VSDFieldList.h:28
libvisio::VSDTextField::~VSDTextField
~VSDTextField()
Definition: VSDFieldList.h:45
libvisio::VSDFieldList::m_elements
std::map< unsigned, VSDFieldListElement * > m_elements
Definition: VSDFieldList.h:105
libvisio::VSDFieldList::m_level
unsigned m_level
Definition: VSDFieldList.h:107
libvisio::VSDFieldList::m_elementsOrder
std::vector< unsigned > m_elementsOrder
Definition: VSDFieldList.h:106