IWORKNumberConverter.h Source File documentation

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

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
45 }
46
47 #endif // IWORKNUMBERCONVERTER_H_INCLUDED
48
49 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libetonyek
Definition: IWORKBezierElement.cpp:18
libetonyek::IWORKNumberConverter::convert
static boost::optional< T > convert(const char *value)
Definition: IWORKNumberConverter.cpp:20
libetonyek::IWORKCellNumberType
IWORKCellNumberType
Definition: IWORKEnum.h:79
libetonyek::IWORKCapitalization
IWORKCapitalization
Definition: IWORKEnum.h:48
libetonyek::IWORKBaseline
IWORKBaseline
Definition: IWORKEnum.h:24
libetonyek::IWORK_DECLARE_NUMBER_CONVERTER
IWORK_DECLARE_NUMBER_CONVERTER(bool)
libetonyek::IWORKAlignment
IWORKAlignment
Definition: IWORKEnum.h:16
IWORKEnum.h
libetonyek::IWORKBorderType
IWORKBorderType
Definition: IWORKEnum.h:31
libetonyek::IWORKNumberConverter
Definition: IWORKNumberConverter.h:29
libetonyek::IWORKStrokeType
IWORKStrokeType
Definition: IWORKEnum.h:109