Orcus
types.hpp
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6  */
7 
8 #ifndef INCLUDED_ORCUS_TYPES_HPP
9 #define INCLUDED_ORCUS_TYPES_HPP
10 
11 #include <cstdlib>
12 #include <vector>
13 #include <string>
14 #include "pstring.hpp"
15 #include "env.hpp"
16 
17 namespace orcus {
18 
19 // XML specific types
20 
21 typedef size_t xml_token_t;
22 typedef const char* xmlns_id_t;
23 
24 ORCUS_PSR_DLLPUBLIC extern const xmlns_id_t XMLNS_UNKNOWN_ID;
25 ORCUS_PSR_DLLPUBLIC extern const xml_token_t XML_UNKNOWN_TOKEN;
26 ORCUS_PSR_DLLPUBLIC extern const size_t index_not_found;
27 ORCUS_PSR_DLLPUBLIC extern const size_t unspecified;
28 
29 struct xml_name_t
30 {
31  xmlns_id_t ns;
32  pstring name;
33 
34  xml_name_t() : ns(XMLNS_UNKNOWN_ID), name() {}
35  xml_name_t(xmlns_id_t _ns, const pstring& _name) : ns(_ns), name(_name) {}
36  xml_name_t(const xml_name_t& r) : ns(r.ns), name(r.name) {}
37 };
38 
39 struct ORCUS_PSR_DLLPUBLIC xml_token_attr_t
40 {
41  xmlns_id_t ns;
42  xml_token_t name;
43  pstring raw_name;
44  pstring value;
45 
52  bool transient;
53 
56  xmlns_id_t _ns, xml_token_t _name, const pstring& _value, bool _transient);
58  xmlns_id_t _ns, xml_token_t _name, const pstring& _raw_name,
59  const pstring& _value, bool _transient);
60 };
61 
62 // Other types
63 
64 enum class length_unit_t
65 {
66  unknown = 0,
67  centimeter,
68  millimeter,
69  xlsx_column_digit,
70  inch,
71  point,
72  twip,
73  pixel
74 
75  // TODO: Add more.
76 };
77 
78 struct ORCUS_PSR_DLLPUBLIC date_time_t
79 {
80  int year;
81  int month;
82  int day;
83  int hour;
84  int minute;
85  double second;
86 
87  date_time_t();
88 
89  std::string to_string() const;
90 };
91 
92 typedef ::std::vector<xml_token_attr_t> xml_attrs_t;
93 
94 }
95 
96 #endif
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: types.hpp:39
Definition: pstring.hpp:24
Definition: types.hpp:78
Definition: types.hpp:29
Definition: base64.hpp:15