-
Notifications
You must be signed in to change notification settings - Fork 3
/
DSVRecordMD.hh
85 lines (75 loc) · 2.29 KB
/
DSVRecordMD.hh
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//
// Copyright 2009-2017 M. Shulhan (ms@kilabit.info). All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef _LIBVOS_DSVRECORDMD_HH
#define _LIBVOS_DSVRECORDMD_HH 1
#include "File.hh"
#include "List.hh"
namespace vos {
enum _rmd_type {
RMD_T_STRING = 0,
RMD_T_NUMBER,
RMD_T_DATE,
RMD_T_BLOB
};
/**
* @class : DSVRecordMD
* @attr :
* - _idx : index of current meta-data record.
* - _flag : flag of current meta-data record.
* - _type : type of record that this meta-data hold.
* - _left_q : left character used in record data.
* - _right_q : right character used in record data.
* - _start_p : start position of record data.
* - _end_p : end position of record data.
* - _sep : character used as separator between record data.
* - _fltr_idx : index of filter used in record.
* - _fltr_rule : rule of filter that will be used in record.
* - _fop : pointer to filter function.
* - _name : name of record.
* - _date_format : format of date used in data.
* - _fltr_v : value of filter, if filter is in comparable mode.
* - BLOB_SIZE : static, size of blob header.
* @desc :
* Record meta-data hold each definition of records in DSV file, or in
* general: describing how the record will be parsed later on DSV file.
* In example, does the record data started with a single quote, double
* quote, or any printable character; what character is used as a
* separator between record or does its used fixed position; etc.
*
* It's also defined type of filter that will be applied to record. A
* filter is used to accepting or rejecting record after parsed.
*/
class DSVRecordMD : public Object {
public:
static const char* __CNAME;
static uint8_t BLOB_SIZE;
static int DEF_SEP;
static List* INIT(const char* meta);
static List* INIT_FROM_FILE(const char* fmeta);
DSVRecordMD();
~DSVRecordMD();
const char* chars();
int _idx;
int _flag;
int _type;
int _left_q;
int _right_q;
size_t _start_p;
size_t _end_p;
int _sep;
int _fltr_idx;
int _fltr_rule;
int (*_fop)(const int, const void*, const void*);
Buffer _name;
Buffer* _date_format;
Buffer* _fltr_v;
private:
DSVRecordMD(const DSVRecordMD&);
void operator=(const DSVRecordMD&);
};
} // namespace::vos
#endif
// vi: ts=8 sw=8 tw=80: