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 
33 
34  auto_filter_column_t& operator=(const auto_filter_column_t& other);
35  auto_filter_column_t& operator=(auto_filter_column_t&& other);
36 
37  void reset();
38  void swap(auto_filter_column_t& r);
39 };
40 
45 struct ORCUS_SPM_DLLPUBLIC auto_filter_t
46 {
47  typedef std::map<col_t, auto_filter_column_t> columns_type;
48 
49  ixion::abs_range_t range;
50 
51  columns_type columns;
52 
53  auto_filter_t();
54  auto_filter_t(const auto_filter_t& other);
56  ~auto_filter_t();
57 
58  auto_filter_t& operator=(const auto_filter_t& other);
59  auto_filter_t& operator=(auto_filter_t&& other);
60 
61  void reset();
62  void swap(auto_filter_t& r);
63 
70  void commit_column(col_t col, auto_filter_column_t data);
71 };
72 
76 struct ORCUS_SPM_DLLPUBLIC table_column_t
77 {
78  std::size_t identifier;
79  std::string_view name;
80  std::string_view totals_row_label;
81  totals_row_function_t totals_row_function;
82 
84  table_column_t(const table_column_t& other);
85  ~table_column_t();
86 
87  table_column_t& operator=(const table_column_t& other);
88 
89  void reset();
90 };
91 
95 struct ORCUS_SPM_DLLPUBLIC table_style_t
96 {
97  std::string_view name;
98 
99  bool show_first_column:1;
100  bool show_last_column:1;
101  bool show_row_stripes:1;
102  bool show_column_stripes:1;
103 
104  table_style_t();
105  table_style_t(const table_style_t& other);
106  ~table_style_t();
107 
108  table_style_t& operator=(const table_style_t& other);
109 
110  void reset();
111 };
112 
117 struct ORCUS_SPM_DLLPUBLIC table_t
118 {
119  typedef std::vector<table_column_t> columns_type;
120 
121  size_t identifier;
122 
123  std::string_view name;
124  std::string_view display_name;
125 
126  ixion::abs_range_t range;
127 
128  size_t totals_row_count;
129 
130  auto_filter_t filter;
131  columns_type columns;
132  table_style_t style;
133 
134  table_t();
135  table_t(const table_t& other);
136  table_t(table_t&& other);
137  ~table_t();
138 
139  table_t& operator=(const table_t& other);
140  table_t& operator=(table_t&& other);
141 
142  void reset();
143 };
144 
145 }}
146 
147 #endif
148 
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: auto_filter.hpp:25
Definition: auto_filter.hpp:46
void commit_column(col_t col, auto_filter_column_t data)
Definition: auto_filter.hpp:77
Definition: auto_filter.hpp:96
Definition: auto_filter.hpp:118