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 ORCUS_SPREADSHEET_TYPES_HPP
9 #define ORCUS_SPREADSHEET_TYPES_HPP
10 
11 #include "orcus/env.hpp"
12 #include <cstdlib>
13 #include <cstdint>
14 #include <iosfwd>
15 
16 // NB: This header should only use primitive data types and enums.
17 
18 namespace orcus { namespace spreadsheet {
19 
20 typedef int32_t row_t;
21 typedef int32_t col_t;
22 typedef int32_t sheet_t;
23 typedef uint8_t color_elem_t;
24 typedef uint16_t col_width_t;
25 typedef uint16_t row_height_t;
26 
27 typedef uint32_t pivot_cache_id_t;
28 
29 ORCUS_DLLPUBLIC col_width_t get_default_column_width();
30 ORCUS_DLLPUBLIC row_height_t get_default_row_height();
31 
32 enum class error_value_t
33 {
34  unknown = 0,
35  null, // #NULL!
36  div0, // #DIV/0!
37  value, // #VALUE!
38  ref, // #REF!
39  name, // #NAME?
40  num, // #NUM!
41  na // #N/A!
42 };
43 
44 enum class border_direction_t
45 {
46  unknown = 0,
47  top,
48  bottom,
49  left,
50  right,
51  diagonal,
52  diagonal_bl_tr,
53  diagonal_tl_br
54 };
55 
56 enum class border_style_t
57 {
58  unknown = 0,
59  none,
60  solid,
61  dash_dot,
62  dash_dot_dot,
63  dashed,
64  dotted,
65  double_border,
66  hair,
67  medium,
68  medium_dash_dot,
69  medium_dash_dot_dot,
70  medium_dashed,
71  slant_dash_dot,
72  thick,
73  thin,
74  double_thin,
75  fine_dashed
76 };
77 
78 enum class strikethrough_style_t
79 {
80  none = 0,
81  solid,
82  dash,
83  dot_dash,
84  dot_dot_dash,
85  dotted,
86  long_dash,
87  wave
88 };
89 
90 enum class strikethrough_type_t
91 {
92  unknown = 0,
93  none,
94  single,
95  double_type
96 };
97 
98 enum class strikethrough_width_t
99 {
100  unknown = 0,
101  width_auto,
102  thin,
103  medium,
104  thick,
105  bold
106 };
107 
108 enum class strikethrough_text_t
109 {
110  unknown = 0,
111  slash,
112  cross
113 };
114 
115 enum class formula_grammar_t
116 {
117  unknown = 0,
118  xls_xml,
119  xlsx_2007,
120  xlsx_2010,
121  ods,
122  gnumeric
123 };
124 
125 enum class formula_t
126 {
127  array,
128  data_table,
129  normal,
130  shared
131 };
132 
133 enum class underline_t
134 {
135  none = 0,
136  single_line,
137  single_accounting, // unique to xlsx
138  double_line,
139  double_accounting, // unique to xlsx
140  dotted,
141  dash,
142  long_dash,
143  dot_dash,
144  dot_dot_dot_dash,
145  wave
146 };
147 
148 enum class underline_width_t
149 {
150  none = 0,
151  normal,
152  bold,
153  thin,
154  medium,
155  thick,
156  positive_integer,
157  percent,
158  positive_length
159 };
160 
161 enum class underline_mode_t
162 {
163  continuos = 0,
164  skip_white_space
165 };
166 
167 enum class underline_type_t
168 {
169  none = 0,
170  single,
171  double_type //necessary to not call it "double", since it is a reserved word
172 };
173 
175 {
176  underline_t underline_style;
177  underline_width_t underline_width;
178  underline_mode_t underline_mode;
179  underline_type_t underline_type;
180 };
181 
182 enum class hor_alignment_t
183 {
184  unknown = 0,
185  left,
186  center,
187  right,
188  justified,
189  distributed,
190  filled
191 };
192 
193 enum class ver_alignment_t
194 {
195  unknown = 0,
196  top,
197  middle,
198  bottom,
199  justified,
200  distributed
201 };
202 
208 enum class data_table_type_t
209 {
210  column,
211  row,
212  both
213 };
214 
218 enum class totals_row_function_t
219 {
220  none = 0,
221  sum,
222  minimum,
223  maximum,
224  average,
225  count,
226  count_numbers,
227  standard_deviation,
228  variance,
229  custom
230 };
231 
232 enum class conditional_format_t
233 {
234  unknown = 0,
235  condition,
236  date,
237  formula,
238  colorscale,
239  databar,
240  iconset
241 };
242 
243 enum class condition_operator_t
244 {
245  unknown = 0,
246  equal,
247  less,
248  greater,
249  greater_equal,
250  less_equal,
251  not_equal,
252  between,
253  not_between,
254  duplicate,
255  unique,
256  top_n,
257  bottom_n,
258  above_average,
259  below_average,
260  above_equal_average,
261  below_equal_average,
262  contains_error,
263  contains_no_error,
264  begins_with,
265  ends_with,
266  contains,
267  contains_blanks,
268  not_contains,
269  expression
270 };
271 
272 enum class condition_type_t
273 {
274  unknown = 0,
275  value,
276  automatic,
277  max,
278  min,
279  formula,
280  percent,
281  percentile
282 };
283 
284 enum class condition_date_t
285 {
286  unknown = 0,
287  today,
288  yesterday,
289  tomorrow,
290  last_7_days,
291  this_week,
292  next_week,
293  last_week,
294  this_month,
295  next_month,
296  last_month,
297  this_year,
298  next_year,
299  last_year,
300 };
301 
302 enum class databar_axis_t
303 {
304  none = 0,
305  middle,
306  automatic
307 };
308 
309 enum class pivot_cache_group_by_t
310 {
311  unknown = 0,
312  days, // grouping on "days" for date values.
313  hours, // grouping on "hours" for date values.
314  minutes, // grouping on "minutes" for date values.
315  months, // grouping on "months" for date values.
316  quarters, // grouping on "quarters" for date values.
317  range, // grouping by numeric ranges for numeric values.
318  seconds, // grouping on "seconds" for date values.
319  years // grouping on "years" for date values.
320 };
321 
322 struct address_t
323 {
324  row_t row;
325  col_t column;
326 };
327 
329 {
330  row_t rows;
331  col_t columns;
332 };
333 
334 struct range_t
335 {
336  address_t first;
337  address_t last;
338 };
339 
340 ORCUS_DLLPUBLIC bool operator== (const address_t& left, const address_t& right);
341 ORCUS_DLLPUBLIC bool operator!= (const address_t& left, const address_t& right);
342 
343 ORCUS_DLLPUBLIC bool operator== (const range_t& left, const range_t& right);
344 ORCUS_DLLPUBLIC bool operator!= (const range_t& left, const range_t& right);
345 
346 ORCUS_DLLPUBLIC std::ostream& operator<< (std::ostream& os, const address_t& v);
347 ORCUS_DLLPUBLIC std::ostream& operator<< (std::ostream& os, const range_t& v);
348 
349 struct ORCUS_DLLPUBLIC color_rgb_t
350 {
351  color_elem_t red;
352  color_elem_t green;
353  color_elem_t blue;
354 
355  color_rgb_t();
356  color_rgb_t(const color_rgb_t& other);
357  color_rgb_t(color_rgb_t&& other);
358 
359  color_rgb_t& operator= (const color_rgb_t& other);
360 };
361 
371 ORCUS_DLLPUBLIC totals_row_function_t to_totals_row_function_enum(const char* p, size_t n);
372 
382 ORCUS_DLLPUBLIC pivot_cache_group_by_t to_pivot_cache_group_by_enum(const char* p, size_t n);
383 
393 ORCUS_DLLPUBLIC error_value_t to_error_value_enum(const char* p, size_t n);
394 
406 ORCUS_DLLPUBLIC color_rgb_t to_color_rgb(const char* p, size_t n);
407 
408 ORCUS_DLLPUBLIC std::ostream& operator<< (std::ostream& os, error_value_t ev);
409 ORCUS_DLLPUBLIC std::ostream& operator<< (std::ostream& os, const color_rgb_t& color);
410 
411 }}
412 
413 #endif
414 
415 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: types.hpp:349
Definition: types.hpp:334
Definition: types.hpp:174
Definition: types.hpp:328
Definition: types.hpp:322
Definition: base64.hpp:15