C++ library to save & load variables easily.
- It saves time: with landb you don't have to worry about writing and loading your program data, just
database.connect("filename.ldb")
thendatabase.pull()
to read anddatabase.push()
to write your variables intofilename.ldb
. - It's fast: it's really fastπ
- multi-type arrays: Landb Arrays may contain multiple types of data, even another arrays.
- type-oriented variables: In Landb
number=i:1
andnumber=s:"one"
can exist in the same database without conflicts. - object-oriented variables: Containers allows us to implement object oriented variables such as:
(PersonA:
Name=s:"Ty"
Age=i:9
)
(PersonB:
Name=s:"Renato"
Age=i:17
)
- Documentation is available Here.
lan::anchor_t * set_anchor(lan::anchor_t * anchor)
, improved π©bool set(std::string array, size_t index, any const value, lan::db_bit_type type)
, fixedπ§
#include <iostream>
#include "landb.hpp"
int main(int argc, const char * argv[]) {
lan::db database;
database.set< std::string >("message", "hello world", lan::String);
std::cout << database.get< std::string >("message", lan::String) << std::endl;
return 0;
}
Type | Description |
---|---|
Bool | Boolean |
Int | Integer |
Long | Big integer |
LongLong | Big integer (unsigned) |
Float | Real number |
Double | Big real number |
Char | Character |
String | Character sequence |
Unsafe | Unsafe data, only exists at runtime and cannot be pushed |
Array | Variable sequence |
Container | (Similar to namespace in c++) Allows object oriented variables |
A string containing "hello world".
message = s : "Hello world"
An array with numbers and strings:
numbers = a : [ i : 1 s : "one" i : 2 s : "two" ]
1. Clone this repo
# 1.1 clone using git:
git clone https://github.com/ReneMuala/landb.git
2. Build with cmake (inside of the project dir)
# 2.1 get in landb foder :
cd landb
# 2.2 configure cmake :
cmake ./
# 2.3 build with cmake :
cmake --build ./
File | Description | Notes |
---|---|---|
liblandb.a | Static library | Can be used to link binaries statically with landb |
liblandbD.so | Shared library | Can be used to link binaries dynamically with landb |
Note: to include landb as #include "landb.hpp"
you need to copy landb.hpp to your source's dir.
CMakeLists.txt example:
cmake_minimum_required(VERSION 3.0)
project(sgep)
add_compile_options(-std=c++17)
add_executable(sgep main.cpp)
target_link_libraries(sgep ${CMAKE_SOURCE_DIR}/liblandb.a) # linking with liblandb.a in project source dir
install(TARGETS sgep RUNTIME DESTINATION bin)
Read it Here.