Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lishen1/proplib
Properties serialization library
https://github.com/lishen1/proplib
c-plus-plus deserialize imgui qt serialization yaml yml
Last synced: 4 months ago
JSON representation
Properties serialization library
- Host: GitHub
- URL: https://github.com/lishen1/proplib
- Owner: Lishen1
- License: gpl-3.0
- Created: 2018-03-26T17:51:05.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-07-04T13:32:02.000Z (over 1 year ago)
- Last Synced: 2024-10-13T22:42:05.751Z (4 months ago)
- Topics: c-plus-plus, deserialize, imgui, qt, serialization, yaml, yml
- Language: C++
- Homepage:
- Size: 914 KB
- Stars: 15
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/Lishen1/proplib.svg?branch=master)](https://travis-ci.org/Lishen1/proplib)
# Properties serialization library
**proplib** is a set of crossplatform c++11 libraries and tools which allow serialize, deserialize, visualize and edit c++ objects without codegeneration what well suitable for algorithms properties configuration.## Example of usage
```cpp
#include
#include#include
#include
#includeclass Box : public proplib::Serializable
{public:
float height;
float width;
std::string name;private:
SERIALIZE(height, "height of the box");
SERIALIZE(width, "width of the box");
SERIALIZE(name, "name of the box");
};int main()
{
Box box;
box.height = 1.0;
box.width = 1.4;
box.name = "just a small box in the big world";YAML::Emitter out;
box.serialize(out, false);
std::ofstream outfile;
outfile.open("box.prop.yml");
outfile << out.c_str() << std::endl;
outfile.close();box.height = 0.0;
box.width = 0.0;
box.name = "--";box.deserialize(YAML::LoadFile("box.prop.yml"));
std::cout << "box.height " << box.height << std::endl;
std::cout << "box.width " << box.width << std::endl;
std::cout << "box.name " << box.name << std::endl;system("pause");
return 0;
}
```
box.prop.yml file content:
``` yaml
height: 1
name: just a small box in the big world
width: 1.4
```console output:
```
box.height 1
box.width 1.4
box.name just a small box in the big world
Для продолжения нажмите любую клавишу . . .
```
Also we can serialize **box** with **docstrings** and metainfo for gui generation```cpp
box.serialize(out, true);
```box.prop.yml file content:
``` yaml
height: ! 1
height_doc: ! height of the box
name: ! just a small box in the big world
name_doc: ! name of the box
width: ! 1.4
width_doc: ! width of the box
```
then we can open, edit and save this file in **proplib-qt-editor**![alt text](doc/img/qt-editor.png "proplib-qt-editor")
or in ImGui based **proplib-imgui-editor**
![alt text](doc/img/imgui-editor.png "proplib-imgui-editor")
## Supported types
- arithmetic
- bool
- std::string
- std::map
- std::vector## Supported formats
- YAML## Components
- **proplib-serialize** - serialization/deserialization lib
- **proplib-gui**
- **proplib-qt-gui** - qt based qui lib
- **proplib-qt-editor** - qt based editor app
- **propsdk-imgui-editor** - imgui based editor app
- **tests**
- **prop-serialize** - serialization/deserialization test
- **http-client** - remote transfer test## Future work
- support JSON format
- support binary format
- support enums serialization/deserialization
- add meta info in **docstring** like hints for better data representation and hins about possible values of object fields
- minimize transferred data size