More native code gen functionality.
authorWouter van Oortmerssen <aardappel@gmail.com>
Thu, 19 Jan 2017 00:23:35 +0000 (16:23 -0800)
committerWouter van Oortmerssen <aardappel@gmail.com>
Thu, 19 Jan 2017 00:23:35 +0000 (16:23 -0800)
commit3f936c5655d2e802db101c73c42ebaab4ed476aa
tree51be11274f02e89280c5e8f12dc43c05c7f23b8d
parent42a265b4198149bfccc5fbde61c0f663c906eeaa
More native code gen functionality.

Allow tables to be mapped to native types directly.  For example, a table
representing a vector3 (eg. table Vec3 { x:float; y:float; z:float; }) can
be mapped to a "mathfu::vec3" native type in NativeTables.  This requires
users to provide Pack and UnPack functions that convert between the
Table and native types.  This is done by adding the "native_type" attribute
to the table definition.

To support user-defined flatbuffers::Pack and flatbuffers::UnPack functions,
support a "native_include" markup that will generate a corresponding

Also add an UnPackTo function which allows users to pass in a pointer to
a NativeTable object into which to UnPack the Table.  The existing UnPack
function is now simply:

  NativeTable* UnPack() {
    NativeTable* obj = new NativeTable();
    Table::UnPackTo(obj);
    return obj;
  }

Finally, allow native types to be given a default value as well which are
set in the NativeTable constructor.  This is done by providing a
"native_default" attribute to the member of a table.

Change-Id: Ic45cb48b0e6d7cfa5734b24819e54aa96d847cfd
docs/source/CppUsage.md
docs/source/Schemas.md
include/flatbuffers/idl.h
samples/monster_generated.h
src/idl_gen_cpp.cpp
src/idl_parser.cpp
tests/monster_test_generated.h