-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.h
More file actions
71 lines (49 loc) · 1.39 KB
/
database.h
File metadata and controls
71 lines (49 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef DATABASE_H
#define DATABASE_H
#include <string>
enum Type { INT, DOUBLE, STRING, ARRAY };
struct Array {
int size;
Type type;
void *items;
};
struct Entry {
Type type;
std::string key;
void *value;
};
struct Database {
Entry *entries;
int size;
};
// 엔트리를 생성한다.
Entry *create(Type type, std::string key, void *value);
// 데이터베이스를 초기화한다.
void init(Database &database);
// 데이터베이스에 엔트리를 추가한다.
void add(Database &database, Entry *entry);
// 데이터베이스에서 키에 해당하는 엔트리를 찾는다.
Entry *get(Database &database, std::string &key);
// 데이터베이스에서 키에 해당하는 엔트리를 제거한다.
void remove(Database &database, std::string &key);
// 데이터베이스를 해제한다.
void destroy(Database &database);
/*-----추가 함수-----*/
//command를 입력 받는다.
std::string commandInput();
//key값을 입력 받는다.
std::string keyInput();
//type을 입력 받는다.
Type typeInput();
//값(value)을 입력 받는다.
void* valueInput(Type type);
//데이터베이스 목록을 출력한다.
void listPrint(Database &database);
//엔트리를 출력한다.
void entryPrint(Entry *entry);
Type typeCheck(std::string strType);
void* createArray(Type type, int size);
void* arrayInput(Type type);
void arrayPrint(Array* arr);
void *createMultiArray();
#endif