deafwolf / FBE

clear version FastBinaryEncoding

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FBE

Linux (clang) Linux (gcc)

Introduction

FBE was originally forked from Fast Binary Encoding (FBE). After a lot of new features were added, FBE is totally different from the original one.

New features:

  • support circular dependency via --ptr which will generate ptr-based FBE.
  • support variant.
  • supoort arena.

fbec will generate both arena and non-arena code. The generated arena code will be located in files affixed with a _pmr suffix, and the generated classes and structs will also be in namespaces with a _pmr suffix. See /proto/* and tests/test_arena.cpp for more information.

  • fix alignment issues.

The examples containing the above features can be found in /proto/*.fbe /proto/*.fbe

Getting Started

Build

git clone git@github.com:stdbio/FBE.git
cd FBE && git submodule update --init --recursive
sudo pkg-dependency.sh
mkdir build.debug && cd build.debug
cmake .. -DCMAKE_BUILD_TYPE=Debug -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON && mv compile_commands.json ..
ninja

Test

ninja fbe-tests && ./fbe-tests

fbec

fbec --help for more information.

Examples

# Generate template-based FBE.
fbec --cpp --input=./test.fbe --output=./generated

# Generate ptr-based FBE, which support circular dependency.
# And the imported package is template-based.
fbec --cpp --input=./test.fbe --output=./generated --ptr

# Generate ptr-based FBE, and the imported package is also ptr-based.
fbec --cpp --input=./test.fbe --output=./generated --ptr --import-ptr

Below is a cmake example.

add_custom_target(fbec_test_ptr
  COMMAND fbec --cpp --input=./test_ptr.fbe --output=./generated --ptr --import-ptr
    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/metas
  DEPENDS "${PROJECT_SOURCE_DIR}/metas/test_ptr.fbe"
  COMMENT "fbec test_ptr.fbe"
  VERBATIM
)

About

clear version FastBinaryEncoding

License:MIT License


Languages

Language:Go 15.0%Language:C++ 14.8%Language:Java 12.7%Language:Swift 11.7%Language:Kotlin 11.6%Language:C# 11.3%Language:JavaScript 9.0%Language:Python 6.5%Language:Ruby 6.3%Language:CMake 0.7%Language:Yacc 0.1%Language:Lex 0.1%Language:Shell 0.0%Language:C 0.0%Language:Makefile 0.0%