-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfields.hpp
More file actions
56 lines (45 loc) · 1.39 KB
/
fields.hpp
File metadata and controls
56 lines (45 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# if !defined( __structo_fields_hpp__ )
# define __structo_fields_hpp__
# include <string_view>
namespace structo {
struct FieldOptions
{
struct indentation
{
struct { unsigned min; unsigned max; } lower;
struct { unsigned min; unsigned max; } upper;
};
enum: unsigned
{
ofNoBreakWords = 0x00000001,
ofKeywordsOnly = 0x00000002,
ofDisableIndex = 0x00010000,
ofDisableQuote = 0x00020000,
ofEnforceQuote = 0x00040000
};
enum: unsigned
{
defined_NoBreakWords = 0x00000001,
defined_KeywordsOnly = 0x00000002,
defined_DisableIndex = 0x00000004,
defined_QuoteOptions = 0x00000006,
defined_weight = 0x00010000,
defined_indents = 0x00020000,
defined_id = 0x00040000
};
unsigned id;
std::string_view name;
double weight = 1.0;
unsigned options = 0;
unsigned defined = 0;
indentation indents = default_indents;
static constexpr indentation default_indents = { { 2, 8 }, { 2, 8 } };
};
struct FieldHandler
{
virtual auto Add( const std::string_view& ) -> FieldOptions* = 0;
virtual auto Get( const std::string_view& ) const -> const FieldOptions* = 0;
virtual auto Get( unsigned ) const -> const FieldOptions* = 0;
};
}
# endif // !__structo_fields_hpp__