summaryrefslogtreecommitdiff
path: root/docs/source
diff options
context:
space:
mode:
Diffstat (limited to 'docs/source')
-rwxr-xr-xdocs/source/Compiler.md3
-rwxr-xr-xdocs/source/CppUsage.md24
2 files changed, 27 insertions, 0 deletions
diff --git a/docs/source/Compiler.md b/docs/source/Compiler.md
index 80f81e8f..aaa274c3 100755
--- a/docs/source/Compiler.md
+++ b/docs/source/Compiler.md
@@ -125,5 +125,8 @@ 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.
diff --git a/docs/source/CppUsage.md b/docs/source/CppUsage.md
index cff3071b..2ded6110 100755
--- a/docs/source/CppUsage.md
+++ b/docs/source/CppUsage.md
@@ -231,6 +231,30 @@ schema, as well as a lot of helper functions.
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