Lite³
A JSON-Compatible Zero-Copy Serialization Format
Loading...
Searching...
No Matches
How-to Guides

Building Messages - Reading Messages - Strings - Nesting - Arrays - Iterators - JSON Conversion

Introduction

This section contains various how-to guides on using essential library functions. Every topic is accompanied by an example code file inside the Lite³ repository, with separate directories for each API:

  • examples/buffer_api/*
  • examples/context_api/*

To build the examples, inside the project root run:

make examples -j

To run an example:

./build/examples/context_api/01-building-messages

All how-to guides will explain topics using the Context API, though the concepts explained are equally valid for the Buffer API, the only difference being that library functions for the latter take manual buffers parameters instead of opaque *ctx pointers. For those wishing to use the buffer API, it is recommended to study the code examples of the buffer API while reading the guides.

Library error messages

By default, library error messages are disabled. However it is recommended to enable them to receive feedback during development. To do this, either:

  1. uncomment the line // #define LITE3_ERROR_MESSAGES inside the header file: include/lite3.h
  2. build the library using compilation flag -DLITE3_ERROR_MESSAGES

If you installed using pkg-config, you may need to reinstall the library to apply the changes. To do this, run:

sudo make uninstall
sudo make clean
sudo make install
sudo ldconfig

How-to Guides

  1. Building Messages
  2. Reading Messages
  3. Strings
  4. Nesting
  5. Arrays
  6. Iterators
  7. JSON Conversion