Commit fb7f27a7 authored by Maor Itzkovitch's avatar Maor Itzkovitch

Merge remote-tracking branch 'upstream/master'

parents 7bfed4b2 a170b69d
......@@ -97,6 +97,7 @@ $(document).ready(function(){initNavTree('index.html','');});
<li>How to <a href="md__cpp_usage.html">use the generated C++ code</a> in your own programs.</li>
<li>How to <a href="md__java_usage.html">use the generated Java/C# code</a> in your own programs.</li>
<li>How to <a href="md__go_usage.html">use the generated Go code</a> in your own programs.</li>
<li><a href="md__support.html">Support matrix</a> for platforms/languages/features.</li>
<li>Some <a href="md__benchmarks.html">benchmarks</a> showing the advantage of using FlatBuffers.</li>
<li>A <a href="md__white_paper.html">white paper</a> explaining the "why" of FlatBuffers.</li>
<li>A description of the <a href="md__internals.html">internals</a> of FlatBuffers.</li>
......
<!-- HTML header for doxygen 1.8.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.7"/>
<title>FlatBuffers: Platform / Language / Feature support</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,400italic,500,500italic,700,700italic|Roboto+Mono:400,700" rel="stylesheet">
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea" style="height: 110px;">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="commonprojectlogo">
<img alt="Logo" src="fpl_logo_small.png"/>
</td>
<td style="padding-left: 0.5em;">
<div id="projectname">FlatBuffers
</div>
<div style="font-size:12px;">
An open source project by <a href="https://developers.google.com/games/#Tools">FPL</a>.
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.7 -->
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('md__support.html','');});
</script>
<div id="doc-content">
<div class="header">
<div class="headertitle">
<div class="title">Platform / Language / Feature support </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>FlatBuffers is actively being worked on, which means that certain platform / language / feature combinations may not be available yet.</p>
<p>This page tries to track those issues, to make informed decisions easier. In general:</p>
<ul>
<li>Languages: language support beyond the ones created by the original FlatBuffer authors typically depends on community contributions.</li>
<li>Features: C++ was the first language supported, since our original target was high performance game development. It thus has the richest feature set, and is likely most robust. Other languages are catching up however.</li>
<li>Platforms: All language implementations are typically portable to most platforms, unless where noted otherwise.</li>
</ul>
<p>NOTE: this table is a start, it needs to be extended.</p>
<table class="doxtable">
<tr>
<th>Feature </th><th>C++ </th><th>Java </th><th>C# </th><th>Go </th><th>Python </th><th>JS </th></tr>
<tr>
<td>Codegen for all basic features </td><td>Yes </td><td>Yes </td><td>Yes </td><td>Yes </td><td>Yes </td><td>WIP </td></tr>
<tr>
<td>JSON parsing </td><td>Yes </td><td>No </td><td>No </td><td>No </td><td>No </td><td>No </td></tr>
<tr>
<td>Simple mutation </td><td>Yes </td><td>WIP </td><td>WIP </td><td>No </td><td>No </td><td>No </td></tr>
<tr>
<td>Reflection </td><td>Yes </td><td>No </td><td>No </td><td>No </td><td>No </td><td>No </td></tr>
<tr>
<td>Buffer verifier </td><td>Yes </td><td>No </td><td>No </td><td>No </td><td>No </td><td>No </td></tr>
<tr>
<td>Testing: basic </td><td>Yes </td><td>Yes </td><td>Yes </td><td>Yes </td><td>Yes </td><td>WIP </td></tr>
<tr>
<td>Testing: fuzz </td><td>Yes </td><td>No </td><td>No </td><td>Yes </td><td>Yes </td><td>No </td></tr>
<tr>
<td>Performance: </td><td>Superb </td><td>Great </td><td>Great </td><td>Great </td><td>Ok </td><td>? </td></tr>
<tr>
<td>Platform: Windows </td><td>VS2010 </td><td>Yes </td><td>Yes </td><td>? </td><td>? </td><td>? </td></tr>
<tr>
<td>Platform: Linux </td><td>GCC282 </td><td>Yes </td><td>? </td><td>Yes </td><td>Yes </td><td>? </td></tr>
<tr>
<td>Platform: OS X </td><td>Xcode4 </td><td>? </td><td>? </td><td>? </td><td>Yes </td><td>? </td></tr>
<tr>
<td>Platform: Android </td><td>NDK10d </td><td>Yes </td><td>? </td><td>? </td><td>? </td><td>? </td></tr>
<tr>
<td>Platform: iOS </td><td>? </td><td>? </td><td>? </td><td>? </td><td>? </td><td>? </td></tr>
<tr>
<td>Engine: Unity </td><td>? </td><td>? </td><td>Yes </td><td>? </td><td>? </td><td>? </td></tr>
<tr>
<td>Primary authors (github) </td><td>wvo </td><td>wvo </td><td>(ev/js)</td><td>rw </td><td>rw </td><td>(ev) </td></tr>
</table>
<ul>
<li>ev = evolutional</li>
<li>js = jonsimantov </li>
</ul>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-49880327-7', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
......@@ -8,6 +8,7 @@ var NAVTREE =
[ "Use in Go", "md__go_usage.html", null ],
[ "Use in Java/C-sharp", "md__java_usage.html", null ],
[ "Use in Python", "md__python_usage.html", null ],
[ "Platform / Language / Feature support", "md__support.html", null ],
[ "Benchmarks", "md__benchmarks.html", null ],
[ "FlatBuffers white paper", "md__white_paper.html", null ],
[ "FlatBuffer Internals", "md__internals.html", null ],
......
var NAVTREEINDEX0 =
{
"index.html":[],
"md__benchmarks.html":[7],
"md__benchmarks.html":[8],
"md__building.html":[0],
"md__compiler.html":[1],
"md__cpp_usage.html":[3],
"md__go_usage.html":[4],
"md__grammar.html":[10],
"md__internals.html":[9],
"md__grammar.html":[11],
"md__internals.html":[10],
"md__java_usage.html":[5],
"md__python_usage.html":[6],
"md__schemas.html":[2],
"md__white_paper.html":[8],
"md__support.html":[7],
"md__white_paper.html":[9],
"pages.html":[]
};
......@@ -70,10 +70,11 @@ $(document).ready(function(){initNavTree('pages.html','');});
<tr id="row_4_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><a class="el" href="md__go_usage.html" target="_self">Use in Go</a></td><td class="desc"></td></tr>
<tr id="row_5_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><a class="el" href="md__java_usage.html" target="_self">Use in Java/C-sharp</a></td><td class="desc"></td></tr>
<tr id="row_6_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><a class="el" href="md__python_usage.html" target="_self">Use in Python</a></td><td class="desc"></td></tr>
<tr id="row_7_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><a class="el" href="md__benchmarks.html" target="_self">Benchmarks</a></td><td class="desc"></td></tr>
<tr id="row_8_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><a class="el" href="md__white_paper.html" target="_self">FlatBuffers white paper</a></td><td class="desc"></td></tr>
<tr id="row_9_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><a class="el" href="md__internals.html" target="_self">FlatBuffer Internals</a></td><td class="desc"></td></tr>
<tr id="row_10_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><a class="el" href="md__grammar.html" target="_self">Grammar of the schema language</a></td><td class="desc"></td></tr>
<tr id="row_7_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><a class="el" href="md__support.html" target="_self">Platform / Language / Feature support</a></td><td class="desc"></td></tr>
<tr id="row_8_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><a class="el" href="md__benchmarks.html" target="_self">Benchmarks</a></td><td class="desc"></td></tr>
<tr id="row_9_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><a class="el" href="md__white_paper.html" target="_self">FlatBuffers white paper</a></td><td class="desc"></td></tr>
<tr id="row_10_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><a class="el" href="md__internals.html" target="_self">FlatBuffer Internals</a></td><td class="desc"></td></tr>
<tr id="row_11_"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><a class="el" href="md__grammar.html" target="_self">Grammar of the schema language</a></td><td class="desc"></td></tr>
</table>
</div><!-- directory -->
</div><!-- contents -->
......
......@@ -115,6 +115,7 @@ sections provide a more in-depth usage guide.
programs.
- How to [use the generated Go code](md__go_usage.html) in your own
programs.
- [Support matrix](md__support.html) for platforms/languages/features.
- Some [benchmarks](md__benchmarks.html) showing the advantage of using
FlatBuffers.
- A [white paper](md__white_paper.html) explaining the "why" of FlatBuffers.
......
# Platform / Language / Feature support
FlatBuffers is actively being worked on, which means that certain platform /
language / feature combinations may not be available yet.
This page tries to track those issues, to make informed decisions easier.
In general:
* Languages: language support beyond the ones created by the original
FlatBuffer authors typically depends on community contributions.
* Features: C++ was the first language supported, since our original
target was high performance game development. It thus has the richest
feature set, and is likely most robust. Other languages are catching up
however.
* Platforms: All language implementations are typically portable to most
platforms, unless where noted otherwise.
NOTE: this table is a start, it needs to be extended.
Feature | C++ | Java | C# | Go | Python | JS
------------------------------ | ------ | ------ | ------ | ------ | ------ | ------
Codegen for all basic features | Yes | Yes | Yes | Yes | Yes | WIP
JSON parsing | Yes | No | No | No | No | No
Simple mutation | Yes | WIP | WIP | No | No | No
Reflection | Yes | No | No | No | No | No
Buffer verifier | Yes | No | No | No | No | No
Testing: basic | Yes | Yes | Yes | Yes | Yes | WIP
Testing: fuzz | Yes | No | No | Yes | Yes | No
Performance: | Superb | Great | Great | Great | Ok | ?
Platform: Windows | VS2010 | Yes | Yes | ? | ? | ?
Platform: Linux | GCC282 | Yes | ? | Yes | Yes | ?
Platform: OS X | Xcode4 | ? | ? | ? | Yes | ?
Platform: Android | NDK10d | Yes | ? | ? | ? | ?
Platform: iOS | ? | ? | ? | ? | ? | ?
Engine: Unity | ? | ? | Yes | ? | ? | ?
Primary authors (github) | wvo | wvo | (ev/js)| rw | rw | (ev)
* ev = evolutional
* js = jonsimantov
......@@ -751,6 +751,7 @@ INPUT = "FlatBuffers.md" \
"GoUsage.md" \
"JavaUsage.md" \
"PythonUsage.md" \
"Support.md" \
"Benchmarks.md" \
"WhitePaper.md" \
"Internals.md" \
......
......@@ -870,7 +870,15 @@ static void GenStruct(const LanguageParameters &lang, const Parser &parser,
// Java doesn't have defaults, which means this method must always
// supply all arguments, and thus won't compile when fields are added.
if (lang.language != GeneratorOptions::kJava) {
code += " = " + GenDefaultValue(lang, field.value, false);
code += " = ";
// in C#, enum values have their own type, so we need to cast the
// numeric value to the proper type
if (lang.language == GeneratorOptions::kCSharp &&
field.value.type.enum_def != nullptr &&
field.value.type.base_type != BASE_TYPE_UNION) {
code += "(" + field.value.type.enum_def->name + ")";
}
code += GenDefaultValue(lang, field.value, false);
}
}
code += ") {\n builder.";
......
......@@ -71,6 +71,9 @@
<Compile Include="..\MyGame\Example\Test.cs">
<Link>MyGame\Example\Test.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\TestSimpleTableWithEnum.cs">
<Link>MyGame\Example\TestSimpleTableWithEnum.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Vec3.cs">
<Link>MyGame\Example\Vec3.cs</Link>
</Compile>
......
......@@ -7,6 +7,7 @@ public enum Any : byte
{
NONE = 0,
Monster = 1,
TestSimpleTableWithEnum = 2,
};
......
......@@ -5,4 +5,5 @@ package Example
const (
AnyNONE = 0
AnyMonster = 1
AnyTestSimpleTableWithEnum = 2
)
......@@ -6,8 +6,9 @@ public final class Any {
private Any() { }
public static final byte NONE = 0;
public static final byte Monster = 1;
public static final byte TestSimpleTableWithEnum = 2;
private static final String[] names = { "NONE", "Monster", };
private static final String[] names = { "NONE", "Monster", "TestSimpleTableWithEnum", };
public static String name(int e) { return names[e]; }
};
......
......@@ -5,4 +5,5 @@
class Any(object):
NONE = 0
Monster = 1
TestSimpleTableWithEnum = 2
// automatically generated, do not modify
namespace MyGame.Example
{
using FlatBuffers;
public sealed class TestSimpleTableWithEnum : Table {
public static TestSimpleTableWithEnum GetRootAsTestSimpleTableWithEnum(ByteBuffer _bb) { return GetRootAsTestSimpleTableWithEnum(_bb, new TestSimpleTableWithEnum()); }
public static TestSimpleTableWithEnum GetRootAsTestSimpleTableWithEnum(ByteBuffer _bb, TestSimpleTableWithEnum obj) { return (obj.__init(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public TestSimpleTableWithEnum __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; }
public Color Color { get { int o = __offset(4); return o != 0 ? (Color)bb.GetSbyte(o + bb_pos) : (Color)2; } }
public static Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum(FlatBufferBuilder builder,
Color color = (Color)2) {
builder.StartObject(1);
TestSimpleTableWithEnum.AddColor(builder, color);
return TestSimpleTableWithEnum.EndTestSimpleTableWithEnum(builder);
}
public static void StartTestSimpleTableWithEnum(FlatBufferBuilder builder) { builder.StartObject(1); }
public static void AddColor(FlatBufferBuilder builder, Color color) { builder.AddSbyte(0, (sbyte)(color), 2); }
public static Offset<TestSimpleTableWithEnum> EndTestSimpleTableWithEnum(FlatBufferBuilder builder) {
int o = builder.EndObject();
return new Offset<TestSimpleTableWithEnum>(o);
}
};
}
// automatically generated, do not modify
package Example
import (
flatbuffers "github.com/google/flatbuffers/go"
)
type TestSimpleTableWithEnum struct {
_tab flatbuffers.Table
}
func (rcv *TestSimpleTableWithEnum) Init(buf []byte, i flatbuffers.UOffsetT) {
rcv._tab.Bytes = buf
rcv._tab.Pos = i
}
func (rcv *TestSimpleTableWithEnum) Color() int8 {
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
if o != 0 {
return rcv._tab.GetInt8(o + rcv._tab.Pos)
}
return 2
}
func TestSimpleTableWithEnumStart(builder *flatbuffers.Builder) { builder.StartObject(1) }
func TestSimpleTableWithEnumAddColor(builder *flatbuffers.Builder, color int8) { builder.PrependInt8Slot(0, color, 2) }
func TestSimpleTableWithEnumEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { return builder.EndObject() }
// automatically generated, do not modify
package MyGame.Example;
import java.nio.*;
import java.lang.*;
import java.util.*;
import com.google.flatbuffers.*;
public final class TestSimpleTableWithEnum extends Table {
public static TestSimpleTableWithEnum getRootAsTestSimpleTableWithEnum(ByteBuffer _bb) { return getRootAsTestSimpleTableWithEnum(_bb, new TestSimpleTableWithEnum()); }
public static TestSimpleTableWithEnum getRootAsTestSimpleTableWithEnum(ByteBuffer _bb, TestSimpleTableWithEnum obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__init(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public TestSimpleTableWithEnum __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; }
public byte color() { int o = __offset(4); return o != 0 ? bb.get(o + bb_pos) : 2; }
public static int createTestSimpleTableWithEnum(FlatBufferBuilder builder,
byte color) {
builder.startObject(1);
TestSimpleTableWithEnum.addColor(builder, color);
return TestSimpleTableWithEnum.endTestSimpleTableWithEnum(builder);
}
public static void startTestSimpleTableWithEnum(FlatBufferBuilder builder) { builder.startObject(1); }
public static void addColor(FlatBufferBuilder builder, byte color) { builder.addByte(0, color, 2); }
public static int endTestSimpleTableWithEnum(FlatBufferBuilder builder) {
int o = builder.endObject();
return o;
}
};
# automatically generated, do not modify
# namespace: Example
import flatbuffers
class TestSimpleTableWithEnum(object):
__slots__ = ['_tab']
# TestSimpleTableWithEnum
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
# TestSimpleTableWithEnum
def Color(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
return 2
def TestSimpleTableWithEnumStart(builder): builder.StartObject(1)
def TestSimpleTableWithEnumAddColor(builder, color): builder.PrependInt8Slot(0, color, 2)
def TestSimpleTableWithEnumEnd(builder): return builder.EndObject()
......@@ -8,10 +8,14 @@ attribute "priority";
enum Color:byte (bit_flags) { Red = 0, Green, Blue = 3, }
union Any { Monster } // TODO: add more elements
union Any { Monster, TestSimpleTableWithEnum } // TODO: add more elements
struct Test { a:short; b:byte; }
table TestSimpleTableWithEnum {
color: Color = Green;
}
struct Vec3 (force_align: 16) {
x:float;
y:float;
......
......@@ -15,6 +15,7 @@ namespace MyGame {
namespace Example {
struct Test;
struct TestSimpleTableWithEnum;
struct Vec3;
struct Stat;
struct Monster;
......@@ -34,11 +35,12 @@ inline const char *EnumNameColor(Color e) { return EnumNamesColor()[e - Color_Re
enum Any {
Any_NONE = 0,
Any_Monster = 1
Any_Monster = 1,
Any_TestSimpleTableWithEnum = 2
};
inline const char **EnumNamesAny() {
static const char *names[] = { "NONE", "Monster", nullptr };
static const char *names[] = { "NONE", "Monster", "TestSimpleTableWithEnum", nullptr };
return names;
}
......@@ -94,6 +96,35 @@ MANUALLY_ALIGNED_STRUCT(16) Vec3 FLATBUFFERS_FINAL_CLASS {
};
STRUCT_END(Vec3, 32);
struct TestSimpleTableWithEnum FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
Color color() const { return static_cast<Color>(GetField<int8_t>(4, 2)); }
bool mutate_color(Color color) { return SetField(4, static_cast<int8_t>(color)); }
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<int8_t>(verifier, 4 /* color */) &&
verifier.EndTable();
}
};
struct TestSimpleTableWithEnumBuilder {
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_color(Color color) { fbb_.AddElement<int8_t>(4, static_cast<int8_t>(color), 2); }
TestSimpleTableWithEnumBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
TestSimpleTableWithEnumBuilder &operator=(const TestSimpleTableWithEnumBuilder &);
flatbuffers::Offset<TestSimpleTableWithEnum> Finish() {
auto o = flatbuffers::Offset<TestSimpleTableWithEnum>(fbb_.EndTable(start_, 1));
return o;
}
};
inline flatbuffers::Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum(flatbuffers::FlatBufferBuilder &_fbb,
Color color = Color_Green) {
TestSimpleTableWithEnumBuilder builder_(_fbb);
builder_.add_color(color);
return builder_.Finish();
}
struct Stat FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
const flatbuffers::String *id() const { return GetPointer<const flatbuffers::String *>(4); }
flatbuffers::String *mutable_id() { return GetPointer<flatbuffers::String *>(4); }
......@@ -318,6 +349,7 @@ inline bool VerifyAny(flatbuffers::Verifier &verifier, const void *union_obj, An
switch (type) {
case Any_NONE: return true;
case Any_Monster: return verifier.VerifyTable(reinterpret_cast<const Monster *>(union_obj));
case Any_TestSimpleTableWithEnum: return verifier.VerifyTable(reinterpret_cast<const TestSimpleTableWithEnum *>(union_obj));
default: return false;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment