-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnvp.h
49 lines (37 loc) · 953 Bytes
/
nvp.h
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
#ifndef _NVP_H_
#define _NVP_H_
#include "common.h"
namespace hiberlite{
template<class C>
class sql_nvp{
public:
std::string name;
C& value;
std::string search_key;
sql_nvp(std::string _name, C& _value, std::string search="") : name(_name), value(_value), search_key(search) {}
};
template<class E,class Stream>
class collection_nvp{
public:
std::string name;
Stream stream;
collection_nvp(std::string _name, Stream _s) : name(_name), stream(_s) {}
};
class abstract_atom{
public:
virtual void bindValue(sqlite3_stmt* stmt, int col)=0;
inline virtual ~abstract_atom() {}
};
template<class C>
class db_atom : public abstract_atom{
public:
C& val;
db_atom(C& x) : val(x) {}
inline virtual ~db_atom() {}
inline std::string sqliteStorageClass();
template<class Stmt,class Arg>
void loadValue(Stmt& res, Arg& arg);
inline virtual void bindValue(sqlite3_stmt* stmt, int col);
};
} //namespace hiberlite
#endif