Skip to content

A hierarchical data storage header library for c++, which uses the json structure (Hierarchical JSON Storage for c++).

Notifications You must be signed in to change notification settings

Vilerio/hjs-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 

Repository files navigation

HJS

A header library for storing and accessing hierarchical data for C++11, which uses the JSON structure. (Hierarchical JSON storage for C++).

HJS documentation

Installation

Installing hjs is very simple, you just have to put the files available in the "include" folder of the repo in the same directory as your main c++ 11 file (often main.cpp). Once this is done, you have to include the header with these lines :

#include "hjs.hpp"
#include "json.hpp"

Once the header is included, you can use it !

Usage

Hjs Intitialization

To initialize HJS correctly, you must use the "hjs_init" function and then the "hjs_create_index" function, here is the correct syntax :

hjs_init("absolute_directory_of_where_you_want_to_store_data")
hjs_create_index()



These functions will create a file named "conf.json" in the same directory as the header and an "index.json" file in the storage folder.

Hjs Functions

HJS Groups

HJS groups are sets of elements. These are the ones that will allow the data to be grouped together in order to hierarchise them.
To create a group, use the "hjs_create_group" function, with the following syntax :

hjs_create_group("group_name")



To obtain a list of existing groups, use the "hjs_list_groups" function :

hjs_list_groups()



To delete a group, use the "hjs_delete_group" function :

hjs_delete_group("group_name")



HJS Elements

The elements of HJS are divided into groups, each element has a name, a type and a value. They can be string, int, bool, float, double.

To create an element, use the "hjs_create_element" function, with the following syntax :

hjs_create_element("group_name", "element_name", "element_value", "element_type")



To obtain a list of existing elements, use the "hjs_list_elements" function :

hjs_list_elements("group_name")



To delete an element, use the "hjs_delete_element" function :

hjs_delete_element("group_name", "element_name")



Get element value and type

To get the type of an element, use the "hjs_get_element_type" function :

hjs_get_element_type("group_name", "element_name")



This function will return a string containing the type of the element.

To get the value of an element, use the "hjs_get_element_value" function :

hjs_get_<type of the element>_element("group_name", "element_name")



HJS Credits

HJS is a project using the nlohmann's json library.

About

A hierarchical data storage header library for c++, which uses the json structure (Hierarchical JSON Storage for c++).

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages