Commit Graph

35 Commits

Author SHA1 Message Date
Frank Benkstein 5c0f914f38 forbid enum values that are out of range (#4977)
* forbid enum values that are out of range

Enum values that are out of range can lead to generated C++ code that does
not compile.  Also forbid boolean enums.

* update enum and union documentation slightly
2018-10-18 10:39:08 -07:00
Vladimir Glavnyy 4ed6fafdfa Refactoring of idl_parser (#4948)
* Refactoring of numbers parser

More accurate parse of float and double.
Hexadecimal floats.
Check "out-of-range" of uint64 fields.
Check correctness of default values and metadata.

* Remove locale-independent code strtod/strtof from PR #4948.

* small optimization

* Add is_(ascii) functions

* is_ascii cleanup

* Fix format conversation

* Refine number parser

* Make code compatible with Android build

* Remove unnecessary suppression of warning C4127
2018-10-11 10:37:47 -07:00
MikkelFJ 0cf04ad9d5 Document type aliases (#4499) 2017-11-17 08:57:01 -08:00
Sergey Avseyev 6eb031de9a Text files should not have executable bit set (#4480) 2017-11-06 10:20:22 -08:00
Wouter van Oortmerssen 4b27c92910 Misc documentation fixes.
Change-Id: Id7be5baba7d8a11ca050e8d94d95857406690378
2017-08-10 11:25:13 -07:00
Wouter van Oortmerssen dddd0865cb Added nested FlexBuffer parsing
Change-Id: I918b66eb5646d035e3aae675f745802eb54b03ea
2017-06-12 14:34:45 -07:00
Bei Li 68bbe983e9 Union Vector 2017-01-24 11:52:36 -08:00
Wouter van Oortmerssen 3f936c5655 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
2017-01-18 16:23:35 -08:00
Wouter van Oortmerssen 81b6bacead Documentation improvements: style guide & guide lines.
Bug: 22346508
Change-Id: I3f6e6b2811adaaf9d79faca8cdd00af3927299b5
2016-12-19 16:04:08 -08:00
Wouter van Oortmerssen dc2fa215b8 External references for the object API thru a resolver function.
This allows hashed string fields to be used for lookup of any
C++ objects, a pointer to which are then stored in the object
besides the original hash for easy access.

Change-Id: I2247a13c349b905f1c54660becde2c818ad23e97
Tested: on Linux.
Bug: 30204449
2016-10-12 11:22:20 -07:00
Louis Cognault c94cb6dae9 Fixed typo
is => it
2016-07-01 17:22:36 +02:00
Wouter van Oortmerssen 48f37f9e0a Added GRPC code generator to flatc.
Also added simple (in-process) test.

Change-Id: I38580d554dd52f590e3396ec4846e07546dcf07d
Tested: on Linux.
2016-06-29 15:51:44 -07:00
Wouter van Oortmerssen d3ac0bc149 Added conversion operations that can be used inline in JSON.
e.g.: { myfield: cos(rad(180)) } is equivalent to writing { myfield: -1.0 }

Bug: 29338398
Change-Id: I6fc4ef1fd10bda3ba78cba464414dd071a2f50ca
Tested: on Linux.
2016-06-15 14:54:44 -07:00
Wouter van Oortmerssen 1a63eb46bb Added RPC declarations to the schema parser.
This is the first step in RPC support. Actual code generation
to follow.

Change-Id: I96c40fec3db671d100dd9eb509a71c5cbe55bfb2
Tested: on Linux.
Bug: 20122696
2016-03-09 13:47:40 -08:00
Wouter van Oortmerssen 19afcdc704 Clarified how to test for the presence of fields.
This is FAQ on the issue tracker.

Bug: 26863353
Change-Id: I227e10a5c0134dbe7fd7f59e64cd57a0752c568e
2016-03-07 12:58:36 -08:00
Mark Klara 69a31b807a Revamping the FlatBuffers docs.
Adding an API reference for the supported languages.

General docs cleanup, including a new `tutorial` section that
supports all of the supported languages.

Added samples for each supported language to mirror the new
tutorial page.

Cleaned up all the links by making them `@ref` style links,
instead of referencing the names of the generated `.html` files.

Removed all generated files that were unnecessarily committed.

Also fixed the C# tests (two were failing due to a missing file).

Bug: b/25801305

Tested: Tested all samples on Ubuntu, Mac, and Android. Docs were
generated using doxygen and viewed on Chrome.

Change-Id: I2acaba6e332a15ae2deff5f26a4a25da7bd2c954
2016-01-19 14:31:17 -08:00
Wouter van Oortmerssen 049f3f7907 Added support for parsing JSON null value.
These cause the field in question to be skipped.

Bug: 16550393
Change-Id: Id05104e89818ee773b8a91fdcc86e18061b9a82f
Tested: on Linux.
2016-01-19 14:05:27 -08:00
Wouter van Oortmerssen f8c1980fdf Added schema evolution examples to the docs.
Bug: 26296711
Change-Id: I225067d82ac0f8bd71b2b97b1672517ca86cc3b9
Tested: on Linux.
2016-01-19 12:29:53 -08:00
Wouter van Oortmerssen d0e9bc6a75 A few schema documentation fixes.
Change-Id: I140e1322fc1bfb3ab8012e00d8f3006ee2e7ce95
2015-07-08 17:49:49 -07:00
Wouter van Oortmerssen 3550899987 Sorted Vector & binary search functionality.
Bug: 16659276
Tested: on Linux & Windows.

Change-Id: Ie7a73810345fad4cf0a3ad03dfaa5464e3ed5ac8
2015-01-16 10:59:52 -08:00
Wouter van Oortmerssen b929c62c71 Added clarification about unions in JSON to the docs.
Change-Id: I1f310636f8b74366b5b0fc73c7e106424583fc93
2015-01-07 15:42:43 -08:00
Wouter van Oortmerssen 89d2b0861b Documentation clarifications.
Change-Id: I7dc4bb3bbe32c6fe83a013790391fba0df8f4888
2015-01-07 10:34:17 -08:00
Wouter van Oortmerssen 2d9b3ade18 Various documentation clarifications.
Change-Id: Ibc2bd88a636f3b4abf82a7c2722fc1e354dab848
Tested: on Linux.
2014-12-08 16:47:00 -08:00
Wouter van Oortmerssen 0952143971 Added user defined attribute declarations.
This is such that if you mis-spell an attribute, it doesn't get
silently ignored.

Bug: 18294628
Change-Id: I10013f5b2a21048b7daba2e9410678f528e09761
Tested: on Linux.
2014-11-19 11:06:17 -08:00
Wouter van Oortmerssen ea592296b8 Various documentation improvements.
Change-Id: Iacea45ae0f602f49e46de472286a7a77ee20c301
2014-10-24 14:58:32 -07:00
Wouter van Oortmerssen 517c964fe2 Support for required fields.
Change-Id: I560c7ca11b3d665eecafb528f3737b7e139ca9b0
Tested: on Linux and Windows.
2014-09-22 15:53:19 -07:00
Wouter van Oortmerssen ebac1e1940 Support all JSON escape codes (including \u) for parsing & text gen.
Bug: 16624362
Change-Id: Ia09ea404c0c11dd1dc6993a8cbd155bf8152b65f
Tested: on Windows & Linux.
2014-08-22 14:02:31 -07:00
Wouter van Oortmerssen be894f09df Schemas now support include files.
Bug: 15521443
Change-Id: I2e1ef97e7225a1a0ecf2ca65e31d49d443003747
Tested: on Linux.
2014-08-19 16:44:14 -07:00
Wouter van Oortmerssen 5da7bda826 File identifier feature.
Allows you to add, and test for the presence of a magic 4-char
string in a FlatBuffer.

Tested: on OS X.

Change-Id: I090692a9e4fb53bed3543279a28563e67132cba0
2014-08-12 14:37:06 -07:00
Wouter van Oortmerssen 9c3de1e2a0 Extended symbolic enum parsing in JSON for integers and OR-ing.
Change-Id: Iedbd9914a1ca3897776fb92aa9a1fdfc4603da3c
Tested: on Windows and Linux
2014-07-25 15:20:24 -07:00
Wouter van Oortmerssen 127d35085a Added a `bit_flags` attribute to enum declarations that 1<<N every value.
Change-Id: Ib9ec0cb3ddec60b1ca124eaf815fb1ae0cc53e1c
Tested: on Windows and Linux
Bug: 16186562
2014-07-21 16:40:39 -07:00
Wouter van Oortmerssen 9140144d51 Added functionality to assign field ids manually in a schema
New attribute:

-   `id: n` (on a table field): manually set the field identifier to `n`.
    If you use this attribute, you must use it on ALL fields of this table,
    and the numbers must be a contiguous range from 0 onwards.
    Additionally, since a union type effectively adds two fields, its
    id must be that of the second field (the first field is the type
    field and not explicitly declared in the schema).
    For example, if the last field before the union field had id 6,
    the union field should have id 8, and the unions type field will
    implicitly be 7.
    IDs allow the fields to be placed in any order in the schema.
    When a new field is added to the schema is must use the next available ID.

Change-Id: I8690f105f3a2d31fdcb75a4fab4130692b12c62f
Tested: on Windows
2014-07-08 11:12:33 -07:00
Wouter van Oortmerssen a5f50019bc Made declaring the underlying type of an enum mandatory.
This is a breaking change, anyone having schema files with enums
that do not specify a type will get a specialized error:

must specify the underlying integer type for this
enum (e.g. ': short', which was the default).

All of the samples and docs already had a type specified,
so hopefully this will affect very few people.

Bug: 15777205
Change-Id: I9b8d7c0827867f7efb6c217346db7e402695eff0
Tested: on Windows
2014-07-02 14:39:59 -07:00
Wouter van Oortmerssen 66de19ace8 Documentation changes to clarify FlatBuffer internals.
Change-Id: I3759a07385f0d8d172ca2f88ac1759b71bee5a6a
2014-06-17 17:49:50 -07:00
Wouter van Oortmerssen 26a30738a4 Initial commit of the FlatBuffers code.
Change-Id: I4c9f0f722490b374257adb3fec63e44ae93da920
Tested: using VS2010 / Xcode / gcc on Linux.
2014-06-10 13:53:28 -07:00