-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
76 lines (57 loc) · 2.64 KB
/
main.cpp
File metadata and controls
76 lines (57 loc) · 2.64 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
72
73
74
75
76
/*
* version = d : 2.0
* file = s : "main.cpp"
* project = s : "landb"
*
* (credits:
* message = s : "Created by René Descartes Domingos Muala on 10/10/20."
* Copyright = s : "© 2021 landia (René Muala). All rights reserved."
* Contact = s : "[email protected]"
* )
*/
#include <iostream>
#include <string>
#include "landb.hpp"
#include <chrono>
int main (int argc, const char * argv []) {
lan::db students;
students.declare("List", lan::Array);
students.declare("Carlos", lan::Array);
students.declare("Anna", lan::Array);
students.declare("Antony", lan::Array);
students.iterate<std::string>("List", "Carlos", lan::String);
students.iterate<std::string>("List", "Anna", lan::String);
students.iterate<std::string>("List", "Antony", lan::String);
students.iterate("Carlos", 0, lan::Container);
students.iterate("Anna", 0, lan::Container);
students.iterate("Antony", 0, lan::Container);
students.set_anchor("Carlos", 0);
students.set<std::string>("@", "Full_name", "Carlos Eduard" ,lan::String, true);
students.set<double>("@", "Average", 13 ,lan::Double, true);
students.set<bool>("@", "Passed", true ,lan::Bool, true);
students.set_anchor("Anna", 0);
students.set<std::string>("@", "Full_name", "Anna Cristin" ,lan::String, true);
students.set<double>("@", "Average", 16 ,lan::Double, true);
students.set<bool>("@", "Passed", true ,lan::Bool, true);
students.set_anchor("Antony", 0);
students.set<std::string>("@", "Full_name", "Antony Jeff" ,lan::String, true);
students.set<double>("@", "Average", 9 ,lan::Double, true);
students.set<bool>("@", "Passed", false ,lan::Bool, true);
students.connect("generated_example.ldb");
// students.print();
std::cout << "Landia::db version: " << lan::db_version << "; Hello world!\n";
std::string current_student;
for( auto i : { 0, 1, 2}){
current_student = students.get<std::string>("List", i, lan::String);
students.set_anchor(current_student, 0);
std::cout << "info: Printing description for student <" << current_student << ">"
<< std::endl
<< i + 1 <<".\tName: " << students.get<std::string>("@", "Full_name", lan::String)
<< std::endl
<< "\tAverage : " << students.get<double>("@", "Average", lan::Double)
<< std::endl
<< "\tPassed : " << ((students.get<bool>("@", "Passed", lan::Bool) ? "Yes" : "No"))
<< std::endl;
}
students.push();
}