When accessing a union field, we should return the same object type
as was given to the method, i.e. the parameter should have a generic
type for any Table-derived type. This way, we do not need to make
superfluous casts (which also reduce type safety) like
var myUnionType = (MyUnionType)buff.GetUnionField(new MyUnionType());
when we can do just
var myUnionType = buff.GetUnionField(new MyUnionType());
Change-Id: Idac1b638e46cc50b1f2dc19f10741481202b1515
Allows adding an already encoded UTF-8 string directly without
having to convert to a ``String`` first.
Change-Id: I23f9c738eec18fd35f4c14f58dbd0f6cf0970dc7
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.
In C#, plain field accessors should not be nonparametric methods
but should be standard property getters.
The accessor methods with parameters were renamed to `GetXxx`
because a method cannot be named identically to a property.
Also, `ByteBuffer.Position`, `FlatBufferBuilder.Offset` and
`FlatBufferBuilder.DataBuffer` are now properties instead
of nonparametric accessor methods, for more idiomatic C# style.
This is a breaking change, all client C# code accessing these
fields needs to be changed (i.e. remove those `()` or add the
`Get` prefix).
Issue: #77
Change-Id: Iaabe9ada076e5ea2c69911cf6170fdda2df3487e
By default, disallow reading binaries that do not correspond to
the schema file_identifier. Override with --raw-binary
Change-Id: I24822c0e4c80dab4e5a238ae2b6e601a09025c27
Tested: on Linux.
This commit contains the first step in providing mutable FlatBuffers,
non-const accessors and mutation functions for existing fields generated
from --gen-mutable.
Change-Id: Iebee3975f05c1001f8e22824725edeaa6d85fbee
Tested: on Linux.
Bug: 15777024
If an IDL file uses DOS-style EOLs (CR+LF), line comments need to
ignore the second linebreak character, otherwise, as is currently
the case, the parsed documentation comment includes a trailing `\r`
character, which is then output verbatim into the output source
code by flatc.
Change-Id: I39591631995a980622d20a4a32315178b33f18f6
added bii-travis.sh and readme.md files; added build status section with travis and biicode build
systems
Change-Id: I93acd1ca9497416ade6293d63b5311c4c31b880f
Enums should not be (badly) emulated with classes in C# but should
use native C# enums instead. Java implementation made an explicit
choice not to use the (more complex) Java enums, but C# enums are
just light-weight syntactic coating over integral types.
Fixes issue #171.
Change-Id: I9f4d6ba5324400a1e52982e49b58603cb7d7cca7
Builder has a new CreateByteString function that writes a
null-terimnated byte slice to the buffer. This results in zero
allocations for writing strings.
- Add parse handling of .proto struct and field doc comments (enums and
their values were already handled)
- Add FBS generation handling of doc comments for structs, their
fields, enums, and their values (requires linking idl_gen_general in
the test binary build)
- Tested using test.proto|golden with doc comments added. Xcode run of
flattest passes.
Change-Id: Idff64dd8064afba227174ab77d2c7be22d006628
Tested by regenerating all tests/ generated sources; note that only
Monster.java changes. Ran flattests as well.
Change-Id: I65b6ea7d208b0ccd6a0b34761162fed6ba391fc5
We were looking for 'flatc' in motive/bin/Debug/flatc,
on Mac. It's actually built to flatbuffers/Debug/flatc.
Tested: OS X Yosemite, ndk-r10d. Also tested on Linux.
Change-Id: I9f1ecfe00c5f42fd9b6808b5a5da1c920487a4c2
(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
BitConverter was excessively slow since it allocates a byte array
at each access.
Bug: 18702381
Change-Id: I47be9c38e1d04287ba4c10bc369848f3e13a2a2f
Tested: on Windows.
There is a bug in creating a C# table when it includes a field of type 'BOOL'. The problem is that the generate C# code is as follows:
"bool SampleValue = 0;"
This will fail to compile, because in C# this fails, it needs to be generated as:
"bool SampleValue = false;"
The error is in line ~510
Change-Id: I77f6eea0f269b0540dbeb462602fc447cb69237d
This function gets around the inefficiency of populating a [ubyte] vector
byte by byte. Since ubyte vectors are probably the most commonly used type
of generic byte buffer, this seems like a worthwhile thing to create a
fast path for.
Benchmarks show a 6x improvement in throughput on x64.
There is a new test verifying the functionality of the function.
Change-Id: I82e0228ae0f815dd7ea89bf168b8c1925f3ce0d7
1. Random table fields are now marked deprecated. The deprecation rate is adjustable, default is ~10% of fields.
2. Vector type previously produced a dummy field, now a trivial ubyte vector is generated instead.
3. The fuzzed "instances" were previously generated with identical data, now they are randomized: I suppose such was the intent from the beginning, just wasn't implemented.
I ran the new test with a few different settings and random seeds (but only on Windows + VS2015), and it always passed.
Change-Id: I2014686b6680aec24049ccda3f6deffe5205a83e
* Tests for Release feature.
* Check vector_downward.buf_ before passing to deallocator.
* Assertions.
* Shared test between unique_ptr and GetBufferPointer()
* Unnecessary using directives.
* Reallocate vector if released on clear operation.
* Use allocator attribute.
* Renamed `Release()` to `ReleaseBufferPointer()`
* For consistency with `GetBufferPointer()`
* Updated documentation for ReleaseBuffer.
Change-Id: I108527778e56ae5127abf9e5b1be6b445ad75cb7