-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.h
More file actions
53 lines (38 loc) · 1.11 KB
/
database.h
File metadata and controls
53 lines (38 loc) · 1.11 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
#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 {
int iCount;
int iMax;
Entry* dataEntry;
};
// 엔트리를 생성한다.
Entry *create(Type type, std::string key, void *value);
// 데이터베이스를 초기화한다.
void init(Database &database);
// 데이터베이스에 엔트리를 추가한다.
void add(Database &database, Entry *entry);
// 데이터베이스의 메모리를 추가(동적할당)한다.
void newDB(Database &database);
// 데이터베이스에서 키에 해당하는 엔트리를 찾는다.
Entry* get(Database &database, std::string &key);
// 데이터베이스에서 키에 해당하는 엔트리를 제거한다.
void remove(Database &database, std::string &key);
// 데이터베이스를 해제한다.
void destroy(Database &database);
// 데이터베이스의 모든 엔트리를 출력한다.
void showAll(Database &database);
// Array를 출력한다.
void printArray(Array* array);
#endif