/landb

C++ library to save & load variables easily.

Primary LanguageC++MIT LicenseMIT

Landb πŸ—ƒ

C++ library to save & load variables easily.

Why Landb? πŸͺ§

  • It saves time: with landb you don't have to worry about writing and loading your program data, just database.connect("filename.ldb") then database.pull() to read and database.push() to write your variables into filename.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 and number=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
)

What's new in version 2.7? 🎁

  • 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πŸ”§

Examples βš™οΈ

Hello world πŸ€“

#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;
}

Types πŸ“‘

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

Landb structure examples πŸ“‹

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" ]

Compiling πŸ”¨

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 ./

Linking with your projectβ›“

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)

Are you looking for some documentation? πŸ˜…

Read it Here.