-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalue.hpp
60 lines (45 loc) · 1.21 KB
/
value.hpp
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
#ifndef VALUE_H
#define VALUE_H
#include <vector>
#include <map>
#include <string>
#include <stdlib.h>
#include "fragment.h"
#include <cstring>
namespace SEQL{
class Statement;
enum class ValueType {
NUMBER,
STRING,
BOOL,
ARRAY,
UNSPECIFIED,
NIL,
DOUBLE,
OBJ,
};
class Value : public Fragment {
public:
~Value();
Value(bool tf) ;
Value(std::string value);
Value(double value);
Value(int32_t value);
Value(char* arr, size_t sz, ValueType val_type, bool copy=true);
Value(Value* val, bool copy=true);
Value() = default;
ValueType value_type = ValueType::UNSPECIFIED;
//If value is stored in some variable or is in code, it should persist
bool dispose = true;
//There are some variables, than can be pre-maturily deleted
bool is_mature = true;
size_t result_sz = 0;
char* result = nullptr;
//array value
std::vector<Value*> * array_values = nullptr;
Statement * array_statement;
//todo add better indexing
std::map<std::string, Value*> * mapped_values = nullptr;
};
}
#endif