Compare commits
655 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eba6b6f7c9 | ||
|
|
a0b8f669ee | ||
|
|
18d67ed83b | ||
|
|
205ddb175f | ||
|
|
be908939da | ||
|
|
c96fc7fcef | ||
|
|
026c6ddb17 | ||
|
|
3eebba789f | ||
|
|
b36bd67b39 | ||
|
|
ec20233fab | ||
|
|
73d5bf46b4 | ||
|
|
f6416d8471 | ||
|
|
d70f5ac6b0 | ||
|
|
c9b9fd0407 | ||
|
|
6897bb99bb | ||
|
|
c9ee9fb99d | ||
|
|
50e13ef9c6 | ||
|
|
f624065eaa | ||
|
|
03adfa7b1a | ||
|
|
97a9a82324 | ||
|
|
307694e397 | ||
|
|
d268d11ca2 | ||
|
|
094f4d1bad | ||
|
|
a0398ce0f5 | ||
|
|
30c07f4e55 | ||
|
|
fc19f746b0 | ||
|
|
a351124cfd | ||
|
|
0230a7173f | ||
|
|
5f351a35a2 | ||
|
|
2d427e0502 | ||
|
|
1bba4fd9ea | ||
|
|
f98870715a | ||
|
|
f61f0449c7 | ||
|
|
42e0b02149 | ||
|
|
a56c6e5195 | ||
|
|
5efa22447e | ||
|
|
bdd668df7b | ||
|
|
05b00c50ad | ||
|
|
77e9122681 | ||
|
|
e067040375 | ||
|
|
370e101a69 | ||
|
|
91f5cf357c | ||
|
|
7c7c571bbe | ||
|
|
3101e327c0 | ||
|
|
46bf9f5177 | ||
|
|
694725beb0 | ||
|
|
ce3e7fbd72 | ||
|
|
53e9606ea2 | ||
|
|
ffc0d6209a | ||
|
|
9fdb6dcf1f | ||
|
|
298dd21ec8 | ||
|
|
64fa8ba9a9 | ||
|
|
a8d2eeee34 | ||
|
|
e21a61d458 | ||
|
|
410fb15a07 | ||
|
|
a69b19fa8f | ||
|
|
58924538a3 | ||
|
|
e750268f0c | ||
|
|
0328dedab5 | ||
|
|
9605dc5981 | ||
|
|
00694d271e | ||
|
|
b22db6e8eb | ||
|
|
14e7e8260e | ||
|
|
3a1f776132 | ||
|
|
4b53762cf2 | ||
|
|
0d56276102 | ||
|
|
98c7a0c169 | ||
|
|
676f0712fd | ||
|
|
7a3f1cf78e | ||
|
|
49c10bc219 | ||
|
|
df9990acf5 | ||
|
|
3d7b1a32a3 | ||
|
|
db99c1aa64 | ||
|
|
f6f88e567e | ||
|
|
e527b992f9 | ||
|
|
aade31b263 | ||
|
|
e733d95e66 | ||
|
|
14bdce41fe | ||
|
|
4a49493e27 | ||
|
|
df5575de17 | ||
|
|
f0b2cc8f6e | ||
|
|
5f2b4e7872 | ||
|
|
22697722d9 | ||
|
|
ffbc93526e | ||
|
|
d9d47a53bd | ||
|
|
71d30d5c02 | ||
|
|
1661f3a2e8 | ||
|
|
d9767b8315 | ||
|
|
193a631708 | ||
|
|
a6764b9bf1 | ||
|
|
0f5dc152b8 | ||
|
|
8e1aae0fd6 | ||
|
|
084e5dbc4b | ||
|
|
dfbda986d7 | ||
|
|
248432b92d | ||
|
|
f738981ed5 | ||
|
|
4bb6ab3cd5 | ||
|
|
72e8219a65 | ||
|
|
7a955a09f4 | ||
|
|
b730a74a19 | ||
|
|
cc2b04ce1c | ||
|
|
4f8abaaf10 | ||
|
|
5043764247 | ||
|
|
9fd4d66438 | ||
|
|
aae48e3a9d | ||
|
|
ff57f52b72 | ||
|
|
7d84a4914f | ||
|
|
c2411e9c8c | ||
|
|
bf26a0eccc | ||
|
|
68a83eddd4 | ||
|
|
b999d49945 | ||
|
|
c94cb6dae9 | ||
|
|
5ea2b49f58 | ||
|
|
70deb70b76 | ||
|
|
48f37f9e0a | ||
|
|
6dff7c68f1 | ||
|
|
ec59dc026f | ||
|
|
c97abb1eea | ||
|
|
2fdafa9a49 | ||
|
|
f794f97d88 | ||
|
|
03ad8fa4d9 | ||
|
|
43fedfa8ba | ||
|
|
2f52618c4e | ||
|
|
a9e21170bc | ||
|
|
cb6cc3dfb6 | ||
|
|
66f2aac26f | ||
|
|
4a249752ff | ||
|
|
f0695e0edf | ||
|
|
07d4066847 | ||
|
|
57ba8a4d46 | ||
|
|
9e6c5f9f2c | ||
|
|
3639032d1e | ||
|
|
6f75ec8490 | ||
|
|
fd43d3709e | ||
|
|
6e177bf03f | ||
|
|
d3ac0bc149 | ||
|
|
afa276288c | ||
|
|
4832238708 | ||
|
|
1f8e3c13e6 | ||
|
|
5a401aef57 | ||
|
|
78ecf45527 | ||
|
|
3ae503a191 | ||
|
|
bafd48d96c | ||
|
|
cf7e4b027a | ||
|
|
15863c34a0 | ||
|
|
9875b0e0f8 | ||
|
|
2bdf44a25d | ||
|
|
4ffc881fb6 | ||
|
|
e92ae5199d | ||
|
|
a3a2bf890f | ||
|
|
a9194c4c68 | ||
|
|
ca32eb77f3 | ||
|
|
886441df98 | ||
|
|
e02ceca54b | ||
|
|
b3c35750c2 | ||
|
|
3e52fecd1e | ||
|
|
cccd7003ed | ||
|
|
038ea7c1d3 | ||
|
|
0b0cf58f24 | ||
|
|
7d1f372ba6 | ||
|
|
25e4ad19f6 | ||
|
|
7dfe8e726b | ||
|
|
61b101d442 | ||
|
|
cd1493b082 | ||
|
|
a98bff3ea1 | ||
|
|
06eb6e94e3 | ||
|
|
4a8801da34 | ||
|
|
b1e8be27a9 | ||
|
|
b922a3c952 | ||
|
|
b52826e7cc | ||
|
|
0ef72db7bf | ||
|
|
505d0f2288 | ||
|
|
6704b19db6 | ||
|
|
64b91da9cf | ||
|
|
fe9787e58d | ||
|
|
d06e571b31 | ||
|
|
208c15f29d | ||
|
|
a82dbb6e01 | ||
|
|
a42a99029f | ||
|
|
0c7b700895 | ||
|
|
1aa3ee2170 | ||
|
|
8c0d56d55a | ||
|
|
c41a0453c1 | ||
|
|
1a161a8333 | ||
|
|
9d8ae1b0c3 | ||
|
|
2de558057d | ||
|
|
0756caa42e | ||
|
|
99c1ddc792 | ||
|
|
69eef0a0ec | ||
|
|
42bd6447c0 | ||
|
|
747a8c628e | ||
|
|
023fec627e | ||
|
|
3a8bc309e2 | ||
|
|
3400727fff | ||
|
|
77742a3fba | ||
|
|
7cce55d8f0 | ||
|
|
933c195e51 | ||
|
|
d0898fd0c8 | ||
|
|
6765c19d45 | ||
|
|
599f5e3915 | ||
|
|
ba7204a7b7 | ||
|
|
e8ac0f293e | ||
|
|
a0d1161feb | ||
|
|
828b2680c0 | ||
|
|
c17cf022ea | ||
|
|
f6330ab8f1 | ||
|
|
6908826f95 | ||
|
|
fd542c71e3 | ||
|
|
9fb87f813b | ||
|
|
b0146b3d9a | ||
|
|
286587d151 | ||
|
|
6f751d5d26 | ||
|
|
4d7890c2c9 | ||
|
|
fdfaf23361 | ||
|
|
38597160f2 | ||
|
|
791c83aa7e | ||
|
|
29d957ed5e | ||
|
|
8d8b7c19b7 | ||
|
|
039ab48b7a | ||
|
|
8a64afabfd | ||
|
|
4a04bac250 | ||
|
|
72fc45aa6a | ||
|
|
9f2b05df1b | ||
|
|
83dc5ed4a7 | ||
|
|
e597ad8f0f | ||
|
|
3ea5446680 | ||
|
|
8b18e487bd | ||
|
|
c837d29eab | ||
|
|
ec1daef858 | ||
|
|
7d396bc2e7 | ||
|
|
8128df7655 | ||
|
|
cfaa7782b6 | ||
|
|
5e3f9d5175 | ||
|
|
cdc5d5b18d | ||
|
|
e98b1912b3 | ||
|
|
c8c0082413 | ||
|
|
1c1d079113 | ||
|
|
7523e4ad49 | ||
|
|
f4a5c9de50 | ||
|
|
1db9783bfc | ||
|
|
5b38134431 | ||
|
|
4c16038e72 | ||
|
|
2f7f50b8cb | ||
|
|
a1633055f7 | ||
|
|
35f6bb5060 | ||
|
|
28a3c939e7 | ||
|
|
7d9779fc67 | ||
|
|
9b8c91c90b | ||
|
|
47d4b46950 | ||
|
|
a649cb7db5 | ||
|
|
68c69b3717 | ||
|
|
ce4d3316d3 | ||
|
|
e6b79f0002 | ||
|
|
1a63eb46bb | ||
|
|
91c27148c0 | ||
|
|
1e7310e6cd | ||
|
|
b49a7d146d | ||
|
|
fbc8af40e3 | ||
|
|
709e720839 | ||
|
|
3cd9181ef8 | ||
|
|
81e4d3c6c3 | ||
|
|
958fc6ec49 | ||
|
|
19afcdc704 | ||
|
|
51d48bd953 | ||
|
|
26f15bcd77 | ||
|
|
412b8d2c80 | ||
|
|
617fedf349 | ||
|
|
59caa536ed | ||
|
|
3d5f7f64f8 | ||
|
|
66126cc32d | ||
|
|
31b30335f6 | ||
|
|
959866b848 | ||
|
|
cbab26673b | ||
|
|
1cf5e3f751 | ||
|
|
9a76ce8a65 | ||
|
|
574404e2ee | ||
|
|
20c0082ee5 | ||
|
|
9d92aeb182 | ||
|
|
2f5d7ae645 | ||
|
|
d2bc73bbbe | ||
|
|
697cad7027 | ||
|
|
472fb12273 | ||
|
|
d779308b3e | ||
|
|
a03f3287b3 | ||
|
|
a88cf317fd | ||
|
|
38662548c7 | ||
|
|
5973b778b1 | ||
|
|
ac655b3ff0 | ||
|
|
0b3cd33e55 | ||
|
|
d7a86eb029 | ||
|
|
757d830f4e | ||
|
|
e43d127eff | ||
|
|
9b8a814c3f | ||
|
|
8b4c0b94dc | ||
|
|
dbf6702371 | ||
|
|
491e970943 | ||
|
|
9a54c44742 | ||
|
|
9dfc3d61ee | ||
|
|
db0727e943 | ||
|
|
abd6a1427e | ||
|
|
0afac8f75a | ||
|
|
519dcdd0b2 | ||
|
|
112a619ec1 | ||
|
|
fff4590faf | ||
|
|
41395d981d | ||
|
|
b7d97ff3de | ||
|
|
bf07c37a53 | ||
|
|
2ab7ebc82b | ||
|
|
0ece042162 | ||
|
|
69a31b807a | ||
|
|
d75d29e2fe | ||
|
|
049f3f7907 | ||
|
|
e848137ded | ||
|
|
f8c1980fdf | ||
|
|
7d70082590 | ||
|
|
8472b5f224 | ||
|
|
6136dd490a | ||
|
|
3de82050ce | ||
|
|
f1ab30a490 | ||
|
|
cbe8747b59 | ||
|
|
eaa2b414b2 | ||
|
|
77a6a786b8 | ||
|
|
b63ebad49d | ||
|
|
42c20d7a69 | ||
|
|
63b526db52 | ||
|
|
514d274a45 | ||
|
|
6beafd14e0 | ||
|
|
b4d29970f4 | ||
|
|
586fdee89b | ||
|
|
178f768f7f | ||
|
|
316854c26f | ||
|
|
6532bfce34 | ||
|
|
e1e7dfa625 | ||
|
|
a3363def52 | ||
|
|
b4fef31d84 | ||
|
|
cfd6e7dea8 | ||
|
|
56f9b2d142 | ||
|
|
01025fa22b | ||
|
|
30013b4ff8 | ||
|
|
4731c7e502 | ||
|
|
e0b2f81885 | ||
|
|
0e1601b80d | ||
|
|
a6a38f6035 | ||
|
|
4e4a5142fb | ||
|
|
17c0b677e0 | ||
|
|
af23683311 | ||
|
|
451272b618 | ||
|
|
8f13c828f5 | ||
|
|
e6240f4039 | ||
|
|
4691558ee3 | ||
|
|
7fbd9b8de4 | ||
|
|
f243109524 | ||
|
|
13d0594b4c | ||
|
|
6bfcb286b1 | ||
|
|
1891537236 | ||
|
|
d7d527d154 | ||
|
|
995ee86a6e | ||
|
|
40a33b1d06 | ||
|
|
c9198dbbb8 | ||
|
|
b974e95ce4 | ||
|
|
99249ada01 | ||
|
|
a9909a0c18 | ||
|
|
2ce5d6c2b6 | ||
|
|
853e34087a | ||
|
|
be11d2b6ef | ||
|
|
b8187e5b82 | ||
|
|
4dcaec7938 | ||
|
|
c44bc6a719 | ||
|
|
6fba6b6e71 | ||
|
|
96cd275603 | ||
|
|
42b48bd55f | ||
|
|
8bb45dc0a6 | ||
|
|
8db90f5073 | ||
|
|
d5a113e5bf | ||
|
|
8e6758d205 | ||
|
|
163d04a5d2 | ||
|
|
b0d5bb1c4b | ||
|
|
f622e5996c | ||
|
|
77fbdd28e2 | ||
|
|
c9ad6d5496 | ||
|
|
e083e466b8 | ||
|
|
fe2f8d32aa | ||
|
|
45bda6e08d | ||
|
|
47478117d8 | ||
|
|
d7f2488099 | ||
|
|
3881bbd651 | ||
|
|
7b06041a7c | ||
|
|
3fc5387db7 | ||
|
|
fc1cfd287a | ||
|
|
54dc4395b9 | ||
|
|
1d457a0271 | ||
|
|
671c9495d9 | ||
|
|
d7b4a31e93 | ||
|
|
b7d8c2af1a | ||
|
|
1075c80e8a | ||
|
|
b611dc4b99 | ||
|
|
5f19ea5e45 | ||
|
|
e4abeef65c | ||
|
|
ac49eda053 | ||
|
|
1fa803d187 | ||
|
|
6d1ff8a525 | ||
|
|
59dc29a19a | ||
|
|
6db667b6b1 | ||
|
|
07da3fc216 | ||
|
|
c5835b896c | ||
|
|
345e8ca804 | ||
|
|
9202f0cf09 | ||
|
|
d10f9a6abc | ||
|
|
ec0c0b14ca | ||
|
|
6267f8c6c0 | ||
|
|
947a5b4ea3 | ||
|
|
e10b8d6f2a | ||
|
|
644bcbde91 | ||
|
|
6775a0a941 | ||
|
|
20c712f31b | ||
|
|
e6d51b54b6 | ||
|
|
c7482832b8 | ||
|
|
6fe6532673 | ||
|
|
8212da5d5d | ||
|
|
a7b5f92f51 | ||
|
|
6266b4f122 | ||
|
|
e4eb286483 | ||
|
|
331d2d835c | ||
|
|
5ce8682671 | ||
|
|
37e28d98ea | ||
|
|
097797bf9f | ||
|
|
4725be015d | ||
|
|
f7d465f990 | ||
|
|
c4966370e2 | ||
|
|
65c9b355c1 | ||
|
|
f2949c3fb1 | ||
|
|
ef53aebf9e | ||
|
|
4f96603e12 | ||
|
|
3232727ace | ||
|
|
2dfff15a9d | ||
|
|
3f1c4b41f6 | ||
|
|
b98f526b8a | ||
|
|
9dc5d378b1 | ||
|
|
b0b39543de | ||
|
|
721d21923e | ||
|
|
3f79e05585 | ||
|
|
4d7810424c | ||
|
|
2107a7d514 | ||
|
|
40b03519c1 | ||
|
|
d236dea13d | ||
|
|
ed88f7de96 | ||
|
|
07478a6700 | ||
|
|
48ff729477 | ||
|
|
7c60937806 | ||
|
|
ace304513f | ||
|
|
1917e577a2 | ||
|
|
9c9fce96c7 | ||
|
|
525130765a | ||
|
|
d890ef9e20 | ||
|
|
9f69d79430 | ||
|
|
9d66af6efc | ||
|
|
8f1729f7df | ||
|
|
4bef5e89c4 | ||
|
|
79222bf100 | ||
|
|
c3bfefca57 | ||
|
|
00fd394d23 | ||
|
|
e1e8d53df6 | ||
|
|
57a6dd472f | ||
|
|
224e33ed09 | ||
|
|
94680f5483 | ||
|
|
b4db88808f | ||
|
|
d9db48257b | ||
|
|
e1e1bced08 | ||
|
|
b56add9520 | ||
|
|
2abe24b9dd | ||
|
|
a35c32e30f | ||
|
|
781c39c708 | ||
|
|
ff9e539cc5 | ||
|
|
feb4816610 | ||
|
|
703b790939 | ||
|
|
811a5c3389 | ||
|
|
2736711d67 | ||
|
|
edb3b9c307 | ||
|
|
477fedccd4 | ||
|
|
5de28c74f9 | ||
|
|
44261ccdf1 | ||
|
|
c02b16e195 | ||
|
|
169df65df4 | ||
|
|
af1487bcfb | ||
|
|
5db12e9907 | ||
|
|
dff07b6f31 | ||
|
|
5dd8795a10 | ||
|
|
be503cb0f2 | ||
|
|
01e06b69a5 | ||
|
|
782e05de55 | ||
|
|
82a71b18f1 | ||
|
|
aeff09d724 | ||
|
|
a5c511576f | ||
|
|
ac10873e26 | ||
|
|
9689d38bef | ||
|
|
d06b2736aa | ||
|
|
a0f3fb44e7 | ||
|
|
d97f628703 | ||
|
|
fb7f27a7c9 | ||
|
|
7bfed4b29a | ||
|
|
a170b69d5d | ||
|
|
33e4ab65e9 | ||
|
|
201699288b | ||
|
|
e9202d85bd | ||
|
|
9a1ab5006f | ||
|
|
25c99273d3 | ||
|
|
7bcbb19569 | ||
|
|
b062af4c8c | ||
|
|
0956719726 | ||
|
|
766eaad4e7 | ||
|
|
3a74c33ba5 | ||
|
|
e4c3bf3d2c | ||
|
|
7196c36842 | ||
|
|
e151160560 | ||
|
|
dac63a227e | ||
|
|
986b52d849 | ||
|
|
45cc503bbd | ||
|
|
6aeb09b297 | ||
|
|
210c0ece54 | ||
|
|
ad84b5b8fa | ||
|
|
7101224d86 | ||
|
|
6be146d67f | ||
|
|
f706a42951 | ||
|
|
e24afd838a | ||
|
|
81c2b185ef | ||
|
|
0e064e415b | ||
|
|
4998ad7365 | ||
|
|
9a30d3d0df | ||
|
|
0b761ece4d | ||
|
|
01249c1d48 | ||
|
|
588564d74f | ||
|
|
6e192fa408 | ||
|
|
12ca3e054e | ||
|
|
62af533820 | ||
|
|
b56020ad3b | ||
|
|
6e160f4c59 | ||
|
|
07e77ad0ff | ||
|
|
b6380aceac | ||
|
|
79d3cb6a6c | ||
|
|
a4de6de700 | ||
|
|
a1d801c375 | ||
|
|
f66e93cd8d | ||
|
|
59a09cb1d0 | ||
|
|
c23c620d26 | ||
|
|
4798456df6 | ||
|
|
147fbb4285 | ||
|
|
a9ae9bdcab | ||
|
|
f7d8102b35 | ||
|
|
d0e9bc6a75 | ||
|
|
d863df8683 | ||
|
|
4834634766 | ||
|
|
a4c893dbe2 | ||
|
|
8833255ed3 | ||
|
|
fb5f9456e9 | ||
|
|
0dacfbbfca | ||
|
|
47aab78233 | ||
|
|
185b9f9792 | ||
|
|
21765bea2e | ||
|
|
36c7e9a962 | ||
|
|
cb2b2be54e | ||
|
|
1c152cc72a | ||
|
|
d67661eb39 | ||
|
|
ea97e1b5e2 | ||
|
|
dca3ccf5fd | ||
|
|
ef7b3ed8f5 | ||
|
|
4d305f5922 | ||
|
|
1e6f8f5b8c | ||
|
|
c967515da5 | ||
|
|
576022c64b | ||
|
|
eab9cfbec9 | ||
|
|
ab4801a82e | ||
|
|
8df4b318bc | ||
|
|
8a98e9ad98 | ||
|
|
eee5628569 | ||
|
|
ad3fd6ecbf | ||
|
|
622b8d05cf | ||
|
|
5faa0ab1be | ||
|
|
81312c2128 | ||
|
|
1808337adc | ||
|
|
5f091c46ce | ||
|
|
a96bfdb369 | ||
|
|
ad3ebb110b | ||
|
|
929105432c | ||
|
|
40fffc8fff | ||
|
|
2f76141813 | ||
|
|
932b22f043 | ||
|
|
ecf5a6a580 | ||
|
|
788acb08d4 | ||
|
|
ddb1d5ffe4 | ||
|
|
7ba29dbe41 | ||
|
|
3b070310f0 | ||
|
|
fbe085601b | ||
|
|
36f9b1ec91 | ||
|
|
7bcd99451f | ||
|
|
2535a3aa3a | ||
|
|
0894c25f2c | ||
|
|
7810fb9ce4 | ||
|
|
c127cf78c2 | ||
|
|
6fffa2a14d | ||
|
|
2b02d330fd | ||
|
|
c8f1682e07 | ||
|
|
f64e040896 | ||
|
|
339376ba67 | ||
|
|
7a1b77322b | ||
|
|
60b6ca5850 | ||
|
|
b8681d8031 | ||
|
|
f8139b05cb | ||
|
|
776c4eb965 | ||
|
|
2746aabcf1 | ||
|
|
04a06781f5 | ||
|
|
48dfc69ee6 | ||
|
|
4d213c2d06 | ||
|
|
361bfb6764 | ||
|
|
3f96eead4c | ||
|
|
8896587faf | ||
|
|
9fa3e2f387 | ||
|
|
e5c21ec666 | ||
|
|
e11da87a24 | ||
|
|
3dd54424c0 | ||
|
|
5d68493df4 | ||
|
|
d322eec3c3 | ||
|
|
221193eaa2 | ||
|
|
f7d24f60a2 | ||
|
|
e5a1a3129d | ||
|
|
39833d7cf0 | ||
|
|
ecb27817ca | ||
|
|
f59bfdd084 | ||
|
|
0ee1b99c5d | ||
|
|
a50711ad13 | ||
|
|
249f71a12b | ||
|
|
1d138fbe07 | ||
|
|
a0bf238b09 | ||
|
|
c49c6da803 | ||
|
|
37e6efe1f9 | ||
|
|
d4d7a84e11 | ||
|
|
fc7e8af55e | ||
|
|
3ec5dddb00 | ||
|
|
f47660f510 | ||
|
|
a8d6962ac2 | ||
|
|
23f75f598e | ||
|
|
e3b432cba8 | ||
|
|
557c57eb9d | ||
|
|
9d368deb05 | ||
|
|
8b99bf614c | ||
|
|
c4a3e2f6bd | ||
|
|
803f9bba27 | ||
|
|
d756efbf76 | ||
|
|
ace7fa8094 | ||
|
|
f02646e357 | ||
|
|
0a3a09aaf3 | ||
|
|
796be3282c | ||
|
|
468124fb9b | ||
|
|
3ad853630c | ||
|
|
b8708beeec | ||
|
|
8fb6c4f764 |
20
.gitignore
vendored
@@ -19,7 +19,9 @@
|
||||
**/*.dir/**
|
||||
**/CMakeFiles/**
|
||||
**/cmake_install.cmake
|
||||
**/install_manifest.txt
|
||||
**/CMakeCache.txt
|
||||
**/CMakeTestfile.cmake
|
||||
**/Debug/**
|
||||
**/Release/**
|
||||
build.xml
|
||||
@@ -29,20 +31,36 @@ proguard-project.txt
|
||||
linklint_results
|
||||
Makefile
|
||||
flatc
|
||||
flatc.exe
|
||||
flathash
|
||||
flathash.exe
|
||||
flattests
|
||||
flattests.exe
|
||||
flatsamplebinary
|
||||
flatsamplebinary.exe
|
||||
flatsampletext
|
||||
flatsampletext.exe
|
||||
grpctest
|
||||
grpctest.exe
|
||||
snapshot.sh
|
||||
tests/go_gen
|
||||
tests/monsterdata_java_wire.mon
|
||||
tests/monsterdata_go_wire.mon
|
||||
tests/monsterdata_javascript_wire.mon
|
||||
tests/unicode_test.mon
|
||||
CMakeLists.txt.user
|
||||
CMakeScripts/**
|
||||
CTestTestfile.cmake
|
||||
FlatBuffers.cbp
|
||||
build/Xcode/FlatBuffers.xcodeproj/project.xcworkspace/**
|
||||
build/Xcode/FlatBuffers.xcodeproj/xcuserdata/**
|
||||
FlatBuffers.xcodeproj/
|
||||
java/.idea
|
||||
java/*.iml
|
||||
java/target
|
||||
.idea
|
||||
*.iml
|
||||
target
|
||||
**/*.pyc
|
||||
build/VS2010/FlatBuffers.sdf
|
||||
build/VS2010/FlatBuffers.opensdf
|
||||
build/VS2010/ipch/**/*.ipch
|
||||
|
||||
31
.travis.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
language: cpp
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
#- clang
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- BUILD_TYPE=Debug BIICODE=false
|
||||
- BUILD_TYPE=Release BIICODE=false
|
||||
# biicode .deb files no longer available.
|
||||
# - BUILD_TYPE=Release BIICODE=true
|
||||
# - BUILD_TYPE=Debug BIICODE=true
|
||||
global:
|
||||
- GCC_VERSION="4.9"
|
||||
|
||||
before_install:
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq g++-$GCC_VERSION; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq gcc-$GCC_VERSION; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo ln -s -v -f $(which g++-$GCC_VERSION) /usr/bin/g++; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo ln -s -v -f $(which gcc-$GCC_VERSION) /usr/bin/gcc; fi
|
||||
|
||||
script:
|
||||
- if [ "$BIICODE" == "false" ]; then cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE . && make && make test; fi
|
||||
- if [ "$BIICODE" == "true" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then ./biicode/support/bii-travis.sh $BUILD_TYPE; fi
|
||||
148
CMake/BuildFlatBuffers.cmake
Normal file
@@ -0,0 +1,148 @@
|
||||
# Copyright 2015 Google Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# General function to create FlatBuffer build rules for the given list of
|
||||
# schemas.
|
||||
#
|
||||
# flatbuffers_schemas: A list of flatbuffer schema files to process.
|
||||
#
|
||||
# schema_include_dirs: A list of schema file include directories, which will be
|
||||
# passed to flatc via the -I parameter.
|
||||
#
|
||||
# custom_target_name: The generated files will be added as dependencies for a
|
||||
# new custom target with this name. You should add that target as a dependency
|
||||
# for your main target to ensure these files are built. You can also retrieve
|
||||
# various properties from this target, such as GENERATED_INCLUDES_DIR,
|
||||
# BINARY_SCHEMAS_DIR, and COPY_TEXT_SCHEMAS_DIR.
|
||||
#
|
||||
# additional_dependencies: A list of additional dependencies that you'd like
|
||||
# all generated files to depend on. Pass in a blank string if you have none.
|
||||
#
|
||||
# generated_includes_dir: Where to generate the C++ header files for these
|
||||
# schemas. The generated includes directory will automatically be added to
|
||||
# CMake's include directories, and will be where generated header files are
|
||||
# placed. This parameter is optional; pass in empty string if you don't want to
|
||||
# generate include files for these schemas.
|
||||
#
|
||||
# binary_schemas_dir: If you specify an optional binary schema directory, binary
|
||||
# schemas will be generated for these schemas as well, and placed into the given
|
||||
# directory.
|
||||
#
|
||||
# copy_text_schemas_dir: If you want all text schemas (including schemas from
|
||||
# all schema include directories) copied into a directory (for example, if you
|
||||
# need them within your project to build JSON files), you can specify that
|
||||
# folder here. All text schemas will be copied to that folder.
|
||||
#
|
||||
# IMPORTANT: Make sure you quote all list arguments you pass to this function!
|
||||
# Otherwise CMake will only pass in the first element.
|
||||
# Example: build_flatbuffers("${fb_files}" "${include_dirs}" target_name ...)
|
||||
function(build_flatbuffers flatbuffers_schemas
|
||||
schema_include_dirs
|
||||
custom_target_name
|
||||
additional_dependencies
|
||||
generated_includes_dir
|
||||
binary_schemas_dir
|
||||
copy_text_schemas_dir)
|
||||
|
||||
# Test if including from FindFlatBuffers
|
||||
if(FLATBUFFERS_FLATC_EXECUTABLE)
|
||||
set(FLATC_TARGET "")
|
||||
set(FLATC ${FLATBUFFERS_FLATC_EXECUTABLE})
|
||||
else()
|
||||
set(FLATC_TARGET flatc)
|
||||
set(FLATC flatc)
|
||||
endif()
|
||||
set(FLATC_SCHEMA_ARGS --gen-mutable)
|
||||
if(FLATBUFFERS_FLATC_SCHEMA_EXTRA_ARGS)
|
||||
set(FLATC_SCHEMA_ARGS
|
||||
${FLATBUFFERS_FLATC_SCHEMA_EXTRA_ARGS}
|
||||
${FLATC_SCHEMA_ARGS}
|
||||
)
|
||||
endif()
|
||||
|
||||
set(schema_glob "*.fbs")
|
||||
# Generate the include files parameters.
|
||||
set(include_params "")
|
||||
set(all_generated_files "")
|
||||
foreach (include_dir ${schema_include_dirs})
|
||||
set(include_params -I ${include_dir} ${include_params})
|
||||
if (NOT ${copy_text_schemas_dir} STREQUAL "")
|
||||
# Copy text schemas from dependent folders.
|
||||
file(GLOB_RECURSE dependent_schemas ${include_dir}/${schema_glob})
|
||||
foreach (dependent_schema ${dependent_schemas})
|
||||
file(COPY ${dependent_schema} DESTINATION ${copy_text_schemas_dir})
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach(schema ${flatbuffers_schemas})
|
||||
get_filename_component(filename ${schema} NAME_WE)
|
||||
# For each schema, do the things we requested.
|
||||
if (NOT ${generated_includes_dir} STREQUAL "")
|
||||
set(generated_include ${generated_includes_dir}/${filename}_generated.h)
|
||||
add_custom_command(
|
||||
OUTPUT ${generated_include}
|
||||
COMMAND ${FLATC} ${FLATC_SCHEMA_ARGS}
|
||||
-o ${generated_includes_dir}
|
||||
${include_params}
|
||||
-c ${schema}
|
||||
DEPENDS ${FLATC_TARGET} ${schema} ${additional_dependencies})
|
||||
list(APPEND all_generated_files ${generated_include})
|
||||
endif()
|
||||
|
||||
if (NOT ${binary_schemas_dir} STREQUAL "")
|
||||
set(binary_schema ${binary_schemas_dir}/${filename}.bfbs)
|
||||
add_custom_command(
|
||||
OUTPUT ${binary_schema}
|
||||
COMMAND ${FLATC} -b --schema
|
||||
-o ${binary_schemas_dir}
|
||||
${include_params}
|
||||
${schema}
|
||||
DEPENDS ${FLATC_TARGET} ${schema} ${additional_dependencies})
|
||||
list(APPEND all_generated_files ${binary_schema})
|
||||
endif()
|
||||
|
||||
if (NOT ${copy_text_schemas_dir} STREQUAL "")
|
||||
file(COPY ${schema} DESTINATION ${copy_text_schemas_dir})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Create a custom target that depends on all the generated files.
|
||||
# This is the target that you can depend on to trigger all these
|
||||
# to be built.
|
||||
add_custom_target(${custom_target_name}
|
||||
DEPENDS ${all_generated_files} ${additional_dependencies})
|
||||
|
||||
# Register the include directory we are using.
|
||||
if (NOT ${generated_includes_dir} STREQUAL "")
|
||||
include_directories(${generated_includes_dir})
|
||||
set_property(TARGET ${custom_target_name}
|
||||
PROPERTY GENERATED_INCLUDES_DIR
|
||||
${generated_includes_dir})
|
||||
endif()
|
||||
|
||||
# Register the binary schemas dir we are using.
|
||||
if (NOT ${binary_schemas_dir} STREQUAL "")
|
||||
set_property(TARGET ${custom_target_name}
|
||||
PROPERTY BINARY_SCHEMAS_DIR
|
||||
${binary_schemas_dir})
|
||||
endif()
|
||||
|
||||
# Register the text schema copy dir we are using.
|
||||
if (NOT ${copy_text_schemas_dir} STREQUAL "")
|
||||
set_property(TARGET ${custom_target_name}
|
||||
PROPERTY COPY_TEXT_SCHEMAS_DIR
|
||||
${copy_text_schemas_dir})
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -24,6 +24,8 @@
|
||||
# for the given flatbuffer schema files.
|
||||
# Returns the header files in ${Name}_OUTPUTS
|
||||
|
||||
set(FLATBUFFERS_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
find_program(FLATBUFFERS_FLATC_EXECUTABLE NAMES flatc)
|
||||
find_path(FLATBUFFERS_INCLUDE_DIR NAMES flatbuffers/flatbuffers.h)
|
||||
|
||||
@@ -54,3 +56,5 @@ if(FLATBUFFERS_FOUND)
|
||||
else()
|
||||
set(FLATBUFFERS_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
include("${FLATBUFFERS_CMAKE_DIR}/BuildFlatBuffers.cmake")
|
||||
125
CMakeLists.txt
@@ -6,8 +6,12 @@ project(FlatBuffers)
|
||||
option(FLATBUFFERS_CODE_COVERAGE "Enable the code coverage build option." OFF)
|
||||
option(FLATBUFFERS_BUILD_TESTS "Enable the build of tests and samples." ON)
|
||||
option(FLATBUFFERS_INSTALL "Enable the installation of targets." ON)
|
||||
option(FLATBUFFERS_BUILD_FLATC "Enable the build of the flatbuffers compiler" ON)
|
||||
option(FLATBUFFERS_BUILD_FLATLIB "Enable the build of the flatbuffers library"
|
||||
ON)
|
||||
option(FLATBUFFERS_BUILD_FLATC "Enable the build of the flatbuffers compiler"
|
||||
ON)
|
||||
option(FLATBUFFERS_BUILD_FLATHASH "Enable the build of flathash" ON)
|
||||
option(FLATBUFFERS_BUILD_GRPCTEST "Enable the build of grpctest" OFF)
|
||||
|
||||
if(NOT FLATBUFFERS_BUILD_FLATC AND FLATBUFFERS_BUILD_TESTS)
|
||||
message(WARNING
|
||||
@@ -15,18 +19,33 @@ if(NOT FLATBUFFERS_BUILD_FLATC AND FLATBUFFERS_BUILD_TESTS)
|
||||
set(FLATBUFFERS_BUILD_TESTS OFF)
|
||||
endif()
|
||||
|
||||
set(FlatBuffers_Compiler_SRCS
|
||||
set(FlatBuffers_Library_SRCS
|
||||
include/flatbuffers/code_generators.h
|
||||
include/flatbuffers/flatbuffers.h
|
||||
include/flatbuffers/hash.h
|
||||
include/flatbuffers/idl.h
|
||||
include/flatbuffers/util.h
|
||||
include/flatbuffers/reflection.h
|
||||
include/flatbuffers/reflection_generated.h
|
||||
src/idl_parser.cpp
|
||||
src/idl_gen_text.cpp
|
||||
src/reflection.cpp
|
||||
src/util.cpp
|
||||
)
|
||||
|
||||
set(FlatBuffers_Compiler_SRCS
|
||||
${FlatBuffers_Library_SRCS}
|
||||
src/idl_gen_cpp.cpp
|
||||
src/idl_gen_general.cpp
|
||||
src/idl_gen_go.cpp
|
||||
src/idl_gen_text.cpp
|
||||
src/idl_gen_js.cpp
|
||||
src/idl_gen_php.cpp
|
||||
src/idl_gen_python.cpp
|
||||
src/idl_gen_fbs.cpp
|
||||
src/idl_gen_grpc.cpp
|
||||
src/flatc.cpp
|
||||
grpc/src/compiler/cpp_generator.h
|
||||
grpc/src/compiler/cpp_generator.cc
|
||||
)
|
||||
|
||||
set(FlatHash_SRCS
|
||||
@@ -35,13 +54,9 @@ set(FlatHash_SRCS
|
||||
)
|
||||
|
||||
set(FlatBuffers_Tests_SRCS
|
||||
include/flatbuffers/flatbuffers.h
|
||||
include/flatbuffers/hash.h
|
||||
include/flatbuffers/idl.h
|
||||
include/flatbuffers/util.h
|
||||
src/idl_parser.cpp
|
||||
src/idl_gen_text.cpp
|
||||
${FlatBuffers_Library_SRCS}
|
||||
src/idl_gen_fbs.cpp
|
||||
src/idl_gen_general.cpp
|
||||
tests/test.cpp
|
||||
# file generate by running compiler on tests/monster_test.fbs
|
||||
${CMAKE_CURRENT_BINARY_DIR}/tests/monster_test_generated.h
|
||||
@@ -61,20 +76,62 @@ set(FlatBuffers_Sample_Text_SRCS
|
||||
include/flatbuffers/util.h
|
||||
src/idl_parser.cpp
|
||||
src/idl_gen_text.cpp
|
||||
src/util.cpp
|
||||
samples/sample_text.cpp
|
||||
# file generated by running compiler on samples/monster.fbs
|
||||
${CMAKE_CURRENT_BINARY_DIR}/samples/monster_generated.h
|
||||
)
|
||||
|
||||
set(FlatBuffers_GRPCTest_SRCS
|
||||
include/flatbuffers/flatbuffers.h
|
||||
include/flatbuffers/grpc.h
|
||||
tests/monster_test.grpc.fb.h
|
||||
tests/monster_test.grpc.fb.cc
|
||||
grpc/tests/grpctest.cpp
|
||||
# file generated by running compiler on samples/monster.fbs
|
||||
${CMAKE_CURRENT_BINARY_DIR}/samples/monster_generated.h
|
||||
)
|
||||
|
||||
# source_group(Compiler FILES ${FlatBuffers_Compiler_SRCS})
|
||||
# source_group(Tests FILES ${FlatBuffers_Tests_SRCS})
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror -Wextra")
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
if(CYGWIN)
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -std=gnu++11")
|
||||
else(CYGWIN)
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||
endif(CYGWIN)
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++ -Wall -pedantic -Werror -Wextra")
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
"${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror -Wextra -Werror=shadow")
|
||||
if (GCC_VERSION VERSION_GREATER 4.4)
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -Wunused-result -Werror=unused-result")
|
||||
endif()
|
||||
|
||||
# Certain platforms such as ARM do not use signed chars by default
|
||||
# which causes issues with certain bounds checks.
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -std=c++0x -Wall -pedantic -Werror -Wextra")
|
||||
"${CMAKE_CXX_FLAGS} -fsigned-char")
|
||||
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -std=c++0x -stdlib=libc++ -Wall -pedantic -Werror \
|
||||
-Wextra")
|
||||
if(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
|
||||
set(CMAKE_EXE_LINKER_FLAGS
|
||||
"${CMAKE_EXE_LINKER_FLAGS} -lc++abi")
|
||||
endif()
|
||||
|
||||
# Certain platforms such as ARM do not use signed chars by default
|
||||
# which causes issues with certain bounds checks.
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -fsigned-char")
|
||||
|
||||
endif()
|
||||
|
||||
if(FLATBUFFERS_CODE_COVERAGE)
|
||||
@@ -84,18 +141,25 @@ if(FLATBUFFERS_CODE_COVERAGE)
|
||||
endif()
|
||||
|
||||
if(BIICODE)
|
||||
# Execute biicode building
|
||||
include(CMake/biicode.cmake)
|
||||
include(biicode/cmake/biicode.cmake)
|
||||
return()
|
||||
endif(BIICODE)
|
||||
endif()
|
||||
|
||||
include_directories(include)
|
||||
include_directories(grpc)
|
||||
|
||||
if(FLATBUFFERS_BUILD_FLATC)
|
||||
add_executable(flatc ${FlatBuffers_Compiler_SRCS})
|
||||
if(FLATBUFFERS_BUILD_FLATLIB)
|
||||
add_library(flatbuffers STATIC ${FlatBuffers_Library_SRCS})
|
||||
endif()
|
||||
|
||||
if(FLATBUFFERS_BUILD_FLATC)
|
||||
add_executable(flatc ${FlatBuffers_Compiler_SRCS})
|
||||
if(NOT FLATBUFFERS_FLATC_EXECUTABLE)
|
||||
set(FLATBUFFERS_FLATC_EXECUTABLE $<TARGET_FILE:flatc>)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(FLATBUFFERS_BUILD_FLATHASH)
|
||||
add_executable(flathash ${FlatHash_SRCS})
|
||||
endif()
|
||||
|
||||
@@ -104,7 +168,19 @@ function(compile_flatbuffers_schema_to_cpp SRC_FBS)
|
||||
string(REGEX REPLACE "\\.fbs$" "_generated.h" GEN_HEADER ${SRC_FBS})
|
||||
add_custom_command(
|
||||
OUTPUT ${GEN_HEADER}
|
||||
COMMAND flatc -c -o "${SRC_FBS_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FBS}"
|
||||
COMMAND "${FLATBUFFERS_FLATC_EXECUTABLE}" -c --no-includes --gen-mutable
|
||||
--gen-object-api -o "${SRC_FBS_DIR}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FBS}"
|
||||
DEPENDS flatc)
|
||||
endfunction()
|
||||
|
||||
function(compile_flatbuffers_schema_to_binary SRC_FBS)
|
||||
get_filename_component(SRC_FBS_DIR ${SRC_FBS} PATH)
|
||||
string(REGEX REPLACE "\\.fbs$" ".bfbs" GEN_BINARY_SCHEMA ${SRC_FBS})
|
||||
add_custom_command(
|
||||
OUTPUT ${GEN_BINARY_SCHEMA}
|
||||
COMMAND "${FLATBUFFERS_FLATC_EXECUTABLE}" -b --schema -o "${SRC_FBS_DIR}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FBS}"
|
||||
DEPENDS flatc)
|
||||
endfunction()
|
||||
|
||||
@@ -119,8 +195,19 @@ if(FLATBUFFERS_BUILD_TESTS)
|
||||
add_executable(flatsampletext ${FlatBuffers_Sample_Text_SRCS})
|
||||
endif()
|
||||
|
||||
if(FLATBUFFERS_BUILD_GRPCTEST)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter")
|
||||
endif()
|
||||
add_executable(grpctest ${FlatBuffers_GRPCTest_SRCS})
|
||||
target_link_libraries(grpctest grpc++_unsecure grpc pthread dl)
|
||||
endif()
|
||||
|
||||
if(FLATBUFFERS_INSTALL)
|
||||
install(DIRECTORY include/flatbuffers DESTINATION include)
|
||||
if(FLATBUFFERS_BUILD_FLATLIB)
|
||||
install(TARGETS flatbuffers DESTINATION lib)
|
||||
endif()
|
||||
if(FLATBUFFERS_BUILD_FLATC)
|
||||
install(TARGETS flatc DESTINATION bin)
|
||||
endif()
|
||||
@@ -133,3 +220,5 @@ if(FLATBUFFERS_BUILD_TESTS)
|
||||
"${CMAKE_CURRENT_BINARY_DIR}")
|
||||
add_test(NAME flattests COMMAND flattests)
|
||||
endif()
|
||||
|
||||
include(CMake/BuildFlatBuffers.cmake)
|
||||
|
||||
0
LICENSE.txt
Executable file → Normal file
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash -eu
|
||||
#
|
||||
# Copyright (c) 2013 Google, Inc.
|
||||
#
|
||||
# This software is provided 'as-is', without any express or implied
|
||||
|
||||
@@ -14,29 +14,42 @@
|
||||
# misrepresented as being the original software.
|
||||
# 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
LOCAL_PATH := $(call my-dir)/../..
|
||||
|
||||
# Empty static library so that other projects can include FlatBuffers as a
|
||||
# module.
|
||||
include $(LOCAL_PATH)/android/jni/include.mk
|
||||
LOCAL_PATH := $(call realpath-portable,$(LOCAL_PATH))
|
||||
|
||||
# Empty static library so that other projects can include just the basic
|
||||
# FlatBuffers headers as a module.
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := flatbuffers
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../include
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
LOCAL_EXPORT_CPPFLAGS := -std=c++11 -fexceptions -Wall -Wno-literal-suffix
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
# static library that additionally includes text parsing/generation/reflection
|
||||
# for projects that want richer functionality.
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := flatbuffers_extra
|
||||
LOCAL_SRC_FILES := src/idl_parser.cpp \
|
||||
src/idl_gen_text.cpp \
|
||||
src/reflection.cpp \
|
||||
src/util.cpp
|
||||
LOCAL_STATIC_LIBRARIES := flatbuffers
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
# FlatBuffers test
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := FlatBufferTest
|
||||
LOCAL_SRC_FILES := main.cpp \
|
||||
../../tests/test.cpp \
|
||||
../../src/idl_parser.cpp \
|
||||
../../src/idl_gen_text.cpp \
|
||||
../../src/idl_gen_fbs.cpp
|
||||
LOCAL_SRC_FILES := android/jni/main.cpp \
|
||||
tests/test.cpp \
|
||||
src/idl_gen_fbs.cpp \
|
||||
src/idl_gen_general.cpp
|
||||
LOCAL_LDLIBS := -llog -landroid
|
||||
LOCAL_STATIC_LIBRARIES := android_native_app_glue flatbuffers
|
||||
LOCAL_STATIC_LIBRARIES := android_native_app_glue flatbuffers_extra
|
||||
LOCAL_ARM_MODE := arm
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
$(call import-module,android/native_app_glue)
|
||||
|
||||
$(call import-add-path,../..)
|
||||
$(call import-add-path,$(LOCAL_PATH)/../..)
|
||||
|
||||
@@ -18,5 +18,5 @@ APP_PROJECT_PATH := $(call my-dir)/..
|
||||
APP_STL := gnustl_static
|
||||
|
||||
APP_ABI := armeabi-v7a
|
||||
NDK_TOOLCHAIN_VERSION := 4.8
|
||||
|
||||
APP_CPPFLAGS += -std=c++11
|
||||
|
||||
68
android/jni/build_flatc.bat
Executable file
@@ -0,0 +1,68 @@
|
||||
@rem Copyright (c) 2013 Google, Inc.
|
||||
@rem
|
||||
@rem This software is provided 'as-is', without any express or implied
|
||||
@rem warranty. In no event will the authors be held liable for any damages
|
||||
@rem arising from the use of this software.
|
||||
@rem Permission is granted to anyone to use this software for any purpose,
|
||||
@rem including commercial applications, and to alter it and redistribute it
|
||||
@rem freely, subject to the following restrictions:
|
||||
@rem 1. The origin of this software must not be misrepresented; you must not
|
||||
@rem claim that you wrote the original software. If you use this software
|
||||
@rem in a product, an acknowledgment in the product documentation would be
|
||||
@rem appreciated but is not required.
|
||||
@rem 2. Altered source versions must be plainly marked as such, and must not be
|
||||
@rem misrepresented as being the original software.
|
||||
@rem 3. This notice may not be removed or altered from any source distribution.
|
||||
@echo off
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
set thispath=%~dp0
|
||||
|
||||
rem Path to cmake passed in by caller.
|
||||
set cmake=%1
|
||||
rem Path to cmake project to build.
|
||||
set cmake_project_path=%2
|
||||
|
||||
rem Newest and oldest version of Visual Studio that it's possible to select.
|
||||
set visual_studio_version_max=20
|
||||
set visual_studio_version_min=8
|
||||
|
||||
rem Determine the newest version of Visual Studio installed on this machine.
|
||||
set visual_studio_version=
|
||||
for /L %%a in (%visual_studio_version_max%,-1,%visual_studio_version_min%) do (
|
||||
echo Searching for Visual Studio %%a >&2
|
||||
reg query HKLM\SOFTWARE\Microsoft\VisualStudio\%%a.0 /ve 1>NUL 2>NUL
|
||||
if !ERRORLEVEL! EQU 0 (
|
||||
set visual_studio_version=%%a
|
||||
goto found_vs
|
||||
)
|
||||
)
|
||||
echo Unable to determine whether Visual Studio is installed. >&2
|
||||
exit /B 1
|
||||
:found_vs
|
||||
|
||||
rem Map Visual Studio version to cmake generator name.
|
||||
if "%visual_studio_version%"=="8" (
|
||||
set cmake_generator=Visual Studio 8 2005
|
||||
)
|
||||
if "%visual_studio_version%"=="9" (
|
||||
set cmake_generator=Visual Studio 9 2008
|
||||
)
|
||||
if %visual_studio_version% GEQ 10 (
|
||||
set cmake_generator=Visual Studio %visual_studio_version%
|
||||
)
|
||||
rem Set visual studio version variable for msbuild.
|
||||
set VisualStudioVersion=%visual_studio_version%.0
|
||||
|
||||
rem Generate Visual Studio solution.
|
||||
echo Generating solution for %cmake_generator%. >&2
|
||||
cd "%cmake_project_path%"
|
||||
%cmake% -G"%cmake_generator%"
|
||||
if %ERRORLEVEL% NEQ 0 (
|
||||
exit /B %ERRORLEVEL%
|
||||
)
|
||||
|
||||
rem Build flatc
|
||||
python %thispath%\msbuild.py flatc.vcxproj
|
||||
if ERRORLEVEL 1 exit /B 1
|
||||
@@ -37,6 +37,10 @@
|
||||
ifeq (,$(FLATBUFFERS_INCLUDE_MK_))
|
||||
FLATBUFFERS_INCLUDE_MK_ := 1
|
||||
|
||||
# Portable version of $(realpath) that omits drive letters on Windows.
|
||||
realpath-portable = $(join $(filter %:,$(subst :,: ,$1)),\
|
||||
$(realpath $(filter-out %:,$(subst :,: ,$1))))
|
||||
|
||||
PROJECT_OS := $(OS)
|
||||
ifeq (,$(OS))
|
||||
PROJECT_OS := $(shell uname -s)
|
||||
@@ -50,24 +54,31 @@ endif
|
||||
# rebuilt from flatbuffers schemas.
|
||||
|
||||
FLATBUFFERS_CMAKELISTS_DIR := \
|
||||
$(realpath $(dir $(lastword $(MAKEFILE_LIST)))/../..)
|
||||
$(call realpath-portable,$(dir $(lastword $(MAKEFILE_LIST)))/../..)
|
||||
|
||||
# Directory that contains the FlatBuffers compiler.
|
||||
ifeq (Windows,$(PROJECT_OS))
|
||||
FLATBUFFERS_FLATC_PATH?=$(CURDIR)/bin
|
||||
FLATBUFFERS_FLATC := $(FLATBUFFERS_FLATC_PATH)/Debug/flatc.exe
|
||||
FLATBUFFERS_FLATC_PATH?=$(FLATBUFFERS_CMAKELISTS_DIR)
|
||||
FLATBUFFERS_FLATC := $(lastword \
|
||||
$(wildcard $(FLATBUFFERS_FLATC_PATH)/*/flatc.exe) \
|
||||
$(wildcard $(FLATBUFFERS_FLATC_PATH)/flatc.exe))
|
||||
endif
|
||||
ifeq (Linux,$(PROJECT_OS))
|
||||
FLATBUFFERS_FLATC_PATH?=$(CURDIR)/bin
|
||||
FLATBUFFERS_FLATC_PATH?=$(FLATBUFFERS_CMAKELISTS_DIR)
|
||||
FLATBUFFERS_FLATC := $(FLATBUFFERS_FLATC_PATH)/flatc
|
||||
endif
|
||||
ifeq (Darwin,$(PROJECT_OS))
|
||||
FLATBUFFERS_FLATC_PATH?=$(FLATBUFFERS_CMAKELISTS_DIR)
|
||||
FLATBUFFERS_FLATC := $(FLATBUFFERS_FLATC_PATH)/Debug/flatc
|
||||
FLATBUFFERS_FLATC := $(lastword \
|
||||
$(wildcard $(FLATBUFFERS_FLATC_PATH)/*/flatc) \
|
||||
$(wildcard $(FLATBUFFERS_FLATC_PATH)/flatc))
|
||||
endif
|
||||
|
||||
FLATBUFFERS_FLATC_ARGS?=
|
||||
|
||||
# Search for cmake.
|
||||
CMAKE_ROOT := $(realpath $(LOCAL_PATH)/../../../../../../prebuilts/cmake)
|
||||
CMAKE_ROOT := \
|
||||
$(call realpath-portable,$(LOCAL_PATH)/../../../../../../prebuilts/cmake)
|
||||
ifeq (,$(CMAKE))
|
||||
ifeq (Linux,$(PROJECT_OS))
|
||||
CMAKE := $(wildcard $(CMAKE_ROOT)/linux-x86/current/bin/cmake*)
|
||||
@@ -84,16 +95,26 @@ ifeq (,$(CMAKE))
|
||||
CMAKE := cmake
|
||||
endif
|
||||
|
||||
# Windows friendly portable local path.
|
||||
# GNU-make doesn't like : in paths, must use relative paths on Windows.
|
||||
ifeq (Windows,$(PROJECT_OS))
|
||||
PORTABLE_LOCAL_PATH =
|
||||
else
|
||||
PORTABLE_LOCAL_PATH = $(LOCAL_PATH)/
|
||||
endif
|
||||
|
||||
# Generate a host build rule for the flatbuffers compiler.
|
||||
ifeq (Windows,$(PROJECT_OS))
|
||||
define build_flatc_recipe
|
||||
cd & jni\build_flatc.bat $(CMAKE)
|
||||
$(FLATBUFFERS_CMAKELISTS_DIR)\android\jni\build_flatc.bat \
|
||||
$(CMAKE) $(FLATBUFFERS_CMAKELISTS_DIR)
|
||||
endef
|
||||
endif
|
||||
ifeq (Linux,$(PROJECT_OS))
|
||||
define build_flatc_recipe
|
||||
mkdir -p bin && cd bin && $(CMAKE) $(FLATBUFFERS_CMAKELISTS_DIR) \
|
||||
&& $(MAKE) flatc
|
||||
+cd $(FLATBUFFERS_CMAKELISTS_DIR) && \
|
||||
$(CMAKE) . && \
|
||||
$(MAKE) flatc
|
||||
endef
|
||||
endif
|
||||
ifeq (Darwin,$(PROJECT_OS))
|
||||
@@ -112,6 +133,9 @@ endif
|
||||
ifeq ($(strip $(FLATBUFFERS_FLATC)),)
|
||||
flatc_target := build_flatc
|
||||
.PHONY: $(flatc_target)
|
||||
FLATBUFFERS_FLATC := \
|
||||
python $(FLATBUFFERS_CMAKELISTS_DIR)/android/jni/run_flatc.py \
|
||||
$(FLATBUFFERS_CMAKELISTS_DIR)
|
||||
else
|
||||
flatc_target := $(FLATBUFFERS_FLATC)
|
||||
endif
|
||||
@@ -148,13 +172,33 @@ define flatbuffers_header_build_rule
|
||||
$(eval \
|
||||
$(call flatbuffers_fbs_to_h,$(2),$(3),$(1)): $(1) $(flatc_target)
|
||||
$(call host-echo-build-step,generic,Generate) \
|
||||
$(subst $(LOCAL_PATH)/,,$(call flatbuffers_fbs_to_h,$(2),$(3),$(1)))
|
||||
$(hide) $$(FLATBUFFERS_FLATC) --gen-includes \
|
||||
$(foreach include,$(4),-I $(include)) -o $$(dir $$@) -c $$<)
|
||||
$(subst $(LOCAL_PATH)/,,$(call flatbuffers_fbs_to_h,$(2),$(3),$(1)))
|
||||
$(hide) $$(FLATBUFFERS_FLATC) $(FLATBUFFERS_FLATC_ARGS) \
|
||||
$(foreach include,$(4),-I $(include)) -o $$(dir $$@) -c $$<)
|
||||
endef
|
||||
|
||||
# TODO: Remove when the LOCAL_PATH expansion bug in the NDK is fixed.
|
||||
# Override the default behavior of local-source-file-path to workaround
|
||||
# a bug which prevents the build of deeply nested projects when NDK_OUT is
|
||||
# set.
|
||||
local-source-file-path=\
|
||||
$(if $(call host-path-is-absolute,$1),$1,$(call \
|
||||
realpath-portable,$(LOCAL_PATH)/$1))
|
||||
|
||||
|
||||
# $(flatbuffers_header_build_rules schema_files,schema_dir,output_dir,\
|
||||
# schema_include_dirs,src_files))
|
||||
# schema_include_dirs,src_files,[build_target],[dependencies]))
|
||||
#
|
||||
# $(1) schema_files: Space separated list of flatbuffer schema files.
|
||||
# $(2) schema_dir: Directory containing the flatbuffer schemas.
|
||||
# $(3) output_dir: Where to place the generated files.
|
||||
# $(4) schema_include_dirs: Directories to include when generating schemas.
|
||||
# $(5) src_files: Files that should depend upon the headers generated from the
|
||||
# flatbuffer schemas.
|
||||
# $(6) build_target: Name of a build target that depends upon all generated
|
||||
# headers.
|
||||
# $(7) dependencies: Space seperated list of additional build targets src_files
|
||||
# should depend upon.
|
||||
#
|
||||
# Use this in your own Android.mk file to generate build rules that will
|
||||
# generate header files for your flatbuffer schemas as well as automatically
|
||||
@@ -163,15 +207,31 @@ endef
|
||||
# $(call flatbuffers_header_build_rules,$(MY_PROJ_SCHEMA_FILES),\
|
||||
# $(MY_PROJ_SCHEMA_DIR),$(MY_PROJ_GENERATED_OUTPUT_DIR),
|
||||
# $(MY_PROJ_SCHEMA_INCLUDE_DIRS),$(LOCAL_SRC_FILES))
|
||||
#
|
||||
# NOTE: Due problesm with path processing in ndk-build when presented with
|
||||
# deeply nested projects must redefine LOCAL_PATH after include this makefile
|
||||
# using:
|
||||
#
|
||||
# LOCAL_PATH := $(call realpath-portable,$(LOCAL_PATH))
|
||||
#
|
||||
define flatbuffers_header_build_rules
|
||||
$(foreach schema,$(1),\
|
||||
$(call flatbuffers_header_build_rule,\
|
||||
$(schema),$(strip $(2)),$(strip $(3)),$(strip $(4))))\
|
||||
$(schema),$(strip $(2)),$(strip $(3)),$(strip $(4))))\
|
||||
$(foreach src,$(strip $(5)),\
|
||||
$(eval $(LOCAL_PATH)/$$(src): \
|
||||
$(foreach schema,$(strip $(1)),\
|
||||
$(call flatbuffers_fbs_to_h,$(strip $(2)),$(strip $(3)),$(schema)))))
|
||||
$(eval $(call local-source-file-path,$(src)): \
|
||||
$(foreach schema,$(strip $(1)),\
|
||||
$(call flatbuffers_fbs_to_h,$(strip $(2)),$(strip $(3)),$(schema)))))\
|
||||
$(if $(6),\
|
||||
$(foreach schema,$(strip $(1)),\
|
||||
$(eval $(6): \
|
||||
$(call flatbuffers_fbs_to_h,$(strip $(2)),$(strip $(3)),$(schema)))),)\
|
||||
$(if $(7),\
|
||||
$(foreach src,$(strip $(5)),\
|
||||
$(eval $(call local-source-file-path,$(src)): $(strip $(7)))),)\
|
||||
$(if $(7),\
|
||||
$(foreach dependency,$(strip $(7)),\
|
||||
$(eval $(6): $(dependency))),)
|
||||
endef
|
||||
|
||||
endif # FLATBUFFERS_INCLUDE_MK_
|
||||
|
||||
|
||||
0
android/jni/main.cpp
Executable file → Normal file
77
android/jni/msbuild.py
Normal file
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/python
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""Simple script that locates the newest MSBuild in one of several locations.
|
||||
|
||||
This script will find the highest version number of MSBuild and run it,
|
||||
passing its arguments through to MSBuild.
|
||||
"""
|
||||
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
import string
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
SYSTEMROOT = os.getenv("SYSTEMROOT", "c:\\windows")
|
||||
PROGRAM_FILES = os.getenv("ProgramFiles", "c:\\Program Files")
|
||||
PROGRAM_FILES_X86 = os.getenv("ProgramFiles(x86)", "c:\\Program Files (x86)")
|
||||
|
||||
SEARCH_FOLDERS = [ PROGRAM_FILES + "\\MSBuild\\*\\Bin\\MSBuild.exe",
|
||||
PROGRAM_FILES_X86 + "\\MSBuild\\*\\Bin\\MSBuild.exe",
|
||||
SYSTEMROOT + "\\Microsoft.NET\Framework\\*\\MSBuild.exe" ]
|
||||
|
||||
def compare_version(a, b):
|
||||
"""Compare two version number strings of the form W.X.Y.Z.
|
||||
|
||||
The numbers are compared most-significant to least-significant.
|
||||
For example, 12.345.67.89 > 2.987.88.99.
|
||||
|
||||
Args:
|
||||
a: First version number string to compare
|
||||
b: Second version number string to compare
|
||||
|
||||
Returns:
|
||||
0 if the numbers are identical, a positive number if 'a' is larger, and
|
||||
a negative number if 'b' is larger.
|
||||
"""
|
||||
aa = string.split(a, ".")
|
||||
bb = string.split(b, ".")
|
||||
for i in range(0, 4):
|
||||
if aa[i] != bb[i]:
|
||||
return cmp(int(aa[i]), int(bb[i]))
|
||||
return 0
|
||||
|
||||
def main():
|
||||
msbuilds = []
|
||||
|
||||
for folder in SEARCH_FOLDERS:
|
||||
for file in glob.glob(folder):
|
||||
p = subprocess.Popen([file, "/version"], stdout=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
match = re.search("^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$", out, re.M)
|
||||
if match:
|
||||
msbuilds.append({ 'ver':match.group(), 'exe':file })
|
||||
msbuilds.sort(lambda x, y: compare_version(x['ver'], y['ver']), reverse=True)
|
||||
if len(msbuilds) == 0:
|
||||
print "Unable to find MSBuild.\n"
|
||||
return -1;
|
||||
cmd = [msbuilds[0]['exe']]
|
||||
cmd.extend(sys.argv[1:])
|
||||
return subprocess.call(cmd)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
46
android/jni/run_flatc.py
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/python
|
||||
# Copyright 2015 Google Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
EXECUTABLE_EXTENSION = '.exe' if platform.system() == 'Windows' else ''
|
||||
# Paths to search for flatc relative to the current working directory.
|
||||
FLATC_SEARCH_PATHS = [os.path.curdir, 'Release', 'Debug']
|
||||
|
||||
def main():
|
||||
"""Script that finds and runs flatc built from source."""
|
||||
if len(sys.argv) < 2:
|
||||
sys.stderr.write('Usage: run_flatc.py flatbuffers_dir [flatc_args]\n')
|
||||
return 1
|
||||
cwd = os.getcwd()
|
||||
flatc = ''
|
||||
flatbuffers_dir = sys.argv[1]
|
||||
for path in FLATC_SEARCH_PATHS:
|
||||
current = os.path.join(flatbuffers_dir, path,
|
||||
'flatc' + EXECUTABLE_EXTENSION)
|
||||
if os.path.exists(current):
|
||||
flatc = current
|
||||
break
|
||||
if not flatc:
|
||||
sys.stderr.write('flatc not found\n')
|
||||
return 1
|
||||
command = [flatc] + sys.argv[2:]
|
||||
return subprocess.call(command)
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
26
appveyor.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
os: Visual Studio 2015
|
||||
|
||||
platform:
|
||||
- x86
|
||||
- x64
|
||||
|
||||
configuration:
|
||||
- Debug
|
||||
- Release
|
||||
|
||||
before_build:
|
||||
- cmake -G"Visual Studio 10 2010"
|
||||
|
||||
build:
|
||||
project: ALL_BUILD.vcxproj
|
||||
|
||||
#test_script:
|
||||
# - Debug/flattests.exe
|
||||
|
||||
#artifacts:
|
||||
# - path: Release/flatc.exe
|
||||
# name: flatc.exe
|
||||
@@ -1,5 +1,7 @@
|
||||
# Biicode configuration file
|
||||
|
||||
[paths]
|
||||
# Local directories to look for headers (within block)
|
||||
include
|
||||
[mains]
|
||||
!android/*
|
||||
[tests]
|
||||
tests/*
|
||||
|
||||
21
biicode/README.md
Normal file
@@ -0,0 +1,21 @@
|
||||
Biicode C/C++ dependency manager
|
||||
=================================
|
||||
|
||||
[](https://www.biicode.com/fenix/flatbuffers)
|
||||
|
||||
New with biicode? Check the [Getting Started Guide](http://docs.biicode.com/c++/gettingstarted.html).
|
||||
|
||||
How to build it?
|
||||
------------------
|
||||
Building it is too easy:
|
||||
|
||||
$ git clone git@github.com:google/flatbuffers.git
|
||||
$ cd flatbuffers
|
||||
$ bii init -L && bii build
|
||||
$ ./bin/any_executable
|
||||
|
||||
Or run its tests:
|
||||
|
||||
$ bii test
|
||||
|
||||
You can check [the examples/flatbuffers block](https://www.biicode.com/examples/flatbuffers).
|
||||
@@ -1,6 +1,4 @@
|
||||
# Initializes block variables
|
||||
INIT_BIICODE_BLOCK()
|
||||
|
||||
set(BII_TESTS_WORKING_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
# Copying data files to project/bin folder
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/samples")
|
||||
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/samples/monster.fbs"
|
||||
@@ -14,9 +12,7 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
|
||||
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
|
||||
endif()
|
||||
|
||||
# Actually create targets: EXEcutables and libraries.
|
||||
ADD_BIICODE_TARGETS()
|
||||
|
||||
string(REPLACE " " ";" REPLACED_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
target_compile_options(${BII_BLOCK_TARGET} INTERFACE ${REPLACED_FLAGS})
|
||||
target_include_directories(${BII_BLOCK_TARGET} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
target_compile_options(${BII_BLOCK_TARGET} INTERFACE ${REPLACED_FLAGS})
|
||||
30
biicode/support/bii-travis.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2016 Google Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install libglu1-mesa-dev xorg-dev
|
||||
wget http://www.biicode.com/downloads/latest/ubuntu64
|
||||
mv ubuntu64 bii-ubuntu64.deb
|
||||
(sudo dpkg -i bii-ubuntu64.deb) && sudo apt-get -f install
|
||||
rm bii-ubuntu64.deb
|
||||
wget https://s3.amazonaws.com/biibinaries/thirdparty/cmake-3.0.2-Linux-64.tar.gz
|
||||
tar -xzf cmake-3.0.2-Linux-64.tar.gz
|
||||
sudo cp -fR cmake-3.0.2-Linux-64/* /usr
|
||||
rm -rf cmake-3.0.2-Linux-64
|
||||
rm cmake-3.0.2-Linux-64.tar.gz
|
||||
|
||||
cmake --version
|
||||
bii init -l && bii configure -DCMAKE_BUILD_TYPE=$1 && bii test
|
||||
@@ -1,55 +0,0 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flatc", "flatc.vcxproj", "{5B5857E1-64E2-4CED-A12E-45E1B3880496}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flatsamplebinary", "flatsamplebinary.vcxproj", "{16FA5518-3DE1-4B15-A1E0-F4734C276FB4}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flatsampletext", "flatsampletext.vcxproj", "{F0A15675-1017-4217-BB5B-3372F2C636AB}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flattests", "flattests.vcxproj", "{DC7BBA00-9FC6-48AF-B7E9-12CA91AC02AA}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{5B5857E1-64E2-4CED-A12E-45E1B3880496}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{5B5857E1-64E2-4CED-A12E-45E1B3880496}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{5B5857E1-64E2-4CED-A12E-45E1B3880496}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{5B5857E1-64E2-4CED-A12E-45E1B3880496}.Debug|x64.Build.0 = Debug|x64
|
||||
{5B5857E1-64E2-4CED-A12E-45E1B3880496}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{5B5857E1-64E2-4CED-A12E-45E1B3880496}.Release|Win32.Build.0 = Release|Win32
|
||||
{5B5857E1-64E2-4CED-A12E-45E1B3880496}.Release|x64.ActiveCfg = Release|x64
|
||||
{5B5857E1-64E2-4CED-A12E-45E1B3880496}.Release|x64.Build.0 = Release|x64
|
||||
{16FA5518-3DE1-4B15-A1E0-F4734C276FB4}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{16FA5518-3DE1-4B15-A1E0-F4734C276FB4}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{16FA5518-3DE1-4B15-A1E0-F4734C276FB4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{16FA5518-3DE1-4B15-A1E0-F4734C276FB4}.Debug|x64.Build.0 = Debug|x64
|
||||
{16FA5518-3DE1-4B15-A1E0-F4734C276FB4}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{16FA5518-3DE1-4B15-A1E0-F4734C276FB4}.Release|Win32.Build.0 = Release|Win32
|
||||
{16FA5518-3DE1-4B15-A1E0-F4734C276FB4}.Release|x64.ActiveCfg = Release|x64
|
||||
{16FA5518-3DE1-4B15-A1E0-F4734C276FB4}.Release|x64.Build.0 = Release|x64
|
||||
{F0A15675-1017-4217-BB5B-3372F2C636AB}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F0A15675-1017-4217-BB5B-3372F2C636AB}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{F0A15675-1017-4217-BB5B-3372F2C636AB}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{F0A15675-1017-4217-BB5B-3372F2C636AB}.Debug|x64.Build.0 = Debug|x64
|
||||
{F0A15675-1017-4217-BB5B-3372F2C636AB}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{F0A15675-1017-4217-BB5B-3372F2C636AB}.Release|Win32.Build.0 = Release|Win32
|
||||
{F0A15675-1017-4217-BB5B-3372F2C636AB}.Release|x64.ActiveCfg = Release|x64
|
||||
{F0A15675-1017-4217-BB5B-3372F2C636AB}.Release|x64.Build.0 = Release|x64
|
||||
{DC7BBA00-9FC6-48AF-B7E9-12CA91AC02AA}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{DC7BBA00-9FC6-48AF-B7E9-12CA91AC02AA}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{DC7BBA00-9FC6-48AF-B7E9-12CA91AC02AA}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{DC7BBA00-9FC6-48AF-B7E9-12CA91AC02AA}.Debug|x64.Build.0 = Debug|x64
|
||||
{DC7BBA00-9FC6-48AF-B7E9-12CA91AC02AA}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{DC7BBA00-9FC6-48AF-B7E9-12CA91AC02AA}.Release|Win32.Build.0 = Release|Win32
|
||||
{DC7BBA00-9FC6-48AF-B7E9-12CA91AC02AA}.Release|x64.ActiveCfg = Release|x64
|
||||
{DC7BBA00-9FC6-48AF-B7E9-12CA91AC02AA}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,282 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGUID>{5B5857E1-64E2-4CED-A12E-45E1B3880496}</ProjectGUID>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<Platform>Win32</Platform>
|
||||
<ProjectName>flatc</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.20506.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">flatc.dir\Debug\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">flatc.dir\Debug\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">flatc</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">flatc</TargetName>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.exe</TargetExt>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.exe</TargetExt>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</GenerateManifest>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</GenerateManifest>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">flatc.dir\Release\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">flatc.dir\Release\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">flatc</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">flatc</TargetName>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.exe</TargetExt>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.exe</TargetExt>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</GenerateManifest>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>Debug</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>../../Debug/flatc.pdb</ProgramDataBaseFileName>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Midl>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OutputDirectory>$(IntDir)</OutputDirectory>
|
||||
<HeaderFileName>%(Filename).h</HeaderFileName>
|
||||
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
|
||||
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
|
||||
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
|
||||
</Midl>
|
||||
<Link>
|
||||
<AdditionalOptions> /machine:X86 /debug %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ImportLibrary>../../Debug/flatc.lib</ImportLibrary>
|
||||
<ProgramDataBaseFile>../../Debug/flatc.pdb</ProgramDataBaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>Debug</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>../../Debug/flatc.pdb</ProgramDataBaseFileName>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Midl>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OutputDirectory>$(IntDir)</OutputDirectory>
|
||||
<HeaderFileName>%(Filename).h</HeaderFileName>
|
||||
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
|
||||
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
|
||||
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
|
||||
</Midl>
|
||||
<Link>
|
||||
<AdditionalOptions>/debug %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ImportLibrary>../../Debug/flatc.lib</ImportLibrary>
|
||||
<ProgramDataBaseFile>../../Debug/flatc.pdb</ProgramDataBaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>
|
||||
</DebugInformationFormat>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>Release</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>../../Release/flatc.pdb</ProgramDataBaseFileName>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Midl>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OutputDirectory>$(IntDir)</OutputDirectory>
|
||||
<HeaderFileName>%(Filename).h</HeaderFileName>
|
||||
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
|
||||
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
|
||||
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
|
||||
</Midl>
|
||||
<Link>
|
||||
<AdditionalOptions> /machine:X86 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ImportLibrary>../../Release/flatc.lib</ImportLibrary>
|
||||
<ProgramDataBaseFile>../../Release/flatc.pdb</ProgramDataBaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>
|
||||
</DebugInformationFormat>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>Release</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>../../Release/flatc.pdb</ProgramDataBaseFileName>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Midl>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OutputDirectory>$(IntDir)</OutputDirectory>
|
||||
<HeaderFileName>%(Filename).h</HeaderFileName>
|
||||
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
|
||||
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
|
||||
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
|
||||
</Midl>
|
||||
<Link>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ImportLibrary>../../Release/flatc.lib</ImportLibrary>
|
||||
<ProgramDataBaseFile>../../Release/flatc.pdb</ProgramDataBaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\include\flatbuffers\flatbuffers.h" />
|
||||
<ClInclude Include="..\..\include\flatbuffers\idl.h" />
|
||||
<ClInclude Include="..\..\include\flatbuffers\util.h" />
|
||||
<ClCompile Include="..\..\src\idl_gen_fbs.cpp" />
|
||||
<ClCompile Include="..\..\src\idl_gen_general.cpp" />
|
||||
<ClCompile Include="..\..\src\idl_gen_go.cpp">
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\idl_parser.cpp" />
|
||||
<ClCompile Include="..\..\src\idl_gen_cpp.cpp" />
|
||||
<ClCompile Include="..\..\src\idl_gen_text.cpp" />
|
||||
<ClCompile Include="..\..\src\flatc.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LocalDebuggerWorkingDirectory>..\..\tests</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommandArguments>-j -c -n -g -b -t monster_test.fbs monsterdata_test.golden</LocalDebuggerCommandArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommandArguments>-j -c -n -g -b -t monster_test.fbs monsterdata_test.golden</LocalDebuggerCommandArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LocalDebuggerCommandArguments>-j -c -g -n -b -t monster_test.fbs monsterdata_test.golden</LocalDebuggerCommandArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LocalDebuggerWorkingDirectory>..\..\tests</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LocalDebuggerCommandArguments>-j -c -g -b -t monster_test.fbs monsterdata_test.json</LocalDebuggerCommandArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LocalDebuggerWorkingDirectory>..\..\tests</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,273 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGUID>{16FA5518-3DE1-4B15-A1E0-F4734C276FB4}</ProjectGUID>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<Platform>Win32</Platform>
|
||||
<ProjectName>flatsamplebinary</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.20506.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">flatsamplebinary.dir\Debug\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">flatsamplebinary.dir\Debug\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">flatsamplebinary</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">flatsamplebinary</TargetName>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.exe</TargetExt>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.exe</TargetExt>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</GenerateManifest>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</GenerateManifest>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">flatsamplebinary.dir\Release\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">flatsamplebinary.dir\Release\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">flatsamplebinary</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">flatsamplebinary</TargetName>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.exe</TargetExt>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.exe</TargetExt>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</GenerateManifest>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>Debug</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>../../Debug/flatsamplebinary.pdb</ProgramDataBaseFileName>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Midl>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OutputDirectory>$(IntDir)</OutputDirectory>
|
||||
<HeaderFileName>%(Filename).h</HeaderFileName>
|
||||
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
|
||||
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
|
||||
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
|
||||
</Midl>
|
||||
<Link>
|
||||
<AdditionalOptions> /machine:X86 /debug %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ImportLibrary>../../Debug/flatsamplebinary.lib</ImportLibrary>
|
||||
<ProgramDataBaseFile>../../Debug/flatsamplebinary.pdb</ProgramDataBaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>Debug</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>../../Debug/flatsamplebinary.pdb</ProgramDataBaseFileName>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Midl>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OutputDirectory>$(IntDir)</OutputDirectory>
|
||||
<HeaderFileName>%(Filename).h</HeaderFileName>
|
||||
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
|
||||
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
|
||||
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
|
||||
</Midl>
|
||||
<Link>
|
||||
<AdditionalOptions>/debug %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ImportLibrary>../../Debug/flatsamplebinary.lib</ImportLibrary>
|
||||
<ProgramDataBaseFile>../../Debug/flatsamplebinary.pdb</ProgramDataBaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>
|
||||
</DebugInformationFormat>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>Release</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>../../Release/flatsamplebinary.pdb</ProgramDataBaseFileName>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Midl>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OutputDirectory>$(IntDir)</OutputDirectory>
|
||||
<HeaderFileName>%(Filename).h</HeaderFileName>
|
||||
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
|
||||
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
|
||||
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
|
||||
</Midl>
|
||||
<Link>
|
||||
<AdditionalOptions> /machine:X86 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ImportLibrary>../../Release/flatsamplebinary.lib</ImportLibrary>
|
||||
<ProgramDataBaseFile>../../Release/flatsamplebinary.pdb</ProgramDataBaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>
|
||||
</DebugInformationFormat>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>Release</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>../../Release/flatsamplebinary.pdb</ProgramDataBaseFileName>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Midl>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OutputDirectory>$(IntDir)</OutputDirectory>
|
||||
<HeaderFileName>%(Filename).h</HeaderFileName>
|
||||
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
|
||||
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
|
||||
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
|
||||
</Midl>
|
||||
<Link>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ImportLibrary>../../Release/flatsamplebinary.lib</ImportLibrary>
|
||||
<ProgramDataBaseFile>../../Release/flatsamplebinary.pdb</ProgramDataBaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\include\flatbuffers\flatbuffers.h" />
|
||||
<ClInclude Include="..\..\samples\monster_generated.h" />
|
||||
<ClCompile Include="..\..\samples\sample_binary.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,277 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGUID>{F0A15675-1017-4217-BB5B-3372F2C636AB}</ProjectGUID>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<Platform>Win32</Platform>
|
||||
<ProjectName>flatsampletext</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.20506.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">flatsampletext.dir\Debug\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">flatsampletext.dir\Debug\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">flatsampletext</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">flatsampletext</TargetName>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.exe</TargetExt>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.exe</TargetExt>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</GenerateManifest>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</GenerateManifest>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">flatsampletext.dir\Release\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">flatsampletext.dir\Release\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">flatsampletext</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">flatsampletext</TargetName>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.exe</TargetExt>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.exe</TargetExt>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</GenerateManifest>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>Debug</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>../../Debug/flatsampletext.pdb</ProgramDataBaseFileName>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Midl>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OutputDirectory>$(IntDir)</OutputDirectory>
|
||||
<HeaderFileName>%(Filename).h</HeaderFileName>
|
||||
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
|
||||
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
|
||||
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
|
||||
</Midl>
|
||||
<Link>
|
||||
<AdditionalOptions> /machine:X86 /debug %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ImportLibrary>../../Debug/flatsampletext.lib</ImportLibrary>
|
||||
<ProgramDataBaseFile>../../Debug/flatsampletext.pdb</ProgramDataBaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>Debug</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>../../Debug/flatsampletext.pdb</ProgramDataBaseFileName>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Midl>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OutputDirectory>$(IntDir)</OutputDirectory>
|
||||
<HeaderFileName>%(Filename).h</HeaderFileName>
|
||||
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
|
||||
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
|
||||
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
|
||||
</Midl>
|
||||
<Link>
|
||||
<AdditionalOptions>/debug %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ImportLibrary>../../Debug/flatsampletext.lib</ImportLibrary>
|
||||
<ProgramDataBaseFile>../../Debug/flatsampletext.pdb</ProgramDataBaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>
|
||||
</DebugInformationFormat>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>Release</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>../../Release/flatsampletext.pdb</ProgramDataBaseFileName>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Midl>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OutputDirectory>$(IntDir)</OutputDirectory>
|
||||
<HeaderFileName>%(Filename).h</HeaderFileName>
|
||||
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
|
||||
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
|
||||
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
|
||||
</Midl>
|
||||
<Link>
|
||||
<AdditionalOptions> /machine:X86 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ImportLibrary>../../Release/flatsampletext.lib</ImportLibrary>
|
||||
<ProgramDataBaseFile>../../Release/flatsampletext.pdb</ProgramDataBaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>
|
||||
</DebugInformationFormat>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>Release</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>../../Release/flatsampletext.pdb</ProgramDataBaseFileName>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Midl>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OutputDirectory>$(IntDir)</OutputDirectory>
|
||||
<HeaderFileName>%(Filename).h</HeaderFileName>
|
||||
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
|
||||
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
|
||||
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
|
||||
</Midl>
|
||||
<Link>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ImportLibrary>../../Release/flatsampletext.lib</ImportLibrary>
|
||||
<ProgramDataBaseFile>../../Release/flatsampletext.pdb</ProgramDataBaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\include\flatbuffers\flatbuffers.h" />
|
||||
<ClInclude Include="..\..\include\flatbuffers\idl.h" />
|
||||
<ClInclude Include="..\..\include\flatbuffers\util.h" />
|
||||
<ClInclude Include="..\..\samples\monster_generated.h" />
|
||||
<ClCompile Include="..\..\src\idl_parser.cpp" />
|
||||
<ClCompile Include="..\..\src\idl_gen_text.cpp" />
|
||||
<ClCompile Include="..\..\samples\sample_text.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,278 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGUID>{DC7BBA00-9FC6-48AF-B7E9-12CA91AC02AA}</ProjectGUID>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<Platform>Win32</Platform>
|
||||
<ProjectName>flattests</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.20506.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">flattests.dir\Debug\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">flattests.dir\Debug\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">flattests</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">flattests</TargetName>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.exe</TargetExt>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.exe</TargetExt>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</GenerateManifest>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</GenerateManifest>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">flattests.dir\Release\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">flattests.dir\Release\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">flattests</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">flattests</TargetName>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.exe</TargetExt>
|
||||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.exe</TargetExt>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</GenerateManifest>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>Debug</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>../../Debug/flattests.pdb</ProgramDataBaseFileName>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Midl>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OutputDirectory>$(IntDir)</OutputDirectory>
|
||||
<HeaderFileName>%(Filename).h</HeaderFileName>
|
||||
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
|
||||
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
|
||||
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
|
||||
</Midl>
|
||||
<Link>
|
||||
<AdditionalOptions> /machine:X86 /debug %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ImportLibrary>../../Debug/flattests.lib</ImportLibrary>
|
||||
<ProgramDataBaseFile>../../Debug/flattests.pdb</ProgramDataBaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>Debug</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>../../Debug/flattests.pdb</ProgramDataBaseFileName>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Midl>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OutputDirectory>$(IntDir)</OutputDirectory>
|
||||
<HeaderFileName>%(Filename).h</HeaderFileName>
|
||||
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
|
||||
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
|
||||
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
|
||||
</Midl>
|
||||
<Link>
|
||||
<AdditionalOptions>/debug %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ImportLibrary>../../Debug/flattests.lib</ImportLibrary>
|
||||
<ProgramDataBaseFile>../../Debug/flattests.pdb</ProgramDataBaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>
|
||||
</DebugInformationFormat>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>Release</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>../../Release/flattests.pdb</ProgramDataBaseFileName>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Midl>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OutputDirectory>$(IntDir)</OutputDirectory>
|
||||
<HeaderFileName>%(Filename).h</HeaderFileName>
|
||||
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
|
||||
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
|
||||
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
|
||||
</Midl>
|
||||
<Link>
|
||||
<AdditionalOptions> /machine:X86 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ImportLibrary>../../Release/flattests.lib</ImportLibrary>
|
||||
<ProgramDataBaseFile>../../Release/flattests.pdb</ProgramDataBaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>
|
||||
</DebugInformationFormat>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerListingLocation>Release</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>../../Release/flattests.pdb</ProgramDataBaseFileName>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Midl>
|
||||
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OutputDirectory>$(IntDir)</OutputDirectory>
|
||||
<HeaderFileName>%(Filename).h</HeaderFileName>
|
||||
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
|
||||
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
|
||||
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
|
||||
</Midl>
|
||||
<Link>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ImportLibrary>../../Release/flattests.lib</ImportLibrary>
|
||||
<ProgramDataBaseFile>../../Release/flattests.pdb</ProgramDataBaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<Version>
|
||||
</Version>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\include\flatbuffers\flatbuffers.h" />
|
||||
<ClInclude Include="..\..\include\flatbuffers\idl.h" />
|
||||
<ClInclude Include="..\..\include\flatbuffers\util.h" />
|
||||
<ClInclude Include="..\..\tests\monster_test_generated.h" />
|
||||
<ClCompile Include="..\..\src\idl_gen_fbs.cpp" />
|
||||
<ClCompile Include="..\..\src\idl_parser.cpp" />
|
||||
<ClCompile Include="..\..\src\idl_gen_text.cpp" />
|
||||
<ClCompile Include="..\..\tests\test.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
18
composer.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "google/flatbuffers",
|
||||
"type": "library",
|
||||
"description": "FlatBuffers for PHP",
|
||||
"keywords": ["google", "flatbuffers", "serialization"],
|
||||
"homepage": "https://github.com/google/flatbuffers",
|
||||
"license": "Apache-2.0",
|
||||
"require": {
|
||||
"php": ">=5.4"
|
||||
},
|
||||
"require-dev": {
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Google\\FlatBuffers\\": "php"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;url=html/index.html">
|
||||
</head>
|
||||
<body>
|
||||
<a href="html/index.html">Click here if you are not redirected.</a>
|
||||
</body>
|
||||
</html>
|
||||
62
docs/header.html
Normal file
@@ -0,0 +1,62 @@
|
||||
<!-- 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 $doxygenversion"/>
|
||||
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
|
||||
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
|
||||
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="$relpath^jquery.js"></script>
|
||||
<script type="text/javascript" src="$relpath^dynsections.js"></script>
|
||||
$treeview
|
||||
$search
|
||||
$mathjax
|
||||
<link href="$relpath^$stylesheet" 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">
|
||||
$extrastylesheet
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
|
||||
<!--BEGIN TITLEAREA-->
|
||||
<div id="titlearea" style="height: 110px;">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<!--BEGIN PROJECT_LOGO-->
|
||||
<td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo"/></td>
|
||||
<!--END PROJECT_LOGO-->
|
||||
<td id="commonprojectlogo">
|
||||
<img alt="Logo" src="$relpath^fpl_logo_small.png"/>
|
||||
</td>
|
||||
<!--BEGIN PROJECT_NAME-->
|
||||
<td style="padding-left: 0.5em;">
|
||||
<div id="projectname">$projectname
|
||||
<!--BEGIN PROJECT_NUMBER--> <span id="projectnumber">$projectnumber</span><!--END PROJECT_NUMBER-->
|
||||
</div>
|
||||
<div style="font-size:12px;">
|
||||
An open source project by <a href="https://developers.google.com/games/#Tools">FPL</a>.
|
||||
</div>
|
||||
<!--BEGIN PROJECT_BRIEF--><div id="projectbrief">$projectbrief</div><!--END PROJECT_BRIEF-->
|
||||
</td>
|
||||
<!--END PROJECT_NAME-->
|
||||
<!--BEGIN !PROJECT_NAME-->
|
||||
<!--BEGIN PROJECT_BRIEF-->
|
||||
<td style="padding-left: 0.5em;">
|
||||
<div id="projectbrief">$projectbrief</div>
|
||||
</td>
|
||||
<!--END PROJECT_BRIEF-->
|
||||
<!--END !PROJECT_NAME-->
|
||||
<!--BEGIN DISABLE_INDEX-->
|
||||
<!--BEGIN SEARCHENGINE-->
|
||||
<td>$searchbox</td>
|
||||
<!--END SEARCHENGINE-->
|
||||
<!--END DISABLE_INDEX-->
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!--END TITLEAREA-->
|
||||
<!-- end header part -->
|
||||
|
Before Width: | Height: | Size: 676 B |
|
Before Width: | Height: | Size: 147 B |
|
Before Width: | Height: | Size: 132 B |
|
Before Width: | Height: | Size: 3.7 KiB |
@@ -1,97 +0,0 @@
|
||||
function toggleVisibility(linkObj)
|
||||
{
|
||||
var base = $(linkObj).attr('id');
|
||||
var summary = $('#'+base+'-summary');
|
||||
var content = $('#'+base+'-content');
|
||||
var trigger = $('#'+base+'-trigger');
|
||||
var src=$(trigger).attr('src');
|
||||
if (content.is(':visible')===true) {
|
||||
content.hide();
|
||||
summary.show();
|
||||
$(linkObj).addClass('closed').removeClass('opened');
|
||||
$(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');
|
||||
} else {
|
||||
content.show();
|
||||
summary.hide();
|
||||
$(linkObj).removeClass('closed').addClass('opened');
|
||||
$(trigger).attr('src',src.substring(0,src.length-10)+'open.png');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function updateStripes()
|
||||
{
|
||||
$('table.directory tr').
|
||||
removeClass('even').filter(':visible:even').addClass('even');
|
||||
}
|
||||
|
||||
function toggleLevel(level)
|
||||
{
|
||||
$('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<level+1) {
|
||||
i.removeClass('iconfopen iconfclosed').addClass('iconfopen');
|
||||
a.html('▼');
|
||||
$(this).show();
|
||||
} else if (l==level+1) {
|
||||
i.removeClass('iconfclosed iconfopen').addClass('iconfclosed');
|
||||
a.html('►');
|
||||
$(this).show();
|
||||
} else {
|
||||
$(this).hide();
|
||||
}
|
||||
});
|
||||
updateStripes();
|
||||
}
|
||||
|
||||
function toggleFolder(id)
|
||||
{
|
||||
// the clicked row
|
||||
var currentRow = $('#row_'+id);
|
||||
|
||||
// all rows after the clicked row
|
||||
var rows = currentRow.nextAll("tr");
|
||||
|
||||
var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub
|
||||
|
||||
// only match elements AFTER this one (can't hide elements before)
|
||||
var childRows = rows.filter(function() { return this.id.match(re); });
|
||||
|
||||
// first row is visible we are HIDING
|
||||
if (childRows.filter(':first').is(':visible')===true) {
|
||||
// replace down arrow by right arrow for current row
|
||||
var currentRowSpans = currentRow.find("span");
|
||||
currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
|
||||
currentRowSpans.filter(".arrow").html('►');
|
||||
rows.filter("[id^=row_"+id+"]").hide(); // hide all children
|
||||
} else { // we are SHOWING
|
||||
// replace right arrow by down arrow for current row
|
||||
var currentRowSpans = currentRow.find("span");
|
||||
currentRowSpans.filter(".iconfclosed").removeClass("iconfclosed").addClass("iconfopen");
|
||||
currentRowSpans.filter(".arrow").html('▼');
|
||||
// replace down arrows by right arrows for child rows
|
||||
var childRowsSpans = childRows.find("span");
|
||||
childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
|
||||
childRowsSpans.filter(".arrow").html('►');
|
||||
childRows.show(); //show all children
|
||||
}
|
||||
updateStripes();
|
||||
}
|
||||
|
||||
|
||||
function toggleInherit(id)
|
||||
{
|
||||
var rows = $('tr.inherit.'+id);
|
||||
var img = $('tr.inherit_header.'+id+' img');
|
||||
var src = $(img).attr('src');
|
||||
if (rows.filter(':first').is(':visible')===true) {
|
||||
rows.css('display','none');
|
||||
$(img).attr('src',src.substring(0,src.length-8)+'closed.png');
|
||||
} else {
|
||||
rows.css('display','table-row'); // using show() causes jump in firefox
|
||||
$(img).attr('src',src.substring(0,src.length-10)+'open.png');
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 86 B |
|
Before Width: | Height: | Size: 453 B |
|
Before Width: | Height: | Size: 746 B |
|
Before Width: | Height: | Size: 616 B |
|
Before Width: | Height: | Size: 597 B |
|
Before Width: | Height: | Size: 86 B |
|
Before Width: | Height: | Size: 746 B |
|
Before Width: | Height: | Size: 246 B |
|
Before Width: | Height: | Size: 246 B |
|
Before Width: | Height: | Size: 403 B |
|
Before Width: | Height: | Size: 86 B |
|
Before Width: | Height: | Size: 388 B |
|
Before Width: | Height: | Size: 229 B |
|
Before Width: | Height: | Size: 229 B |
|
Before Width: | Height: | Size: 314 B |
|
Before Width: | Height: | Size: 86 B |
@@ -1,116 +0,0 @@
|
||||
<!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: Main Page</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="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td style="padding-left: 0.5em;">
|
||||
<div id="projectname">FlatBuffers
|
||||
</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('index.html','');});
|
||||
</script>
|
||||
<div id="doc-content">
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">FlatBuffers Documentation</div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>FlatBuffers is an efficient cross platform serialization library for C++, with support for Java, C# and Go. It was created at Google specifically for game development and other performance-critical applications.</p>
|
||||
<p>It is available as open source under the Apache license, v2 (see LICENSE.txt).</p>
|
||||
<h2>Why use FlatBuffers?</h2>
|
||||
<ul>
|
||||
<li><b>Access to serialized data without parsing/unpacking</b> - What sets FlatBuffers apart is that it represents hierarchical data in a flat binary buffer in such a way that it can still be accessed directly without parsing/unpacking, while also still supporting data structure evolution (forwards/backwards compatibility).</li>
|
||||
<li><b>Memory efficiency and speed</b> - The only memory needed to access your data is that of the buffer. It requires 0 additional allocations. FlatBuffers is also very suitable for use with mmap (or streaming), requiring only part of the buffer to be in memory. Access is close to the speed of raw struct access with only one extra indirection (a kind of vtable) to allow for format evolution and optional fields. It is aimed at projects where spending time and space (many memory allocations) to be able to access or construct serialized data is undesirable, such as in games or any other performance sensitive applications. See the <a href="md__benchmarks.html">benchmarks</a> for details.</li>
|
||||
<li><b>Flexible</b> - Optional fields means not only do you get great forwards and backwards compatibility (increasingly important for long-lived games: don't have to update all data with each new version!). It also means you have a lot of choice in what data you write and what data you don't, and how you design data structures.</li>
|
||||
<li><b>Tiny code footprint</b> - Small amounts of generated code, and just a single small header as the minimum dependency, which is very easy to integrate. Again, see the benchmark section for details.</li>
|
||||
<li><b>Strongly typed</b> - Errors happen at compile time rather than manually having to write repetitive and error prone run-time checks. Useful code can be generated for you.</li>
|
||||
<li><p class="startli"><b>Convenient to use</b> - Generated C++ code allows for terse access & construction code. Then there's optional functionality for parsing schemas and JSON-like text representations at runtime efficiently if needed (faster and more memory efficient than other JSON parsers).</p>
|
||||
<p class="startli">Java and Go code supports object-reuse.</p>
|
||||
</li>
|
||||
<li><b>Cross platform C++11/Java/C#/Go code with no dependencies</b> - will work with any recent gcc/clang and VS2010. Comes with build files for the tests & samples (Android .mk files, and cmake for all other platforms).</li>
|
||||
</ul>
|
||||
<h3>Why not use Protocol Buffers, or .. ?</h3>
|
||||
<p>Protocol Buffers is indeed relatively similar to FlatBuffers, with the primary difference being that FlatBuffers does not need a parsing/ unpacking step to a secondary representation before you can access data, often coupled with per-object memory allocation. The code is an order of magnitude bigger, too. Protocol Buffers has neither optional text import/export nor schema language features like unions.</p>
|
||||
<h3>But all the cool kids use JSON!</h3>
|
||||
<p>JSON is very readable (which is why we use it as our optional text format) and very convenient when used together with dynamically typed languages (such as JavaScript). When serializing data from statically typed languages, however, JSON not only has the obvious drawback of runtime inefficiency, but also forces you to write <em>more</em> code to access data (counterintuitively) due to its dynamic-typing serialization system. In this context, it is only a better choice for systems that have very little to no information ahead of time about what data needs to be stored.</p>
|
||||
<p>Read more about the "why" of FlatBuffers in the <a href="md__white_paper.html">white paper</a>.</p>
|
||||
<h2>Usage in brief</h2>
|
||||
<p>This section is a quick rundown of how to use this system. Subsequent sections provide a more in-depth usage guide.</p>
|
||||
<ul>
|
||||
<li>Write a schema file that allows you to define the data structures you may want to serialize. Fields can have a scalar type (ints/floats of all sizes), or they can be a: string; array of any type; reference to yet another object; or, a set of possible objects (unions). Fields are optional and have defaults, so they don't need to be present for every object instance.</li>
|
||||
<li>Use <code>flatc</code> (the FlatBuffer compiler) to generate a C++ header (or Java/C#/Go classes) with helper classes to access and construct serialized data. This header (say <code>mydata_generated.h</code>) only depends on <code>flatbuffers.h</code>, which defines the core functionality.</li>
|
||||
<li>Use the <code>FlatBufferBuilder</code> class to construct a flat binary buffer. The generated functions allow you to add objects to this buffer recursively, often as simply as making a single function call.</li>
|
||||
<li>Store or send your buffer somewhere!</li>
|
||||
<li>When reading it back, you can obtain the pointer to the root object from the binary buffer, and from there traverse it conveniently in-place with <code>object->field()</code>.</li>
|
||||
</ul>
|
||||
<h2>In-depth documentation</h2>
|
||||
<ul>
|
||||
<li>How to <a href="md__building.html">build the compiler</a> and samples on various platforms.</li>
|
||||
<li>How to <a href="md__compiler.html">use the compiler</a>.</li>
|
||||
<li>How to <a href="md__schemas.html">write a schema</a>.</li>
|
||||
<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>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>
|
||||
<li>A formal <a href="md__grammar.html">grammar</a> of the schema language.</li>
|
||||
</ul>
|
||||
<h2>Online resources</h2>
|
||||
<ul>
|
||||
<li><a href="http://github.com/google/flatbuffers">github repository</a></li>
|
||||
<li><a href="http://google.github.io/flatbuffers">landing page</a></li>
|
||||
<li><a href="http://group.google.com/group/flatbuffers">FlatBuffers Google Group</a></li>
|
||||
<li><a href="http://github.com/google/flatbuffers/issues">FlatBuffers Issues Tracker</a> </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>
|
||||
72
docs/html/jquery.js
vendored
@@ -1,103 +0,0 @@
|
||||
<!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: Benchmarks</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="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td style="padding-left: 0.5em;">
|
||||
<div id="projectname">FlatBuffers
|
||||
</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__benchmarks.html','');});
|
||||
</script>
|
||||
<div id="doc-content">
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">Benchmarks </div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>Comparing against other serialization solutions, running on Windows 7 64bit. We use the LITE runtime for Protocol Buffers (less code / lower overhead), Rapid JSON (one of the fastest C++ JSON parsers around), and pugixml, also one of the fastest XML parsers.</p>
|
||||
<p>We also compare against code that doesn't use a serialization library at all (the column "Raw structs"), which is what you get if you write hardcoded code that just writes structs. This is the fastest possible, but of course is not cross platform nor has any kind of forwards / backwards compatibility.</p>
|
||||
<p>We compare against Flatbuffers with the binary wire format (as intended), and also with JSON as the wire format with the optional JSON parser (which, using a schema, parses JSON into a binary buffer that can then be accessed as before).</p>
|
||||
<p>The benchmark object is a set of about 10 objects containing an array, 4 strings, and a large variety of int/float scalar values of all sizes, meant to be representative of game data, e.g. a scene format.</p>
|
||||
<table class="doxtable">
|
||||
<tr>
|
||||
<th></th><th>FlatBuffers (binary) </th><th>Protocol Buffers LITE </th><th>Rapid JSON </th><th>FlatBuffers (JSON) </th><th>pugixml </th><th>Raw structs </th></tr>
|
||||
<tr>
|
||||
<td>Decode + Traverse + Dealloc (1 million times, seconds) </td><td>0.08 </td><td>302 </td><td>583 </td><td>105 </td><td>196 </td><td>0.02 </td></tr>
|
||||
<tr>
|
||||
<td>Decode / Traverse / Dealloc (breakdown) </td><td>0 / 0.08 / 0 </td><td>220 / 0.15 / 81 </td><td>294 / 0.9 / 287 </td><td>70 / 0.08 / 35 </td><td>41 / 3.9 / 150 </td><td>0 / 0.02 / 0 </td></tr>
|
||||
<tr>
|
||||
<td>Encode (1 million times, seconds) </td><td>3.2 </td><td>185 </td><td>650 </td><td>169 </td><td>273 </td><td>0.15 </td></tr>
|
||||
<tr>
|
||||
<td>Wire format size (normal / zlib, bytes) </td><td>344 / 220 </td><td>228 / 174 </td><td>1475 / 322 </td><td>1029 / 298 </td><td>1137 / 341 </td><td>312 / 187 </td></tr>
|
||||
<tr>
|
||||
<td>Memory needed to store decoded wire (bytes / blocks) </td><td>0 / 0 </td><td>760 / 20 </td><td>65689 / 4 </td><td>328 / 1 </td><td>34194 / 3 </td><td>0 / 0 </td></tr>
|
||||
<tr>
|
||||
<td>Transient memory allocated during decode (KB) </td><td>0 </td><td>1 </td><td>131 </td><td>4 </td><td>34 </td><td>0 </td></tr>
|
||||
<tr>
|
||||
<td>Generated source code size (KB) </td><td>4 </td><td>61 </td><td>0 </td><td>4 </td><td>0 </td><td>0 </td></tr>
|
||||
<tr>
|
||||
<td>Field access in handwritten traversal code </td><td>typed accessors </td><td>typed accessors </td><td>manual error checking </td><td>typed accessors </td><td>manual error checking </td><td>typed but no safety </td></tr>
|
||||
<tr>
|
||||
<td>Library source code (KB) </td><td>15 </td><td>some subset of 3800 </td><td>87 </td><td>43 </td><td>327 </td><td>0 </td></tr>
|
||||
</table>
|
||||
<h3>Some other serialization systems we compared against but did not benchmark (yet), in rough order of applicability:</h3>
|
||||
<ul>
|
||||
<li>Cap'n'Proto promises to reduce Protocol Buffers much like FlatBuffers does, though with a more complicated binary encoding and less flexibility (no optional fields to allow deprecating fields or serializing with missing fields for which defaults exist). It currently also isn't fully cross-platform portable (lack of VS support).</li>
|
||||
<li>msgpack: has very minimal forwards/backwards compatability support when used with the typed C++ interface. Also lacks VS2010 support.</li>
|
||||
<li>Thrift: very similar to Protocol Buffers, but appears to be less efficient, and have more dependencies.</li>
|
||||
<li>YAML: a superset of JSON and otherwise very similar. Used by e.g. Unity.</li>
|
||||
<li>C# comes with built-in serialization functionality, as used by Unity also. Being tied to the language, and having no automatic versioning support limits its applicability.</li>
|
||||
<li>Project Anarchy (the free mobile engine by Havok) comes with a serialization system, that however does no automatic versioning (have to code around new fields manually), is very much tied to the rest of the engine, and works without a schema to generate code (tied to your C++ class definition). </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>
|
||||
@@ -1,79 +0,0 @@
|
||||
<!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: Building</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="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td style="padding-left: 0.5em;">
|
||||
<div id="projectname">FlatBuffers
|
||||
</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__building.html','');});
|
||||
</script>
|
||||
<div id="doc-content">
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">Building </div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>There are project files for Visual Studio and Xcode that should allow you to build the compiler <code>flatc</code>, the samples and the tests out of the box.</p>
|
||||
<p>Alternatively, the distribution comes with a <code>cmake</code> file that should allow you to build project/make files for any platform. For details on <code>cmake</code>, see <a href="http://www.cmake.org">http://www.cmake.org</a>. In brief, depending on your platform, use one of e.g.: </p><pre class="fragment">cmake -G "Unix Makefiles"
|
||||
cmake -G "Visual Studio 10"
|
||||
cmake -G "Xcode"
|
||||
</pre><p>Then, build as normal for your platform. This should result in a <code>flatc</code> 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. <code>CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -G "Unix Makefiles"</code>.</p>
|
||||
<p>Optionally, run the <code>flattests</code> executable to ensure everything is working correctly on your system. If this fails, please contact us!</p>
|
||||
<p>Note that you MUST be in the root of the FlatBuffers distribution when you run 'flattests' (and the samples), or it will fail to load its files.</p>
|
||||
<p>Building should also produce two sample executables, <code>sample_binary</code> and <code>sample_text</code>, see the corresponding <code>.cpp</code> file in the samples directory.</p>
|
||||
<p>There is an <code>android</code> directory that contains all you need to build the test executable on android (use the included <code>build_apk.sh</code> script, or use <code>ndk_build</code> / <code>adb</code> etc. as usual). Upon running, it will output to the log if tests succeeded or not.</p>
|
||||
<p>There is usually no runtime to compile, as the code consists of a single header, <code>include/flatbuffers/flatbuffers.h</code>. You should add the <code>include</code> folder to your include paths. If you wish to be able to load schemas and/or parse text into binary buffers at runtime, you additionally need the other headers in <code>include/flatbuffers</code>. You must also compile/link <code>src/idl_parser.cpp</code> (and <code>src/idl_gen_text.cpp</code> if you also want to be able convert binary to text).</p>
|
||||
<p>For applications on Google Play that integrate this library, usage is tracked. This tracking is done automatically using the embedded version string (flatbuffer_version_string), and helps us continue to optimize it. Aside from consuming a few extra bytes in your application binary, it shouldn't affect your application at all. We use this information to let us know if FlatBuffers is useful and if we should continue to invest in it. Since this is open source, you are free to remove the version string but we would appreciate if you would leave it in. </p>
|
||||
</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>
|
||||
@@ -1,87 +0,0 @@
|
||||
<!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: Using the schema compiler</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="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td style="padding-left: 0.5em;">
|
||||
<div id="projectname">FlatBuffers
|
||||
</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__compiler.html','');});
|
||||
</script>
|
||||
<div id="doc-content">
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">Using the schema compiler </div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>Usage: </p><pre class="fragment">flatc [ -c ] [ -j ] [ -b ] [ -t ] [ -o PATH ] [ -I PATH ] [ -S ] FILES...
|
||||
[ -- FILES...]
|
||||
</pre><p>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.</p>
|
||||
<p><code>--</code> indicates that the following files are binary files in FlatBuffer format conforming to the schema(s) indicated before it. Incompatible binary files currently will give unpredictable results (!)</p>
|
||||
<p>Depending on the flags passed, additional files may be generated for each file processed:</p>
|
||||
<ul>
|
||||
<li><code>-c</code> : Generate a C++ header for all definitions in this file (as <code>filename_generated.h</code>). Skipped for data.</li>
|
||||
<li><code>-j</code> : Generate Java classes. Skipped for data.</li>
|
||||
<li><code>-n</code> : Generate C# classes. Skipped for data.</li>
|
||||
<li><code>-g</code> : Generate Go classes. Skipped for data.</li>
|
||||
<li><code>-b</code> : If data is contained in this file, generate a <code>filename.bin</code> containing the binary flatbuffer.</li>
|
||||
<li><code>-t</code> : If data is contained in this file, generate a <code>filename.json</code> representing the data in the flatbuffer.</li>
|
||||
<li><code>-o PATH</code> : Output all generated files to PATH (either absolute, or relative to the current directory). If omitted, PATH will be the current directory. PATH should end in your systems path separator, e.g. <code>/</code> or <code>\</code>.</li>
|
||||
<li><code>-I PATH</code> : when encountering <code>include</code> statements, attempt to load the files from this path. Paths will be tried in the order given, and if all fail (or none are specified) it will try to load relative to the path of the schema file being parsed.</li>
|
||||
<li><code>--strict-json</code> : Require & generate strict JSON (field names are enclosed in quotes, no trailing commas in tables/vectors). By default, no quotes are required/generated, and trailing commas are allowed.</li>
|
||||
<li><code>--no-prefix</code> : Don't prefix enum values in generated C++ by their enum type.</li>
|
||||
<li><code>--gen-includes</code> : Generate include statements for included schemas the generated file depends on (C++).</li>
|
||||
<li><code>--proto</code>: Expect input files to be .proto files (protocol buffers). Output the corresponding .fbs file. Currently supports: <code>package</code>, <code>message</code>, <code>enum</code>. Does not support, but will skip without error: <code>import</code>, <code>option</code>. Does not support, will generate error: <code>service</code>, <code>extend</code>, <code>extensions</code>, <code>oneof</code>, <code>group</code>, custom options, nested declarations. </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>
|
||||
@@ -1,164 +0,0 @@
|
||||
<!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: Use in C++</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="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td style="padding-left: 0.5em;">
|
||||
<div id="projectname">FlatBuffers
|
||||
</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__cpp_usage.html','');});
|
||||
</script>
|
||||
<div id="doc-content">
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">Use in C++ </div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>Assuming you have written a schema using the above language in say <code>mygame.fbs</code> (FlatBuffer Schema, though the extension doesn't matter), you've generated a C++ header called <code>mygame_generated.h</code> using the compiler (e.g. <code>flatc -c mygame.fbs</code>), you can now start using this in your program by including the header. As noted, this header relies on <code>flatbuffers/flatbuffers.h</code>, which should be in your include path.</p>
|
||||
<h3>Writing in C++</h3>
|
||||
<p>To start creating a buffer, create an instance of <code>FlatBufferBuilder</code> which will contain the buffer as it grows:</p>
|
||||
<div class="fragment"><div class="line">FlatBufferBuilder fbb;</div>
|
||||
</div><!-- fragment --><p>Before we serialize a Monster, we need to first serialize any objects that are contained there-in, i.e. we serialize the data tree using depth first, pre-order traversal. This is generally easy to do on any tree structures. For example:</p>
|
||||
<div class="fragment"><div class="line"><span class="keyword">auto</span> name = fbb.CreateString(<span class="stringliteral">"MyMonster"</span>);</div>
|
||||
<div class="line"></div>
|
||||
<div class="line"><span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> inv[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };</div>
|
||||
<div class="line"><span class="keyword">auto</span> inventory = fbb.CreateVector(inv, 10);</div>
|
||||
</div><!-- fragment --><p><code>CreateString</code> and <code>CreateVector</code> serialize these two built-in datatypes, and return offsets into the serialized data indicating where they are stored, such that <code>Monster</code> below can refer to them.</p>
|
||||
<p><code>CreateString</code> can also take an <code>std::string</code>, or a <code>const char *</code> with an explicit length, and is suitable for holding UTF-8 and binary data if needed.</p>
|
||||
<p><code>CreateVector</code> can also take an <code>std::vector</code>. The offset it returns is typed, i.e. can only be used to set fields of the correct type below. To create a vector of struct objects (which will be stored as contiguous memory in the buffer, use <code>CreateVectorOfStructs</code> instead.</p>
|
||||
<p>To create a vector of nested objects (e.g. tables, strings or other vectors) collect their offsets in a temporary array/vector, then call <code>CreateVector</code> on that (see e.g. the array of strings example in <code>test.cpp</code> <code>CreateFlatBufferTest</code>).</p>
|
||||
<div class="fragment"><div class="line">Vec3 vec(1, 2, 3);</div>
|
||||
</div><!-- fragment --><p><code>Vec3</code> is the first example of code from our generated header. Structs (unlike tables) translate to simple structs in C++, so we can construct them in a familiar way.</p>
|
||||
<p>We have now serialized the non-scalar components of of the monster example, so we could create the monster something like this:</p>
|
||||
<div class="fragment"><div class="line"><span class="keyword">auto</span> mloc = CreateMonster(fbb, &vec, 150, 80, name, inventory, Color_Red, 0, Any_NONE);</div>
|
||||
</div><!-- fragment --><p>Note that we're passing <code>150</code> for the <code>mana</code> field, which happens to be the default value: this means the field will not actually be written to the buffer, since we'll get that value anyway when we query it. This is a nice space savings, since it is very common for fields to be at their default. It means we also don't need to be scared to add fields only used in a minority of cases, since they won't bloat up the buffer sizes if they're not actually used.</p>
|
||||
<p>We do something similarly for the union field <code>test</code> by specifying a <code>0</code> offset and the <code>NONE</code> enum value (part of every union) to indicate we don't actually want to write this field. You can use <code>0</code> also as a default for other non-scalar types, such as strings, vectors and tables.</p>
|
||||
<p>Tables (like <code>Monster</code>) give you full flexibility on what fields you write (unlike <code>Vec3</code>, which always has all fields set because it is a <code>struct</code>). If you want even more control over this (i.e. skip fields even when they are not default), instead of the convenient <code>CreateMonster</code> call we can also build the object field-by-field manually:</p>
|
||||
<div class="fragment"><div class="line">MonsterBuilder mb(fbb);</div>
|
||||
<div class="line">mb.add_pos(&vec);</div>
|
||||
<div class="line">mb.add_hp(80);</div>
|
||||
<div class="line">mb.add_name(name);</div>
|
||||
<div class="line">mb.add_inventory(inventory);</div>
|
||||
<div class="line"><span class="keyword">auto</span> mloc = mb.Finish();</div>
|
||||
</div><!-- fragment --><p>We start with a temporary helper class <code>MonsterBuilder</code> (which is defined in our generated code also), then call the various <code>add_</code> methods to set fields, and <code>Finish</code> to complete the object. This is pretty much the same code as you find inside <code>CreateMonster</code>, except we're leaving out a few fields. Fields may also be added in any order, though orderings with fields of the same size adjacent to each other most efficient in size, due to alignment. You should not nest these Builder classes (serialize your data in pre-order).</p>
|
||||
<p>Regardless of whether you used <code>CreateMonster</code> or <code>MonsterBuilder</code>, you now have an offset to the root of your data, and you can finish the buffer using:</p>
|
||||
<div class="fragment"><div class="line">FinishMonsterBuffer(fbb, mloc);</div>
|
||||
</div><!-- fragment --><p>The buffer is now ready to be stored somewhere, sent over the network, be compressed, or whatever you'd like to do with it. You can access the start of the buffer with <code>fbb.GetBufferPointer()</code>, and it's size from <code>fbb.GetSize()</code>.</p>
|
||||
<p>Calling code may take ownership of the buffer with <code>fbb.ReleaseBufferPointer()</code>. Should you do it, the <code>FlatBufferBuilder</code> will be in an invalid state, and <em>must</em> be cleared before it can be used again. However, it also means you are able to destroy the builder while keeping the buffer in your application.</p>
|
||||
<p><code>samples/sample_binary.cpp</code> is a complete code sample similar to the code above, that also includes the reading code below.</p>
|
||||
<h3>Reading in C++</h3>
|
||||
<p>If you've received a buffer from somewhere (disk, network, etc.) you can directly start traversing it using:</p>
|
||||
<div class="fragment"><div class="line"><span class="keyword">auto</span> monster = GetMonster(buffer_pointer);</div>
|
||||
</div><!-- fragment --><p><code>monster</code> is of type <code>Monster *</code>, and points to somewhere <em>inside</em> your buffer (root object pointers are not the same as <code>buffer_pointer</code> !). If you look in your generated header, you'll see it has convenient accessors for all fields, e.g.</p>
|
||||
<div class="fragment"><div class="line">assert(monster->hp() == 80);</div>
|
||||
<div class="line">assert(monster->mana() == 150); <span class="comment">// default</span></div>
|
||||
<div class="line">assert(strcmp(monster->name()->c_str(), <span class="stringliteral">"MyMonster"</span>) == 0);</div>
|
||||
</div><!-- fragment --><p>These should all be true. Note that we never stored a <code>mana</code> value, so it will return the default.</p>
|
||||
<p>To access sub-objects, in this case the <code>Vec3</code>:</p>
|
||||
<div class="fragment"><div class="line"><span class="keyword">auto</span> pos = monster->pos();</div>
|
||||
<div class="line">assert(pos);</div>
|
||||
<div class="line">assert(pos->z() == 3);</div>
|
||||
</div><!-- fragment --><p>If we had not set the <code>pos</code> field during serialization, it would be <code>NULL</code>.</p>
|
||||
<p>Similarly, we can access elements of the inventory array:</p>
|
||||
<div class="fragment"><div class="line"><span class="keyword">auto</span> inv = monster->inventory();</div>
|
||||
<div class="line">assert(inv);</div>
|
||||
<div class="line">assert(inv->Get(9) == 9);</div>
|
||||
</div><!-- fragment --><h3>Storing maps / dictionaries in a FlatBuffer</h3>
|
||||
<p>FlatBuffers doesn't support maps natively, but there is support to emulate their behavior with vectors and binary search, which means you can have fast lookups directly from a FlatBuffer without having to unpack your data into a <code>std::map</code> or similar.</p>
|
||||
<p>To use it:</p><ul>
|
||||
<li>Designate one of the fields in a table as they "key" field. You do this by setting the <code>key</code> attribute on this field, e.g. <code>name:string (key)</code>. You may only have one key field, and it must be of string or scalar type.</li>
|
||||
<li>Write out tables of this type as usual, collect their offsets in an array or vector.</li>
|
||||
<li>Instead of <code>CreateVector</code>, call <code>CreateVectorOfSortedTables</code>, which will first sort all offsets such that the tables they refer to are sorted by the key field, then serialize it.</li>
|
||||
<li>Now when you're accessing the FlatBuffer, you can use <code>Vector::LookupByKey</code> instead of just <code>Vector::Get</code> to access elements of the vector, e.g.: <code>myvector->LookupByKey("Fred")</code>, which returns a pointer to the corresponding table type, or <code>nullptr</code> if not found. <code>LookupByKey</code> performs a binary search, so should have a similar speed to <code>std::map</code>, though may be faster because of better caching. <code>LookupByKey</code> only works if the vector has been sorted, it will likely not find elements if it hasn't been sorted.</li>
|
||||
</ul>
|
||||
<h3>Direct memory access</h3>
|
||||
<p>As you can see from the above examples, all elements in a buffer are accessed through generated accessors. This is because everything is stored in little endian format on all platforms (the accessor performs a swap operation on big endian machines), and also because the layout of things is generally not known to the user.</p>
|
||||
<p>For structs, layout is deterministic and guaranteed to be the same accross platforms (scalars are aligned to their own size, and structs themselves to their largest member), and you are allowed to access this memory directly by using <code>sizeof()</code> and <code>memcpy</code> on the pointer to a struct, or even an array of structs.</p>
|
||||
<p>To compute offsets to sub-elements of a struct, make sure they are a structs themselves, as then you can use the pointers to figure out the offset without having to hardcode it. This is handy for use of arrays of structs with calls like <code>glVertexAttribPointer</code> in OpenGL or similar APIs.</p>
|
||||
<p>It is important to note is that structs are still little endian on all machines, so only use tricks like this if you can guarantee you're not shipping on a big endian machine (an <code>assert(FLATBUFFERS_LITTLEENDIAN)</code> would be wise).</p>
|
||||
<h3>Access of untrusted buffers</h3>
|
||||
<p>The generated accessor functions access fields over offsets, which is very quick. These offsets are not verified at run-time, so a malformed buffer could cause a program to crash by accessing random memory.</p>
|
||||
<p>When you're processing large amounts of data from a source you know (e.g. your own generated data on disk), this is acceptable, but when reading data from the network that can potentially have been modified by an attacker, this is undesirable.</p>
|
||||
<p>For this reason, you can optionally use a buffer verifier before you access the data. This verifier will check all offsets, all sizes of fields, and null termination of strings to ensure that when a buffer is accessed, all reads will end up inside the buffer.</p>
|
||||
<p>Each root type will have a verification function generated for it, e.g. for <code>Monster</code>, you can call:</p>
|
||||
<div class="fragment"><div class="line"><span class="keywordtype">bool</span> ok = VerifyMonsterBuffer(Verifier(buf, len));</div>
|
||||
</div><!-- fragment --><p>if <code>ok</code> is true, the buffer is safe to read.</p>
|
||||
<p>Besides untrusted data, this function may be useful to call in debug mode, as extra insurance against data being corrupted somewhere along the way.</p>
|
||||
<p>While verifying a buffer isn't "free", it is typically faster than a full traversal (since any scalar data is not actually touched), and since it may cause the buffer to be brought into cache before reading, the actual overhead may be even lower than expected.</p>
|
||||
<p>In specialized cases where a denial of service attack is possible, the verifier has two additional constructor arguments that allow you to limit the nesting depth and total amount of tables the verifier may encounter before declaring the buffer malformed. The default is <code>Verifier(buf, len, 64 /* max depth */, 1000000, /* max tables */)</code> which should be sufficient for most uses.</p>
|
||||
<h2>Text & schema parsing</h2>
|
||||
<p>Using binary buffers with the generated header provides a super low overhead use of FlatBuffer data. There are, however, times when you want to use text formats, for example because it interacts better with source control, or you want to give your users easy access to data.</p>
|
||||
<p>Another reason might be that you already have a lot of data in JSON format, or a tool that generates JSON, and if you can write a schema for it, this will provide you an easy way to use that data directly.</p>
|
||||
<p>(see the schema documentation for some specifics on the JSON format accepted).</p>
|
||||
<p>There are two ways to use text formats:</p>
|
||||
<h3>Using the compiler as a conversion tool</h3>
|
||||
<p>This is the preferred path, as it doesn't require you to add any new code to your program, and is maximally efficient since you can ship with binary data. The disadvantage is that it is an extra step for your users/developers to perform, though you might be able to automate it. </p><pre class="fragment">flatc -b myschema.fbs mydata.json
|
||||
</pre><p>This will generate the binary file <code>mydata_wire.bin</code> which can be loaded as before.</p>
|
||||
<h3>Making your program capable of loading text directly</h3>
|
||||
<p>This gives you maximum flexibility. You could even opt to support both, i.e. check for both files, and regenerate the binary from text when required, otherwise just load the binary.</p>
|
||||
<p>This option is currently only available for C++, or Java through JNI.</p>
|
||||
<p>As mentioned in the section "Building" above, this technique requires you to link a few more files into your program, and you'll want to include <code>flatbuffers/idl.h</code>.</p>
|
||||
<p>Load text (either a schema or json) into an in-memory buffer (there is a convenient <code>LoadFile()</code> utility function in <code>flatbuffers/util.h</code> if you wish). Construct a parser:</p>
|
||||
<div class="fragment"><div class="line">flatbuffers::Parser parser;</div>
|
||||
</div><!-- fragment --><p>Now you can parse any number of text files in sequence:</p>
|
||||
<div class="fragment"><div class="line">parser.Parse(text_file.c_str());</div>
|
||||
</div><!-- fragment --><p>This works similarly to how the command-line compiler works: a sequence of files parsed by the same <code>Parser</code> object allow later files to reference definitions in earlier files. Typically this means you first load a schema file (which populates <code>Parser</code> with definitions), followed by one or more JSON files.</p>
|
||||
<p>As optional argument to <code>Parse</code>, you may specify a null-terminated list of include paths. If not specified, any include statements try to resolve from the current directory.</p>
|
||||
<p>If there were any parsing errors, <code>Parse</code> will return <code>false</code>, and <code>Parser::err</code> contains a human readable error string with a line number etc, which you should present to the creator of that file.</p>
|
||||
<p>After each JSON file, the <code>Parser::fbb</code> member variable is the <code>FlatBufferBuilder</code> that contains the binary buffer version of that file, that you can access as described above.</p>
|
||||
<p><code>samples/sample_text.cpp</code> is a code sample showing the above operations.</p>
|
||||
<h3>Threading</h3>
|
||||
<p>Reading a FlatBuffer does not touch any memory outside the original buffer, and is entirely read-only (all const), so is safe to access from multiple threads even without synchronisation primitives.</p>
|
||||
<p>Creating a FlatBuffer is not thread safe. All state related to building a FlatBuffer is contained in a FlatBufferBuilder instance, and no memory outside of it is touched. To make this thread safe, either do not share instances of FlatBufferBuilder between threads (recommended), or manually wrap it in synchronisation primites. There's no automatic way to accomplish this, by design, as we feel multithreaded construction of a single buffer will be rare, and synchronisation overhead would be costly. </p>
|
||||
</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>
|
||||
@@ -1,114 +0,0 @@
|
||||
<!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: Use in Go</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="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td style="padding-left: 0.5em;">
|
||||
<div id="projectname">FlatBuffers
|
||||
</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__go_usage.html','');});
|
||||
</script>
|
||||
<div id="doc-content">
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">Use in Go </div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>There's experimental support for reading FlatBuffers in Go. Generate code for Go with the <code>-g</code> option to <code>flatc</code>.</p>
|
||||
<p>See <code>go_test.go</code> for an example. You import the generated code, read a FlatBuffer binary file into a <code>[]byte</code>, which you pass to the <code>GetRootAsMonster</code> function:</p>
|
||||
<div class="fragment"><div class="line"><span class="keyword">import</span> (</div>
|
||||
<div class="line"> example <span class="stringliteral">"MyGame/Example"</span></div>
|
||||
<div class="line"> flatbuffers <span class="stringliteral">"github.com/google/flatbuffers/go"</span></div>
|
||||
<div class="line"></div>
|
||||
<div class="line"> io/ioutil</div>
|
||||
<div class="line">)</div>
|
||||
<div class="line"></div>
|
||||
<div class="line">buf, err := ioutil.ReadFile(<span class="stringliteral">"monster.dat"</span>)</div>
|
||||
<div class="line"><span class="comment">// handle err</span></div>
|
||||
<div class="line">monster := example.GetRootAsMonster(buf, 0)</div>
|
||||
</div><!-- fragment --><p>Now you can access values like this:</p>
|
||||
<div class="fragment"><div class="line">hp := monster.Hp()</div>
|
||||
<div class="line">pos := monster.Pos(nil)</div>
|
||||
</div><!-- fragment --><p>Note that whenever you access a new object like in the <code>Pos</code> example above, a new temporary accessor object gets created. If your code is very performance sensitive (you iterate through a lot of objects), you can replace nil with a pointer to a <code>Vec3</code> 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.</p>
|
||||
<p>To access vectors you pass an extra index to the vector field accessor. Then a second method with the same name suffixed by <code>Length</code> let's you know the number of elements you can access:</p>
|
||||
<div class="fragment"><div class="line"><span class="keywordflow">for</span> i := 0; i < monster.InventoryLength(); i++ {</div>
|
||||
<div class="line"> monster.Inventory(i) <span class="comment">// do something here</span></div>
|
||||
<div class="line">}</div>
|
||||
</div><!-- fragment --><p>You can also construct these buffers in Go using the functions found in the generated code, and the FlatBufferBuilder class:</p>
|
||||
<div class="fragment"><div class="line">builder := flatbuffers.NewBuilder(0)</div>
|
||||
</div><!-- fragment --><p>Create strings:</p>
|
||||
<div class="fragment"><div class="line">str := builder.CreateString(<span class="stringliteral">"MyMonster"</span>)</div>
|
||||
</div><!-- fragment --><p>Create a table with a struct contained therein:</p>
|
||||
<div class="fragment"><div class="line">example.MonsterStart(builder)</div>
|
||||
<div class="line">example.MonsterAddPos(builder, example.CreateVec3(builder, 1.0, 2.0, 3.0, 3.0, 4, 5, 6))</div>
|
||||
<div class="line">example.MonsterAddHp(builder, 80)</div>
|
||||
<div class="line">example.MonsterAddName(builder, str)</div>
|
||||
<div class="line">example.MonsterAddInventory(builder, inv)</div>
|
||||
<div class="line">example.MonsterAddTest_Type(builder, 1)</div>
|
||||
<div class="line">example.MonsterAddTest(builder, mon2)</div>
|
||||
<div class="line">example.MonsterAddTest4(builder, test4s)</div>
|
||||
<div class="line">mon := example.MonsterEnd(builder)</div>
|
||||
</div><!-- fragment --><p>Unlike C++, Go does not support table creation functions like 'createMonster()'. This is to create the buffer without using temporary object allocation (since the <code>Vec3</code> is an inline component of <code>Monster</code>, it has to be created right where it is added, whereas the name and the inventory are not inline, and <b>must</b> be created outside of the table creation sequence). Structs do have convenient methods that allow you to construct them in one call. These also have arguments for nested structs, e.g. if a struct has a field <code>a</code> and a nested struct field <code>b</code> (which has fields <code>c</code> and <code>d</code>), then the arguments will be <code>a</code>, <code>c</code> and <code>d</code>.</p>
|
||||
<p>Vectors also use this start/end pattern to allow vectors of both scalar types and structs:</p>
|
||||
<div class="fragment"><div class="line">example.MonsterStartInventoryVector(builder, 5)</div>
|
||||
<div class="line"><span class="keywordflow">for</span> i := 4; i >= 0; i-- {</div>
|
||||
<div class="line"> builder.PrependByte(byte(i))</div>
|
||||
<div class="line">}</div>
|
||||
<div class="line">inv := builder.EndVector(5)</div>
|
||||
</div><!-- fragment --><p>The generated method 'StartInventoryVector' is provided as a convenience function which calls 'StartVector' with the correct element size of the vector type which in this case is 'ubyte' or 1 byte per vector element. You pass the number of elements you want to write. You write the elements backwards since the buffer is being constructed back to front. Use the correct <code>Prepend</code> call for the type, or <code>PrependUOffsetT</code> for offsets. You then pass <code>inv</code> to the corresponding <code>Add</code> call when you construct the table containing it afterwards.</p>
|
||||
<p>There are <code>Prepend</code> functions for all the scalar types. You use <code>PrependUOffset</code> for any previously constructed objects (such as other tables, strings, vectors). For structs, you use the appropriate <code>create</code> function in-line, as shown above in the <code>Monster</code> example.</p>
|
||||
<p>Once you're done constructing a buffer, you call <code>Finish</code> with the root object offset (<code>mon</code> in the example above). Your data now resides in Builder.Bytes. Important to note is that the real data starts at the index indicated by Head(), for Offset() bytes (this is because the buffer is constructed backwards). If you wanted to read the buffer right after creating it (using <code>GetRootAsMonster</code> above), the second argument, instead of <code>0</code> would thus also be <code>Head()</code>.</p>
|
||||
<h2>Text Parsing</h2>
|
||||
<p>There currently is no support for parsing text (Schema's and JSON) directly from Go, though you could use the C++ parser through cgo. Please see the C++ documentation for more on text parsing. </p>
|
||||
</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>
|
||||
@@ -1,83 +0,0 @@
|
||||
<!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: Formal Grammar of the schema language</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="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td style="padding-left: 0.5em;">
|
||||
<div id="projectname">FlatBuffers
|
||||
</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__grammar.html','');});
|
||||
</script>
|
||||
<div id="doc-content">
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">Formal Grammar of the schema language </div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>schema = include* ( namespace_decl | type_decl | enum_decl | root_decl | attribute_decl | object )*</p>
|
||||
<p>include = <code>include</code> string_constant <code>;</code></p>
|
||||
<p>namespace_decl = <code>namespace</code> ident ( <code>.</code> ident )* <code>;</code></p>
|
||||
<p>attribute_decl = <code>attribute</code> string_constant <code>;</code></p>
|
||||
<p>type_decl = ( <code>table</code> | <code>struct</code> ) ident metadata <code>{</code> field_decl+ <code>}</code></p>
|
||||
<p>enum_decl = ( <code>enum</code> | <code>union</code> ) ident [ <code>:</code> type ] metadata <code>{</code> commasep( enumval_decl ) <code>}</code></p>
|
||||
<p>root_decl = <code>root_type</code> ident <code>;</code></p>
|
||||
<p>field_decl = type <code>:</code> ident [ <code>=</code> scalar ] metadata <code>;</code></p>
|
||||
<p>type = <code>bool</code> | <code>byte</code> | <code>ubyte</code> | <code>short</code> | <code>ushort</code> | <code>int</code> | <code>uint</code> | <code>float</code> | <code>long</code> | <code>ulong</code> | <code>double</code> | <code>string</code> | <code>[</code> type <code>]</code> | ident</p>
|
||||
<p>enumval_decl = ident [ <code>=</code> integer_constant ]</p>
|
||||
<p>metadata = [ <code>(</code> commasep( ident [ <code>:</code> scalar ] ) <code>)</code> ]</p>
|
||||
<p>scalar = integer_constant | float_constant | <code>true</code> | <code>false</code></p>
|
||||
<p>object = { commasep( ident <code>:</code> value ) }</p>
|
||||
<p>value = scalar | object | string_constant | <code>[</code> commasep( value ) <code>]</code></p>
|
||||
<p>commasep(x) = [ x ( <code>,</code> x )* ] </p>
|
||||
</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>
|
||||
@@ -1,169 +0,0 @@
|
||||
<!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: FlatBuffer Internals</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="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td style="padding-left: 0.5em;">
|
||||
<div id="projectname">FlatBuffers
|
||||
</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__internals.html','');});
|
||||
</script>
|
||||
<div id="doc-content">
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">FlatBuffer Internals </div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>This section is entirely optional for the use of FlatBuffers. In normal usage, you should never need the information contained herein. If you're interested however, it should give you more of an appreciation of why FlatBuffers is both efficient and convenient.</p>
|
||||
<h3>Format components</h3>
|
||||
<p>A FlatBuffer is a binary file and in-memory format consisting mostly of scalars of various sizes, all aligned to their own size. Each scalar is also always represented in little-endian format, as this corresponds to all commonly used CPUs today. FlatBuffers will also work on big-endian machines, but will be slightly slower because of additional byte-swap intrinsics.</p>
|
||||
<p>On purpose, the format leaves a lot of details about where exactly things live in memory undefined, e.g. fields in a table can have any order, and objects to some extend can be stored in many orders. This is because the format doesn't need this information to be efficient, and it leaves room for optimization and extension (for example, fields can be packed in a way that is most compact). Instead, the format is defined in terms of offsets and adjacency only. This may mean two different implementations may produce different binaries given the same input values, and this is perfectly valid.</p>
|
||||
<h3>Format identification</h3>
|
||||
<p>The format also doesn't contain information for format identification and versioning, which is also by design. FlatBuffers is a statically typed system, meaning the user of a buffer needs to know what kind of buffer it is. FlatBuffers can of course be wrapped inside other containers where needed, or you can use its union feature to dynamically identify multiple possible sub-objects stored. Additionally, it can be used together with the schema parser if full reflective capabilities are desired.</p>
|
||||
<p>Versioning is something that is intrinsically part of the format (the optionality / extensibility of fields), so the format itself does not need a version number (it's a meta-format, in a sense). We're hoping that this format can accommodate all data needed. If format breaking changes are ever necessary, it would become a new kind of format rather than just a variation.</p>
|
||||
<h3>Offsets</h3>
|
||||
<p>The most important and generic offset type (see <code>flatbuffers.h</code>) is <code>uoffset_t</code>, which is currently always a <code>uint32_t</code>, and is used to refer to all tables/unions/strings/vectors (these are never stored in-line). 32bit is intentional, since we want to keep the format binary compatible between 32 and 64bit systems, and a 64bit offset would bloat the size for almost all uses. A version of this format with 64bit (or 16bit) offsets is easy to set when needed. Unsigned means they can only point in one direction, which typically is forward (towards a higher memory location). Any backwards offsets will be explicitly marked as such.</p>
|
||||
<p>The format starts with an <code>uoffset_t</code> to the root object in the buffer.</p>
|
||||
<p>We have two kinds of objects, structs and tables.</p>
|
||||
<h3>Structs</h3>
|
||||
<p>These are the simplest, and as mentioned, intended for simple data that benefits from being extra efficient and doesn't need versioning / extensibility. They are always stored inline in their parent (a struct, table, or vector) for maximum compactness. Structs define a consistent memory layout where all components are aligned to their size, and structs aligned to their largest scalar member. This is done independent of the alignment rules of the underlying compiler to guarantee a cross platform compatible layout. This layout is then enforced in the generated code.</p>
|
||||
<h3>Tables</h3>
|
||||
<p>These start with an <code>soffset_t</code> to a vtable. This is a signed version of <code>uoffset_t</code>, since vtables may be stored anywhere relative to the object. This offset is substracted (not added) from the object start to arrive at the vtable start. This offset is followed by all the fields as aligned scalars (or offsets). Unlike structs, not all fields need to be present. There is no set order and layout.</p>
|
||||
<p>To be able to access fields regardless of these uncertainties, we go through a vtable of offsets. Vtables are shared between any objects that happen to have the same vtable values.</p>
|
||||
<p>The elements of a vtable are all of type <code>voffset_t</code>, which is a <code>uint16_t</code>. The first element is the size of the vtable in bytes, including the size element. The second one is the size of the object, in bytes (including the vtable offset). This size could be used for streaming, to know how many bytes to read to be able to access all fields of the object. The remaining elements are the N offsets, where N is the amount of fields declared in the schema when the code that constructed this buffer was compiled (thus, the size of the table is N + 2).</p>
|
||||
<p>All accessor functions in the generated code for tables contain the offset into this table as a constant. This offset is checked against the first field (the number of elements), to protect against newer code reading older data. If this offset is out of range, or the vtable entry is 0, that means the field is not present in this object, and the default value is return. Otherwise, the entry is used as offset to the field to be read.</p>
|
||||
<h3>Strings and Vectors</h3>
|
||||
<p>Strings are simply a vector of bytes, and are always null-terminated. Vectors are stored as contiguous aligned scalar elements prefixed by a 32bit element count (not including any null termination).</p>
|
||||
<h3>Construction</h3>
|
||||
<p>The current implementation constructs these buffers backwards (starting at the highest memory address of the buffer), since that significantly reduces the amount of bookkeeping and simplifies the construction API.</p>
|
||||
<h3>Code example</h3>
|
||||
<p>Here's an example of the code that gets generated for the <code>samples/monster.fbs</code>. What follows is the entire file, broken up by comments: </p><pre class="fragment">// automatically generated, do not modify
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
namespace MyGame {
|
||||
namespace Sample {
|
||||
</pre><p>Nested namespace support. </p><pre class="fragment">enum {
|
||||
Color_Red = 0,
|
||||
Color_Green = 1,
|
||||
Color_Blue = 2,
|
||||
};
|
||||
|
||||
inline const char **EnumNamesColor() {
|
||||
static const char *names[] = { "Red", "Green", "Blue", nullptr };
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameColor(int e) { return EnumNamesColor()[e]; }
|
||||
</pre><p>Enums and convenient reverse lookup. </p><pre class="fragment">enum {
|
||||
Any_NONE = 0,
|
||||
Any_Monster = 1,
|
||||
};
|
||||
|
||||
inline const char **EnumNamesAny() {
|
||||
static const char *names[] = { "NONE", "Monster", nullptr };
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameAny(int e) { return EnumNamesAny()[e]; }
|
||||
</pre><p>Unions share a lot with enums. </p><pre class="fragment">struct Vec3;
|
||||
struct Monster;
|
||||
</pre><p>Predeclare all data types since circular references between types are allowed (circular references between object are not, though). </p><pre class="fragment">MANUALLY_ALIGNED_STRUCT(4) Vec3 {
|
||||
private:
|
||||
float x_;
|
||||
float y_;
|
||||
float z_;
|
||||
|
||||
public:
|
||||
Vec3(float x, float y, float z)
|
||||
: x_(flatbuffers::EndianScalar(x)), y_(flatbuffers::EndianScalar(y)), z_(flatbuffers::EndianScalar(z)) {}
|
||||
|
||||
float x() const { return flatbuffers::EndianScalar(x_); }
|
||||
float y() const { return flatbuffers::EndianScalar(y_); }
|
||||
float z() const { return flatbuffers::EndianScalar(z_); }
|
||||
};
|
||||
STRUCT_END(Vec3, 12);
|
||||
</pre><p>These ugly macros do a couple of things: they turn off any padding the compiler might normally do, since we add padding manually (though none in this example), and they enforce alignment chosen by FlatBuffers. This ensures the layout of this struct will look the same regardless of compiler and platform. Note that the fields are private: this is because these store little endian scalars regardless of platform (since this is part of the serialized data). <code>EndianScalar</code> then converts back and forth, which is a no-op on all current mobile and desktop platforms, and a single machine instruction on the few remaining big endian platforms. </p><pre class="fragment">struct Monster : private flatbuffers::Table {
|
||||
const Vec3 *pos() const { return GetStruct<const Vec3 *>(4); }
|
||||
int16_t mana() const { return GetField<int16_t>(6, 150); }
|
||||
int16_t hp() const { return GetField<int16_t>(8, 100); }
|
||||
const flatbuffers::String *name() const { return GetPointer<const flatbuffers::String *>(10); }
|
||||
const flatbuffers::Vector<uint8_t> *inventory() const { return GetPointer<const flatbuffers::Vector<uint8_t> *>(14); }
|
||||
int8_t color() const { return GetField<int8_t>(16, 2); }
|
||||
};
|
||||
</pre><p>Tables are a bit more complicated. A table accessor struct is used to point at the serialized data for a table, which always starts with an offset to its vtable. It derives from <code>Table</code>, which contains the <code>GetField</code> helper functions. GetField takes a vtable offset, and a default value. It will look in the vtable at that offset. If the offset is out of bounds (data from an older version) or the vtable entry is 0, the field is not present and the default is returned. Otherwise, it uses the entry as an offset into the table to locate the field. </p><pre class="fragment">struct MonsterBuilder {
|
||||
flatbuffers::FlatBufferBuilder &fbb_;
|
||||
flatbuffers::uoffset_t start_;
|
||||
void add_pos(const Vec3 *pos) { fbb_.AddStruct(4, pos); }
|
||||
void add_mana(int16_t mana) { fbb_.AddElement<int16_t>(6, mana, 150); }
|
||||
void add_hp(int16_t hp) { fbb_.AddElement<int16_t>(8, hp, 100); }
|
||||
void add_name(flatbuffers::Offset<flatbuffers::String> name) { fbb_.AddOffset(10, name); }
|
||||
void add_inventory(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> inventory) { fbb_.AddOffset(14, inventory); }
|
||||
void add_color(int8_t color) { fbb_.AddElement<int8_t>(16, color, 2); }
|
||||
MonsterBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
|
||||
flatbuffers::Offset<Monster> Finish() { return flatbuffers::Offset<Monster>(fbb_.EndTable(start_, 7)); }
|
||||
};
|
||||
</pre><p><code>MonsterBuilder</code> is the base helper struct to construct a table using a <code>FlatBufferBuilder</code>. You can add the fields in any order, and the <code>Finish</code> call will ensure the correct vtable gets generated. </p><pre class="fragment">inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const Vec3 *pos, int16_t mana, int16_t hp, flatbuffers::Offset<flatbuffers::String> name, flatbuffers::Offset<flatbuffers::Vector<uint8_t>> inventory, int8_t color) {
|
||||
MonsterBuilder builder_(_fbb);
|
||||
builder_.add_inventory(inventory);
|
||||
builder_.add_name(name);
|
||||
builder_.add_pos(pos);
|
||||
builder_.add_hp(hp);
|
||||
builder_.add_mana(mana);
|
||||
builder_.add_color(color);
|
||||
return builder_.Finish();
|
||||
}
|
||||
</pre><p><code>CreateMonster</code> is a convenience function that calls all functions in <code>MonsterBuilder</code> above for you. Note that if you pass values which are defaults as arguments, it will not actually construct that field, so you can probably use this function instead of the builder class in almost all cases. </p><pre class="fragment">inline const Monster *GetMonster(const void *buf) { return flatbuffers::GetRoot<Monster>(buf); }
|
||||
</pre><p>This function is only generated for the root table type, to be able to start traversing a FlatBuffer from a raw buffer pointer. </p><pre class="fragment">}; // namespace MyGame
|
||||
}; // namespace Sample</pre> </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>
|
||||
@@ -1,117 +0,0 @@
|
||||
<!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: Use in Java/C-sharp</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="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td style="padding-left: 0.5em;">
|
||||
<div id="projectname">FlatBuffers
|
||||
</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__java_usage.html','');});
|
||||
</script>
|
||||
<div id="doc-content">
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">Use in Java/C-sharp </div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>FlatBuffers supports reading and writing binary FlatBuffers in Java and C#. Generate code for Java with the <code>-j</code> option to <code>flatc</code>, or for C# with <code>-n</code> (think .Net).</p>
|
||||
<p>Note that this document is from the perspective of Java. Code for both languages is generated in the same way, with only very subtle differences, for example any <code>camelCase</code> Java call will be <code>CamelCase</code> in C#.</p>
|
||||
<p>See <code>javaTest.java</code> for an example. Essentially, you read a FlatBuffer binary file into a <code>byte[]</code>, which you then turn into a <code>ByteBuffer</code>, which you pass to the <code>getRootAsMyRootType</code> function:</p>
|
||||
<div class="fragment"><div class="line">ByteBuffer bb = ByteBuffer.wrap(data);</div>
|
||||
<div class="line">Monster monster = Monster.getRootAsMonster(bb);</div>
|
||||
</div><!-- fragment --><p>Now you can access values much like C++:</p>
|
||||
<div class="fragment"><div class="line"><span class="keywordtype">short</span> hp = monster.hp();</div>
|
||||
<div class="line">Vec3 pos = monster.pos();</div>
|
||||
</div><!-- fragment --><p>Note that whenever you access a new object like in the <code>pos</code> 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 <code>pos()</code> method to which you can pass a <code>Vec3</code> 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.</p>
|
||||
<p>Java does not support unsigned scalars. This means that any unsigned types you use in your schema will actually be represented as a signed value. This means all bits are still present, but may represent a negative value when used. For example, to read a <code>byte b</code> as an unsigned number, you can do: <code>(short)(b & 0xFF)</code></p>
|
||||
<p>The default string accessor (e.g. <code>monster.name()</code>) currently always create a new Java <code>String</code> when accessed, since FlatBuffer's UTF-8 strings can't be used in-place by <code>String</code>. Alternatively, use <code>monster.nameAsByteBuffer()</code> which returns a <code>ByteBuffer</code> referring to the UTF-8 data in the original <code>ByteBuffer</code>, which is much more efficient. The <code>ByteBuffer</code>'s <code>position</code> points to the first character, and its <code>limit</code> to just after the last.</p>
|
||||
<p>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 <code>Length</code> let's you know the number of elements you can access:</p>
|
||||
<div class="fragment"><div class="line"><span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < monster.inventoryLength(); i++)</div>
|
||||
<div class="line"> monster.inventory(i); <span class="comment">// do something here</span></div>
|
||||
</div><!-- fragment --><p>Alternatively, much like strings, you can use <code>monster.inventoryAsByteBuffer()</code> to get a <code>ByteBuffer</code> referring to the whole vector. Use <code>ByteBuffer</code> methods like <code>asFloatBuffer</code> to get specific views if needed.</p>
|
||||
<p>If you specified a file_indentifier in the schema, you can query if the buffer is of the desired type before accessing it using:</p>
|
||||
<div class="fragment"><div class="line"><span class="keywordflow">if</span> (Monster.MonsterBufferHasIdentifier(bb)) ...</div>
|
||||
</div><!-- fragment --><h2>Buffer construction in Java</h2>
|
||||
<p>You can also construct these buffers in Java using the static methods found in the generated code, and the FlatBufferBuilder class:</p>
|
||||
<div class="fragment"><div class="line">FlatBufferBuilder fbb = <span class="keyword">new</span> FlatBufferBuilder();</div>
|
||||
</div><!-- fragment --><p>Create strings:</p>
|
||||
<div class="fragment"><div class="line"><span class="keywordtype">int</span> str = fbb.createString(<span class="stringliteral">"MyMonster"</span>);</div>
|
||||
</div><!-- fragment --><p>Create a table with a struct contained therein:</p>
|
||||
<div class="fragment"><div class="line">Monster.startMonster(fbb);</div>
|
||||
<div class="line">Monster.addPos(fbb, Vec3.createVec3(fbb, 1.0f, 2.0f, 3.0f, 3.0, (byte)4, (<span class="keywordtype">short</span>)5, (byte)6));</div>
|
||||
<div class="line">Monster.addHp(fbb, (short)80);</div>
|
||||
<div class="line">Monster.addName(fbb, str);</div>
|
||||
<div class="line">Monster.addInventory(fbb, inv);</div>
|
||||
<div class="line">Monster.addTest_type(fbb, (byte)1);</div>
|
||||
<div class="line">Monster.addTest(fbb, mon2);</div>
|
||||
<div class="line">Monster.addTest4(fbb, test4s);</div>
|
||||
<div class="line"><span class="keywordtype">int</span> mon = Monster.endMonster(fbb);</div>
|
||||
</div><!-- fragment --><p>For some simpler types, you can use a convenient <code>create</code> function call that allows you to construct tables in one function call. This example definition however contains an inline struct field, so we have to create the table manually. This is to create the buffer without using temporary object allocation.</p>
|
||||
<p>It's important to understand that fields that are structs are inline (like <code>Vec3</code> above), and MUST thus be created between the start and end calls of a table. Everything else (other tables, strings, vectors) MUST be created before the start of the table they are referenced in.</p>
|
||||
<p>Structs do have convenient methods that even have arguments for nested structs.</p>
|
||||
<p>As you can see, references to other objects (e.g. the string above) are simple ints, and thus do not have the type-safety of the Offset type in C++. Extra case must thus be taken that you set the right offset on the right field.</p>
|
||||
<p>Vectors can be created from the corresponding Java array like so:</p>
|
||||
<div class="fragment"><div class="line"><span class="keywordtype">int</span> inv = Monster.createInventoryVector(fbb, <span class="keyword">new</span> byte[] { 0, 1, 2, 3, 4 });</div>
|
||||
</div><!-- fragment --><p>This works for arrays of scalars and (int) offsets to strings/tables, but not structs. If you want to write structs, or what you want to write does not sit in an array, you can also use the start/end pattern:</p>
|
||||
<div class="fragment"><div class="line">Monster.startInventoryVector(fbb, 5);</div>
|
||||
<div class="line"><span class="keywordflow">for</span> (byte i = 4; i >=0; i--) fbb.addByte(i);</div>
|
||||
<div class="line"><span class="keywordtype">int</span> inv = fbb.endVector();</div>
|
||||
</div><!-- fragment --><p>You can use the generated method <code>startInventoryVector</code> to conveniently call <code>startVector</code> with the right element size. You pass the number of elements you want to write. Note how you write the elements backwards since the buffer is being constructed back to front. You then pass <code>inv</code> to the corresponding <code>Add</code> call when you construct the table containing it afterwards.</p>
|
||||
<p>There are <code>add</code> functions for all the scalar types. You use <code>addOffset</code> for any previously constructed objects (such as other tables, strings, vectors). For structs, you use the appropriate <code>create</code> function in-line, as shown above in the <code>Monster</code> example.</p>
|
||||
<p>To finish the buffer, call:</p>
|
||||
<div class="fragment"><div class="line">Monster.finishMonsterBuffer(fbb, mon);</div>
|
||||
</div><!-- fragment --><p>The buffer is now ready to be transmitted. It is contained in the <code>ByteBuffer</code> which you can obtain from <code>fbb.dataBuffer()</code>. Importantly, the valid data does not start from offset 0 in this buffer, but from <code>fbb.dataBuffer().position()</code> (this is because the data was built backwards in memory). It ends at <code>fbb.capacity()</code>.</p>
|
||||
<h2>Text Parsing</h2>
|
||||
<p>There currently is no support for parsing text (Schema's and JSON) directly from Java, though you could use the C++ parser through JNI. Please see the C++ documentation for more on text parsing. </p>
|
||||
</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>
|
||||
@@ -1,190 +0,0 @@
|
||||
<!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: Writing a schema</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="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td style="padding-left: 0.5em;">
|
||||
<div id="projectname">FlatBuffers
|
||||
</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__schemas.html','');});
|
||||
</script>
|
||||
<div id="doc-content">
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">Writing a schema </div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>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: </p><pre class="fragment">// example IDL file
|
||||
|
||||
namespace MyGame;
|
||||
|
||||
attribute "priority";
|
||||
|
||||
enum Color : byte { Red = 1, Green, Blue }
|
||||
|
||||
union Any { Monster, Weapon, Pickup }
|
||||
|
||||
struct Vec3 {
|
||||
x:float;
|
||||
y:float;
|
||||
z:float;
|
||||
}
|
||||
|
||||
table Monster {
|
||||
pos:Vec3;
|
||||
mana:short = 150;
|
||||
hp:short = 100;
|
||||
name:string;
|
||||
friendly:bool = false (deprecated, priority: 1);
|
||||
inventory:[ubyte];
|
||||
color:Color = Blue;
|
||||
test:Any;
|
||||
}
|
||||
|
||||
root_type Monster;
|
||||
</pre><p>(Weapon & Pickup not defined as part of this example).</p>
|
||||
<h3>Tables</h3>
|
||||
<p>Tables are the main way of defining objects in FlatBuffers, and consist of a name (here <code>Monster</code>) and a list of fields. Each field has a name, a type, and optionally a default value (if omitted, it defaults to 0 / NULL).</p>
|
||||
<p>Each field is optional: It does not have to appear in the wire representation, and you can choose to omit fields for each individual object. As a result, you have the flexibility to add fields without fear of bloating your data. This design is also FlatBuffer's mechanism for forward and backwards compatibility. Note that:</p>
|
||||
<ul>
|
||||
<li>You can add new fields in the schema ONLY at the end of a table definition. Older data will still read correctly, and give you the default value when read. Older code will simply ignore the new field. If you want to have flexibility to use any order for fields in your schema, you can manually assign ids (much like Protocol Buffers), see the <code>id</code> attribute below.</li>
|
||||
<li>You cannot delete fields you don't use anymore from the schema, but you can simply stop writing them into your data for almost the same effect. Additionally you can mark them as <code>deprecated</code> as in the example above, which will prevent the generation of accessors in the generated C++, as a way to enforce the field not being used any more. (careful: this may break code!).</li>
|
||||
<li>You may change field names and table names, if you're ok with your code breaking until you've renamed them there too.</li>
|
||||
</ul>
|
||||
<h3>Structs</h3>
|
||||
<p>Similar to a table, only now none of the fields are optional (so no defaults either), and fields may not be added or be deprecated. Structs may only contain scalars or other structs. Use this for simple objects where you are very sure no changes will ever be made (as quite clear in the example <code>Vec3</code>). Structs use less memory than tables and are even faster to access (they are always stored in-line in their parent object, and use no virtual table).</p>
|
||||
<h3>Types</h3>
|
||||
<p>Built-in scalar types are:</p>
|
||||
<ul>
|
||||
<li>8 bit: <code>byte ubyte bool</code></li>
|
||||
<li>16 bit: <code>short ushort</code></li>
|
||||
<li>32 bit: <code>int uint float</code></li>
|
||||
<li>64 bit: <code>long ulong double</code></li>
|
||||
</ul>
|
||||
<p>Built-in non-scalar types:</p>
|
||||
<ul>
|
||||
<li>Vector of any other type (denoted with <code>[type]</code>). Nesting vectors is not supported, instead you can wrap the inner vector in a table.</li>
|
||||
<li><code>string</code>, which may only hold UTF-8 or 7-bit ASCII. For other text encodings or general binary data use vectors (<code>[byte]</code> or <code>[ubyte]</code>) instead.</li>
|
||||
<li>References to other tables or structs, enums or unions (see below).</li>
|
||||
</ul>
|
||||
<p>You can't change types of fields once they're used, with the exception of same-size data where a <code>reinterpret_cast</code> would give you a desirable result, e.g. you could change a <code>uint</code> to an <code>int</code> if no values in current data use the high bit yet.</p>
|
||||
<h3>(Default) Values</h3>
|
||||
<p>Values are a sequence of digits, optionally followed by a <code>.</code> and more digits for float constants, and optionally prefixed by a <code>-</code>. Non-scalar defaults are currently not supported (always NULL).</p>
|
||||
<p>You generally do not want to change default values after they're initially defined. Fields that have the default value are not actually stored in the serialized data but are generated in code, so when you change the default, you'd now get a different value than from code generated from an older version of the schema. There are situations however where this may be desirable, especially if you can ensure a simultaneous rebuild of all code.</p>
|
||||
<h3>Enums</h3>
|
||||
<p>Define a sequence of named constants, each with a given value, or increasing by one from the previous one. The default first value is <code>0</code>. As you can see in the enum declaration, you specify the underlying integral type of the enum with <code>:</code> (in this case <code>byte</code>), which then determines the type of any fields declared with this enum type.</p>
|
||||
<h3>Unions</h3>
|
||||
<p>Unions share a lot of properties with enums, but instead of new names for constants, you use names of tables. You can then declare a union field which can hold a reference to any of those types, and additionally a hidden field with the suffix <code>_type</code> is generated that holds the corresponding enum value, allowing you to know which type to cast to at runtime.</p>
|
||||
<p>Unions are a good way to be able to send multiple message types as a FlatBuffer. Note that because a union field is really two fields, it must always be part of a table, it cannot be the root of a FlatBuffer by itself.</p>
|
||||
<p>If you have a need to distinguish between different FlatBuffers in a more open-ended way, for example for use as files, see the file identification feature below.</p>
|
||||
<h3>Namespaces</h3>
|
||||
<p>These will generate the corresponding namespace in C++ for all helper code, and packages in Java. You can use <code>.</code> to specify nested namespaces / packages.</p>
|
||||
<h3>Includes</h3>
|
||||
<p>You can include other schemas files in your current one, e.g.: </p><pre class="fragment">include "mydefinitions.fbs";
|
||||
</pre><p>This makes it easier to refer to types defined elsewhere. <code>include</code> automatically ensures each file is parsed just once, even when referred to more than once.</p>
|
||||
<p>When using the <code>flatc</code> compiler to generate code for schema definitions, only definitions in the current file will be generated, not those from the included files (those you still generate separately).</p>
|
||||
<h3>Root type</h3>
|
||||
<p>This declares what you consider to be the root table (or struct) of the serialized data. This is particular important for parsing JSON data, which doesn't include object type information.</p>
|
||||
<h3>File identification and extension</h3>
|
||||
<p>Typically, a FlatBuffer binary buffer is not self-describing, i.e. it needs you to know its schema to parse it correctly. But if you want to use a FlatBuffer as a file format, it would be convenient to be able to have a "magic number" in there, like most file formats have, to be able to do a sanity check to see if you're reading the kind of file you're expecting.</p>
|
||||
<p>Now, you can always prefix a FlatBuffer with your own file header, but FlatBuffers has a built-in way to add an identifier to a FlatBuffer that takes up minimal space, and keeps the buffer compatible with buffers that don't have such an identifier.</p>
|
||||
<p>You can specify in a schema, similar to <code>root_type</code>, that you intend for this type of FlatBuffer to be used as a file format: </p><pre class="fragment">file_identifier "MYFI";
|
||||
</pre><p>Identifiers must always be exactly 4 characters long. These 4 characters will end up as bytes at offsets 4-7 (inclusive) in the buffer.</p>
|
||||
<p>For any schema that has such an identifier, <code>flatc</code> will automatically add the identifier to any binaries it generates (with <code>-b</code>), and generated calls like <code>FinishMonsterBuffer</code> also add the identifier. If you have specified an identifier and wish to generate a buffer without one, you can always still do so by calling <code>FlatBufferBuilder::Finish</code> explicitly.</p>
|
||||
<p>After loading a buffer, you can use a call like <code>MonsterBufferHasIdentifier</code> to check if the identifier is present.</p>
|
||||
<p>Note that this is best for open-ended uses such as files. If you simply wanted to send one of a set of possible messages over a network for example, you'd be better off with a union.</p>
|
||||
<p>Additionally, by default <code>flatc</code> will output binary files as <code>.bin</code>. This declaration in the schema will change that to whatever you want: </p><pre class="fragment">file_extension "ext";
|
||||
</pre><h3>Comments & documentation</h3>
|
||||
<p>May be written as in most C-based languages. Additionally, a triple comment (<code>///</code>) on a line by itself signals that a comment is documentation for whatever is declared on the line after it (table/struct/field/enum/union/element), and the comment is output in the corresponding C++ code. Multiple such lines per item are allowed.</p>
|
||||
<h3>Attributes</h3>
|
||||
<p>Attributes may be attached to a declaration, behind a field, or after the name of a table/struct/enum/union. These may either have a value or not. Some attributes like <code>deprecated</code> are understood by the compiler, user defined ones need to be declared with the attribute declaration (like <code>priority</code> in the example above), and are available to query if you parse the schema at runtime. This is useful if you write your own code generators/editors etc., and you wish to add additional information specific to your tool (such as a help text).</p>
|
||||
<p>Current understood attributes:</p>
|
||||
<ul>
|
||||
<li><code>id: n</code> (on a table field): manually set the field identifier to <code>n</code>. 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.</li>
|
||||
<li><code>deprecated</code> (on a field): do not generate accessors for this field anymore, code should stop using this data.</li>
|
||||
<li><code>required</code> (on a non-scalar table field): this field must always be set. By default, all fields are optional, i.e. may be left out. This is desirable, as it helps with forwards/backwards compatibility, and flexibility of data structures. It is also a burden on the reading code, since for non-scalar fields it requires you to check against NULL and take appropriate action. By specifying this field, you force code that constructs FlatBuffers to ensure this field is initialized, so the reading code may access it directly, without checking for NULL. If the constructing code does not initialize this field, they will get an assert, and also the verifier will fail on buffers that have missing required fields.</li>
|
||||
<li><code>original_order</code> (on a table): since elements in a table do not need to be stored in any particular order, they are often optimized for space by sorting them to size. This attribute stops that from happening.</li>
|
||||
<li><code>force_align: size</code> (on a struct): force the alignment of this struct to be something higher than what it is naturally aligned to. Causes these structs to be aligned to that amount inside a buffer, IF that buffer is allocated with that alignment (which is not necessarily the case for buffers accessed directly inside a <code>FlatBufferBuilder</code>).</li>
|
||||
<li><code>bit_flags</code> (on an enum): the values of this field indicate bits, meaning that any value N specified in the schema will end up representing 1<<N, or if you don't specify values at all, you'll get the sequence 1, 2, 4, 8, ...</li>
|
||||
<li><code>nested_flatbuffer: "table_name"</code> (on a field): this indicates that the field (which must be a vector of ubyte) contains flatbuffer data, for which the root type is given by <code>table_name</code>. The generated code will then produce a convenient accessor for the nested FlatBuffer.</li>
|
||||
<li><code>key</code> (on a field): this field is meant to be used as a key when sorting a vector of the type of table it sits in. Can be used for in-place binary search.</li>
|
||||
</ul>
|
||||
<h2>JSON Parsing</h2>
|
||||
<p>The same parser that parses the schema declarations above is also able to parse JSON objects that conform to this schema. So, unlike other JSON parsers, this parser is strongly typed, and parses directly into a FlatBuffer (see the compiler documentation on how to do this from the command line, or the C++ documentation on how to do this at runtime).</p>
|
||||
<p>Besides needing a schema, there are a few other changes to how it parses JSON:</p>
|
||||
<ul>
|
||||
<li>It accepts field names with and without quotes, like many JSON parsers already do. It outputs them without quotes as well, though can be made to output them using the <code>strict_json</code> flag.</li>
|
||||
<li>If a field has an enum type, the parser will recognize symbolic enum values (with or without quotes) instead of numbers, e.g. <code>field: EnumVal</code>. If a field is of integral type, you can still use symbolic names, but values need to be prefixed with their type and need to be quoted, e.g. <code>field: "Enum.EnumVal"</code>. For enums representing flags, you may place multiple inside a string separated by spaces to OR them, e.g. <code>field: "EnumVal1 EnumVal2"</code> or <code>field: "Enum.EnumVal1 Enum.EnumVal2"</code>.</li>
|
||||
<li>Similarly, for unions, these need to specified with two fields much like you do when serializing from code. E.g. for a field <code>foo</code>, you must add a field <code>foo_type: FooOne</code> right before the <code>foo</code> field, where <code>FooOne</code> would be the table out of the union you want to use.</li>
|
||||
</ul>
|
||||
<p>When parsing JSON, it recognizes the following escape codes in strings:</p>
|
||||
<ul>
|
||||
<li><code>\n</code> - linefeed.</li>
|
||||
<li><code>\t</code> - tab.</li>
|
||||
<li><code>\r</code> - carriage return.</li>
|
||||
<li><code>\b</code> - backspace.</li>
|
||||
<li><code>\f</code> - form feed.</li>
|
||||
<li><code>\"</code> - double quote.</li>
|
||||
<li><code>\\</code> - backslash.</li>
|
||||
<li><code>\/</code> - forward slash.</li>
|
||||
<li><code>\uXXXX</code> - 16-bit unicode code point, converted to the equivalent UTF-8 representation.</li>
|
||||
<li><code>\xXX</code> - 8-bit binary hexadecimal number XX. This is the only one that is not in the JSON spec (see <a href="http://json.org/">http://json.org/</a>), but is needed to be able to encode arbitrary binary in strings to text and back without losing information (e.g. the byte 0xFF can't be represented in standard JSON).</li>
|
||||
</ul>
|
||||
<p>It also generates these escape codes back again when generating JSON from a binary representation.</p>
|
||||
<h2>Gotchas</h2>
|
||||
<h3>Schemas and version control</h3>
|
||||
<p>FlatBuffers relies on new field declarations being added at the end, and earlier declarations to not be removed, but be marked deprecated when needed. We think this is an improvement over the manual number assignment that happens in Protocol Buffers (and which is still an option using the <code>id</code> attribute mentioned above).</p>
|
||||
<p>One place where this is possibly problematic however is source control. If user A adds a field, generates new binary data with this new schema, then tries to commit both to source control after user B already committed a new field also, and just auto-merges the schema, the binary files are now invalid compared to the new schema.</p>
|
||||
<p>The solution of course is that you should not be generating binary data before your schema changes have been committed, ensuring consistency with the rest of the world. If this is not practical for you, use explicit field ids, which should always generate a merge conflict if two people try to allocate the same id. </p>
|
||||
</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>
|
||||
@@ -1,101 +0,0 @@
|
||||
<!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: FlatBuffers white paper</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="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td style="padding-left: 0.5em;">
|
||||
<div id="projectname">FlatBuffers
|
||||
</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__white_paper.html','');});
|
||||
</script>
|
||||
<div id="doc-content">
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">FlatBuffers white paper </div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><p>This document tries to shed some light on to the "why" of FlatBuffers, a new serialization library.</p>
|
||||
<h2>Motivation</h2>
|
||||
<p>Back in the good old days, performance was all about instructions and cycles. Nowadays, processing units have run so far ahead of the memory subsystem, that making an efficient application should start and finish with thinking about memory. How much you use of it. How you lay it out and access it. How you allocate it. When you copy it.</p>
|
||||
<p>Serialization is a pervasive activity in a lot programs, and a common source of memory inefficiency, with lots of temporary data structures needed to parse and represent data, and inefficient allocation patterns and locality.</p>
|
||||
<p>If it would be possible to do serialization with no temporary objects, no additional allocation, no copying, and good locality, this could be of great value. The reason serialization systems usually don't manage this is because it goes counter to forwards/backwards compatability, and platform specifics like endianness and alignment.</p>
|
||||
<p>FlatBuffers is what you get if you try anyway.</p>
|
||||
<p>In particular, FlatBuffers focus is on mobile hardware (where memory size and memory bandwidth is even more constrained than on desktop hardware), and applications that have the highest performance needs: games.</p>
|
||||
<h2>FlatBuffers</h2>
|
||||
<p><em>This is a summary of FlatBuffers functionality, with some rationale. A more detailed description can be found in the FlatBuffers documentation.</em></p>
|
||||
<h3>Summary</h3>
|
||||
<p>A FlatBuffer is a binary buffer containing nested objects (structs, tables, vectors,..) organized using offsets so that the data can be traversed in-place just like any pointer-based data structure. Unlike most in-memory data structures however, it uses strict rules of alignment and endianness (always little) to ensure these buffers are cross platform. Additionally, for objects that are tables, FlatBuffers provides forwards/backwards compatibility and general optionality of fields, to support most forms of format evolution.</p>
|
||||
<p>You define your object types in a schema, which can then be compiled to C++ or Java for low to zero overhead reading & writing. Optionally, JSON data can be dynamically parsed into buffers.</p>
|
||||
<h3>Tables</h3>
|
||||
<p>Tables are the cornerstone of FlatBuffers, since format evolution is essential for most applications of serialization. Typically, dealing with format changes is something that can be done transparently during the parsing process of most serialization solutions out there. But a FlatBuffer isn't parsed before it is accessed.</p>
|
||||
<p>Tables get around this by using an extra indirection to access fields, through a <em>vtable</em>. Each table comes with a vtable (which may be shared between multiple tables with the same layout), and contains information where fields for this particular kind of instance of vtable are stored. The vtable may also indicate that the field is not present (because this FlatBuffer was written with an older version of the software, of simply because the information was not necessary for this instance, or deemed deprecated), in which case a default value is returned.</p>
|
||||
<p>Tables have a low overhead in memory (since vtables are small and shared) and in access cost (an extra indirection), but provide great flexibility. Tables may even cost less memory than the equivalent struct, since fields do not need to be stored when they are equal to their default.</p>
|
||||
<p>FlatBuffers additionally offers "naked" structs, which do not offer forwards/backwards compatibility, but can be even smaller (useful for very small objects that are unlikely to change, like e.g. a coordinate pair or a RGBA color).</p>
|
||||
<h3>Schemas</h3>
|
||||
<p>While schemas reduce some generality (you can't just read any data without having its schema), they have a lot of upsides:</p>
|
||||
<ul>
|
||||
<li>Most information about the format can be factored into the generated code, reducing memory needed to store data, and time to access it.</li>
|
||||
<li>The strong typing of the data definitions means less error checking/handling at runtime (less can go wrong).</li>
|
||||
<li>A schema enables us to access a buffer without parsing.</li>
|
||||
</ul>
|
||||
<p>FlatBuffer schemas are fairly similar to those of the incumbent, Protocol Buffers, and generally should be readable to those familiar with the C family of languages. We chose to improve upon the features offered by .proto files in the following ways:</p>
|
||||
<ul>
|
||||
<li>Deprecation of fields instead of manual field id assignment. Extending an object in a .proto means hunting for a free slot among the numbers (preferring lower numbers since they have a more compact representation). Besides being inconvenient, it also makes removing fields problematic: you either have to keep them, not making it obvious that this field shouldn't be read/written anymore, and still generating accessors. Or you remove it, but now you risk that there's still old data around that uses that field by the time someone reuses that field id, with nasty consequences.</li>
|
||||
<li>Differentiating between tables and structs (see above). Effectively all table fields are <code>optional</code>, and all struct fields are <code>required</code>.</li>
|
||||
<li>Having a native vector type instead of <code>repeated</code>. This gives you a length without having to collect all items, and in the case of scalars provides for a more compact representation, and one that guarantees adjacency.</li>
|
||||
<li>Having a native <code>union</code> type instead of using a series of <code>optional</code> fields, all of which must be checked individually.</li>
|
||||
<li>Being able to define defaults for all scalars, instead of having to deal with their optionality at each access.</li>
|
||||
<li>A parser that can deal with both schemas and data definitions (JSON compatible) uniformly. </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>
|
||||
|
Before Width: | Height: | Size: 153 B |
|
Before Width: | Height: | Size: 95 B |
|
Before Width: | Height: | Size: 98 B |
@@ -1,143 +0,0 @@
|
||||
#nav-tree .children_ul {
|
||||
margin:0;
|
||||
padding:4px;
|
||||
}
|
||||
|
||||
#nav-tree ul {
|
||||
list-style:none outside none;
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
}
|
||||
|
||||
#nav-tree li {
|
||||
white-space:nowrap;
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
}
|
||||
|
||||
#nav-tree .plus {
|
||||
margin:0px;
|
||||
}
|
||||
|
||||
#nav-tree .selected {
|
||||
background-image: url('tab_a.png');
|
||||
background-repeat:repeat-x;
|
||||
color: #fff;
|
||||
text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0);
|
||||
}
|
||||
|
||||
#nav-tree img {
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
border:0px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#nav-tree a {
|
||||
text-decoration:none;
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
outline:none;
|
||||
}
|
||||
|
||||
#nav-tree .label {
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
font: 12px 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif;
|
||||
}
|
||||
|
||||
#nav-tree .label a {
|
||||
padding:2px;
|
||||
}
|
||||
|
||||
#nav-tree .selected a {
|
||||
text-decoration:none;
|
||||
color:#fff;
|
||||
}
|
||||
|
||||
#nav-tree .children_ul {
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
}
|
||||
|
||||
#nav-tree .item {
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
}
|
||||
|
||||
#nav-tree {
|
||||
padding: 0px 0px;
|
||||
background-color: #FAFAFF;
|
||||
font-size:14px;
|
||||
overflow:auto;
|
||||
}
|
||||
|
||||
#doc-content {
|
||||
overflow:auto;
|
||||
display:block;
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
-webkit-overflow-scrolling : touch; /* iOS 5+ */
|
||||
}
|
||||
|
||||
#side-nav {
|
||||
padding:0 6px 0 0;
|
||||
margin: 0px;
|
||||
display:block;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
.ui-resizable .ui-resizable-handle {
|
||||
display:block;
|
||||
}
|
||||
|
||||
.ui-resizable-e {
|
||||
background:url("ftv2splitbar.png") repeat scroll right center transparent;
|
||||
cursor:e-resize;
|
||||
height:100%;
|
||||
right:0;
|
||||
top:0;
|
||||
width:6px;
|
||||
}
|
||||
|
||||
.ui-resizable-handle {
|
||||
display:none;
|
||||
font-size:0.1px;
|
||||
position:absolute;
|
||||
z-index:1;
|
||||
}
|
||||
|
||||
#nav-tree-contents {
|
||||
margin: 6px 0px 0px 0px;
|
||||
}
|
||||
|
||||
#nav-tree {
|
||||
background-image:url('nav_h.png');
|
||||
background-repeat:repeat-x;
|
||||
background-color: #F9FAFC;
|
||||
-webkit-overflow-scrolling : touch; /* iOS 5+ */
|
||||
}
|
||||
|
||||
#nav-sync {
|
||||
position:absolute;
|
||||
top:5px;
|
||||
right:24px;
|
||||
z-index:0;
|
||||
}
|
||||
|
||||
#nav-sync img {
|
||||
opacity:0.3;
|
||||
}
|
||||
|
||||
#nav-sync img:hover {
|
||||
opacity:0.9;
|
||||
}
|
||||
|
||||
@media print
|
||||
{
|
||||
#nav-tree { display: none; }
|
||||
div.ui-resizable-handle { display: none; position: relative; }
|
||||
}
|
||||
|
||||
@@ -1,550 +0,0 @@
|
||||
var NAVTREE =
|
||||
[
|
||||
[ "FlatBuffers", "index.html", [
|
||||
[ "Building", "md__building.html", null ],
|
||||
[ "Using the schema compiler", "md__compiler.html", null ],
|
||||
[ "Writing a schema", "md__schemas.html", null ],
|
||||
[ "Use in C++", "md__cpp_usage.html", null ],
|
||||
[ "Use in Go", "md__go_usage.html", null ],
|
||||
[ "Use in Java/C-sharp", "md__java_usage.html", null ],
|
||||
[ "Benchmarks", "md__benchmarks.html", null ],
|
||||
[ "FlatBuffers white paper", "md__white_paper.html", null ],
|
||||
[ "FlatBuffer Internals", "md__internals.html", null ],
|
||||
[ "Formal Grammar of the schema language", "md__grammar.html", null ]
|
||||
] ]
|
||||
];
|
||||
|
||||
var NAVTREEINDEX =
|
||||
[
|
||||
"index.html"
|
||||
];
|
||||
|
||||
var SYNCONMSG = 'click to disable panel synchronisation';
|
||||
var SYNCOFFMSG = 'click to enable panel synchronisation';
|
||||
var navTreeSubIndices = new Array();
|
||||
|
||||
function getData(varName)
|
||||
{
|
||||
var i = varName.lastIndexOf('/');
|
||||
var n = i>=0 ? varName.substring(i+1) : varName;
|
||||
return eval(n.replace(/\-/g,'_'));
|
||||
}
|
||||
|
||||
function stripPath(uri)
|
||||
{
|
||||
return uri.substring(uri.lastIndexOf('/')+1);
|
||||
}
|
||||
|
||||
function stripPath2(uri)
|
||||
{
|
||||
var i = uri.lastIndexOf('/');
|
||||
var s = uri.substring(i+1);
|
||||
var m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/);
|
||||
return m ? uri.substring(i-6) : s;
|
||||
}
|
||||
|
||||
function hashValue()
|
||||
{
|
||||
return $(location).attr('hash').substring(1).replace(/[^\w\-]/g,'');
|
||||
}
|
||||
|
||||
function hashUrl()
|
||||
{
|
||||
return '#'+hashValue();
|
||||
}
|
||||
|
||||
function pathName()
|
||||
{
|
||||
return $(location).attr('pathname').replace(/[^-A-Za-z0-9+&@#/%?=~_|!:,.;\(\)]/g, '');
|
||||
}
|
||||
|
||||
function localStorageSupported()
|
||||
{
|
||||
try {
|
||||
return 'localStorage' in window && window['localStorage'] !== null && window.localStorage.getItem;
|
||||
}
|
||||
catch(e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function storeLink(link)
|
||||
{
|
||||
if (!$("#nav-sync").hasClass('sync') && localStorageSupported()) {
|
||||
window.localStorage.setItem('navpath',link);
|
||||
}
|
||||
}
|
||||
|
||||
function deleteLink()
|
||||
{
|
||||
if (localStorageSupported()) {
|
||||
window.localStorage.setItem('navpath','');
|
||||
}
|
||||
}
|
||||
|
||||
function cachedLink()
|
||||
{
|
||||
if (localStorageSupported()) {
|
||||
return window.localStorage.getItem('navpath');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
function getScript(scriptName,func,show)
|
||||
{
|
||||
var head = document.getElementsByTagName("head")[0];
|
||||
var script = document.createElement('script');
|
||||
script.id = scriptName;
|
||||
script.type = 'text/javascript';
|
||||
script.onload = func;
|
||||
script.src = scriptName+'.js';
|
||||
if ($.browser.msie && $.browser.version<=8) {
|
||||
// script.onload does not work with older versions of IE
|
||||
script.onreadystatechange = function() {
|
||||
if (script.readyState=='complete' || script.readyState=='loaded') {
|
||||
func(); if (show) showRoot();
|
||||
}
|
||||
}
|
||||
}
|
||||
head.appendChild(script);
|
||||
}
|
||||
|
||||
function createIndent(o,domNode,node,level)
|
||||
{
|
||||
var level=-1;
|
||||
var n = node;
|
||||
while (n.parentNode) { level++; n=n.parentNode; }
|
||||
if (node.childrenData) {
|
||||
var imgNode = document.createElement("img");
|
||||
imgNode.style.paddingLeft=(16*level).toString()+'px';
|
||||
imgNode.width = 16;
|
||||
imgNode.height = 22;
|
||||
imgNode.border = 0;
|
||||
node.plus_img = imgNode;
|
||||
node.expandToggle = document.createElement("a");
|
||||
node.expandToggle.href = "javascript:void(0)";
|
||||
node.expandToggle.onclick = function() {
|
||||
if (node.expanded) {
|
||||
$(node.getChildrenUL()).slideUp("fast");
|
||||
node.plus_img.src = node.relpath+"ftv2pnode.png";
|
||||
node.expanded = false;
|
||||
} else {
|
||||
expandNode(o, node, false, false);
|
||||
}
|
||||
}
|
||||
node.expandToggle.appendChild(imgNode);
|
||||
domNode.appendChild(node.expandToggle);
|
||||
imgNode.src = node.relpath+"ftv2pnode.png";
|
||||
} else {
|
||||
var span = document.createElement("span");
|
||||
span.style.display = 'inline-block';
|
||||
span.style.width = 16*(level+1)+'px';
|
||||
span.style.height = '22px';
|
||||
span.innerHTML = ' ';
|
||||
domNode.appendChild(span);
|
||||
}
|
||||
}
|
||||
|
||||
var animationInProgress = false;
|
||||
|
||||
function gotoAnchor(anchor,aname,updateLocation)
|
||||
{
|
||||
var pos, docContent = $('#doc-content');
|
||||
var ancParent = $(anchor.parent());
|
||||
if (ancParent.hasClass('memItemLeft') ||
|
||||
ancParent.hasClass('fieldname') ||
|
||||
ancParent.hasClass('fieldtype') ||
|
||||
ancParent.is(':header'))
|
||||
{
|
||||
pos = ancParent.position().top;
|
||||
} else if (anchor.position()) {
|
||||
pos = anchor.position().top;
|
||||
}
|
||||
if (pos) {
|
||||
var dist = Math.abs(Math.min(
|
||||
pos-docContent.offset().top,
|
||||
docContent[0].scrollHeight-
|
||||
docContent.height()-docContent.scrollTop()));
|
||||
animationInProgress=true;
|
||||
docContent.animate({
|
||||
scrollTop: pos + docContent.scrollTop() - docContent.offset().top
|
||||
},Math.max(50,Math.min(500,dist)),function(){
|
||||
if (updateLocation) window.location.href=aname;
|
||||
animationInProgress=false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function newNode(o, po, text, link, childrenData, lastNode)
|
||||
{
|
||||
var node = new Object();
|
||||
node.children = Array();
|
||||
node.childrenData = childrenData;
|
||||
node.depth = po.depth + 1;
|
||||
node.relpath = po.relpath;
|
||||
node.isLast = lastNode;
|
||||
|
||||
node.li = document.createElement("li");
|
||||
po.getChildrenUL().appendChild(node.li);
|
||||
node.parentNode = po;
|
||||
|
||||
node.itemDiv = document.createElement("div");
|
||||
node.itemDiv.className = "item";
|
||||
|
||||
node.labelSpan = document.createElement("span");
|
||||
node.labelSpan.className = "label";
|
||||
|
||||
createIndent(o,node.itemDiv,node,0);
|
||||
node.itemDiv.appendChild(node.labelSpan);
|
||||
node.li.appendChild(node.itemDiv);
|
||||
|
||||
var a = document.createElement("a");
|
||||
node.labelSpan.appendChild(a);
|
||||
node.label = document.createTextNode(text);
|
||||
node.expanded = false;
|
||||
a.appendChild(node.label);
|
||||
if (link) {
|
||||
var url;
|
||||
if (link.substring(0,1)=='^') {
|
||||
url = link.substring(1);
|
||||
link = url;
|
||||
} else {
|
||||
url = node.relpath+link;
|
||||
}
|
||||
a.className = stripPath(link.replace('#',':'));
|
||||
if (link.indexOf('#')!=-1) {
|
||||
var aname = '#'+link.split('#')[1];
|
||||
var srcPage = stripPath(pathName());
|
||||
var targetPage = stripPath(link.split('#')[0]);
|
||||
a.href = srcPage!=targetPage ? url : "javascript:void(0)";
|
||||
a.onclick = function(){
|
||||
storeLink(link);
|
||||
if (!$(a).parent().parent().hasClass('selected'))
|
||||
{
|
||||
$('.item').removeClass('selected');
|
||||
$('.item').removeAttr('id');
|
||||
$(a).parent().parent().addClass('selected');
|
||||
$(a).parent().parent().attr('id','selected');
|
||||
}
|
||||
var anchor = $(aname);
|
||||
gotoAnchor(anchor,aname,true);
|
||||
};
|
||||
} else {
|
||||
a.href = url;
|
||||
a.onclick = function() { storeLink(link); }
|
||||
}
|
||||
} else {
|
||||
if (childrenData != null)
|
||||
{
|
||||
a.className = "nolink";
|
||||
a.href = "javascript:void(0)";
|
||||
a.onclick = node.expandToggle.onclick;
|
||||
}
|
||||
}
|
||||
|
||||
node.childrenUL = null;
|
||||
node.getChildrenUL = function() {
|
||||
if (!node.childrenUL) {
|
||||
node.childrenUL = document.createElement("ul");
|
||||
node.childrenUL.className = "children_ul";
|
||||
node.childrenUL.style.display = "none";
|
||||
node.li.appendChild(node.childrenUL);
|
||||
}
|
||||
return node.childrenUL;
|
||||
};
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function showRoot()
|
||||
{
|
||||
var headerHeight = $("#top").height();
|
||||
var footerHeight = $("#nav-path").height();
|
||||
var windowHeight = $(window).height() - headerHeight - footerHeight;
|
||||
(function (){ // retry until we can scroll to the selected item
|
||||
try {
|
||||
var navtree=$('#nav-tree');
|
||||
navtree.scrollTo('#selected',0,{offset:-windowHeight/2});
|
||||
} catch (err) {
|
||||
setTimeout(arguments.callee, 0);
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
function expandNode(o, node, imm, showRoot)
|
||||
{
|
||||
if (node.childrenData && !node.expanded) {
|
||||
if (typeof(node.childrenData)==='string') {
|
||||
var varName = node.childrenData;
|
||||
getScript(node.relpath+varName,function(){
|
||||
node.childrenData = getData(varName);
|
||||
expandNode(o, node, imm, showRoot);
|
||||
}, showRoot);
|
||||
} else {
|
||||
if (!node.childrenVisited) {
|
||||
getNode(o, node);
|
||||
} if (imm || ($.browser.msie && $.browser.version>8)) {
|
||||
// somehow slideDown jumps to the start of tree for IE9 :-(
|
||||
$(node.getChildrenUL()).show();
|
||||
} else {
|
||||
$(node.getChildrenUL()).slideDown("fast");
|
||||
}
|
||||
if (node.isLast) {
|
||||
node.plus_img.src = node.relpath+"ftv2mlastnode.png";
|
||||
} else {
|
||||
node.plus_img.src = node.relpath+"ftv2mnode.png";
|
||||
}
|
||||
node.expanded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function glowEffect(n,duration)
|
||||
{
|
||||
n.addClass('glow').delay(duration).queue(function(next){
|
||||
$(this).removeClass('glow');next();
|
||||
});
|
||||
}
|
||||
|
||||
function highlightAnchor()
|
||||
{
|
||||
var aname = hashUrl();
|
||||
var anchor = $(aname);
|
||||
if (anchor.parent().attr('class')=='memItemLeft'){
|
||||
var rows = $('.memberdecls tr[class$="'+hashValue()+'"]');
|
||||
glowEffect(rows.children(),300); // member without details
|
||||
} else if (anchor.parent().attr('class')=='fieldname'){
|
||||
glowEffect(anchor.parent().parent(),1000); // enum value
|
||||
} else if (anchor.parent().attr('class')=='fieldtype'){
|
||||
glowEffect(anchor.parent().parent(),1000); // struct field
|
||||
} else if (anchor.parent().is(":header")) {
|
||||
glowEffect(anchor.parent(),1000); // section header
|
||||
} else {
|
||||
glowEffect(anchor.next(),1000); // normal member
|
||||
}
|
||||
gotoAnchor(anchor,aname,false);
|
||||
}
|
||||
|
||||
function selectAndHighlight(hash,n)
|
||||
{
|
||||
var a;
|
||||
if (hash) {
|
||||
var link=stripPath(pathName())+':'+hash.substring(1);
|
||||
a=$('.item a[class$="'+link+'"]');
|
||||
}
|
||||
if (a && a.length) {
|
||||
a.parent().parent().addClass('selected');
|
||||
a.parent().parent().attr('id','selected');
|
||||
highlightAnchor();
|
||||
} else if (n) {
|
||||
$(n.itemDiv).addClass('selected');
|
||||
$(n.itemDiv).attr('id','selected');
|
||||
}
|
||||
if ($('#nav-tree-contents .item:first').hasClass('selected')) {
|
||||
$('#nav-sync').css('top','30px');
|
||||
} else {
|
||||
$('#nav-sync').css('top','5px');
|
||||
}
|
||||
showRoot();
|
||||
}
|
||||
|
||||
function showNode(o, node, index, hash)
|
||||
{
|
||||
if (node && node.childrenData) {
|
||||
if (typeof(node.childrenData)==='string') {
|
||||
var varName = node.childrenData;
|
||||
getScript(node.relpath+varName,function(){
|
||||
node.childrenData = getData(varName);
|
||||
showNode(o,node,index,hash);
|
||||
},true);
|
||||
} else {
|
||||
if (!node.childrenVisited) {
|
||||
getNode(o, node);
|
||||
}
|
||||
$(node.getChildrenUL()).css({'display':'block'});
|
||||
if (node.isLast) {
|
||||
node.plus_img.src = node.relpath+"ftv2mlastnode.png";
|
||||
} else {
|
||||
node.plus_img.src = node.relpath+"ftv2mnode.png";
|
||||
}
|
||||
node.expanded = true;
|
||||
var n = node.children[o.breadcrumbs[index]];
|
||||
if (index+1<o.breadcrumbs.length) {
|
||||
showNode(o,n,index+1,hash);
|
||||
} else {
|
||||
if (typeof(n.childrenData)==='string') {
|
||||
var varName = n.childrenData;
|
||||
getScript(n.relpath+varName,function(){
|
||||
n.childrenData = getData(varName);
|
||||
node.expanded=false;
|
||||
showNode(o,node,index,hash); // retry with child node expanded
|
||||
},true);
|
||||
} else {
|
||||
var rootBase = stripPath(o.toroot.replace(/\..+$/, ''));
|
||||
if (rootBase=="index" || rootBase=="pages" || rootBase=="search") {
|
||||
expandNode(o, n, true, true);
|
||||
}
|
||||
selectAndHighlight(hash,n);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
selectAndHighlight(hash);
|
||||
}
|
||||
}
|
||||
|
||||
function removeToInsertLater(element) {
|
||||
var parentNode = element.parentNode;
|
||||
var nextSibling = element.nextSibling;
|
||||
parentNode.removeChild(element);
|
||||
return function() {
|
||||
if (nextSibling) {
|
||||
parentNode.insertBefore(element, nextSibling);
|
||||
} else {
|
||||
parentNode.appendChild(element);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function getNode(o, po)
|
||||
{
|
||||
var insertFunction = removeToInsertLater(po.li);
|
||||
po.childrenVisited = true;
|
||||
var l = po.childrenData.length-1;
|
||||
for (var i in po.childrenData) {
|
||||
var nodeData = po.childrenData[i];
|
||||
po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2],
|
||||
i==l);
|
||||
}
|
||||
insertFunction();
|
||||
}
|
||||
|
||||
function gotoNode(o,subIndex,root,hash,relpath)
|
||||
{
|
||||
var nti = navTreeSubIndices[subIndex][root+hash];
|
||||
o.breadcrumbs = $.extend(true, [], nti ? nti : navTreeSubIndices[subIndex][root]);
|
||||
if (!o.breadcrumbs && root!=NAVTREE[0][1]) { // fallback: show index
|
||||
navTo(o,NAVTREE[0][1],"",relpath);
|
||||
$('.item').removeClass('selected');
|
||||
$('.item').removeAttr('id');
|
||||
}
|
||||
if (o.breadcrumbs) {
|
||||
o.breadcrumbs.unshift(0); // add 0 for root node
|
||||
showNode(o, o.node, 0, hash);
|
||||
}
|
||||
}
|
||||
|
||||
function navTo(o,root,hash,relpath)
|
||||
{
|
||||
var link = cachedLink();
|
||||
if (link) {
|
||||
var parts = link.split('#');
|
||||
root = parts[0];
|
||||
if (parts.length>1) hash = '#'+parts[1].replace(/[^\w\-]/g,'');
|
||||
else hash='';
|
||||
}
|
||||
if (hash.match(/^#l\d+$/)) {
|
||||
var anchor=$('a[name='+hash.substring(1)+']');
|
||||
glowEffect(anchor.parent(),1000); // line number
|
||||
hash=''; // strip line number anchors
|
||||
}
|
||||
var url=root+hash;
|
||||
var i=-1;
|
||||
while (NAVTREEINDEX[i+1]<=url) i++;
|
||||
if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index
|
||||
if (navTreeSubIndices[i]) {
|
||||
gotoNode(o,i,root,hash,relpath)
|
||||
} else {
|
||||
getScript(relpath+'navtreeindex'+i,function(){
|
||||
navTreeSubIndices[i] = eval('NAVTREEINDEX'+i);
|
||||
if (navTreeSubIndices[i]) {
|
||||
gotoNode(o,i,root,hash,relpath);
|
||||
}
|
||||
},true);
|
||||
}
|
||||
}
|
||||
|
||||
function showSyncOff(n,relpath)
|
||||
{
|
||||
n.html('<img src="'+relpath+'sync_off.png" title="'+SYNCOFFMSG+'"/>');
|
||||
}
|
||||
|
||||
function showSyncOn(n,relpath)
|
||||
{
|
||||
n.html('<img src="'+relpath+'sync_on.png" title="'+SYNCONMSG+'"/>');
|
||||
}
|
||||
|
||||
function toggleSyncButton(relpath)
|
||||
{
|
||||
var navSync = $('#nav-sync');
|
||||
if (navSync.hasClass('sync')) {
|
||||
navSync.removeClass('sync');
|
||||
showSyncOff(navSync,relpath);
|
||||
storeLink(stripPath2(pathName())+hashUrl());
|
||||
} else {
|
||||
navSync.addClass('sync');
|
||||
showSyncOn(navSync,relpath);
|
||||
deleteLink();
|
||||
}
|
||||
}
|
||||
|
||||
function initNavTree(toroot,relpath)
|
||||
{
|
||||
var o = new Object();
|
||||
o.toroot = toroot;
|
||||
o.node = new Object();
|
||||
o.node.li = document.getElementById("nav-tree-contents");
|
||||
o.node.childrenData = NAVTREE;
|
||||
o.node.children = new Array();
|
||||
o.node.childrenUL = document.createElement("ul");
|
||||
o.node.getChildrenUL = function() { return o.node.childrenUL; };
|
||||
o.node.li.appendChild(o.node.childrenUL);
|
||||
o.node.depth = 0;
|
||||
o.node.relpath = relpath;
|
||||
o.node.expanded = false;
|
||||
o.node.isLast = true;
|
||||
o.node.plus_img = document.createElement("img");
|
||||
o.node.plus_img.src = relpath+"ftv2pnode.png";
|
||||
o.node.plus_img.width = 16;
|
||||
o.node.plus_img.height = 22;
|
||||
|
||||
if (localStorageSupported()) {
|
||||
var navSync = $('#nav-sync');
|
||||
if (cachedLink()) {
|
||||
showSyncOff(navSync,relpath);
|
||||
navSync.removeClass('sync');
|
||||
} else {
|
||||
showSyncOn(navSync,relpath);
|
||||
}
|
||||
navSync.click(function(){ toggleSyncButton(relpath); });
|
||||
}
|
||||
|
||||
$(window).load(function(){
|
||||
navTo(o,toroot,hashUrl(),relpath);
|
||||
showRoot();
|
||||
});
|
||||
|
||||
$(window).bind('hashchange', function(){
|
||||
if (window.location.hash && window.location.hash.length>1){
|
||||
var a;
|
||||
if ($(location).attr('hash')){
|
||||
var clslink=stripPath(pathName())+':'+hashValue();
|
||||
a=$('.item a[class$="'+clslink.replace(/</g,'\\3c ')+'"]');
|
||||
}
|
||||
if (a==null || !$(a).parent().parent().hasClass('selected')){
|
||||
$('.item').removeClass('selected');
|
||||
$('.item').removeAttr('id');
|
||||
}
|
||||
var link=stripPath2(pathName());
|
||||
navTo(o,link,hashUrl(),relpath);
|
||||
} else if (!animationInProgress) {
|
||||
$('#doc-content').scrollTop(0);
|
||||
$('.item').removeClass('selected');
|
||||
$('.item').removeAttr('id');
|
||||
navTo(o,toroot,hashUrl(),relpath);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
var NAVTREEINDEX0 =
|
||||
{
|
||||
"index.html":[],
|
||||
"md__benchmarks.html":[6],
|
||||
"md__building.html":[0],
|
||||
"md__compiler.html":[1],
|
||||
"md__cpp_usage.html":[3],
|
||||
"md__go_usage.html":[4],
|
||||
"md__grammar.html":[9],
|
||||
"md__internals.html":[8],
|
||||
"md__java_usage.html":[5],
|
||||
"md__schemas.html":[2],
|
||||
"md__white_paper.html":[7],
|
||||
"pages.html":[]
|
||||
};
|
||||
|
Before Width: | Height: | Size: 123 B |
@@ -1,82 +0,0 @@
|
||||
<!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: Related Pages</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="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td style="padding-left: 0.5em;">
|
||||
<div id="projectname">FlatBuffers
|
||||
</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('pages.html','');});
|
||||
</script>
|
||||
<div id="doc-content">
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">Related Pages</div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock">Here is a list of all related documentation pages:</div><div class="directory">
|
||||
<table class="directory">
|
||||
<tr id="row_0_" class="even"><td class="entry"><span style="width:16px;display:inline-block;"> </span><a class="el" href="md__building.html" target="_self">Building</a></td><td class="desc"></td></tr>
|
||||
<tr id="row_1_"><td class="entry"><span style="width:16px;display:inline-block;"> </span><a class="el" href="md__compiler.html" target="_self">Using the schema compiler</a></td><td class="desc"></td></tr>
|
||||
<tr id="row_2_" class="even"><td class="entry"><span style="width:16px;display:inline-block;"> </span><a class="el" href="md__schemas.html" target="_self">Writing a schema</a></td><td class="desc"></td></tr>
|
||||
<tr id="row_3_"><td class="entry"><span style="width:16px;display:inline-block;"> </span><a class="el" href="md__cpp_usage.html" target="_self">Use in C++</a></td><td class="desc"></td></tr>
|
||||
<tr id="row_4_" class="even"><td class="entry"><span style="width:16px;display:inline-block;"> </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;"> </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;"> </span><a class="el" href="md__benchmarks.html" target="_self">Benchmarks</a></td><td class="desc"></td></tr>
|
||||
<tr id="row_7_"><td class="entry"><span style="width:16px;display:inline-block;"> </span><a class="el" href="md__white_paper.html" target="_self">FlatBuffers white paper</a></td><td class="desc"></td></tr>
|
||||
<tr id="row_8_" class="even"><td class="entry"><span style="width:16px;display:inline-block;"> </span><a class="el" href="md__internals.html" target="_self">FlatBuffer Internals</a></td><td class="desc"></td></tr>
|
||||
<tr id="row_9_"><td class="entry"><span style="width:16px;display:inline-block;"> </span><a class="el" href="md__grammar.html" target="_self">Formal Grammar of the schema language</a></td><td class="desc"></td></tr>
|
||||
</table>
|
||||
</div><!-- directory -->
|
||||
</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>
|
||||
@@ -1,97 +0,0 @@
|
||||
var cookie_namespace = 'doxygen';
|
||||
var sidenav,navtree,content,header;
|
||||
|
||||
function readCookie(cookie)
|
||||
{
|
||||
var myCookie = cookie_namespace+"_"+cookie+"=";
|
||||
if (document.cookie)
|
||||
{
|
||||
var index = document.cookie.indexOf(myCookie);
|
||||
if (index != -1)
|
||||
{
|
||||
var valStart = index + myCookie.length;
|
||||
var valEnd = document.cookie.indexOf(";", valStart);
|
||||
if (valEnd == -1)
|
||||
{
|
||||
valEnd = document.cookie.length;
|
||||
}
|
||||
var val = document.cookie.substring(valStart, valEnd);
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function writeCookie(cookie, val, expiration)
|
||||
{
|
||||
if (val==undefined) return;
|
||||
if (expiration == null)
|
||||
{
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week
|
||||
expiration = date.toGMTString();
|
||||
}
|
||||
document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; expires=" + expiration+"; path=/";
|
||||
}
|
||||
|
||||
function resizeWidth()
|
||||
{
|
||||
var windowWidth = $(window).width() + "px";
|
||||
var sidenavWidth = $(sidenav).outerWidth();
|
||||
content.css({marginLeft:parseInt(sidenavWidth)+"px"});
|
||||
writeCookie('width',sidenavWidth, null);
|
||||
}
|
||||
|
||||
function restoreWidth(navWidth)
|
||||
{
|
||||
var windowWidth = $(window).width() + "px";
|
||||
content.css({marginLeft:parseInt(navWidth)+6+"px"});
|
||||
sidenav.css({width:navWidth + "px"});
|
||||
}
|
||||
|
||||
function resizeHeight()
|
||||
{
|
||||
var headerHeight = header.outerHeight();
|
||||
var footerHeight = footer.outerHeight();
|
||||
var windowHeight = $(window).height() - headerHeight - footerHeight;
|
||||
content.css({height:windowHeight + "px"});
|
||||
navtree.css({height:windowHeight + "px"});
|
||||
sidenav.css({height:windowHeight + "px",top: headerHeight+"px"});
|
||||
}
|
||||
|
||||
function initResizable()
|
||||
{
|
||||
header = $("#top");
|
||||
sidenav = $("#side-nav");
|
||||
content = $("#doc-content");
|
||||
navtree = $("#nav-tree");
|
||||
footer = $("#nav-path");
|
||||
$(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } });
|
||||
$(window).resize(function() { resizeHeight(); });
|
||||
var width = readCookie('width');
|
||||
if (width) { restoreWidth(width); } else { resizeWidth(); }
|
||||
resizeHeight();
|
||||
var url = location.href;
|
||||
var i=url.indexOf("#");
|
||||
if (i>=0) window.location.hash=url.substr(i);
|
||||
var _preventDefault = function(evt) { evt.preventDefault(); };
|
||||
$("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault);
|
||||
$(document).bind('touchmove',function(e){
|
||||
var device = navigator.userAgent.toLowerCase();
|
||||
var ios = device.match(/(iphone|ipod|ipad)/);
|
||||
if (ios) {
|
||||
try {
|
||||
var target = e.target;
|
||||
while (target) {
|
||||
if ($(target).css('-webkit-overflow-scrolling')=='touch') return;
|
||||
target = target.parentNode;
|
||||
}
|
||||
e.preventDefault();
|
||||
} catch(err) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 853 B |
|
Before Width: | Height: | Size: 845 B |
|
Before Width: | Height: | Size: 142 B |
|
Before Width: | Height: | Size: 169 B |
|
Before Width: | Height: | Size: 177 B |
|
Before Width: | Height: | Size: 184 B |
@@ -1,60 +0,0 @@
|
||||
.tabs, .tabs2, .tabs3 {
|
||||
background-image: url('tab_b.png');
|
||||
width: 100%;
|
||||
z-index: 101;
|
||||
font-size: 13px;
|
||||
font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif;
|
||||
}
|
||||
|
||||
.tabs2 {
|
||||
font-size: 10px;
|
||||
}
|
||||
.tabs3 {
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.tablist {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: table;
|
||||
}
|
||||
|
||||
.tablist li {
|
||||
float: left;
|
||||
display: table-cell;
|
||||
background-image: url('tab_b.png');
|
||||
line-height: 36px;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.tablist a {
|
||||
display: block;
|
||||
padding: 0 20px;
|
||||
font-weight: bold;
|
||||
background-image:url('tab_s.png');
|
||||
background-repeat:no-repeat;
|
||||
background-position:right;
|
||||
color: #283A5D;
|
||||
text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
|
||||
text-decoration: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.tabs3 .tablist a {
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.tablist a:hover {
|
||||
background-image: url('tab_h.png');
|
||||
background-repeat:repeat-x;
|
||||
color: #fff;
|
||||
text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.tablist li.current a {
|
||||
background-image: url('tab_a.png');
|
||||
background-repeat:repeat-x;
|
||||
color: #fff;
|
||||
text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0);
|
||||
}
|
||||
BIN
docs/images/fpl_logo_small.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
docs/images/ftv2mnode.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
docs/images/ftv2pnode.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
@@ -1,4 +1,5 @@
|
||||
# Benchmarks
|
||||
Benchmarks {#flatbuffers_benchmarks}
|
||||
==========
|
||||
|
||||
Comparing against other serialization solutions, running on Windows 7
|
||||
64bit. We use the LITE runtime for Protocol Buffers (less code / lower
|
||||
@@ -20,17 +21,17 @@ The benchmark object is a set of about 10 objects containing an array, 4
|
||||
strings, and a large variety of int/float scalar values of all sizes,
|
||||
meant to be representative of game data, e.g. a scene format.
|
||||
|
||||
| | FlatBuffers (binary) | Protocol Buffers LITE | Rapid JSON | FlatBuffers (JSON) | pugixml | Raw structs |
|
||||
|--------------------------------------------------------|-----------------------|-----------------------|-----------------------|-----------------------| ----------------------| ----------------------|
|
||||
| Decode + Traverse + Dealloc (1 million times, seconds) | 0.08 | 302 | 583 | 105 | 196 | 0.02 |
|
||||
| Decode / Traverse / Dealloc (breakdown) | 0 / 0.08 / 0 | 220 / 0.15 / 81 | 294 / 0.9 / 287 | 70 / 0.08 / 35 | 41 / 3.9 / 150 | 0 / 0.02 / 0 |
|
||||
| Encode (1 million times, seconds) | 3.2 | 185 | 650 | 169 | 273 | 0.15 |
|
||||
| Wire format size (normal / zlib, bytes) | 344 / 220 | 228 / 174 | 1475 / 322 | 1029 / 298 | 1137 / 341 | 312 / 187 |
|
||||
| Memory needed to store decoded wire (bytes / blocks) | 0 / 0 | 760 / 20 | 65689 / 4 | 328 / 1 | 34194 / 3 | 0 / 0 |
|
||||
| Transient memory allocated during decode (KB) | 0 | 1 | 131 | 4 | 34 | 0 |
|
||||
| Generated source code size (KB) | 4 | 61 | 0 | 4 | 0 | 0 |
|
||||
| Field access in handwritten traversal code | typed accessors | typed accessors | manual error checking | typed accessors | manual error checking | typed but no safety |
|
||||
| Library source code (KB) | 15 | some subset of 3800 | 87 | 43 | 327 | 0 |
|
||||
| | FlatBuffers (binary) | Protocol Buffers LITE | Rapid JSON | FlatBuffers (JSON) | pugixml | Raw structs |
|
||||
|--------------------------------------------------------|-----------------------|-----------------------|-----------------------|------------------------| ----------------------| ----------------------|
|
||||
| Decode + Traverse + Dealloc (1 million times, seconds) | 0.08 | 302 | 583 | 105 | 196 | 0.02 |
|
||||
| Decode / Traverse / Dealloc (breakdown) | 0 / 0.08 / 0 | 220 / 0.15 / 81 | 294 / 0.9 / 287 | 70 / 0.08 / 35 | 41 / 3.9 / 150 | 0 / 0.02 / 0 |
|
||||
| Encode (1 million times, seconds) | 3.2 | 185 | 650 | 169 | 273 | 0.15 |
|
||||
| Wire format size (normal / zlib, bytes) | 344 / 220 | 228 / 174 | 1475 / 322 | 1029 / 298 | 1137 / 341 | 312 / 187 |
|
||||
| Memory needed to store decoded wire (bytes / blocks) | 0 / 0 | 760 / 20 | 65689 / 4 | 328 / 1 | 34194 / 3 | 0 / 0 |
|
||||
| Transient memory allocated during decode (KB) | 0 | 1 | 131 | 4 | 34 | 0 |
|
||||
| Generated source code size (KB) | 4 | 61 | 0 | 4 | 0 | 0 |
|
||||
| Field access in handwritten traversal code | typed accessors | typed accessors | manual error checking | typed accessors | manual error checking | typed but no safety |
|
||||
| Library source code (KB) | 15 | some subset of 3800 | 87 | 43 | 327 | 0 |
|
||||
|
||||
### Some other serialization systems we compared against but did not benchmark (yet), in rough order of applicability:
|
||||
|
||||
@@ -39,7 +40,7 @@ meant to be representative of game data, e.g. a scene format.
|
||||
optional fields to allow deprecating fields or serializing with missing
|
||||
fields for which defaults exist).
|
||||
It currently also isn't fully cross-platform portable (lack of VS support).
|
||||
- msgpack: has very minimal forwards/backwards compatability support when used
|
||||
- msgpack: has very minimal forwards/backwards compatibility support when used
|
||||
with the typed C++ interface. Also lacks VS2010 support.
|
||||
- Thrift: very similar to Protocol Buffers, but appears to be less efficient,
|
||||
and have more dependencies.
|
||||
@@ -52,3 +53,11 @@ meant to be representative of game data, e.g. a scene format.
|
||||
fields manually), is very much tied to the rest of the engine, and works
|
||||
without a schema to generate code (tied to your C++ class definition).
|
||||
|
||||
### Code for benchmarks
|
||||
|
||||
Code for these benchmarks sits in `benchmarks/` in git branch `benchmarks`.
|
||||
It sits in its own branch because it has submodule dependencies that the main
|
||||
project doesn't need, and the code standards do not meet those of the main
|
||||
project. Please read `benchmarks/cpp/README.txt` before working with the code.
|
||||
|
||||
<br>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# Building
|
||||
Building {#flatbuffers_guide_building}
|
||||
========
|
||||
|
||||
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.
|
||||
## Building with CMake
|
||||
|
||||
Alternatively, the distribution comes with a `cmake` file that should allow
|
||||
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.:
|
||||
@@ -18,28 +18,45 @@ 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"`.
|
||||
|
||||
Optionally, run the `flattests` executable to ensure everything is working
|
||||
correctly on your system. If this fails, please contact us!
|
||||
Optionally, run the `flattests` executable from the root `flatbuffers/`
|
||||
directory to ensure everything is working correctly on your system. If this
|
||||
fails, please contact us!
|
||||
|
||||
Note that you MUST be in the root of the FlatBuffers distribution when you
|
||||
run 'flattests' (and the samples), or it will fail to load its files.
|
||||
Building should also produce two sample executables, `flatsamplebinary` and
|
||||
`flatsampletext`, see the corresponding `.cpp` files in the
|
||||
`flatbuffers/samples` directory.
|
||||
|
||||
Building should also produce two sample executables, `sample_binary` and
|
||||
`sample_text`, see the corresponding `.cpp` file in the samples directory.
|
||||
*Note that you MUST be in the root of the FlatBuffers distribution when you
|
||||
run 'flattests' or `flatsampletext`, or it will fail to load its files.*
|
||||
|
||||
There is an `android` directory that contains all you need to build the test
|
||||
executable on android (use the included `build_apk.sh` script, or use
|
||||
## Building for Android
|
||||
|
||||
There is a `flatbuffers/android` directory that contains all you need to build
|
||||
the test executable on android (use the included `build_apk.sh` script, or use
|
||||
`ndk_build` / `adb` etc. as usual). Upon running, it will output to the log
|
||||
if tests succeeded or not.
|
||||
|
||||
There is usually no runtime to compile, as the code consists of a single
|
||||
header, `include/flatbuffers/flatbuffers.h`. You should add the
|
||||
You may also run an android sample from inside the `flatbuffers/samples`, by
|
||||
running the `android_sample.sh` script. Optionally, you may go to the
|
||||
`flatbuffers/samples/android` folder and build the sample with the
|
||||
`build_apk.sh` script or `ndk_build` / `adb` etc.
|
||||
|
||||
## Using FlatBuffers in your own projects.
|
||||
|
||||
For C++, there is usually no runtime to compile, as the code consists of a
|
||||
single header, `include/flatbuffers/flatbuffers.h`. You should add the
|
||||
`include` folder to your include paths. If you wish to be
|
||||
able to load schemas and/or parse text into binary buffers at runtime,
|
||||
you additionally need the other headers in `include/flatbuffers`. You must
|
||||
also compile/link `src/idl_parser.cpp` (and `src/idl_gen_text.cpp` if you
|
||||
also want to be able convert binary to text).
|
||||
|
||||
To see how to include FlatBuffers in any of our supported languages, please
|
||||
view the [Tutorial](@ref flatbuffers_guide_tutorial) and select your appropriate
|
||||
language using the radio buttons.
|
||||
|
||||
#### For Google Play apps
|
||||
|
||||
For applications on Google Play that integrate this library, usage is tracked.
|
||||
This tracking is done automatically using the embedded version string
|
||||
(flatbuffer_version_string), and helps us continue to optimize it.
|
||||
|
||||
1
docs/source/CONTRIBUTING.md
Symbolic link
@@ -0,0 +1 @@
|
||||
../../CONTRIBUTING
|
||||
224
docs/source/CUsage.md
Normal file
@@ -0,0 +1,224 @@
|
||||
Use in C {#flatbuffers_guide_use_c}
|
||||
==========
|
||||
|
||||
The C language binding exists in a separate project named [FlatCC](https://github.com/dvidelabs/flatcc).
|
||||
|
||||
The `flatcc` C schema compiler can generate code offline as well as
|
||||
online via a C library. It can also generate buffer verifiers and fast
|
||||
JSON parsers, printers.
|
||||
|
||||
Great care has been taken to ensure compatibily with the main `flatc`
|
||||
project.
|
||||
|
||||
## General Documention
|
||||
|
||||
- [Tutorial](@ref flatbuffers_guide_tutorial) - select C as language
|
||||
when scrolling down
|
||||
- [FlatCC Guide](https://github.com/dvidelabs/flatcc#flatcc-flatbuffers-in-c-for-c)
|
||||
- [The C Builder Interface](https://github.com/dvidelabs/flatcc/blob/master/doc/builder.md#the-builder-interface)
|
||||
- [The Monster Sample in C](https://github.com/dvidelabs/flatcc/blob/master/samples/monster/monster.c)
|
||||
- [GitHub](https://github.com/dvidelabs/flatcc)
|
||||
|
||||
|
||||
## Supported Platforms
|
||||
|
||||
- Ubuntu (clang / gcc, ninja / gnu make)
|
||||
- OS-X (clang / gcc, ninja / gnu make)
|
||||
- Windows MSVC 2010, 2013, 2015
|
||||
|
||||
CI builds recent versions of gcc, clang and MSVC on OS-X, Ubuntu, and
|
||||
Windows, and occasionally older compiler versions. See main project [Status](https://github.com/dvidelabs/flatcc#status).
|
||||
|
||||
Other platforms may well work, including Centos, but are not tested
|
||||
regularly.
|
||||
|
||||
The monster sample project was specifically written for C99 in order to
|
||||
follow the C++ version and for that reason it will not work with MSVC
|
||||
2010.
|
||||
|
||||
## Modular Object Creation
|
||||
|
||||
In the tutorial we used the call `Monster_create_as_root` to create the
|
||||
root buffer object since this is easier in simple use cases. Sometimes
|
||||
we need more modularity so we can reuse a function to create nested
|
||||
tables and root tables the same way. For this we need the
|
||||
`flatcc_builder_buffer_create_call`. It is best to keep `flatcc_builder`
|
||||
calls isolated at the top driver level, so we get:
|
||||
|
||||
<div class="language-c">
|
||||
~~~{.c}
|
||||
ns(Monster_ref_t) create_orc(flatcc_builder_t *B)
|
||||
{
|
||||
// ... same as in the tutorial.
|
||||
return s(Monster_create(B, ...));
|
||||
}
|
||||
|
||||
void create_monster_buffer()
|
||||
{
|
||||
uint8_t *buf;
|
||||
size_t size;
|
||||
flatcc_builder_t builder, *B;
|
||||
|
||||
// Initialize the builder object.
|
||||
B = &builder;
|
||||
flatcc_builder_init(B);
|
||||
// Only use `buffer_create` without `create/start/end_as_root`.
|
||||
flatcc_builder_buffer_create(create_orc(B));
|
||||
// Allocate and copy buffer to user memory.
|
||||
buf = flatcc_builder_finalize_buffer(B, &size);
|
||||
// ... write the buffer to disk or network, or something.
|
||||
|
||||
free(buf);
|
||||
flatcc_builder_clear(B);
|
||||
}
|
||||
~~~
|
||||
</div>
|
||||
|
||||
The same principle applies with `start/end` vs `start/end_as_root` in
|
||||
the top-down approach.
|
||||
|
||||
|
||||
## Top Down Example
|
||||
|
||||
The tutorial uses a bottom up approach. In C it is also possible to use
|
||||
a top-down approach by starting and ending objects nested within each
|
||||
other. In the tutorial there is no deep nesting, so the difference is
|
||||
limited, but it shows the idea:
|
||||
|
||||
<div class="language-c">
|
||||
<br>
|
||||
~~~{.c}
|
||||
uint8_t treasure[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
|
||||
size_t treasure_count = c_vec_len(treasure);
|
||||
ns(Weapon_ref_t) axe;
|
||||
|
||||
// NOTE: if we use end_as_root, we MUST also start as root.
|
||||
ns(Monster_start_as_root(B));
|
||||
ns(Monster_pos_create(B, 1.0f, 2.0f, 3.0f));
|
||||
ns(Monster_hp_add(B, 300));
|
||||
ns(Monster_mana_add(B, 150));
|
||||
// We use create_str instead of add because we have no existing string reference.
|
||||
ns(Monster_name_create_str(B, "Orc"));
|
||||
// Again we use create because we no existing vector object, only a C-array.
|
||||
ns(Monster_inventory_create(B, treasure, treasure_count));
|
||||
ns(Monster_color_add(B, ns(Color_Red)));
|
||||
if (1) {
|
||||
ns(Monster_weapons_start(B));
|
||||
ns(Monster_weapons_push_create(B, flatbuffers_string_create_str(B, "Sword"), 3));
|
||||
// We reuse the axe object later. Note that we dereference a pointer
|
||||
// because push always returns a short-term pointer to the stored element.
|
||||
// We could also have created the axe object first and simply pushed it.
|
||||
axe = *ns(Monster_weapons_push_create(B, flatbuffers_string_create_str(B, "Axe"), 5));
|
||||
ns(Monster_weapons_end(B));
|
||||
} else {
|
||||
// We can have more control with the table elements added to a vector:
|
||||
//
|
||||
ns(Monster_weapons_start(B));
|
||||
ns(Monster_weapons_push_start(B));
|
||||
ns(Weapon_name_create_str(B, "Sword"));
|
||||
ns(Weapon_damage_add(B, 3));
|
||||
ns(Monster_weapons_push_end(B));
|
||||
ns(Monster_weapons_push_start(B));
|
||||
ns(Monster_weapons_push_start(B));
|
||||
ns(Weapon_name_create_str(B, "Axe"));
|
||||
ns(Weapon_damage_add(B, 5));
|
||||
axe = *ns(Monster_weapons_push_end(B));
|
||||
ns(Monster_weapons_end(B));
|
||||
}
|
||||
// Unions can get their type by using a type-specific add/create/start method.
|
||||
ns(Monster_equipped_Weapon_add(B, axe));
|
||||
|
||||
ns(Monster_end_as_root(B));
|
||||
~~~
|
||||
</div>
|
||||
|
||||
|
||||
## Basic Reflection
|
||||
|
||||
The C-API does support reading binary schema (.bfbs)
|
||||
files via code generated from the `reflection.fbs` schema, and an
|
||||
[example usage](https://github.com/dvidelabs/flatcc/tree/master/samples/reflection)
|
||||
shows how to use this. The reflection schema files are pre-generated
|
||||
in the [runtime distribution](https://github.com/dvidelabs/flatcc/tree/master/include/flatcc/reflection).
|
||||
|
||||
|
||||
## Mutations and Reflection
|
||||
|
||||
The C-API does not support mutating reflection like C++ does, nor does
|
||||
the reader interface support mutating scalars (and it is generally
|
||||
unsafe to do so even after verification).
|
||||
|
||||
The generated reader interface supports sorting vectors in-place after
|
||||
casting them to a mutating type because it is not practical to do so
|
||||
while building a buffer. This is covered in the builder documentation.
|
||||
The reflection example makes use of this feature to look up objects by
|
||||
name.
|
||||
|
||||
It is possible to build new buffers using complex objects from existing
|
||||
buffers as source. This can be very efficient due to direct copy
|
||||
semantics without endian conversion or temporary stack allocation.
|
||||
|
||||
Scalars, structs and strings can be used as source, as well vectors of
|
||||
these.
|
||||
|
||||
It is currently not possible to use an existing table or vector of table
|
||||
as source, but it would be possible to add support for this at some
|
||||
point.
|
||||
|
||||
|
||||
## Namespaces
|
||||
|
||||
The `FLATBUFFERS_WRAP_NAMESPACE` approach used in the tutorial is convenient
|
||||
when each function has a very long namespace prefix. But it isn't always
|
||||
the best approach. If the namespace is absent, or simple and
|
||||
informative, we might as well use the prefix directly. The
|
||||
[reflection example](https://github.com/dvidelabs/flatcc/blob/master/samples/reflection/bfbs2json.c)
|
||||
mentioned above uses this approach.
|
||||
|
||||
|
||||
## Checking for Present Members
|
||||
|
||||
Not all languages support testing if a field is present, but in C we can
|
||||
elaborate the reader section of the tutorial with tests for this. Recall
|
||||
that `mana` was set to the default value `150` and therefore shouldn't
|
||||
be present.
|
||||
|
||||
<div class="language-c">
|
||||
~~~{.c}
|
||||
int hp_present = ns(Monster_hp_is_present(monster)); // 1
|
||||
int mana_present = ns(Monster_mana_is_present(monster)); // 0
|
||||
~~~
|
||||
</div>
|
||||
|
||||
## Alternative ways to add a Union
|
||||
|
||||
In the tutorial we used a single call to add a union. Here we show
|
||||
different ways to accomplish the same thing. The last form is rarely
|
||||
used, but is the low-level way to do it. It can be used to group small
|
||||
values together in the table by adding type and data at different
|
||||
points in time.
|
||||
|
||||
<div class="language-c">
|
||||
~~~{.c}
|
||||
ns(Equipment_union_ref_t) equipped = ns(Equipment_as_Weapon(axe));
|
||||
ns(Monster_equipped_add(B, equipped));
|
||||
// or alternatively
|
||||
ns(Monster_equipped_Weapon_add(B, axe);
|
||||
// or alternatively
|
||||
ns(Monster_equipped_add_type(B, ns(Equipment_Weapon));
|
||||
ns(Monster_equipped_add_member(B, axe));
|
||||
~~~
|
||||
</div>
|
||||
|
||||
## Why not integrate with the `flatc` tool?
|
||||
|
||||
[It was considered how the C code generator could be integrated into the
|
||||
`flatc` tool](https://github.com/dvidelabs/flatcc/issues/1), but it
|
||||
would either require that the standalone C implementation of the schema
|
||||
compiler was dropped, or it would lead to excessive code duplication, or
|
||||
a complicated intermediate representation would have to be invented.
|
||||
Neither of these alternatives are very attractive, and it isn't a big
|
||||
deal to use the `flatcc` tool instead of `flatc` given that the
|
||||
FlatBuffers C runtime library needs to be made available regardless.
|
||||
|
||||
|
||||
@@ -1,36 +1,51 @@
|
||||
# Using the schema compiler
|
||||
Using the schema compiler {#flatbuffers_guide_using_schema_compiler}
|
||||
=========================
|
||||
|
||||
Usage:
|
||||
|
||||
flatc [ -c ] [ -j ] [ -b ] [ -t ] [ -o PATH ] [ -I PATH ] [ -S ] FILES...
|
||||
flatc [ GENERATOR OPTIONS ] [ -o PATH ] [ -I PATH ] [ -S ] FILES...
|
||||
[ -- FILES...]
|
||||
|
||||
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.
|
||||
or data (see below). Data files are processed according to the definitions of
|
||||
the most recent schema specified.
|
||||
|
||||
`--` indicates that the following files are binary files in
|
||||
FlatBuffer format conforming to the schema(s) indicated before it.
|
||||
Incompatible binary files currently will give unpredictable results (!)
|
||||
FlatBuffer format conforming to the schema indicated before it.
|
||||
|
||||
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`). Skipped for data.
|
||||
For any schema input files, one or more generators can be specified:
|
||||
|
||||
- `-j` : Generate Java classes. Skipped for data.
|
||||
- `--cpp`, `-c` : Generate a C++ header for all definitions in this file (as
|
||||
`filename_generated.h`).
|
||||
|
||||
- `-n` : Generate C# classes. Skipped for data.
|
||||
- `--java`, `-j` : Generate Java code.
|
||||
|
||||
- `-g` : Generate Go classes. Skipped for data.
|
||||
- `--csharp`, `-n` : Generate C# code.
|
||||
|
||||
- `-b` : If data is contained in this file, generate a
|
||||
`filename.bin` containing the binary flatbuffer.
|
||||
- `--go`, `-g` : Generate Go code.
|
||||
|
||||
- `-t` : If data is contained in this file, generate a
|
||||
- `--python`, `-p`: Generate Python code.
|
||||
|
||||
- `--javascript`, `-s`: Generate JavaScript code.
|
||||
|
||||
- `--php`: Generate PHP code.
|
||||
|
||||
- `--grpc`: Generate RPC stub code for GRPC.
|
||||
|
||||
For any data input files:
|
||||
|
||||
- `--binary`, `-b` : If data is contained in this file, generate a
|
||||
`filename.bin` containing the binary flatbuffer (or a different extension
|
||||
if one is specified in the schema).
|
||||
|
||||
- `--json`, `-t` : If data is contained in this file, generate a
|
||||
`filename.json` representing the data in the flatbuffer.
|
||||
|
||||
Additional options:
|
||||
|
||||
- `-o PATH` : Output all generated files to PATH (either absolute, or
|
||||
relative to the current directory). If omitted, PATH will be the
|
||||
current directory. PATH should end in your systems path separator,
|
||||
@@ -41,19 +56,61 @@ be generated for each file processed:
|
||||
fail (or none are specified) it will try to load relative to the path of
|
||||
the schema file being parsed.
|
||||
|
||||
- `-M` : Print make rules for generated files.
|
||||
|
||||
- `--strict-json` : Require & generate strict JSON (field names are enclosed
|
||||
in quotes, no trailing commas in tables/vectors). By default, no quotes are
|
||||
required/generated, and trailing commas are allowed.
|
||||
|
||||
- `--defaults-json` : Output fields whose value is equal to the default value
|
||||
when writing JSON text.
|
||||
|
||||
- `--no-prefix` : Don't prefix enum values in generated C++ by their enum
|
||||
type.
|
||||
|
||||
- `--gen-includes` : Generate include statements for included schemas the
|
||||
- `--scoped-enums` : Use C++11 style scoped and strongly typed enums in
|
||||
generated C++. This also implies `--no-prefix`.
|
||||
|
||||
- `--gen-includes` : (deprecated), this is the default behavior.
|
||||
If the original behavior is required (no include
|
||||
statements) use `--no-includes.`
|
||||
|
||||
- `--no-includes` : Don't generate include statements for included schemas the
|
||||
generated file depends on (C++).
|
||||
|
||||
- `--gen-mutable` : Generate additional non-const accessors for mutating
|
||||
FlatBuffers in-place.
|
||||
|
||||
`--gen-object-api` : Generate an additional object-based API. This API is
|
||||
more convenient for object construction and mutation than the base API,
|
||||
at the cost of efficiency (object allocation). Recommended only to be used
|
||||
if other options are insufficient.
|
||||
|
||||
- `--gen-onefile` : Generate single output file (useful for C#)
|
||||
|
||||
- `--gen-all`: Generate not just code for the current schema files, but
|
||||
for all files it includes as well. If the language uses a single file for
|
||||
output (by default the case for C++ and JS), all code will end up in
|
||||
this one file.
|
||||
|
||||
- `--raw-binary` : Allow binaries without a file_indentifier to be read.
|
||||
This may crash flatc given a mismatched schema.
|
||||
|
||||
- `--proto`: Expect input files to be .proto files (protocol buffers).
|
||||
Output the corresponding .fbs file.
|
||||
Currently supports: `package`, `message`, `enum`.
|
||||
Does not support, but will skip without error: `import`, `option`.
|
||||
Does not support, will generate error: `service`, `extend`, `extensions`,
|
||||
`oneof`, `group`, custom options, nested declarations.
|
||||
Currently supports: `package`, `message`, `enum`, nested declarations,
|
||||
`import` (use `-I` for paths), `extend`, `oneof`, `group`.
|
||||
Does not support, but will skip without error: `option`, `service`,
|
||||
`extensions`, and most everything else.
|
||||
|
||||
- `--schema`: Serialize schemas instead of JSON (use with -b). This will
|
||||
output a binary version of the specified schema that itself corresponds
|
||||
to the reflection/reflection.fbs schema. Loading this binary file is the
|
||||
basis for reflection functionality.
|
||||
|
||||
- `--conform FILE` : Specify a schema the following schemas should be
|
||||
an evolution of. Gives errors if not. Useful to check if schema
|
||||
modifications don't break schema evolution rules.
|
||||
|
||||
NOTE: short-form options for generators are deprecated, use the long form
|
||||
whenever possible.
|
||||
|
||||
@@ -1,169 +1,134 @@
|
||||
# Use in C++
|
||||
Use in C++ {#flatbuffers_guide_use_cpp}
|
||||
==========
|
||||
|
||||
Assuming you have written a schema using the above language in say
|
||||
`mygame.fbs` (FlatBuffer Schema, though the extension doesn't matter),
|
||||
you've generated a C++ header called `mygame_generated.h` using the
|
||||
## Before you get started
|
||||
|
||||
Before diving into the FlatBuffers usage in C++, it should be noted that
|
||||
the [Tutorial](@ref flatbuffers_guide_tutorial) page has a complete guide
|
||||
to general FlatBuffers usage in all of the supported languages (including C++).
|
||||
This page is designed to cover the nuances of FlatBuffers usage, specific to
|
||||
C++.
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
This page assumes you have written a FlatBuffers schema and compiled it
|
||||
with the Schema Compiler. If you have not, please see
|
||||
[Using the schema compiler](@ref flatbuffers_guide_using_schema_compiler)
|
||||
and [Writing a schema](@ref flatbuffers_guide_writing_schema).
|
||||
|
||||
Assuming you wrote a schema, say `mygame.fbs` (though the extension doesn't
|
||||
matter), you've generated a C++ header called `mygame_generated.h` using the
|
||||
compiler (e.g. `flatc -c mygame.fbs`), you can now start using this in
|
||||
your program by including the header. As noted, this header relies on
|
||||
`flatbuffers/flatbuffers.h`, which should be in your include path.
|
||||
|
||||
### Writing in C++
|
||||
## FlatBuffers C++ library code location
|
||||
|
||||
To start creating a buffer, create an instance of `FlatBufferBuilder`
|
||||
which will contain the buffer as it grows:
|
||||
The code for the FlatBuffers C++ library can be found at
|
||||
`flatbuffers/include/flatbuffers`. You can browse the library code on the
|
||||
[FlatBuffers GitHub page](https://github.com/google/flatbuffers/tree/master/include/flatbuffers).
|
||||
|
||||
## Testing the FlatBuffers C++ library
|
||||
|
||||
The code to test the C++ library can be found at `flatbuffers/tests`.
|
||||
The test code itself is located in
|
||||
[test.cpp](https://github.com/google/flatbuffers/blob/master/tests/test.cpp).
|
||||
|
||||
This test file is built alongside `flatc`. To review how to build the project,
|
||||
please read the [Building](@ref flatbuffers_guide_building) documenation.
|
||||
|
||||
To run the tests, execute `flattests` from the root `flatbuffers/` directory.
|
||||
For example, on [Linux](https://en.wikipedia.org/wiki/Linux), you would simply
|
||||
run: `./flattests`.
|
||||
|
||||
## Using the FlatBuffers C++ library
|
||||
|
||||
*Note: See [Tutorial](@ref flatbuffers_guide_tutorial) for a more in-depth
|
||||
example of how to use FlatBuffers in C++.*
|
||||
|
||||
FlatBuffers supports both reading and writing FlatBuffers in C++.
|
||||
|
||||
To use FlatBuffers in your code, first generate the C++ classes from your
|
||||
schema with the `--cpp` option to `flatc`. Then you can include both FlatBuffers
|
||||
and the generated code to read or write FlatBuffers.
|
||||
|
||||
For example, here is how you would read a FlatBuffer binary file in C++:
|
||||
First, include the library and generated code. Then read the file into
|
||||
a `char *` array, which you pass to `GetMonster()`.
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
|
||||
FlatBufferBuilder fbb;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
#include "monster_test_generate.h"
|
||||
#include <cstdio> // For printing and file access.
|
||||
|
||||
Before we serialize a Monster, we need to first serialize any objects
|
||||
that are contained there-in, i.e. we serialize the data tree using
|
||||
depth first, pre-order traversal. This is generally easy to do on
|
||||
any tree structures. For example:
|
||||
FILE* file = fopen("monsterdata_test.mon", "rb");
|
||||
fseek(file, 0L, SEEK_END);
|
||||
int length = ftell(file);
|
||||
fseek(file, 0L, SEEK_SET);
|
||||
char *data = new char[length];
|
||||
fread(data, sizeof(char), length, file);
|
||||
fclose(file);
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
|
||||
auto name = fbb.CreateString("MyMonster");
|
||||
|
||||
unsigned char inv[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
auto inventory = fbb.CreateVector(inv, 10);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
`CreateString` and `CreateVector` serialize these two built-in
|
||||
datatypes, and return offsets into the serialized data indicating where
|
||||
they are stored, such that `Monster` below can refer to them.
|
||||
|
||||
`CreateString` can also take an `std::string`, or a `const char *` with
|
||||
an explicit length, and is suitable for holding UTF-8 and binary
|
||||
data if needed.
|
||||
|
||||
`CreateVector` can also take an `std::vector`. The
|
||||
offset it returns is typed, i.e. can only be used to set fields of the
|
||||
correct type below. To create a vector of struct objects (which will
|
||||
be stored as contiguous memory in the buffer, use `CreateVectorOfStructs`
|
||||
instead.
|
||||
|
||||
To create a vector of nested objects (e.g. tables, strings or other vectors)
|
||||
collect their offsets in a temporary array/vector, then call `CreateVector`
|
||||
on that (see e.g. the array of strings example in `test.cpp`
|
||||
`CreateFlatBufferTest`).
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
|
||||
Vec3 vec(1, 2, 3);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
`Vec3` is the first example of code from our generated
|
||||
header. Structs (unlike tables) translate to simple structs in C++, so
|
||||
we can construct them in a familiar way.
|
||||
|
||||
We have now serialized the non-scalar components of of the monster
|
||||
example, so we could create the monster something like this:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
|
||||
auto mloc = CreateMonster(fbb, &vec, 150, 80, name, inventory, Color_Red, 0, Any_NONE);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Note that we're passing `150` for the `mana` field, which happens to be the
|
||||
default value: this means the field will not actually be written to the buffer,
|
||||
since we'll get that value anyway when we query it. This is a nice space
|
||||
savings, since it is very common for fields to be at their default. It means
|
||||
we also don't need to be scared to add fields only used in a minority of cases,
|
||||
since they won't bloat up the buffer sizes if they're not actually used.
|
||||
|
||||
We do something similarly for the union field `test` by specifying a `0` offset
|
||||
and the `NONE` enum value (part of every union) to indicate we don't actually
|
||||
want to write this field. You can use `0` also as a default for other
|
||||
non-scalar types, such as strings, vectors and tables.
|
||||
|
||||
Tables (like `Monster`) give you full flexibility on what fields you write
|
||||
(unlike `Vec3`, which always has all fields set because it is a `struct`).
|
||||
If you want even more control over this (i.e. skip fields even when they are
|
||||
not default), instead of the convenient `CreateMonster` call we can also
|
||||
build the object field-by-field manually:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
|
||||
MonsterBuilder mb(fbb);
|
||||
mb.add_pos(&vec);
|
||||
mb.add_hp(80);
|
||||
mb.add_name(name);
|
||||
mb.add_inventory(inventory);
|
||||
auto mloc = mb.Finish();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
We start with a temporary helper class `MonsterBuilder` (which is
|
||||
defined in our generated code also), then call the various `add_`
|
||||
methods to set fields, and `Finish` to complete the object. This is
|
||||
pretty much the same code as you find inside `CreateMonster`, except
|
||||
we're leaving out a few fields. Fields may also be added in any order,
|
||||
though orderings with fields of the same size adjacent
|
||||
to each other most efficient in size, due to alignment. You should
|
||||
not nest these Builder classes (serialize your
|
||||
data in pre-order).
|
||||
|
||||
Regardless of whether you used `CreateMonster` or `MonsterBuilder`, you
|
||||
now have an offset to the root of your data, and you can finish the
|
||||
buffer using:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
|
||||
FinishMonsterBuffer(fbb, mloc);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The buffer is now ready to be stored somewhere, sent over the network,
|
||||
be compressed, or whatever you'd like to do with it. You can access the
|
||||
start of the buffer with `fbb.GetBufferPointer()`, and it's size from
|
||||
`fbb.GetSize()`.
|
||||
|
||||
Calling code may take ownership of the buffer with `fbb.ReleaseBufferPointer()`.
|
||||
Should you do it, the `FlatBufferBuilder` will be in an invalid state,
|
||||
and *must* be cleared before it can be used again.
|
||||
However, it also means you are able to destroy the builder while keeping
|
||||
the buffer in your application.
|
||||
|
||||
`samples/sample_binary.cpp` is a complete code sample similar to
|
||||
the code above, that also includes the reading code below.
|
||||
|
||||
### Reading in C++
|
||||
|
||||
If you've received a buffer from somewhere (disk, network, etc.) you can
|
||||
directly start traversing it using:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
|
||||
auto monster = GetMonster(buffer_pointer);
|
||||
auto monster = GetMonster(data);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
`monster` is of type `Monster *`, and points to somewhere *inside* your
|
||||
buffer (root object pointers are not the same as `buffer_pointer` !).
|
||||
If you look in your generated header, you'll see it has
|
||||
convenient accessors for all fields, e.g.
|
||||
convenient accessors for all fields, e.g. `hp()`, `mana()`, etc:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
|
||||
assert(monster->hp() == 80);
|
||||
assert(monster->mana() == 150); // default
|
||||
assert(strcmp(monster->name()->c_str(), "MyMonster") == 0);
|
||||
printf("%d\n", monster->hp()); // `80`
|
||||
printf("%d\n", monster->mana()); // default value of `150`
|
||||
printf("%s\n", monster->name()->c_str()); // "MyMonster"
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
These should all be true. Note that we never stored a `mana` value, so
|
||||
it will return the default.
|
||||
*Note: That we never stored a `mana` value, so it will return the default.*
|
||||
|
||||
To access sub-objects, in this case the `Vec3`:
|
||||
## Object based API.
|
||||
|
||||
FlatBuffers is all about memory efficiency, which is why its base API is written
|
||||
around using as little as possible of it. This does make the API clumsier
|
||||
(requiring pre-order construction of all data, and making mutation harder).
|
||||
|
||||
For times when efficiency is less important a more convenient object based API
|
||||
can be used (through `--gen-object-api`) that is able to unpack & pack a
|
||||
FlatBuffer into objects and standard STL containers, allowing for convenient
|
||||
construction, access and mutation.
|
||||
|
||||
To use:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
|
||||
auto pos = monster->pos();
|
||||
assert(pos);
|
||||
assert(pos->z() == 3);
|
||||
auto monsterobj = GetMonster(buffer)->UnPack();
|
||||
cout << monsterobj->name; // This is now a std::string!
|
||||
monsterobj->name = "Bob"; // Change the name.
|
||||
FlatBufferBuilder fbb;
|
||||
CreateMonster(fbb, monsterobj.get()); // Serialize into new buffer.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If we had not set the `pos` field during serialization, it would be
|
||||
`NULL`.
|
||||
## Reflection (& Resizing)
|
||||
|
||||
Similarly, we can access elements of the inventory array:
|
||||
There is experimental support for reflection in FlatBuffers, allowing you to
|
||||
read and write data even if you don't know the exact format of a buffer, and
|
||||
even allows you to change sizes of strings and vectors in-place.
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
|
||||
auto inv = monster->inventory();
|
||||
assert(inv);
|
||||
assert(inv->Get(9) == 9);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
The way this works is very elegant; there is actually a FlatBuffer schema that
|
||||
describes schemas (!) which you can find in `reflection/reflection.fbs`.
|
||||
The compiler, `flatc`, can write out any schemas it has just parsed as a binary
|
||||
FlatBuffer, corresponding to this meta-schema.
|
||||
|
||||
### Storing maps / dictionaries in a FlatBuffer
|
||||
Loading in one of these binary schemas at runtime allows you traverse any
|
||||
FlatBuffer data that corresponds to it without knowing the exact format. You
|
||||
can query what fields are present, and then read/write them after.
|
||||
|
||||
For convenient field manipulation, you can include the header
|
||||
`flatbuffers/reflection.h` which includes both the generated code from the meta
|
||||
schema, as well as a lot of helper functions.
|
||||
|
||||
And example of usage, for the time being, can be found in
|
||||
`test.cpp/ReflectionTest()`.
|
||||
|
||||
## Storing maps / dictionaries in a FlatBuffer
|
||||
|
||||
FlatBuffers doesn't support maps natively, but there is support to
|
||||
emulate their behavior with vectors and binary search, which means you
|
||||
@@ -189,7 +154,7 @@ To use it:
|
||||
only works if the vector has been sorted, it will likely not find elements
|
||||
if it hasn't been sorted.
|
||||
|
||||
### Direct memory access
|
||||
## Direct memory access
|
||||
|
||||
As you can see from the above examples, all elements in a buffer are
|
||||
accessed through generated accessors. This is because everything is
|
||||
@@ -214,7 +179,7 @@ machines, so only use tricks like this if you can guarantee you're not
|
||||
shipping on a big endian machine (an `assert(FLATBUFFERS_LITTLEENDIAN)`
|
||||
would be wise).
|
||||
|
||||
### Access of untrusted buffers
|
||||
## Access of untrusted buffers
|
||||
|
||||
The generated accessor functions access fields over offsets, which is
|
||||
very quick. These offsets are not verified at run-time, so a malformed
|
||||
@@ -271,7 +236,7 @@ accepted).
|
||||
|
||||
There are two ways to use text formats:
|
||||
|
||||
### Using the compiler as a conversion tool
|
||||
#### Using the compiler as a conversion tool
|
||||
|
||||
This is the preferred path, as it doesn't require you to add any new
|
||||
code to your program, and is maximally efficient since you can ship with
|
||||
@@ -283,7 +248,7 @@ users/developers to perform, though you might be able to automate it.
|
||||
This will generate the binary file `mydata_wire.bin` which can be loaded
|
||||
as before.
|
||||
|
||||
### Making your program capable of loading text directly
|
||||
#### Making your program capable of loading text directly
|
||||
|
||||
This gives you maximum flexibility. You could even opt to support both,
|
||||
i.e. check for both files, and regenerate the binary from text when
|
||||
@@ -329,7 +294,7 @@ file, that you can access as described above.
|
||||
|
||||
`samples/sample_text.cpp` is a code sample showing the above operations.
|
||||
|
||||
### Threading
|
||||
## Threading
|
||||
|
||||
Reading a FlatBuffer does not touch any memory outside the original buffer,
|
||||
and is entirely read-only (all const), so is safe to access from multiple
|
||||
@@ -342,3 +307,5 @@ share instances of FlatBufferBuilder between threads (recommended), or
|
||||
manually wrap it in synchronisation primites. There's no automatic way to
|
||||
accomplish this, by design, as we feel multithreaded construction
|
||||
of a single buffer will be rare, and synchronisation overhead would be costly.
|
||||
|
||||
<br>
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
# FlatBuffers
|
||||
FlatBuffers {#flatbuffers_index}
|
||||
===========
|
||||
|
||||
FlatBuffers is an efficient cross platform serialization library for C++,
|
||||
with support for Java, C# and Go. It was created at Google specifically for game
|
||||
development and other performance-critical applications.
|
||||
# Overview {#flatbuffers_overview}
|
||||
|
||||
It is available as open source under the Apache license, v2 (see LICENSE.txt).
|
||||
[FlatBuffers](@ref flatbuffers_overview) is an efficient cross platform
|
||||
serialization library for C++, C#, C, Go, Java, JavaScript, PHP, and Python.
|
||||
It was originally created at Google for game development and other
|
||||
performance-critical applications.
|
||||
|
||||
It is available as Open Source on [GitHub](http://github.com/google/flatbuffers)
|
||||
under the Apache license, v2 (see LICENSE.txt).
|
||||
|
||||
## Why use FlatBuffers?
|
||||
|
||||
@@ -15,8 +20,8 @@ It is available as open source under the Apache license, v2 (see LICENSE.txt).
|
||||
structure evolution (forwards/backwards compatibility).
|
||||
|
||||
- **Memory efficiency and speed** - The only memory needed to access
|
||||
your data is that of the buffer. It requires 0 additional allocations.
|
||||
FlatBuffers is also very
|
||||
your data is that of the buffer. It requires 0 additional allocations
|
||||
(in C++, other languages may vary). FlatBuffers is also very
|
||||
suitable for use with mmap (or streaming), requiring only part of the
|
||||
buffer to be in memory. Access is close to the speed of raw
|
||||
struct access with only one extra indirection (a kind of vtable) to
|
||||
@@ -24,7 +29,7 @@ It is available as open source under the Apache license, v2 (see LICENSE.txt).
|
||||
projects where spending time and space (many memory allocations) to
|
||||
be able to access or construct serialized data is undesirable, such
|
||||
as in games or any other performance sensitive applications. See the
|
||||
[benchmarks](md__benchmarks.html) for details.
|
||||
[benchmarks](@ref flatbuffers_benchmarks) for details.
|
||||
|
||||
- **Flexible** - Optional fields means not only do you get great
|
||||
forwards and backwards compatibility (increasingly important for
|
||||
@@ -46,9 +51,10 @@ It is available as open source under the Apache license, v2 (see LICENSE.txt).
|
||||
needed (faster and more memory efficient than other JSON
|
||||
parsers).
|
||||
|
||||
Java and Go code supports object-reuse.
|
||||
Java and Go code supports object-reuse. C# has efficient struct based
|
||||
accessors.
|
||||
|
||||
- **Cross platform C++11/Java/C#/Go code with no dependencies** - will work
|
||||
- **Cross platform code with no dependencies** - C++ code will work
|
||||
with any recent gcc/clang and VS2010. Comes with build files for the tests &
|
||||
samples (Android .mk files, and cmake for all other platforms).
|
||||
|
||||
@@ -73,7 +79,18 @@ In this context, it is only a better choice for systems that have very
|
||||
little to no information ahead of time about what data needs to be stored.
|
||||
|
||||
Read more about the "why" of FlatBuffers in the
|
||||
[white paper](md__white_paper.html).
|
||||
[white paper](@ref flatbuffers_white_paper).
|
||||
|
||||
### Who uses FlatBuffers?
|
||||
- [Cocos2d-x](http://www.cocos2d-x.org/), the #1 open source mobile game
|
||||
engine, uses it to serialize all their
|
||||
[game data](http://www.cocos2d-x.org/reference/native-cpp/V3.5/d7/d2d/namespaceflatbuffers.html).
|
||||
- [Facebook](http://facebook.com/) uses it for client-server communication in
|
||||
their Android app. They have a nice
|
||||
[article](https://code.facebook.com/posts/872547912839369/improving-facebook-s-performance-on-android-with-flatbuffers/)
|
||||
explaining how it speeds up loading their posts.
|
||||
- [Fun Propulsion Labs](https://developers.google.com/games/#Tools)
|
||||
at Google uses it extensively in all their libraries and games.
|
||||
|
||||
## Usage in brief
|
||||
|
||||
@@ -88,8 +105,8 @@ sections provide a more in-depth usage guide.
|
||||
present for every object instance.
|
||||
|
||||
- Use `flatc` (the FlatBuffer compiler) to generate a C++ header (or
|
||||
Java/C#/Go classes) with helper classes to access and construct serialized
|
||||
data. This header (say `mydata_generated.h`) only depends on
|
||||
Java/C#/Go/Python.. classes) with helper classes to access and construct
|
||||
serialized data. This header (say `mydata_generated.h`) only depends on
|
||||
`flatbuffers.h`, which defines the core functionality.
|
||||
|
||||
- Use the `FlatBufferBuilder` class to construct a flat binary buffer.
|
||||
@@ -104,25 +121,43 @@ sections provide a more in-depth usage guide.
|
||||
|
||||
## In-depth documentation
|
||||
|
||||
- How to [build the compiler](md__building.html) and samples on various
|
||||
platforms.
|
||||
- How to [use the compiler](md__compiler.html).
|
||||
- How to [write a schema](md__schemas.html).
|
||||
- How to [use the generated C++ code](md__cpp_usage.html) in your own
|
||||
programs.
|
||||
- How to [use the generated Java/C# code](md__java_usage.html) in your own
|
||||
programs.
|
||||
- How to [use the generated Go code](md__go_usage.html) in your own
|
||||
programs.
|
||||
- Some [benchmarks](md__benchmarks.html) showing the advantage of using
|
||||
- How to [build the compiler](@ref flatbuffers_guide_building) and samples on
|
||||
various platforms.
|
||||
- How to [use the compiler](@ref flatbuffers_guide_using_schema_compiler).
|
||||
- How to [write a schema](@ref flatbuffers_guide_writing_schema).
|
||||
- How to [use the generated C++ code](@ref flatbuffers_guide_use_cpp) in your
|
||||
own programs.
|
||||
- How to [use the generated Java/C# code](@ref flatbuffers_guide_use_java_c-sharp)
|
||||
in your own programs.
|
||||
- How to [use the generated Go code](@ref flatbuffers_guide_use_go) in your
|
||||
own programs.
|
||||
- How to [use FlatBuffers in C with `flatcc`](@ref flatbuffers_guide_use_c) in your
|
||||
own programs.
|
||||
- [Support matrix](@ref flatbuffers_support) for platforms/languages/features.
|
||||
- Some [benchmarks](@ref flatbuffers_benchmarks) showing the advantage of
|
||||
using FlatBuffers.
|
||||
- A [white paper](@ref flatbuffers_white_paper) explaining the "why" of
|
||||
FlatBuffers.
|
||||
- A [white paper](md__white_paper.html) explaining the "why" of FlatBuffers.
|
||||
- A description of the [internals](md__internals.html) of FlatBuffers.
|
||||
- A formal [grammar](md__grammar.html) of the schema language.
|
||||
- A description of the [internals](@ref flatbuffers_internals) of FlatBuffers.
|
||||
- A formal [grammar](@ref flatbuffers_grammar) of the schema language.
|
||||
|
||||
## Online resources
|
||||
|
||||
- [github repository](http://github.com/google/flatbuffers)
|
||||
- [landing page](http://google.github.io/flatbuffers)
|
||||
- [FlatBuffers Google Group](http://group.google.com/group/flatbuffers)
|
||||
- [GitHub repository](http://github.com/google/flatbuffers)
|
||||
- [Landing page](http://google.github.io/flatbuffers)
|
||||
- [FlatBuffers Google Group](https://groups.google.com/forum/#!forum/flatbuffers)
|
||||
- [FlatBuffers Issues Tracker](http://github.com/google/flatbuffers/issues)
|
||||
- Independent implementations & tools:
|
||||
- [FlatCC](https://github.com/dvidelabs/flatcc) Alternative FlatBuffers
|
||||
parser, code generator and runtime all in C.
|
||||
- Videos:
|
||||
- Colt's [DevByte](https://www.youtube.com/watch?v=iQTxMkSJ1dQ).
|
||||
- GDC 2015 [Lightning Talk](https://www.youtube.com/watch?v=olmL1fUnQAQ).
|
||||
- FlatBuffers for [Go](https://www.youtube.com/watch?v=-BPVId_lA5w).
|
||||
- Evolution of FlatBuffers
|
||||
[visualization](https://www.youtube.com/watch?v=a0QE0xS8rKM).
|
||||
- Useful documentation created by others:
|
||||
- [FlatBuffers in Go](https://rwinslow.com/tags/flatbuffers/)
|
||||
- [FlatBuffers in Android](http://frogermcs.github.io/flatbuffers-in-android-introdution/)
|
||||
- [Parsing JSON to FlatBuffers in Java](http://frogermcs.github.io/json-parsing-with-flatbuffers-in-android/)
|
||||
- [FlatBuffers in Unity](http://exiin.com/blog/flatbuffers-for-unity-sample-code/)
|
||||
|
||||
26
docs/source/GoApi.md
Normal file
@@ -0,0 +1,26 @@
|
||||
Go API
|
||||
======
|
||||
|
||||
\addtogroup flatbuffers_go_api
|
||||
|
||||
<!-- Note: The `GoApi_generate.txt` code snippet was generated using `godoc` and
|
||||
customized for use with this markdown file. To regenerate the file, use the
|
||||
`godoc` tool (http://godoc.org) with the files in the `flatbuffers/go`
|
||||
folder.
|
||||
|
||||
You may need to ensure that copies of the files exist in the `src/`
|
||||
subfolder at the path set by the `$GOROOT` environment variable. You can
|
||||
either move the files to `$GOROOT/src/flatbuffers` manually, if `$GOROOT`
|
||||
is already set, otherwise you will need to manually set the `$GOROOT`
|
||||
variable to a path and create `src/flatbuffers` subfolders at that path.
|
||||
Then copy the flatbuffers files into `$GOROOT/src/flatbuffers`. (Some
|
||||
versions of `godoc` include a `-path` flag. This could be used instead, if
|
||||
available).
|
||||
|
||||
Once the files exist at the `$GOROOT/src/flatbuffers` location, you can
|
||||
regenerate this doc using the following command:
|
||||
`godoc flatbuffers > GoApi_generated.txt`.
|
||||
|
||||
After the documentation is generated, you will have to manually remove any
|
||||
non-user facing documentation from this file. -->
|
||||
\snippet GoApi_generated.txt Go API
|
||||
125
docs/source/GoApi_generated.txt
Normal file
@@ -0,0 +1,125 @@
|
||||
// This file was generated using `godoc` and customized for use with the
|
||||
// API Reference documentation. To recreate this file, use the `godoc` tool
|
||||
// (http://godoc.org) with the files in the `flatbuffers/go` folder.
|
||||
//
|
||||
// Note: You may need to ensure that copies of the files exist in the
|
||||
// `src/` subfolder at the path set by the `$GOROOT` environment variable.
|
||||
// You can either move the files to `$GOROOT/src/flatbuffers` manually, if
|
||||
// `$GOROOT` is already set, otherwise you will need to manually set the
|
||||
// `$GOROOT` variable to a path and create `src/flatbuffers` subfolders at that
|
||||
// path. Then copy these files into `$GOROOT/src/flatbuffers`. (Some versions of
|
||||
// `godoc` include a `-path` flag. This could be used instead, if available).
|
||||
//
|
||||
// Once the files exist at the `$GOROOT/src/flatbuffers` location, you can
|
||||
// regenerate this doc using the following command:
|
||||
// `godoc flatbuffers > GoApi_generated.txt`.
|
||||
//
|
||||
// After the documentation is generated, you will have to manually remove any
|
||||
// non-user facing documentation from this file.
|
||||
|
||||
/// [Go API]
|
||||
PACKAGE DOCUMENTATION
|
||||
|
||||
package flatbuffers
|
||||
Package flatbuffers provides facilities to read and write flatbuffers
|
||||
objects.
|
||||
|
||||
TYPES
|
||||
|
||||
type Builder struct {
|
||||
// `Bytes` gives raw access to the buffer. Most users will want to use
|
||||
// FinishedBytes() instead.
|
||||
Bytes []byte
|
||||
}
|
||||
Builder is a state machine for creating FlatBuffer objects. Use a
|
||||
Builder to construct object(s) starting from leaf nodes.
|
||||
|
||||
A Builder constructs byte buffers in a last-first manner for simplicity
|
||||
and performance.
|
||||
|
||||
FUNCTIONS
|
||||
|
||||
func NewBuilder(initialSize int) *Builder
|
||||
NewBuilder initializes a Builder of size `initial_size`. The internal
|
||||
buffer is grown as needed.
|
||||
|
||||
func (b *Builder) CreateByteString(s []byte) UOffsetT
|
||||
CreateByteString writes a byte slice as a string (null-terminated).
|
||||
|
||||
func (b *Builder) CreateByteVector(v []byte) UOffsetT
|
||||
CreateByteVector writes a ubyte vector
|
||||
|
||||
func (b *Builder) CreateString(s string) UOffsetT
|
||||
CreateString writes a null-terminated string as a vector.
|
||||
|
||||
func (b *Builder) EndVector(vectorNumElems int) UOffsetT
|
||||
EndVector writes data necessary to finish vector construction.
|
||||
|
||||
func (b *Builder) Finish(rootTable UOffsetT)
|
||||
Finish finalizes a buffer, pointing to the given `rootTable`.
|
||||
|
||||
func (b *Builder) FinishedBytes() []byte
|
||||
FinishedBytes returns a pointer to the written data in the byte buffer.
|
||||
Panics if the builder is not in a finished state (which is caused by
|
||||
calling `Finish()`).
|
||||
|
||||
func (b *Builder) Head() UOffsetT
|
||||
Head gives the start of useful data in the underlying byte buffer. Note:
|
||||
unlike other functions, this value is interpreted as from the left.
|
||||
|
||||
func (b *Builder) PrependBool(x bool)
|
||||
PrependBool prepends a bool to the Builder buffer. Aligns and checks for
|
||||
space.
|
||||
|
||||
func (b *Builder) PrependByte(x byte)
|
||||
PrependByte prepends a byte to the Builder buffer. Aligns and checks for
|
||||
space.
|
||||
|
||||
func (b *Builder) PrependFloat32(x float32)
|
||||
PrependFloat32 prepends a float32 to the Builder buffer. Aligns and
|
||||
checks for space.
|
||||
|
||||
func (b *Builder) PrependFloat64(x float64)
|
||||
PrependFloat64 prepends a float64 to the Builder buffer. Aligns and
|
||||
checks for space.
|
||||
|
||||
func (b *Builder) PrependInt16(x int16)
|
||||
PrependInt16 prepends a int16 to the Builder buffer. Aligns and checks
|
||||
for space.
|
||||
|
||||
func (b *Builder) PrependInt32(x int32)
|
||||
PrependInt32 prepends a int32 to the Builder buffer. Aligns and checks
|
||||
for space.
|
||||
|
||||
func (b *Builder) PrependInt64(x int64)
|
||||
PrependInt64 prepends a int64 to the Builder buffer. Aligns and checks
|
||||
for space.
|
||||
|
||||
func (b *Builder) PrependInt8(x int8)
|
||||
PrependInt8 prepends a int8 to the Builder buffer. Aligns and checks for
|
||||
space.
|
||||
|
||||
func (b *Builder) PrependUOffsetT(off UOffsetT)
|
||||
PrependUOffsetT prepends an UOffsetT, relative to where it will be
|
||||
written.
|
||||
|
||||
func (b *Builder) PrependUint16(x uint16)
|
||||
PrependUint16 prepends a uint16 to the Builder buffer. Aligns and checks
|
||||
for space.
|
||||
|
||||
func (b *Builder) PrependUint32(x uint32)
|
||||
PrependUint32 prepends a uint32 to the Builder buffer. Aligns and checks
|
||||
for space.
|
||||
|
||||
func (b *Builder) PrependUint64(x uint64)
|
||||
PrependUint64 prepends a uint64 to the Builder buffer. Aligns and checks
|
||||
for space.
|
||||
|
||||
func (b *Builder) PrependUint8(x uint8)
|
||||
PrependUint8 prepends a uint8 to the Builder buffer. Aligns and checks
|
||||
for space.
|
||||
|
||||
func (b *Builder) Reset()
|
||||
Reset truncates the underlying Builder buffer, facilitating alloc-free
|
||||
reuse of a Builder. It also resets bookkeeping data.
|
||||
/// [Go API]
|
||||
@@ -1,11 +1,51 @@
|
||||
# Use in Go
|
||||
Use in Go {#flatbuffers_guide_use_go}
|
||||
=========
|
||||
|
||||
There's experimental support for reading FlatBuffers in Go. Generate code
|
||||
for Go with the `-g` option to `flatc`.
|
||||
## Before you get started
|
||||
|
||||
See `go_test.go` for an example. You import the generated code, read a
|
||||
FlatBuffer binary file into a `[]byte`, which you pass to the
|
||||
`GetRootAsMonster` function:
|
||||
Before diving into the FlatBuffers usage in Go, it should be noted that
|
||||
the [Tutorial](@ref flatbuffers_guide_tutorial) page has a complete guide
|
||||
to general FlatBuffers usage in all of the supported languages (including Go).
|
||||
This page is designed to cover the nuances of FlatBuffers usage, specific to
|
||||
Go.
|
||||
|
||||
You should also have read the [Building](@ref flatbuffers_guide_building)
|
||||
documentation to build `flatc` and should be familiar with
|
||||
[Using the schema compiler](@ref flatbuffers_guide_using_schema_compiler) and
|
||||
[Writing a schema](@ref flatbuffers_guide_writing_schema).
|
||||
|
||||
## FlatBuffers Go library code location
|
||||
|
||||
The code for the FlatBuffers Go library can be found at
|
||||
`flatbuffers/go`. You can browse the library code on the [FlatBuffers
|
||||
GitHub page](https://github.com/google/flatbuffers/tree/master/go).
|
||||
|
||||
## Testing the FlatBuffers Go library
|
||||
|
||||
The code to test the Go library can be found at `flatbuffers/tests`.
|
||||
The test code itself is located in [go_test.go](https://github.com/google/
|
||||
flatbuffers/blob/master/tests/go_test.go).
|
||||
|
||||
To run the tests, use the [GoTest.sh](https://github.com/google/flatbuffers/
|
||||
blob/master/tests/GoTest.sh) shell script.
|
||||
|
||||
*Note: The shell script requires [Go](https://golang.org/doc/install) to
|
||||
be installed.*
|
||||
|
||||
## Using the FlatBuffers Go library
|
||||
|
||||
*Note: See [Tutorial](@ref flatbuffers_guide_tutorial) for a more in-depth
|
||||
example of how to use FlatBuffers in Go.*
|
||||
|
||||
FlatBuffers supports reading and writing binary FlatBuffers in Go.
|
||||
|
||||
To use FlatBuffers in your own code, first generate Go classes from your
|
||||
schema with the `--go` option to `flatc`. Then you can include both FlatBuffers
|
||||
and the generated code to read or write a FlatBuffer.
|
||||
|
||||
For example, here is how you would read a FlatBuffer binary file in Go: First,
|
||||
include the library and generated code. Then read a FlatBuffer binary file into
|
||||
a `[]byte`, which you pass to the `GetRootAsMonster` function:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.go}
|
||||
import (
|
||||
@@ -27,96 +67,33 @@ Now you can access values like this:
|
||||
pos := monster.Pos(nil)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
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), you can replace nil with a
|
||||
pointer to 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.
|
||||
|
||||
To access vectors 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:
|
||||
In some cases it's necessary to modify values in an existing FlatBuffer in place (without creating a copy). For this reason, scalar fields of a Flatbuffer table or struct can be mutated.
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.go}
|
||||
for i := 0; i < monster.InventoryLength(); i++ {
|
||||
monster.Inventory(i) // do something here
|
||||
monster := example.GetRootAsMonster(buf, 0)
|
||||
|
||||
// Set table field.
|
||||
if ok := monster.MutateHp(10); !ok {
|
||||
panic("failed to mutate Hp")
|
||||
}
|
||||
|
||||
// Set struct field.
|
||||
monster.Pos().MutateZ(4)
|
||||
|
||||
// This mutation will fail because the mana field is not available in
|
||||
// the buffer. It should be set when creating the buffer.
|
||||
if ok := monster.MutateMana(20); !ok {
|
||||
panic("failed to mutate Hp")
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
You can also construct these buffers in Go using the functions found in the
|
||||
generated code, and the FlatBufferBuilder class:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.go}
|
||||
builder := flatbuffers.NewBuilder(0)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Create strings:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.go}
|
||||
str := builder.CreateString("MyMonster")
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Create a table with a struct contained therein:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.go}
|
||||
example.MonsterStart(builder)
|
||||
example.MonsterAddPos(builder, example.CreateVec3(builder, 1.0, 2.0, 3.0, 3.0, 4, 5, 6))
|
||||
example.MonsterAddHp(builder, 80)
|
||||
example.MonsterAddName(builder, str)
|
||||
example.MonsterAddInventory(builder, inv)
|
||||
example.MonsterAddTest_Type(builder, 1)
|
||||
example.MonsterAddTest(builder, mon2)
|
||||
example.MonsterAddTest4(builder, test4s)
|
||||
mon := example.MonsterEnd(builder)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Unlike C++, Go does not support table creation functions like 'createMonster()'.
|
||||
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, and **must** be created outside of the table
|
||||
creation sequence).
|
||||
Structs do have convenient methods that allow you to construct them in one call.
|
||||
These also have arguments for nested structs, e.g. if a struct has a field `a`
|
||||
and a nested struct field `b` (which has fields `c` and `d`), then the arguments
|
||||
will be `a`, `c` and `d`.
|
||||
|
||||
Vectors also use this start/end pattern to allow vectors of both scalar types
|
||||
and structs:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.go}
|
||||
example.MonsterStartInventoryVector(builder, 5)
|
||||
for i := 4; i >= 0; i-- {
|
||||
builder.PrependByte(byte(i))
|
||||
}
|
||||
inv := builder.EndVector(5)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The generated method 'StartInventoryVector' is provided as a convenience
|
||||
function which calls 'StartVector' with the correct element size of the vector
|
||||
type which in this case is 'ubyte' or 1 byte per vector element.
|
||||
You pass the number of elements you want to write.
|
||||
You write the elements backwards since the buffer
|
||||
is being constructed back to front. Use the correct `Prepend` call for the type,
|
||||
or `PrependUOffsetT` for offsets. You then pass `inv` to the corresponding
|
||||
`Add` call when you construct the table containing it afterwards.
|
||||
|
||||
There are `Prepend` functions for all the scalar types. You use
|
||||
`PrependUOffset` for any previously constructed objects (such as other tables,
|
||||
strings, vectors). For structs, you use the appropriate `create` function
|
||||
in-line, as shown above in the `Monster` example.
|
||||
|
||||
Once you're done constructing a buffer, you call `Finish` with the root object
|
||||
offset (`mon` in the example above). Your data now resides in Builder.Bytes.
|
||||
Important to note is that the real data starts at the index indicated by Head(),
|
||||
for Offset() bytes (this is because the buffer is constructed backwards).
|
||||
If you wanted to read the buffer right after creating it (using
|
||||
`GetRootAsMonster` above), the second argument, instead of `0` would thus
|
||||
also be `Head()`.
|
||||
The term `mutate` is used instead of `set` to indicate that this is a special use case. All mutate functions return a boolean value which is false if the field we're trying to mutate is not available in the buffer.
|
||||
|
||||
## Text Parsing
|
||||
|
||||
There currently is no support for parsing text (Schema's and JSON) directly
|
||||
from Go, though you could use the C++ parser through cgo. Please see the
|
||||
C++ documentation for more on text parsing.
|
||||
|
||||
<br>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
# Formal Grammar of the schema language
|
||||
Grammar of the schema language {#flatbuffers_grammar}
|
||||
==============================
|
||||
|
||||
schema = include*
|
||||
( namespace\_decl | type\_decl | enum\_decl | root\_decl |
|
||||
file_extension_decl | file_identifier_decl |
|
||||
attribute\_decl | object )*
|
||||
|
||||
include = `include` string\_constant `;`
|
||||
@@ -17,7 +19,7 @@ enumval\_decl ) `}`
|
||||
|
||||
root\_decl = `root_type` ident `;`
|
||||
|
||||
field\_decl = type `:` ident [ `=` scalar ] metadata `;`
|
||||
field\_decl = ident `:` type [ `=` scalar ] metadata `;`
|
||||
|
||||
type = `bool` | `byte` | `ubyte` | `short` | `ushort` | `int` | `uint` |
|
||||
`float` | `long` | `ulong` | `double`
|
||||
@@ -25,12 +27,22 @@ type = `bool` | `byte` | `ubyte` | `short` | `ushort` | `int` | `uint` |
|
||||
|
||||
enumval\_decl = ident [ `=` integer\_constant ]
|
||||
|
||||
metadata = [ `(` commasep( ident [ `:` scalar ] ) `)` ]
|
||||
metadata = [ `(` commasep( ident [ `:` single\_value ] ) `)` ]
|
||||
|
||||
scalar = integer\_constant | float\_constant | `true` | `false`
|
||||
scalar = integer\_constant | float\_constant
|
||||
|
||||
object = { commasep( ident `:` value ) }
|
||||
|
||||
value = scalar | object | string\_constant | `[` commasep( value ) `]`
|
||||
single\_value = scalar | string\_constant
|
||||
|
||||
value = single\_value | object | `[` commasep( value ) `]`
|
||||
|
||||
commasep(x) = [ x ( `,` x )\* ]
|
||||
|
||||
file_extension_decl = `file_extension` string\_constant `;`
|
||||
|
||||
file_identifier_decl = `file_identifier` string\_constant `;`
|
||||
|
||||
integer\_constant = -?[0-9]+ | `true` | `false`
|
||||
|
||||
float\_constant = -?[0-9]+.[0-9]+((e|E)(+|-)?[0-9]+)?
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# FlatBuffer Internals
|
||||
FlatBuffer Internals {#flatbuffers_internals}
|
||||
====================
|
||||
|
||||
This section is entirely optional for the use of FlatBuffers. In normal
|
||||
usage, you should never need the information contained herein. If you're
|
||||
@@ -16,7 +17,7 @@ byte-swap intrinsics.
|
||||
|
||||
On purpose, the format leaves a lot of details about where exactly
|
||||
things live in memory undefined, e.g. fields in a table can have any
|
||||
order, and objects to some extend can be stored in many orders. This is
|
||||
order, and objects to some extent can be stored in many orders. This is
|
||||
because the format doesn't need this information to be efficient, and it
|
||||
leaves room for optimization and extension (for example, fields can be
|
||||
packed in a way that is most compact). Instead, the format is defined in
|
||||
@@ -73,7 +74,10 @@ code.
|
||||
|
||||
### Tables
|
||||
|
||||
These start with an `soffset_t` to a vtable. This is a signed version of
|
||||
Unlike structs, these are not stored in inline in their parent, but are
|
||||
referred to by offset.
|
||||
|
||||
They start with an `soffset_t` to a vtable. This is a signed version of
|
||||
`uoffset_t`, since vtables may be stored anywhere relative to the object.
|
||||
This offset is substracted (not added) from the object start to arrive at
|
||||
the vtable start. This offset is followed by all the
|
||||
@@ -88,7 +92,7 @@ The elements of a vtable are all of type `voffset_t`, which is
|
||||
a `uint16_t`. The first element is the size of the vtable in bytes,
|
||||
including the size element. The second one is the size of the object, in bytes
|
||||
(including the vtable offset). This size could be used for streaming, to know
|
||||
how many bytes to read to be able to access all fields of the object.
|
||||
how many bytes to read to be able to access all *inline* fields of the object.
|
||||
The remaining elements are the N offsets, where N is the amount of fields
|
||||
declared in the schema when the code that constructed this buffer was
|
||||
compiled (thus, the size of the table is N + 2).
|
||||
@@ -106,7 +110,8 @@ field to be read.
|
||||
Strings are simply a vector of bytes, and are always
|
||||
null-terminated. Vectors are stored as contiguous aligned scalar
|
||||
elements prefixed by a 32bit element count (not including any
|
||||
null termination).
|
||||
null termination). Neither is stored inline in their parent, but are referred to
|
||||
by offset.
|
||||
|
||||
### Construction
|
||||
|
||||
@@ -224,7 +229,12 @@ Otherwise, it uses the entry as an offset into the table to locate the field.
|
||||
`FlatBufferBuilder`. You can add the fields in any order, and the `Finish`
|
||||
call will ensure the correct vtable gets generated.
|
||||
|
||||
inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const Vec3 *pos, int16_t mana, int16_t hp, flatbuffers::Offset<flatbuffers::String> name, flatbuffers::Offset<flatbuffers::Vector<uint8_t>> inventory, int8_t color) {
|
||||
inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb,
|
||||
const Vec3 *pos, int16_t mana,
|
||||
int16_t hp,
|
||||
flatbuffers::Offset<flatbuffers::String> name,
|
||||
flatbuffers::Offset<flatbuffers::Vector<uint8_t>> inventory,
|
||||
int8_t color) {
|
||||
MonsterBuilder builder_(_fbb);
|
||||
builder_.add_inventory(inventory);
|
||||
builder_.add_name(name);
|
||||
@@ -249,4 +259,37 @@ start traversing a FlatBuffer from a raw buffer pointer.
|
||||
}; // namespace MyGame
|
||||
}; // namespace Sample
|
||||
|
||||
### Encoding example.
|
||||
|
||||
Below is a sample encoding for the following JSON corresponding to the above
|
||||
schema:
|
||||
|
||||
{ pos: { x: 1, y: 2, z: 3 }, name: "fred", hp: 50 }
|
||||
|
||||
Resulting in this binary buffer:
|
||||
|
||||
// Start of the buffer:
|
||||
uint32_t 20 // Offset to the root table.
|
||||
|
||||
// Start of the vtable. Not shared in this example, but could be:
|
||||
uint16_t 16 // Size of table, starting from here.
|
||||
uint16_t 22 // Size of object inline data.
|
||||
uint16_t 4, 0, 20, 16, 0, 0 // Offsets to fields from start of (root) table, 0 for not present.
|
||||
|
||||
// Start of the root table:
|
||||
int32_t 16 // Offset to vtable used (default negative direction)
|
||||
float 1, 2, 3 // the Vec3 struct, inline.
|
||||
uint32_t 8 // Offset to the name string.
|
||||
int16_t 50 // hp field.
|
||||
int16_t 0 // Padding for alignment.
|
||||
|
||||
// Start of name string:
|
||||
uint32_t 4 // Length of string.
|
||||
int8_t 'f', 'r', 'e', 'd', 0, 0, 0, 0 // Text + 0 termination + padding.
|
||||
|
||||
Note that this not the only possible encoding, since the writer has some
|
||||
flexibility in which of the children of root object to write first (though in
|
||||
this case there's only one string), and what order to write the fields in.
|
||||
Different orders may also cause different alignments to happen.
|
||||
|
||||
<br>
|
||||
|
||||
141
docs/source/JavaCsharpUsage.md
Executable file
@@ -0,0 +1,141 @@
|
||||
Use in Java/C# {#flatbuffers_guide_use_java_c-sharp}
|
||||
==============
|
||||
|
||||
## Before you get started
|
||||
|
||||
Before diving into the FlatBuffers usage in Java or C#, it should be noted that
|
||||
the [Tutorial](@ref flatbuffers_guide_tutorial) page has a complete guide to
|
||||
general FlatBuffers usage in all of the supported languages (including both Java
|
||||
and C#). This page is designed to cover the nuances of FlatBuffers usage,
|
||||
specific to Java and C#.
|
||||
|
||||
You should also have read the [Building](@ref flatbuffers_guide_building)
|
||||
documentation to build `flatc` and should be familiar with
|
||||
[Using the schema compiler](@ref flatbuffers_guide_using_schema_compiler) and
|
||||
[Writing a schema](@ref flatbuffers_guide_writing_schema).
|
||||
|
||||
## FlatBuffers Java and C-sharp code location
|
||||
|
||||
#### Java
|
||||
|
||||
The code for the FlatBuffers Java library can be found at
|
||||
`flatbuffers/java/com/google/flatbuffers`. You can browse the library on the
|
||||
[FlatBuffers GitHub page](https://github.com/google/flatbuffers/tree/master/
|
||||
java/com/google/flatbuffers).
|
||||
|
||||
#### C-sharp
|
||||
|
||||
The code for the FlatBuffers C# library can be found at
|
||||
`flatbuffers/net/FlatBuffers`. You can browse the library on the
|
||||
[FlatBuffers GitHub page](https://github.com/google/flatbuffers/tree/master/net/
|
||||
FlatBuffers).
|
||||
|
||||
## Testing the FlatBuffers Java and C-sharp libraries
|
||||
|
||||
The code to test the libraries can be found at `flatbuffers/tests`.
|
||||
|
||||
#### Java
|
||||
|
||||
The test code for Java is located in [JavaTest.java](https://github.com/google
|
||||
/flatbuffers/blob/master/tests/JavaTest.java).
|
||||
|
||||
To run the tests, use either [JavaTest.sh](https://github.com/google/
|
||||
flatbuffers/blob/master/tests/JavaTest.sh) or [JavaTest.bat](https://github.com/
|
||||
google/flatbuffers/blob/master/tests/JavaTest.bat), depending on your operating
|
||||
system.
|
||||
|
||||
*Note: These scripts require that [Java](https://www.oracle.com/java/index.html)
|
||||
is installed.*
|
||||
|
||||
#### C-sharp
|
||||
|
||||
The test code for C# is located in the [FlatBuffers.Test](https://github.com/
|
||||
google/flatbuffers/tree/master/tests/FlatBuffers.Test) subfolder. To run the
|
||||
tests, open `FlatBuffers.Test.csproj` in [Visual Studio](
|
||||
https://www.visualstudio.com), and compile/run the project.
|
||||
|
||||
Optionally, you can run this using [Mono](http://www.mono-project.com/) instead.
|
||||
Once you have installed `Mono`, you can run the tests from the command line
|
||||
by running the following commands from inside the `FlatBuffers.Test` folder:
|
||||
|
||||
~~~{.sh}
|
||||
mcs *.cs ../MyGame/Example/*.cs ../../net/FlatBuffers/*.cs
|
||||
mono Assert.exe
|
||||
~~~
|
||||
|
||||
## Using the FlatBuffers Java (and C#) library
|
||||
|
||||
*Note: See [Tutorial](@ref flatbuffers_guide_tutorial) for a more in-depth
|
||||
example of how to use FlatBuffers in Java or C#.*
|
||||
|
||||
FlatBuffers supports reading and writing binary FlatBuffers in Java and C#.
|
||||
|
||||
To use FlatBuffers in your own code, first generate Java classes from your
|
||||
schema with the `--java` option to `flatc`. (Or for C# with `--csharp`).
|
||||
Then you can include both FlatBuffers and the generated code to read
|
||||
or write a FlatBuffer.
|
||||
|
||||
For example, here is how you would read a FlatBuffer binary file in Java:
|
||||
First, import the library and generated code. Then, you read a FlatBuffer binary
|
||||
file into a `byte[]`. You then turn the `byte[]` into a `ByteBuffer`, which you
|
||||
pass to the `getRootAsMyRootType` function:
|
||||
|
||||
*Note: The code here is written from the perspective of Java. Code for both
|
||||
languages is both generated and used in nearly the exact same way, with only
|
||||
minor differences. These differences are
|
||||
[explained in a section below](#differences_in_c-sharp).*
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.java}
|
||||
import MyGame.Example.*;
|
||||
import com.google.flatbuffers.FlatBufferBuilder;
|
||||
|
||||
// This snippet ignores exceptions for brevity.
|
||||
File file = new File("monsterdata_test.mon");
|
||||
RandomAccessFile f = new RandomAccessFile(file, "r");
|
||||
byte[] data = new byte[(int)f.length()];
|
||||
f.readFully(data);
|
||||
f.close();
|
||||
|
||||
ByteBuffer bb = ByteBuffer.wrap(data);
|
||||
Monster monster = Monster.getRootAsMonster(bb);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Now you can access the data from the `Monster monster`:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.java}
|
||||
short hp = monster.hp();
|
||||
Vec3 pos = monster.pos();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
<a name="differences_in_c-sharp">
|
||||
#### Differences in C-sharp
|
||||
</a>
|
||||
|
||||
C# code works almost identically to Java, with only a few minor differences.
|
||||
You can see an example of C# code in
|
||||
`tests/FlatBuffers.Test/FlatBuffersExampleTests.cs` or
|
||||
`samples/SampleBinary.cs`.
|
||||
|
||||
First of all, naming follows standard C# style with `PascalCasing` identifiers,
|
||||
e.g. `GetRootAsMyRootType`. Also, values (except vectors and unions) are
|
||||
available as properties instead of parameterless accessor methods as in Java.
|
||||
The performance-enhancing methods to which you can pass an already created
|
||||
object are prefixed with `Get`, e.g.:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cs}
|
||||
// property
|
||||
var pos = monster.Pos;
|
||||
|
||||
// method filling a preconstructed object
|
||||
var preconstructedPos = new Vec3();
|
||||
monster.GetPos(preconstructedPos);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
## Text parsing
|
||||
|
||||
There currently is no support for parsing text (Schema's and JSON) directly
|
||||
from Java or C#, though you could use the C++ parser through native call
|
||||
interfaces available to each language. Please see the
|
||||
C++ documentation for more on text parsing.
|
||||
|
||||
<br>
|
||||
105
docs/source/JavaScriptUsage.md
Executable file
@@ -0,0 +1,105 @@
|
||||
Use in JavaScript {#flatbuffers_guide_use_javascript}
|
||||
=================
|
||||
|
||||
## Before you get started
|
||||
|
||||
Before diving into the FlatBuffers usage in JavaScript, it should be noted that
|
||||
the [Tutorial](@ref flatbuffers_guide_tutorial) page has a complete guide to
|
||||
general FlatBuffers usage in all of the supported languages
|
||||
(including JavaScript). This page is specifically designed to cover the nuances
|
||||
of FlatBuffers usage in JavaScript.
|
||||
|
||||
You should also have read the [Building](@ref flatbuffers_guide_building)
|
||||
documentation to build `flatc` and should be familiar with
|
||||
[Using the schema compiler](@ref flatbuffers_guide_using_schema_compiler) and
|
||||
[Writing a schema](@ref flatbuffers_guide_writing_schema).
|
||||
|
||||
## FlatBuffers JavaScript library code location
|
||||
|
||||
The code for the FlatBuffers JavaScript library can be found at
|
||||
`flatbuffers/js`. You can browse the library code on the [FlatBuffers
|
||||
GitHub page](https://github.com/google/flatbuffers/tree/master/js).
|
||||
|
||||
## Testing the FlatBuffers JavaScript library
|
||||
|
||||
The code to test the JavaScript library can be found at `flatbuffers/tests`.
|
||||
The test code itself is located in [JavaScriptTest.js](https://github.com/
|
||||
google/flatbuffers/blob/master/tests/JavaScriptTest.js).
|
||||
|
||||
To run the tests, use the [JavaScriptTest.sh](https://github.com/google/
|
||||
flatbuffers/blob/master/tests/JavaScriptTest.sh) shell script.
|
||||
|
||||
*Note: The JavaScript test file requires [Node.js](https://nodejs.org/en/).*
|
||||
|
||||
## Using the FlatBuffers JavaScript libary
|
||||
|
||||
*Note: See [Tutorial](@ref flatbuffers_guide_tutorial) for a more in-depth
|
||||
example of how to use FlatBuffers in JavaScript.*
|
||||
|
||||
FlatBuffers supports both reading and writing FlatBuffers in JavaScript.
|
||||
|
||||
To use FlatBuffers in your own code, first generate JavaScript classes from your
|
||||
schema with the `--js` option to `flatc`. Then you can include both FlatBuffers
|
||||
and the generated code to read or write a FlatBuffer.
|
||||
|
||||
For example, here is how you would read a FlatBuffer binary file in Javascript:
|
||||
First, include the library and generated code. Then read the file into an
|
||||
`Uint8Array`. Make a `flatbuffers.ByteBuffer` out of the `Uint8Array`, and pass
|
||||
the ByteBuffer to the `getRootAsMonster` function.
|
||||
|
||||
*Note: Both JavaScript module loaders (e.g. Node.js) and browser-based
|
||||
HTML/JavaScript code segments are shown below in the following snippet:*
|
||||
|
||||
~~~{.js}
|
||||
// Note: These require functions are specific to JavaScript module loaders
|
||||
// (namely, Node.js). See below for a browser-based example.
|
||||
var fs = require('fs');
|
||||
|
||||
var flatbuffers = require('../flatbuffers').flatbuffers;
|
||||
var MyGame = require('./monster_generated').MyGame;
|
||||
|
||||
var data = new Uint8Array(fs.readFileSync('monster.dat'));
|
||||
var buf = new flatbuffers.ByteBuffer(data);
|
||||
|
||||
var monster = MyGame.Example.Monster.getRootAsMonster(buf);
|
||||
|
||||
//--------------------------------------------------------------------------//
|
||||
|
||||
// Note: This code is specific to browser-based HTML/JavaScript. See above
|
||||
// for the code using JavaScript module loaders (e.g. Node.js).
|
||||
<script src="../js/flatbuffers.js"></script>
|
||||
<script src="monster_generated.js"></script>
|
||||
<script>
|
||||
function readFile() {
|
||||
var reader = new FileReader(); // This example uses the HTML5 FileReader.
|
||||
var file = document.getElementById(
|
||||
'file_input').files[0]; // "monster.dat" from the HTML <input> field.
|
||||
|
||||
reader.onload = function() { // Executes after the file is read.
|
||||
var data = new Uint8Array(reader.result);
|
||||
|
||||
var buf = new flatbuffers.ByteBuffer(data);
|
||||
|
||||
var monster = MyGame.Example.Monster.getRootAsMonster(buf);
|
||||
}
|
||||
|
||||
reader.readAsArrayBuffer(file);
|
||||
}
|
||||
</script>
|
||||
|
||||
// Open the HTML file in a browser and select "monster.dat" from with the
|
||||
// <input> field.
|
||||
<input type="file" id="file_input" onchange="readFile();">
|
||||
~~~
|
||||
|
||||
Now you can access values like this:
|
||||
|
||||
~~~{.js}
|
||||
var hp = monster.hp();
|
||||
var pos = monster.pos();
|
||||
~~~
|
||||
|
||||
## Text parsing FlatBuffers in JavaScript
|
||||
|
||||
There currently is no support for parsing text (Schema's and JSON) directly
|
||||
from JavaScript.
|
||||
@@ -1,158 +0,0 @@
|
||||
# Use in Java/C-sharp
|
||||
|
||||
FlatBuffers supports reading and writing binary FlatBuffers in Java and C#.
|
||||
Generate code for Java with the `-j` option to `flatc`, or for C# with `-n`
|
||||
(think .Net).
|
||||
|
||||
Note that this document is from the perspective of Java. Code for both languages
|
||||
is generated in the same way, with only very subtle differences, for example
|
||||
any `camelCase` Java call will be `CamelCase` in C#.
|
||||
|
||||
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 `getRootAsMyRootType` function:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.java}
|
||||
ByteBuffer bb = ByteBuffer.wrap(data);
|
||||
Monster monster = Monster.getRootAsMonster(bb);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Now you can access values much like C++:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.java}
|
||||
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.
|
||||
|
||||
Java does not support unsigned scalars. This means that any unsigned types you
|
||||
use in your schema will actually be represented as a signed value. This means
|
||||
all bits are still present, but may represent a negative value when used.
|
||||
For example, to read a `byte b` as an unsigned number, you can do:
|
||||
`(short)(b & 0xFF)`
|
||||
|
||||
The default string accessor (e.g. `monster.name()`) currently always create
|
||||
a new Java `String` when accessed, since FlatBuffer's UTF-8 strings can't be
|
||||
used in-place by `String`. Alternatively, use `monster.nameAsByteBuffer()`
|
||||
which returns a `ByteBuffer` referring to the UTF-8 data in the original
|
||||
`ByteBuffer`, which is much more efficient. The `ByteBuffer`'s `position`
|
||||
points to the first character, and its `limit` to just after the last.
|
||||
|
||||
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:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.java}
|
||||
for (int i = 0; i < monster.inventoryLength(); i++)
|
||||
monster.inventory(i); // do something here
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Alternatively, much like strings, you can use `monster.inventoryAsByteBuffer()`
|
||||
to get a `ByteBuffer` referring to the whole vector. Use `ByteBuffer` methods
|
||||
like `asFloatBuffer` to get specific views if needed.
|
||||
|
||||
If you specified a file_indentifier in the schema, you can query if the
|
||||
buffer is of the desired type before accessing it using:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.java}
|
||||
if (Monster.MonsterBufferHasIdentifier(bb)) ...
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
## Buffer construction in Java
|
||||
|
||||
You can also construct these buffers in Java using the static methods found
|
||||
in the generated code, and the FlatBufferBuilder class:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.java}
|
||||
FlatBufferBuilder fbb = new FlatBufferBuilder();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Create strings:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.java}
|
||||
int str = fbb.createString("MyMonster");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Create a table with a struct contained therein:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.java}
|
||||
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);
|
||||
Monster.addInventory(fbb, inv);
|
||||
Monster.addTest_type(fbb, (byte)1);
|
||||
Monster.addTest(fbb, mon2);
|
||||
Monster.addTest4(fbb, test4s);
|
||||
int mon = Monster.endMonster(fbb);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
For some simpler types, you can use a convenient `create` function call that
|
||||
allows you to construct tables in one function call. This example definition
|
||||
however contains an inline struct field, so we have to create the table
|
||||
manually.
|
||||
This is to create the buffer without using temporary object allocation.
|
||||
|
||||
It's important to understand that fields that are structs are inline (like
|
||||
`Vec3` above), and MUST thus be created between the start and end calls of
|
||||
a table. Everything else (other tables, strings, vectors) MUST be created
|
||||
before the start of the table they are referenced in.
|
||||
|
||||
Structs do have convenient methods that even have arguments for nested structs.
|
||||
|
||||
As you can see, references to other objects (e.g. the string above) are simple
|
||||
ints, and thus do not have the type-safety of the Offset type in C++. Extra
|
||||
case must thus be taken that you set the right offset on the right field.
|
||||
|
||||
Vectors can be created from the corresponding Java array like so:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.java}
|
||||
int inv = Monster.createInventoryVector(fbb, new byte[] { 0, 1, 2, 3, 4 });
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
This works for arrays of scalars and (int) offsets to strings/tables,
|
||||
but not structs. If you want to write structs, or what you want to write
|
||||
does not sit in an array, you can also use the start/end pattern:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.java}
|
||||
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. Note how you write the elements backwards since
|
||||
the buffer is being constructed back to front. You then pass `inv` to the
|
||||
corresponding `Add` call when you construct the table containing it afterwards.
|
||||
|
||||
There are `add` functions for all the scalar types. You use `addOffset` for
|
||||
any previously constructed objects (such as other tables, strings, vectors).
|
||||
For structs, you use the appropriate `create` function in-line, as shown
|
||||
above in the `Monster` example.
|
||||
|
||||
To finish the buffer, call:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.java}
|
||||
Monster.finishMonsterBuffer(fbb, mon);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The buffer is now ready to be transmitted. It is contained in the `ByteBuffer`
|
||||
which you can obtain from `fbb.dataBuffer()`. Importantly, the valid data does
|
||||
not start from offset 0 in this buffer, but from `fbb.dataBuffer().position()`
|
||||
(this is because the data was built backwards in memory).
|
||||
It ends at `fbb.capacity()`.
|
||||
|
||||
|
||||
## Text Parsing
|
||||
|
||||
There currently is no support for parsing text (Schema's and JSON) directly
|
||||
from Java, though you could use the C++ parser through JNI. Please see the
|
||||
C++ documentation for more on text parsing.
|
||||