Orcus
auto_filter.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_SPREADSHEET_AUTO_FILTER_HPP
9 #define INCLUDED_ORCUS_SPREADSHEET_AUTO_FILTER_HPP
10 
11 #include "types.hpp"
12 #include "../env.hpp"
13 
14 #include <map>
15 #include <unordered_set>
16 
17 #include <ixion/address.hpp>
18 
19 namespace orcus { namespace spreadsheet {
20 
24 struct ORCUS_SPM_DLLPUBLIC auto_filter_column_t
25 {
26  using match_values_type = std::unordered_set<std::string_view>;
27  match_values_type match_values;
28 
29  void reset();
30  void swap(auto_filter_column_t& r);
31 };
32 
37 struct ORCUS_SPM_DLLPUBLIC auto_filter_t
38 {
39  typedef std::map<col_t, auto_filter_column_t> columns_type;
40 
41  ixion::abs_range_t range;
42 
43  columns_type columns;
44 
45  auto_filter_t();
46 
47  void reset();
48  void swap(auto_filter_t& r);
49 
58  void commit_column(col_t col, auto_filter_column_t& data);
59 };
60 
64 struct ORCUS_SPM_DLLPUBLIC table_column_t
65 {
66  size_t identifier;
67  std::string_view name;
68  std::string_view totals_row_label;
69  totals_row_function_t totals_row_function;
70 
72 
73  void reset();
74 };
75 
79 struct ORCUS_SPM_DLLPUBLIC table_style_t
80 {
81  std::string_view name;
82 
83  bool show_first_column:1;
84  bool show_last_column:1;
85  bool show_row_stripes:1;
86  bool show_column_stripes:1;
87 
88  table_style_t();
89 
90  void reset();
91 };
92 
97 struct ORCUS_SPM_DLLPUBLIC table_t
98 {
99  typedef std::vector<table_column_t> columns_type;
100 
101  size_t identifier;
102 
103  std::string_view name;
104  std::string_view display_name;
105 
106  ixion::abs_range_t range;
107 
108  size_t totals_row_count;
109 
110  auto_filter_t filter;
111  columns_type columns;
112  table_style_t style;
113 
114  table_t();
115 
116  void reset();
117 };
118 
119 }}
120 
121 #endif
122 
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: auto_filter.hpp:25
Definition: auto_filter.hpp:38
void commit_column(col_t col, auto_filter_column_t &data)
Definition: auto_filter.hpp:65
Definition: auto_filter.hpp:80
Definition: auto_filter.hpp:98