From f1db0a93658de0d85e87bb63eee87c25a45f2d53 Mon Sep 17 00:00:00 2001 From: Sergey Avseyev Date: Wed, 22 Nov 2017 17:52:45 +0300 Subject: update manpages for 1.8.0 --- flatbuffers.7.md | 24 ++++++++++++++++++++++-- flatc.1.md | 10 +++++++++- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/flatbuffers.7.md b/flatbuffers.7.md index 5cde2d2..7f13b0b 100644 --- a/flatbuffers.7.md +++ b/flatbuffers.7.md @@ -1,4 +1,4 @@ -FLATBUFFERS 7 "JUNE 2017" Linux "User Manuals" +FLATBUFFERS 7 "NOVEMBER 2017" Linux "User Manuals" ============================================== NAME @@ -192,6 +192,26 @@ DESCRIPTION And example of usage, for the time being, can be found in `test.cpp/ReflectionTest()`. +**Mini Reflection** + + A more limited form of reflection is available for direct inclusion in generated code, which doesn't any (binary) + schema access at all. It was designed to keep the overhead of reflection as low as possible (on the order of 2-6 + bytes per field added to your executable), but doesn't contain all the information the (binary) schema contains. + + You add this information to your generated code by specifying `--reflect-types` (or instead `--reflect-names` if you + also want field / enum names). + + You can now use this information, for example to print a FlatBuffer to text: + + auto s = flatbuffers::FlatBufferToString(flatbuf, MonsterTypeTable()); + + `MonsterTypeTable()` is declared in the generated code for each type. The string produced is very similar to the JSON + produced by the `Parser` based text generator. + + You'll need `flatbuffers/minireflect.h` for this functionality. In there is also a convenient visitor/iterator so you + can write your own output / functionality based on the mini reflection tables without having to know the FlatBuffers + or reflection encoding. + **Storing maps / dictionaries in a FlatBuffer** FlatBuffers doesn't support maps natively, but there is support to emulate their behavior with vectors and binary search, which means you can have fast lookups directly from a FlatBuffer without having to unpack your data into a @@ -245,7 +265,7 @@ DESCRIPTION Each root type will have a verification function generated for it, e.g. for `Monster`, you can call: - bool ok = VerifyMonsterBuffer(Verifier(buf, len)); + bool ok = VerifyMonsterBuffer(Verifier(buf, len)); if `ok` is true, the buffer is safe to read. diff --git a/flatc.1.md b/flatc.1.md index b431afa..3e49953 100644 --- a/flatc.1.md +++ b/flatc.1.md @@ -1,4 +1,4 @@ -FLATC 1 "JUNE 2017" Linux "User Manuals" +FLATC 1 "NOVEMBER 2017" Linux "User Manuals" ======================================== NAME @@ -118,6 +118,14 @@ Additional options: `--keep-prefix` Keep original prefix of schema include statement. +`--reflect-types` + Add minimal type reflection to code generation. + +`--reflect-names` + Add minimal type/name reflection. + + + NOTE: short-form options for generators are deprecated, use the long form whenever possible. SEE ALSO -- cgit