Commit Graph

22 Commits

Author SHA1 Message Date
Maxim Zaks ac10873e26 fixed code generator for array of bools
Change-Id: I3cdd801b641bf180222203a37634598350d340e3
2015-08-19 14:39:06 -07:00
Mormegil 25c99273d3 [Issue 252] Add type cast for default enum values in C#
When creating a “CreateXxx(...)” method for a “simple table” type,
enum-type fields with a non-zero default must have an explicit
cast for the respective argument default value, because in C#,
there is an implicit cast from int to an enum only for 0.

Also, added an example of such type into the example monster_test
type, so that we test this feature.
2015-08-11 18:07:38 +02:00
Wouter van Oortmerssen 39833d7cf0 Added namespaced way to refer to types in schemas.
Also made proper namespacing work for enums.

You can now say namespace.MyTable as the type when declaring
a field that refers to a type in a different namespace.

Previously, it would work just referring to MyTable, however
with the recent commit fixing namespaced types this now
is ambiguous.

Change-Id: Ieaa3f4ac1662b8c4dc1f16e1898ea3cdb02e10fd
Tested: on Linux.
2015-05-08 16:21:53 -07:00
Wouter van Oortmerssen ca5c9e7496 Unsigned types in Java now return bigger size signed types.
(Java doesn't support unsigned types).

ubyte/ushort return as int
uint returns as long
(all with correct masking)

ulong still returns as long, as before.

Tested: on Linux & Windows.
Bug 17521464

Change-Id: Id6bc8f38fc8c1a2f4e6733c6980dc6b6e322b452
2015-03-23 17:01:33 -07:00
Alex Ames d575321eba Added the hash attribute to ints and longs.
FlatBuffer schema files can now optionally specify a hash attribute that
will allow someone writing json files to enter a string to be hashed
rather than a specific value. The hashing algorithm to use is specified
by the schema.

Currently the only algorithms are fnv1 and fnv1a. There are 32 bit and
64 variatns for each. Additionally, a hashing command line tool was
added so that you can see what a string will hash to without needing to
inspect the flatbuffer binary blob.

Change-Id: I0cb359d0e2dc7d2dc1874b446dc19a17cc77109d
2015-02-17 14:10:18 -08:00
Wouter van Oortmerssen 4fb5a764df Support for booleans in the Java/C# API
Change-Id: I72e92183a7b5f4145ea51fcec29257dc9553a461
2015-01-26 13:08:44 -08: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 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 18cf19f876 Fixed bug in convenient constructors for Java/C#
Also fixed Go unit tests not being up to date with recent schema
changes.

Change-Id: I42e619f9c5ea05f6f937c68a5c8a92462c46bce3
Tested: on Linux and Windows.
2014-09-25 15:53:56 -07:00
Wouter van Oortmerssen 7b8053570e Enums in C++ are now strongly typed.
Accessors and constructors now take enum types rather than ints.

Bug: 16570507
Change-Id: I4b50fd64ad2e662ea2481bc0ccea784326fb31c0
Tested: on Linux and Windows.
2014-09-23 17:25:50 -07:00
Wouter van Oortmerssen 85c9c83844 Made flatc error messages look like what other compilers output.
Looks like MSVC on Windows and like gcc everywhere else.
For enhanced IDE clickability.

Bug: 17208371
Change-Id: Ie3e02658fccd3edfd464b4bacf4bc68c613a8570
Tested: on Linux and Windows.
2014-09-23 17:19:01 -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 c553b6b950 The list of enum values is now allowed to end in a comma.
Bug: 16490424
Change-Id: Ic3dd5f06efb5cf2dc4aefbd3f2db64c7b59b6b93
Tested: on OS X.
2014-08-22 14:02:32 -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 0b47e69d4d Parser now allows empty tables in JSON
Bug: 16870719
Change-Id: Ia5fdce49a67b1aa621ab1e37a815e2a3293257b6
Tested: on Linux
2014-08-13 11:44:20 -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 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 3e201a99b2 A feature that officially supports nested FlatBuffers.
Generates convenient accessors for the nested root.

Change-Id: Ic0b1531de7ace475ff2a7b1f430d27f41c838430
Tested: on Windows.
2014-07-21 16:40:39 -07:00
Wouter van Oortmerssen 75349ae8c3 Fixed incorrect verifier code for nested tables.
It was outputting the type instead of the field name, and didn't deal
with NULL fields. Added test case.

Also fixed token enums having the wrong value, resulting in
unreadable error messages.

Change-Id: Icd9b4d22f417bfad5824c0f58e067ce3f2e2dc6f
Tested: on Windows and Linux.
2014-07-09 17:13:03 -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 a0b6ffc25b Add buffer verification functionality to FlatBuffers
Bug: 15732628
Change-Id: I0b7cb65982d6b8957d5a899cca7d2b5d2ef53206
Tested: On Windows, OS X and Linux
2014-07-01 17:52:16 -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