IWORKNumberConverter.h Source File documentation

IWORKNumberConverter.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 libetonyek 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 IWORKNUMBERCONVERTER_H_INCLUDED
11 #define IWORKNUMBERCONVERTER_H_INCLUDED
12
13 #include <boost/optional.hpp>
14
15 #include "IWORKEnum.h"
16
17 namespace libetonyek
18 {
19
20 #define IWORK_DECLARE_NUMBER_CONVERTER(type) \
21 template<> \
22 struct IWORKNumberConverter<type> \
23 { \
24 static boost::optional<type> convert (const char *value); \
25 static boost::optional<type> convert (unsigned value); \
26 }
27
28 template<typename T>
29 struct IWORKNumberConverter
30 {
31 static boost::optional<T> convert(const char *value);
32 static boost::optional<T> convert(unsigned value);
33 };
34
35 IWORK_DECLARE_NUMBER_CONVERTER(bool);
36 IWORK_DECLARE_NUMBER_CONVERTER(double);
37 IWORK_DECLARE_NUMBER_CONVERTER(int);
38 IWORK_DECLARE_NUMBER_CONVERTER(IWORKAlignment);
39 IWORK_DECLARE_NUMBER_CONVERTER(IWORKBaseline);
40 IWORK_DECLARE_NUMBER_CONVERTER(IWORKBorderType);
41 IWORK_DECLARE_NUMBER_CONVERTER(IWORKCapitalization);
42 IWORK_DECLARE_NUMBER_CONVERTER(IWORKCellNumberType);
43 IWORK_DECLARE_NUMBER_CONVERTER(IWORKStrokeType);
44 IWORK_DECLARE_NUMBER_CONVERTER(IWORKVerticalAlignment);
45
46 }
47
48 #endif // IWORKNUMBERCONVERTER_H_INCLUDED
49
50 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libetonyek::try_double_cast
boost::optional< double > try_double_cast(const char *value)
Definition: libetonyek_xml.cpp:84
libetonyek::IWORK_CELL_NUMBER_TYPE_SCIENTIFIC
@ IWORK_CELL_NUMBER_TYPE_SCIENTIFIC
Definition: IWORKEnum.h:92
libetonyek::IWORKAlignment
IWORKAlignment
Definition: IWORKEnum.h:16
libetonyek
Definition: IWORKBezierElement.cpp:20
libetonyek::IWORKToken::none
@ none
Definition: IWORKToken.h:666
libetonyek::IWORK_ALIGNMENT_RIGHT
@ IWORK_ALIGNMENT_RIGHT
Definition: IWORKEnum.h:19
IWORKEnum.h
libetonyek::IWORK_ALIGNMENT_AUTOMATIC
@ IWORK_ALIGNMENT_AUTOMATIC
Definition: IWORKEnum.h:22
libetonyek::IWORKStrokeType
IWORKStrokeType
Definition: IWORKEnum.h:118
libetonyek::IWORKToken::type
@ type
Definition: IWORKToken.h:486
libetonyek::IWORK_BORDER_TYPE_BOTTOM
@ IWORK_BORDER_TYPE_BOTTOM
Definition: IWORKEnum.h:36
libetonyek::IWORKToken::alignment
@ alignment
Definition: IWORKToken.h:89
libetonyek::IWORK_BORDER_TYPE_TOP
@ IWORK_BORDER_TYPE_TOP
Definition: IWORKEnum.h:35
libetonyek::IWORK_BORDER_TYPE_TOP_AND_BOTTOM
@ IWORK_BORDER_TYPE_TOP_AND_BOTTOM
Definition: IWORKEnum.h:37
IWORKNumberConverter.h
libetonyek::IWORKNumberConverter::convert
static boost::optional< T > convert(const char *value)
Definition: IWORKNumberConverter.cpp:20
libetonyek::IWORKNumberConverter
Definition: IWORKNumberConverter.h:29
ETONYEK_DEBUG_MSG
#define ETONYEK_DEBUG_MSG(M)
Definition: libetonyek_utils.h:54
libetonyek::IWORK_STROKE_TYPE_AUTO
@ IWORK_STROKE_TYPE_AUTO
Definition: IWORKEnum.h:123
libetonyek::IWORK_STROKE_TYPE_SOLID
@ IWORK_STROKE_TYPE_SOLID
Definition: IWORKEnum.h:121
libetonyek::IWORKVerticalAlignment
IWORKVerticalAlignment
Definition: IWORKEnum.h:111
libetonyek::IWORK_ALIGNMENT_CENTER
@ IWORK_ALIGNMENT_CENTER
Definition: IWORKEnum.h:20
libetonyek::try_int_cast
boost::optional< int > try_int_cast(const char *value)
Definition: libetonyek_xml.cpp:99
libetonyek::IWORKToken::capitalization
@ capitalization
Definition: IWORKToken.h:125
libetonyek::IWORK_VERTICAL_ALIGNMENT_BOTTOM
@ IWORK_VERTICAL_ALIGNMENT_BOTTOM
Definition: IWORKEnum.h:115
libetonyek::try_bool_cast
boost::optional< bool > try_bool_cast(const char *value)
Definition: libetonyek_xml.cpp:61
libetonyek::IWORK_VERTICAL_ALIGNMENT_MIDDLE
@ IWORK_VERTICAL_ALIGNMENT_MIDDLE
Definition: IWORKEnum.h:114
libetonyek::IWORK_BASELINE_SUB
@ IWORK_BASELINE_SUB
Definition: IWORKEnum.h:28
libetonyek::IWORK_VERTICAL_ALIGNMENT_TOP
@ IWORK_VERTICAL_ALIGNMENT_TOP
Definition: IWORKEnum.h:113
libetonyek::IWORKBaseline
IWORKBaseline
Definition: IWORKEnum.h:25
libetonyek::IWORK_CELL_NUMBER_TYPE_DOUBLE
@ IWORK_CELL_NUMBER_TYPE_DOUBLE
Definition: IWORKEnum.h:93
libetonyek::IWORK_CAPITALIZATION_ALL_CAPS
@ IWORK_CAPITALIZATION_ALL_CAPS
Definition: IWORKEnum.h:60
libetonyek::IWORKCellNumberType
IWORKCellNumberType
Definition: IWORKEnum.h:88
libetonyek::IWORK_BASELINE_SUPER
@ IWORK_BASELINE_SUPER
Definition: IWORKEnum.h:29
libetonyek::IWORKToken::superscript
@ superscript
Definition: IWORKToken.h:419
libetonyek::IWORK_STROKE_TYPE_DASHED
@ IWORK_STROKE_TYPE_DASHED
Definition: IWORKEnum.h:122
libetonyek::IWORKBorderType
IWORKBorderType
Definition: IWORKEnum.h:32
libetonyek::IWORK_CAPITALIZATION_TITLE
@ IWORK_CAPITALIZATION_TITLE
Definition: IWORKEnum.h:62
libetonyek::IWORK_BORDER_TYPE_ALL
@ IWORK_BORDER_TYPE_ALL
Definition: IWORKEnum.h:38
libetonyek::IWORK_ALIGNMENT_LEFT
@ IWORK_ALIGNMENT_LEFT
Definition: IWORKEnum.h:18
libetonyek::IWORK_CAPITALIZATION_NONE
@ IWORK_CAPITALIZATION_NONE
Definition: IWORKEnum.h:59
libetonyek::IWORKCapitalization
IWORKCapitalization
Definition: IWORKEnum.h:57
libetonyek::IWORK_ALIGNMENT_JUSTIFY
@ IWORK_ALIGNMENT_JUSTIFY
Definition: IWORKEnum.h:21
libetonyek::IWORK_DECLARE_NUMBER_CONVERTER
IWORK_DECLARE_NUMBER_CONVERTER(bool)
libetonyek::IWORK_CELL_NUMBER_TYPE_PERCENTAGE
@ IWORK_CELL_NUMBER_TYPE_PERCENTAGE
Definition: IWORKEnum.h:91
libetonyek::get
const ValueT & get(const detail::IWAFieldImpl< TagV, ValueT, Reader > &field)
Definition: IWAField.h:190
libetonyek::IWORK_CELL_NUMBER_TYPE_CURRENCY
@ IWORK_CELL_NUMBER_TYPE_CURRENCY
Definition: IWORKEnum.h:90
libetonyek::IWORK_CAPITALIZATION_SMALL_CAPS
@ IWORK_CAPITALIZATION_SMALL_CAPS
Definition: IWORKEnum.h:61
libetonyek::IWORKToken::value
@ value
Definition: IWORKToken.h:624
libetonyek_xml.h