The following features have been baked into this library:
- Builds with CMake making it easy to add to other projects
- GibHub Actions verifies that it builds on Ubuntu, Windows, and MacOS using various compilers
- Provides a
serializer_t
anddeserializer_t
structure for writing/reading complex data structures packed intounsigned char
(byte) vectors - Includes RapidJSON support for serializing/de-serializing to/from JSON
- Including helper MACROS for common patterns
- Includes support for uint256_t & uint128_t value serialization
- Includes an abstract
Serializable
struct that other structures/classes should extend to ensure support with this library - Includes an abstract
SerializablePod<#>
that creates a structured wrapper around a C++ POD- Templated constructor for various underlying byte size(s)
- For more complex data structures, most methods should be overridden (or build your own)
- Includes a
secure_erase()
method that sets the underlying data storage to 0s without being optimized away by the compiler - Includes various string helper methods such as:
from_hex()
converts a hex encoded string to a vector of unsigned char (bytes)to_hex()
converts a data structure to a hex encoded stringstr_join()
joins a vector of strings together using the supplied delimiterstr_pad()
pads a string with blank spaces up to the specified lengthstr_split()
splits a string into a vector of strings using the specified delimiterstr_trim()
trims any whitespace from both the start and end of the given string
C++ API documentation can be found in the headers (.h)
See test/test.cpp
for a high level example
This repository uses submodules, make sure you pull those before doing anything if you are cloning the project.
git clone --recursive https://github.com/gibme-c/serialization-cpp
git submodule add https://github.com/gibme-c/serialization-cpp external/serialization
git submodule update --init --recursive
This wrapper is provided under the BSD-3-Clause license found in LICENSE.
- RapidJSON itself is licensed under the MIT License
- Dependencies of RapidJSON are provided the under following license(s):
- The uint256_t library is licensed under the MIT License