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 
25 {
26 public:
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 
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() override {}
46  void handle(VSDCollector *collector) const override;
47  VSDFieldListElement *clone() override;
48  librevenge::RVNGString getString(const std::map<unsigned, librevenge::RVNGString> &strVec) override;
49  void setNameId(int nameId) override;
50  void setFormat(unsigned short) override {}
51  void setValue(double) override {}
52 private:
53  unsigned m_id, m_level;
55 };
56 
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() override {}
67  void handle(VSDCollector *collector) const override;
68  VSDFieldListElement *clone() override;
69  librevenge::RVNGString getString(const std::map<unsigned, librevenge::RVNGString> &) override;
70  void setNameId(int) override {}
71  void setFormat(unsigned short format) override;
72  void setValue(double number) override;
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;
79 };
80 
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: */
VSD_FIELD_FORMAT_DateDMMMMYYYY
#define VSD_FIELD_FORMAT_DateDMMMMYYYY
Definition: VSDDocumentStructure.h:160
VSD_FIELD_FORMAT_TimeAMPMhmm_J
#define VSD_FIELD_FORMAT_TimeAMPMhmm_J
Definition: VSDDocumentStructure.h:174
VSD_FIELD_FORMAT_DateMmmDYYYY
#define VSD_FIELD_FORMAT_DateMmmDYYYY
Definition: VSDDocumentStructure.h:155
VSD_FIELD_FORMAT_TimeAMPM_hmm_C
#define VSD_FIELD_FORMAT_TimeAMPM_hmm_C
Definition: VSDDocumentStructure.h:196
libvisio::VSDNumericField::setNameId
void setNameId(int) override
Definition: VSDFieldList.h:70
libvisio::VSDFieldListElement::handle
virtual void handle(VSDCollector *collector) const =0
VSD_FIELD_FORMAT_Dateyyyymd
#define VSD_FIELD_FORMAT_Dateyyyymd
Definition: VSDDocumentStructure.h:172
libvisio::VSDFieldList::m_elements
std::map< unsigned, VSDFieldListElement * > m_elements
Definition: VSDFieldList.h:105
libvisio::VSDNumericField
Definition: VSDFieldList.h:58
libvisio::VSDNumericField::clone
VSDFieldListElement * clone() override
Definition: VSDFieldList.cpp:44
VSD_FIELD_FORMAT_Timehmm_C
#define VSD_FIELD_FORMAT_Timehmm_C
Definition: VSDDocumentStructure.h:197
libvisio::VSDFieldListElement::VSDFieldListElement
VSDFieldListElement()
Definition: VSDFieldList.h:27
VSD_FIELD_FORMAT_TimeAMPM_hmm_J
#define VSD_FIELD_FORMAT_TimeAMPM_hmm_J
Definition: VSDDocumentStructure.h:194
libvisio::VSDTextField::m_nameId
int m_nameId
Definition: VSDFieldList.h:54
VSD_FIELD_FORMAT_Timehmm_K
#define VSD_FIELD_FORMAT_Timehmm_K
Definition: VSDDocumentStructure.h:199
libvisio::VSDFieldListElement::getString
virtual librevenge::RVNGString getString(const std::map< unsigned, librevenge::RVNGString > &)=0
VSDFieldList.h
libvisio::VSDFieldList::addNumericField
void addNumericField(unsigned id, unsigned level, unsigned short format, double number, int formatStringId)
Definition: VSDFieldList.cpp:223
libvisio::VSDTextField::m_formatStringId
int m_formatStringId
Definition: VSDFieldList.h:54
VSD_FIELD_FORMAT_MsoDateShort
#define VSD_FIELD_FORMAT_MsoDateShort
Definition: VSDDocumentStructure.h:209
libvisio::VSDFieldListElement
Definition: VSDFieldList.h:25
libvisio::VSDFieldListElement::setFormat
virtual void setFormat(unsigned short)=0
VSD_FIELD_FORMAT_MsoDateShortMon
#define VSD_FIELD_FORMAT_MsoDateShortMon
Definition: VSDDocumentStructure.h:214
libvisio::VSDTextField::setNameId
void setNameId(int nameId) override
Definition: VSDFieldList.cpp:33
libvisio::VSDTextField::handle
void handle(VSDCollector *collector) const override
Definition: VSDFieldList.cpp:14
libvisio::VSDNumericField::m_number
double m_number
Definition: VSDFieldList.h:77
libvisio::VSDNumericField::VSDNumericField
VSDNumericField(unsigned id, unsigned level, unsigned short format, double number, int formatStringId)
Definition: VSDFieldList.h:60
libvisio::VSDCollector
Definition: VSDCollector.h:21
libvisio::VSDFieldList::operator=
VSDFieldList & operator=(const VSDFieldList &fieldList)
Definition: VSDFieldList.cpp:184
VSD_FIELD_FORMAT_DateTWNfyyyymmddww_C
#define VSD_FIELD_FORMAT_DateTWNfyyyymmddww_C
Definition: VSDDocumentStructure.h:178
VSD_FIELD_FORMAT_Dateyyyy_m_d
#define VSD_FIELD_FORMAT_Dateyyyy_m_d
Definition: VSDDocumentStructure.h:190
VSD_FIELD_FORMAT_TimeAMPM_hmm_K
#define VSD_FIELD_FORMAT_TimeAMPM_hmm_K
Definition: VSDDocumentStructure.h:198
libvisio::VSDFieldList::handle
void handle(VSDCollector *collector) const
Definition: VSDFieldList.cpp:229
VSD_FIELD_FORMAT_Dateyyyymdww_J
#define VSD_FIELD_FORMAT_Dateyyyymdww_J
Definition: VSDDocumentStructure.h:181
VSD_FIELD_FORMAT_MsoTimeSec24
#define VSD_FIELD_FORMAT_MsoTimeSec24
Definition: VSDDocumentStructure.h:225
VSD_FIELD_FORMAT_Dateyy_mm_dd
#define VSD_FIELD_FORMAT_Dateyy_mm_dd
Definition: VSDDocumentStructure.h:191
VSD_FIELD_FORMAT_TimeAMPMhmm_S
#define VSD_FIELD_FORMAT_TimeAMPMhmm_S
Definition: VSDDocumentStructure.h:206
libvisio::VSDFieldList::addClonedField
void addClonedField(unsigned id)
libvisio::VSDTextField::setValue
void setValue(double) override
Definition: VSDFieldList.h:51
VSD_FIELD_FORMAT_TimeHMMAMPM_E
#define VSD_FIELD_FORMAT_TimeHMMAMPM_E
Definition: VSDDocumentStructure.h:200
VSD_FIELD_FORMAT_MsoTimeDatePM
#define VSD_FIELD_FORMAT_MsoTimeDatePM
Definition: VSDDocumentStructure.h:220
VSD_FIELD_FORMAT_TimeHHMM
#define VSD_FIELD_FORMAT_TimeHHMM
Definition: VSDDocumentStructure.h:163
VSDDocumentStructure.h
VSD_FIELD_FORMAT_TimeHMM
#define VSD_FIELD_FORMAT_TimeHMM
Definition: VSDDocumentStructure.h:162
VSD_FIELD_FORMAT_MsoDateLongDay
#define VSD_FIELD_FORMAT_MsoDateLongDay
Definition: VSDDocumentStructure.h:210
VSD_FIELD_FORMAT_TimeHMM24
#define VSD_FIELD_FORMAT_TimeHMM24
Definition: VSDDocumentStructure.h:164
libvisio::VSDNumericField::~VSDNumericField
~VSDNumericField() override
Definition: VSDFieldList.h:66
VSD_FIELD_FORMAT_MsoDateEnglish
#define VSD_FIELD_FORMAT_MsoDateEnglish
Definition: VSDDocumentStructure.h:217
libvisio::VSDFieldList::size
unsigned long size() const
Definition: VSDFieldList.h:95
VSDTypes.h
libvisio::VSDFieldList
Definition: VSDFieldList.h:82
VSDCollector.h
libvisio::VSDTextField
Definition: VSDFieldList.h:38
libvisio::VSDFieldList::addTextField
void addTextField(unsigned id, unsigned level, int nameId, int formatStringId)
Definition: VSDFieldList.cpp:217
VSD_FIELD_FORMAT_Dateyyyymd_S
#define VSD_FIELD_FORMAT_Dateyyyymd_S
Definition: VSDDocumentStructure.h:202
VSD_FIELD_FORMAT_DateDMMMYYYY
#define VSD_FIELD_FORMAT_DateDMMMYYYY
Definition: VSDDocumentStructure.h:159
VSD_FIELD_FORMAT_DateMmmmDYYYY
#define VSD_FIELD_FORMAT_DateMmmmDYYYY
Definition: VSDDocumentStructure.h:156
libvisio::VSDFieldListElement::setNameId
virtual void setNameId(int)=0
VSD_FIELD_FORMAT_MsoDateShortSlash
#define VSD_FIELD_FORMAT_MsoDateShortSlash
Definition: VSDDocumentStructure.h:215
libvisio::VSDNumericField::setFormat
void setFormat(unsigned short format) override
Definition: VSDFieldList.cpp:155
libvisio::VSDFieldList::m_elementsOrder
std::vector< unsigned > m_elementsOrder
Definition: VSDFieldList.h:106
VSD_FIELD_FORMAT_TimeAMPMhhmm_S
#define VSD_FIELD_FORMAT_TimeAMPMhhmm_S
Definition: VSDDocumentStructure.h:207
VSD_FIELD_FORMAT_TimeAMPMhmm_C
#define VSD_FIELD_FORMAT_TimeAMPMhmm_C
Definition: VSDDocumentStructure.h:192
libvisio::VSDNumericField::setValue
void setValue(double number) override
Definition: VSDFieldList.cpp:159
VSD_FIELD_FORMAT_MsoTimePM
#define VSD_FIELD_FORMAT_MsoTimePM
Definition: VSDDocumentStructure.h:222
libvisio::VSDFieldList::empty
bool empty() const
Definition: VSDFieldList.h:99
VSD_FIELD_FORMAT_Dateyymmdd
#define VSD_FIELD_FORMAT_Dateyymmdd
Definition: VSDDocumentStructure.h:173
libvisio::VSDFieldList::m_level
unsigned m_level
Definition: VSDFieldList.h:107
libvisio::VSDTextField::getString
librevenge::RVNGString getString(const std::map< unsigned, librevenge::RVNGString > &strVec) override
Definition: VSDFieldList.cpp:24
libvisio::VSDFieldListElement::clone
virtual VSDFieldListElement * clone()=0
VSD_FIELD_FORMAT_Dateyyyymmdd_S
#define VSD_FIELD_FORMAT_Dateyyyymmdd_S
Definition: VSDDocumentStructure.h:203
libvisio::VSDTextField::setFormat
void setFormat(unsigned short) override
Definition: VSDFieldList.h:50
MAX_BUFFER
#define MAX_BUFFER
Definition: VSDFieldList.cpp:49
VSD_FIELD_FORMAT_DateTWNfyyyymmdd_C
#define VSD_FIELD_FORMAT_DateTWNfyyyymmdd_C
Definition: VSDDocumentStructure.h:179
VSD_FIELD_FORMAT_MsoTimeSecPM
#define VSD_FIELD_FORMAT_MsoTimeSecPM
Definition: VSDDocumentStructure.h:223
libvisio::VSDFieldList::~VSDFieldList
~VSDFieldList()
Definition: VSDFieldList.cpp:199
libvisio::VSDFieldList::m_id
unsigned m_id
Definition: VSDFieldList.h:107
VSD_FIELD_FORMAT_DateDMYY
#define VSD_FIELD_FORMAT_DateDMYY
Definition: VSDDocumentStructure.h:157
VSD_FIELD_FORMAT_DateYYYYMMMDDD_C
#define VSD_FIELD_FORMAT_DateYYYYMMMDDD_C
Definition: VSDDocumentStructure.h:185
libvisio::VSDFieldList::addFieldList
void addFieldList(unsigned id, unsigned level)
Definition: VSDFieldList.cpp:211
libvisio::VSDTextField::m_level
unsigned m_level
Definition: VSDFieldList.h:53
VSD_FIELD_FORMAT_MsoDateLong
#define VSD_FIELD_FORMAT_MsoDateLong
Definition: VSDDocumentStructure.h:211
VSD_FIELD_FORMAT_Dateyyyymdww_K
#define VSD_FIELD_FORMAT_Dateyyyymdww_K
Definition: VSDDocumentStructure.h:187
VSD_FIELD_FORMAT_MsoDateISO
#define VSD_FIELD_FORMAT_MsoDateISO
Definition: VSDDocumentStructure.h:213
VSD_FIELD_FORMAT_TimeHMMAMPM
#define VSD_FIELD_FORMAT_TimeHMMAMPM
Definition: VSDDocumentStructure.h:166
VSD_FIELD_FORMAT_DateTWNsYYYYMMDDD_C
#define VSD_FIELD_FORMAT_DateTWNsYYYYMMDDD_C
Definition: VSDDocumentStructure.h:177
libvisio::VSDTextField::VSDTextField
VSDTextField(unsigned id, unsigned level, int nameId, int formatStringId)
Definition: VSDFieldList.h:40
VSD_FIELD_FORMAT_DateMDYY
#define VSD_FIELD_FORMAT_DateMDYY
Definition: VSDDocumentStructure.h:153
VSD_FIELD_FORMAT_MsoDateShortAlt
#define VSD_FIELD_FORMAT_MsoDateShortAlt
Definition: VSDDocumentStructure.h:212
libvisio::VSDFieldListElement::setValue
virtual void setValue(double)=0
libvisio::VSDFieldList::VSDFieldList
VSDFieldList()
Definition: VSDFieldList.cpp:165
libvisio::VSDNumericField::m_level
unsigned m_level
Definition: VSDFieldList.h:75
VSD_FIELD_FORMAT_TimeGen
#define VSD_FIELD_FORMAT_TimeGen
Definition: VSDDocumentStructure.h:161
libvisio::VSDCollector::collectNumericField
virtual void collectNumericField(unsigned id, unsigned level, unsigned short format, double number, int formatStringId)=0
VSD_FIELD_FORMAT_TimeAMPMhmm_K
#define VSD_FIELD_FORMAT_TimeAMPMhmm_K
Definition: VSDDocumentStructure.h:193
libvisio::VSDTextField::clone
VSDFieldListElement * clone() override
Definition: VSDFieldList.cpp:19
libvisio::VSDNumericField::m_id
unsigned m_id
Definition: VSDFieldList.h:75
libvisio::VSDNumericField::handle
void handle(VSDCollector *collector) const override
Definition: VSDFieldList.cpp:39
VSD_FIELD_FORMAT_TimeHHMMAMPM_E
#define VSD_FIELD_FORMAT_TimeHHMMAMPM_E
Definition: VSDDocumentStructure.h:201
VSD_FIELD_FORMAT_Dategggemdww_J
#define VSD_FIELD_FORMAT_Dategggemdww_J
Definition: VSDDocumentStructure.h:180
libvisio::VSDNumericField::datetimeToString
librevenge::RVNGString datetimeToString(const char *format, double datetime)
Definition: VSDFieldList.cpp:51
VSD_FIELD_FORMAT_MsoDateMon_Yr
#define VSD_FIELD_FORMAT_MsoDateMon_Yr
Definition: VSDDocumentStructure.h:219
VSD_FIELD_FORMAT_Datewwyyyymd_S
#define VSD_FIELD_FORMAT_Datewwyyyymd_S
Definition: VSDDocumentStructure.h:205
VSD_FIELD_FORMAT_MsoTimeDateSecPM
#define VSD_FIELD_FORMAT_MsoTimeDateSecPM
Definition: VSDDocumentStructure.h:221
VSD_FIELD_FORMAT_TimeHHMMAMPM
#define VSD_FIELD_FORMAT_TimeHHMMAMPM
Definition: VSDDocumentStructure.h:167
VSD_FIELD_FORMAT_DateDDMMYY
#define VSD_FIELD_FORMAT_DateDDMMYY
Definition: VSDDocumentStructure.h:158
libvisio::VSDCollector::collectFieldList
virtual void collectFieldList(unsigned id, unsigned level)=0
VSD_FIELD_FORMAT_DategeMMMMddddww_K
#define VSD_FIELD_FORMAT_DategeMMMMddddww_K
Definition: VSDDocumentStructure.h:186
VSD_FIELD_FORMAT_TimeHHMM24
#define VSD_FIELD_FORMAT_TimeHHMM24
Definition: VSDDocumentStructure.h:165
VSD_FIELD_FORMAT_DateTWNfYYYYMMDDD_C
#define VSD_FIELD_FORMAT_DateTWNfYYYYMMDDD_C
Definition: VSDDocumentStructure.h:176
VSD_FIELD_FORMAT_Datewwyyyymmdd_S
#define VSD_FIELD_FORMAT_Datewwyyyymmdd_S
Definition: VSDDocumentStructure.h:204
VSD_FIELD_FORMAT_Dateyyyymd_J
#define VSD_FIELD_FORMAT_Dateyyyymd_J
Definition: VSDDocumentStructure.h:183
VSD_FIELD_FORMAT_Dateyyyymd_K
#define VSD_FIELD_FORMAT_Dateyyyymd_K
Definition: VSDDocumentStructure.h:189
VSD_FIELD_FORMAT_DateYYYYMMMDDDWWW_C
#define VSD_FIELD_FORMAT_DateYYYYMMMDDDWWW_C
Definition: VSDDocumentStructure.h:184
VSD_FIELD_FORMAT_MsoTime24
#define VSD_FIELD_FORMAT_MsoTime24
Definition: VSDDocumentStructure.h:224
libvisio::VSDNumericField::m_formatStringId
int m_formatStringId
Definition: VSDFieldList.h:78
libvisio::VSDFieldList::clear
void clear()
Definition: VSDFieldList.cpp:252
libvisio::VSDCollector::collectTextField
virtual void collectTextField(unsigned id, unsigned level, int nameId, int formatStringId)=0
libvisio::VSDFieldListElement::~VSDFieldListElement
virtual ~VSDFieldListElement()
Definition: VSDFieldList.h:28
libvisio::VSDNumericField::m_format
unsigned short m_format
Definition: VSDFieldList.h:76
libvisio::VSDTextField::m_id
unsigned m_id
Definition: VSDFieldList.h:53
VSD_FIELD_FORMAT_Dategggemd_J
#define VSD_FIELD_FORMAT_Dategggemd_J
Definition: VSDDocumentStructure.h:182
libvisio::VSDNumericField::getString
librevenge::RVNGString getString(const std::map< unsigned, librevenge::RVNGString > &) override
Definition: VSDFieldList.cpp:65
libvisio::VSDFieldList::getElement
VSDFieldListElement * getElement(unsigned index)
Definition: VSDFieldList.cpp:260
VSD_FIELD_FORMAT_DateMMDDYY
#define VSD_FIELD_FORMAT_DateMMDDYY
Definition: VSDDocumentStructure.h:154
libvisio::VSDTextField::~VSDTextField
~VSDTextField() override
Definition: VSDFieldList.h:45
libvisio::VSDFieldList::setElementsOrder
void setElementsOrder(const std::vector< unsigned > &m_elementsOrder)
Definition: VSDFieldList.cpp:204
libvisio
Definition: libvisio_utils.h:49
VSD_FIELD_FORMAT_Timehmm_J
#define VSD_FIELD_FORMAT_Timehmm_J
Definition: VSDDocumentStructure.h:195
VSD_FIELD_FORMAT_MsoDateShortAbb
#define VSD_FIELD_FORMAT_MsoDateShortAbb
Definition: VSDDocumentStructure.h:216
VSD_FIELD_FORMAT_DategeMMMMddd_K
#define VSD_FIELD_FORMAT_DategeMMMMddd_K
Definition: VSDDocumentStructure.h:188
VSD_FIELD_FORMAT_MsoDateMonthYr
#define VSD_FIELD_FORMAT_MsoDateMonthYr
Definition: VSDDocumentStructure.h:218

Generated for libvisio by doxygen 1.8.20