Added -M flatc flag to the documentation.

Change-Id: Ie19af91ec5bf0b65297cba58c124bceaa58fd73e
parent ace30451
......@@ -75,6 +75,7 @@ $(document).ready(function(){initNavTree('md__compiler.html','');});
<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>-M</code> : Print make rules for generated files.</li>
<li><code>--strict-json</code> : Require &amp; 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>--defaults-json</code> : Output fields whose value is equal to the default value when writing JSON text.</li>
<li><code>--no-prefix</code> : Don't prefix enum values in generated C++ by their enum type.</li>
......
......@@ -76,7 +76,7 @@ $(document).ready(function(){initNavTree('md__python_usage.html','');});
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="keywordflow">for</span> i <span class="keywordflow">in</span> xrange(monster.InventoryLength()):</div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160; monster.Inventory(i) <span class="comment"># do something here</span></div>
</div><!-- fragment --><p>You can also construct these buffers in Python using the functions found in the generated code, and the FlatBufferBuilder class:</p>
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;builder = flatbuffers.NewBuilder(0)</div>
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;builder = flatbuffers.Builder(0)</div>
</div><!-- fragment --><p>Create strings:</p>
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;s = builder.CreateString(<span class="stringliteral">&quot;MyMonster&quot;</span>)</div>
</div><!-- fragment --><p>Create a table with a struct contained therein:</p>
......@@ -90,7 +90,7 @@ $(document).ready(function(){initNavTree('md__python_usage.html','');});
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;example.MonsterAddTest4(builder, test4s)</div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;mon = example.MonsterEnd(builder)</div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;</div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;final_flatbuffer = bulder.Output()</div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;final_flatbuffer = builder.Output()</div>
</div><!-- fragment --><p>Unlike C++, Python 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"><a name="l00001"></a><span class="lineno"> 1</span>&#160;example.MonsterStartInventoryVector(builder, 5)</div>
......
......@@ -41,6 +41,8 @@ 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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment