diff --git a/CMakeLists.txt b/CMakeLists.txt index 2fa4160b6c3..dea199e8036 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,6 +70,43 @@ add_executable(flattests ${FlatBuffers_Tests_SRCS}) add_executable(flatsamplebinary ${FlatBuffers_Sample_Binary_SRCS}) add_executable(flatsampletext ${FlatBuffers_Sample_Text_SRCS}) +#---------------------------------------------------------------------------- +# Copy all example files to the build directory. Important for +# out of place builds. The progem flatsampletext requires that monster.fbs +# and monsterdata.json be in the directory ./samples +# +set(NEEDED_FILES + monster.fbs + monsterdata.json +) + +foreach(NEEDED_ ${NEEDED_FILES}) + configure_file( + ${PROJECT_SOURCE_DIR}/samples/${NEEDED_} + ${PROJECT_BINARY_DIR}/samples/${NEEDED_} + COPYONLY + ) +endforeach() + +#---------------------------------------------------------------------------- +# Copy all example files to the build directory. Important for +# out of place builds. The progem flattests requires that monster_test.fbs +# and monsterdata_test.json be in the directory ./test +# +set(NEEDED_FILES + monster_test.fbs + monsterdata_test.json +) + +foreach(NEEDED_ ${NEEDED_FILES}) + configure_file( + ${PROJECT_SOURCE_DIR}/tests/${NEEDED_} + ${PROJECT_BINARY_DIR}/tests/${NEEDED_} + COPYONLY + ) +endforeach() + +#---------------------------------------------------------------------------- add_test(NAME flattest CONFIGURATIONS Debug WORKING_DIRECTORY tests diff --git a/build/Xcode/FlatBuffers.xcodeproj/project.pbxproj b/build/Xcode/FlatBuffers.xcodeproj/project.pbxproj index c30aa8d43c9..ead87f8d6fd 100644 --- a/build/Xcode/FlatBuffers.xcodeproj/project.pbxproj +++ b/build/Xcode/FlatBuffers.xcodeproj/project.pbxproj @@ -338,6 +338,7 @@ 02575EDE5A1349C9A3584E32 /* RelWithDebInfo */ = { isa = XCBuildConfiguration; buildSettings = { + CONFIGURATION_BUILD_DIR = .; ONLY_ACTIVE_ARCH = YES; SDKROOT = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk; SYMROOT = build; @@ -758,6 +759,7 @@ 60917B4900A4484898ED29EF /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CONFIGURATION_BUILD_DIR = .; ONLY_ACTIVE_ARCH = YES; SDKROOT = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk; SYMROOT = build; @@ -767,6 +769,7 @@ 65B8F01CB7E6407CB262E6B6 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CONFIGURATION_BUILD_DIR = .; ONLY_ACTIVE_ARCH = YES; SDKROOT = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk; SYMROOT = build; @@ -926,6 +929,7 @@ C839EDC9489F432994623A13 /* MinSizeRel */ = { isa = XCBuildConfiguration; buildSettings = { + CONFIGURATION_BUILD_DIR = .; ONLY_ACTIVE_ARCH = YES; SDKROOT = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk; SYMROOT = build; diff --git a/build/Xcode/FlatBuffers.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/build/Xcode/FlatBuffers.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index bcc0adbab47..00000000000 --- a/build/Xcode/FlatBuffers.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/build/Xcode/FlatBuffers.xcodeproj/xcuserdata/wvo.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/build/Xcode/FlatBuffers.xcodeproj/xcuserdata/wvo.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist deleted file mode 100644 index 65e6142d351..00000000000 --- a/build/Xcode/FlatBuffers.xcodeproj/xcuserdata/wvo.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/build/Xcode/FlatBuffers.xcodeproj/xcuserdata/wvo.xcuserdatad/xcschemes/flatc.xcscheme b/build/Xcode/FlatBuffers.xcodeproj/xcuserdata/wvo.xcuserdatad/xcschemes/flatc.xcscheme deleted file mode 100644 index 225107dac8d..00000000000 --- a/build/Xcode/FlatBuffers.xcodeproj/xcuserdata/wvo.xcuserdatad/xcschemes/flatc.xcscheme +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/Xcode/FlatBuffers.xcodeproj/xcuserdata/wvo.xcuserdatad/xcschemes/flatsamplebinary.xcscheme b/build/Xcode/FlatBuffers.xcodeproj/xcuserdata/wvo.xcuserdatad/xcschemes/flatsamplebinary.xcscheme deleted file mode 100644 index 886a604f2c9..00000000000 --- a/build/Xcode/FlatBuffers.xcodeproj/xcuserdata/wvo.xcuserdatad/xcschemes/flatsamplebinary.xcscheme +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/Xcode/FlatBuffers.xcodeproj/xcuserdata/wvo.xcuserdatad/xcschemes/flatsampletext.xcscheme b/build/Xcode/FlatBuffers.xcodeproj/xcuserdata/wvo.xcuserdatad/xcschemes/flatsampletext.xcscheme deleted file mode 100644 index 65e4b546a41..00000000000 --- a/build/Xcode/FlatBuffers.xcodeproj/xcuserdata/wvo.xcuserdatad/xcschemes/flatsampletext.xcscheme +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/Xcode/FlatBuffers.xcodeproj/xcuserdata/wvo.xcuserdatad/xcschemes/flattests.xcscheme b/build/Xcode/FlatBuffers.xcodeproj/xcuserdata/wvo.xcuserdatad/xcschemes/flattests.xcscheme deleted file mode 100644 index 8469abc334e..00000000000 --- a/build/Xcode/FlatBuffers.xcodeproj/xcuserdata/wvo.xcuserdatad/xcschemes/flattests.xcscheme +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/Xcode/FlatBuffers.xcodeproj/xcuserdata/wvo.xcuserdatad/xcschemes/xcschememanagement.plist b/build/Xcode/FlatBuffers.xcodeproj/xcuserdata/wvo.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 40cf82be0eb..00000000000 --- a/build/Xcode/FlatBuffers.xcodeproj/xcuserdata/wvo.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,62 +0,0 @@ - - - - - SchemeUserState - - flatc.xcscheme - - orderHint - 2 - - flatsamplebinary.xcscheme - - orderHint - 3 - - flatsampletext.xcscheme - - orderHint - 4 - - flattests.xcscheme - - orderHint - 5 - - - SuppressBuildableAutocreation - - 3BCC495629FE4952AF99E971 - - primary - - - 49A8585B4DDF45E9A3B17CFC - - primary - - - 6FAE4035E73E43A4B85484F5 - - primary - - - D36669E5F70540ECA618AF27 - - primary - - - D69F7F780CCE4A07821AC50E - - primary - - - DBAB5216DC474DD19C4A3A9D - - primary - - - - - diff --git a/docs/html/doxygen.css b/docs/html/doxygen.css index 4699e6971b8..0a8f9627a5e 100644 --- a/docs/html/doxygen.css +++ b/docs/html/doxygen.css @@ -1,4 +1,4 @@ -/* The standard CSS for doxygen 1.8.5 */ +/* The standard CSS for doxygen 1.8.7 */ body, table, div, p, dl { font: 400 14px/22px Roboto,sans-serif; @@ -56,10 +56,14 @@ div.multicol { -webkit-column-count: 3; } -p.startli, p.startdd, p.starttd { +p.startli, p.startdd { margin-top: 2px; } +p.starttd { + margin-top: 0px; +} + p.endli { margin-bottom: 0px; } @@ -169,8 +173,8 @@ pre.fragment { } div.fragment { - padding: 0px; - margin: 0px; + padding: 4px 6px; + margin: 4px 8px 4px 2px; background-color: #FBFCFD; border: 1px solid #C4CFE5; } @@ -666,12 +670,12 @@ span.mlabel { /* @end */ -/* these are for tree view when not used as main index */ +/* these are for tree view inside a (index) page */ div.directory { margin: 10px 0px; - border-top: 1px solid #A8B8D9; - border-bottom: 1px solid #A8B8D9; + border-top: 1px solid #9CAFD4; + border-bottom: 1px solid #9CAFD4; width: 100%; } @@ -730,6 +734,80 @@ div.directory { color: #3D578C; } +.arrow { + color: #9CAFD4; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + cursor: pointer; + font-size: 80%; + display: inline-block; + width: 16px; + height: 22px; +} + +.icon { + font-family: Arial, Helvetica; + font-weight: bold; + font-size: 12px; + height: 14px; + width: 16px; + display: inline-block; + background-color: #728DC1; + color: white; + text-align: center; + border-radius: 4px; + margin-left: 2px; + margin-right: 2px; +} + +.icona { + width: 24px; + height: 22px; + display: inline-block; +} + +.iconfopen { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('ftv2folderopen.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +.iconfclosed { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('ftv2folderclosed.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +.icondoc { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('ftv2doc.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +table.directory { + font: 400 14px Roboto,sans-serif; +} + +/* @end */ + div.dynheader { margin-top: 8px; -webkit-touch-callout: none; @@ -1065,6 +1143,11 @@ dl.section dd { text-align: center; } +.diagraph +{ + text-align: center; +} + .caption { font-weight: bold; diff --git a/docs/html/dynsections.js b/docs/html/dynsections.js index ed092c7f630..85e18369095 100644 --- a/docs/html/dynsections.js +++ b/docs/html/dynsections.js @@ -24,19 +24,20 @@ function updateStripes() $('table.directory tr'). removeClass('even').filter(':visible:even').addClass('even'); } + function toggleLevel(level) { - $('table.directory tr').each(function(){ + $('table.directory tr').each(function() { var l = this.id.split('_').length-1; var i = $('#img'+this.id.substring(3)); var a = $('#arr'+this.id.substring(3)); if (l - + FlatBuffers: Main Page @@ -32,7 +32,7 @@ - +
- +
- +

There are project files for Visual Studio and Xcode that should allow you to build the compiler flatc, the samples and the tests out of the box.

-

Alternatively, the distribution comes with a cmake file that should allow you to build project/make files for any platform. For details on cmake, see http://www.cmake.org. In brief, depending on your platform, use one of e.g.:

-
cmake -G "Unix Makefiles"
+

Alternatively, the distribution comes with a cmake file that should allow you to build project/make files for any platform. For details on cmake, see http://www.cmake.org. In brief, depending on your platform, use one of e.g.:

cmake -G "Unix Makefiles"
 cmake -G "Visual Studio 10"
 cmake -G "Xcode"
 

Then, build as normal for your platform. This should result in a flatc executable, essential for the next steps. Note that to use clang instead of gcc, you may need to set up your environment variables, e.g. CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -G "Unix Makefiles".

diff --git a/docs/html/md__compiler.html b/docs/html/md__compiler.html index fab13cd7734..21bd4d476b8 100644 --- a/docs/html/md__compiler.html +++ b/docs/html/md__compiler.html @@ -3,7 +3,7 @@ - + FlatBuffers: Using the schema compiler @@ -32,7 +32,7 @@
- +
-

Usage:

-
flatc [ -c ] [ -j ] [ -b ] [ -t ] file1 file2 ..
+

Usage:

flatc [ -c ] [ -j ] [ -b ] [ -t ] file1 file2 ..
 

The files are read and parsed in order, and can contain either schemas or data (see below). Later files can make use of definitions in earlier files. Depending on the flags passed, additional files may be generated for each file processed:

  • -c : Generate a C++ header for all definitions in this file (as filename_generated.h). Skips data.
  • diff --git a/docs/html/md__cpp_usage.html b/docs/html/md__cpp_usage.html index 4023544f6be..386fffc8678 100644 --- a/docs/html/md__cpp_usage.html +++ b/docs/html/md__cpp_usage.html @@ -3,7 +3,7 @@ - + FlatBuffers: Use in C++ @@ -32,7 +32,7 @@
- +
diff --git a/docs/html/md__java_usage.html b/docs/html/md__java_usage.html index 7a90aeafdd7..27aae1b7e5d 100644 --- a/docs/html/md__java_usage.html +++ b/docs/html/md__java_usage.html @@ -3,7 +3,7 @@ - + FlatBuffers: Use in Java @@ -32,7 +32,7 @@
- +

There's experimental support for reading FlatBuffers in Java. Generate code for Java with the -j option to flatc.

-

See javaTest.java for an example. Essentially, you read a FlatBuffer binary file into a byte[], which you then turn into a ByteBuffer, which you pass to the getRootAsMonster function:

-
ByteBuffer bb = ByteBuffer.wrap(data);
+

See javaTest.java for an example. Essentially, you read a FlatBuffer binary file into a byte[], which you then turn into a ByteBuffer, which you pass to the getRootAsMonster function:

ByteBuffer bb = ByteBuffer.wrap(data);
 Monster monster = Monster.getRootAsMonster(bb);
-

Now you can access values much like C++:

-
short hp = monster.hp();
+

Now you can access values much like C++:

short hp = monster.hp();
 Vec3 pos = monster.pos();
 

Note that whenever you access a new object like in the pos example above, a new temporary accessor object gets created. If your code is very performance sensitive (you iterate through a lot of objects), there's a second pos() method to which you can pass a Vec3 object you've already created. This allows you to reuse it across many calls and reduce the amount of object allocation (and thus garbage collection) your program does.

Sadly the string accessors currently always create a new string when accessed, since FlatBuffer's UTF-8 strings can't be read in-place by Java.

-

Vector access is also a bit different from C++: you pass an extra index to the vector field accessor. Then a second method with the same name suffixed by _length let's you know the number of elements you can access:

-
for (int i = 0; i < monster.inventory_length(); i++)
+

Vector access is also a bit different from C++: you pass an extra index to the vector field accessor. Then a second method with the same name suffixed by _length let's you know the number of elements you can access:

for (int i = 0; i < monster.inventory_length(); i++)
     monster.inventory(i); // do something here
-

You can also construct these buffers in Java using the static methods found in the generated code, and the FlatBufferBuilder class:

-
FlatBufferBuilder fbb = new FlatBufferBuilder();
-

Create strings:

-
int str = fbb.createString("MyMonster");
-

Create a table with a struct contained therein:

-
Monster.startMonster(fbb);
+

You can also construct these buffers in Java using the static methods found in the generated code, and the FlatBufferBuilder class:

FlatBufferBuilder fbb = new FlatBufferBuilder();
+

Create strings:

int str = fbb.createString("MyMonster");
+

Create a table with a struct contained therein:

Monster.startMonster(fbb);
 Monster.addPos(fbb, Vec3.createVec3(fbb, 1.0f, 2.0f, 3.0f, 3.0, (byte)4, (short)5, (byte)6));
 Monster.addHp(fbb, (short)80);
 Monster.addName(fbb, str);
@@ -80,8 +74,7 @@
 Monster.addTest4(fbb, test4s);
 int mon = Monster.endMonster(fbb);
 

As you can see, the Java code for tables does not use a convenient createMonster call like the C++ code. This is to create the buffer without using temporary object allocation (since the Vec3 is an inline component of Monster, it has to be created right where it is added, whereas the name and the inventory are not inline). Structs do have convenient methods that even have arguments for nested structs.

-

Vectors also use this start/end pattern to allow vectors of both scalar types and structs:

-
Monster.startInventoryVector(fbb, 5);
+

Vectors also use this start/end pattern to allow vectors of both scalar types and structs:

Monster.startInventoryVector(fbb, 5);
 for (byte i = 4; i >=0; i--) fbb.addByte(i);
 int inv = fbb.endVector();
 

You can use the generated method startInventoryVector to conveniently call startVector with the right element size. You pass the number of elements you want to write. You write the elements backwards since the buffer is being constructed back to front.

diff --git a/docs/html/md__schemas.html b/docs/html/md__schemas.html index d1faa73c77e..f4b82c6a034 100644 --- a/docs/html/md__schemas.html +++ b/docs/html/md__schemas.html @@ -3,7 +3,7 @@ - + FlatBuffers: Writing a schema @@ -32,7 +32,7 @@
- +
-

The syntax of the schema language (aka IDL, Interface Definition Language) should look quite familiar to users of any of the C family of languages, and also to users of other IDLs. Let's look at an example first:

-
// example IDL file
+

The syntax of the schema language (aka IDL, Interface Definition Language) should look quite familiar to users of any of the C family of languages, and also to users of other IDLs. Let's look at an example first:

// example IDL file
 
 namespace MyGame;
 
diff --git a/docs/html/md__white_paper.html b/docs/html/md__white_paper.html
index b2ea6103509..b64f58180e6 100644
--- a/docs/html/md__white_paper.html
+++ b/docs/html/md__white_paper.html
@@ -3,7 +3,7 @@
 
 
 
-
+
 FlatBuffers: FlatBuffers white paper
 
 
@@ -32,7 +32,7 @@
 
 
- +
- +