Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions content/reference/cpp/api-docs/_index.md

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions content/reference/cpp/api-docs/google.protobuf.arena.md

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "This section contains reference documentation for working with Pr
type = "docs"
+++

<p><code>#include &lt;google/protobuf/compiler/command_line_interface.h&gt;<br>namespace <a href="#google.protobuf.compiler">google::protobuf::compiler</a></code></p><p>Implements the Protocol Compiler front-end such that it may be reused by custom compilers written to support other languages. </p><table width="100%"><tr><th colspan="2"><h3 style="margin-top: 4px">Classes in this file</h3></th></tr><tr><td><div><code><a href="#CommandLineInterface">CommandLineInterface</a></code></div><div style="font-style: italic; margin-top: 4px; margin-left: 16px;">This class implements the command-line interface to the protocol compiler. </div></td></tr></table><h2 id="CommandLineInterface">class CommandLineInterface</h2><p><code>#include &lt;<a href="#">google/protobuf/compiler/command_line_interface.h</a>&gt;<br>namespace <a href="#google.protobuf.compiler">google::protobuf::compiler</a></code></p><p>This class implements the command-line interface to the protocol compiler. </p><p>It is designed to make it very easy to create a custom protocol compiler supporting the languages of your choice. For example, if you wanted to create a custom protocol compiler binary which includes both the regular C++ support plus support for your own custom output "Foo", you would write a class "FooGenerator" which implements the <a href='google.protobuf.compiler.code_generator#CodeGenerator'>CodeGenerator</a> interface, then write a main() procedure like this:</p>
<p><code>#include &lt;google/protobuf/compiler/command_line_interface.h&gt;<br>namespace <a href="/reference/cpp/api-docs/#google.protobuf.compiler">google::protobuf::compiler</a></code></p><p>Implements the Protocol Compiler front-end such that it may be reused by custom compilers written to support other languages. </p><table width="100%"><tr><th colspan="2"><h3 style="margin-top: 4px">Classes in this file</h3></th></tr><tr><td><div><code><a href="#CommandLineInterface">CommandLineInterface</a></code></div><div style="font-style: italic; margin-top: 4px; margin-left: 16px;">This class implements the command-line interface to the protocol compiler. </div></td></tr></table><h2 id="CommandLineInterface">class CommandLineInterface</h2><p><code>#include &lt;<a href="#">google/protobuf/compiler/command_line_interface.h</a>&gt;<br>namespace <a href="/reference/cpp/api-docs/#google.protobuf.compiler">google::protobuf::compiler</a></code></p><p>This class implements the command-line interface to the protocol compiler. </p><p>It is designed to make it very easy to create a custom protocol compiler supporting the languages of your choice. For example, if you wanted to create a custom protocol compiler binary which includes both the regular C++ support plus support for your own custom output "Foo", you would write a class "FooGenerator" which implements the <a href='/reference/cpp/api-docs/google.protobuf.compiler.code_generator/#CodeGenerator'>CodeGenerator</a> interface, then write a main() procedure like this:</p>

<pre>int main(int argc, char* argv[]) {
google::protobuf::compiler::CommandLineInterface cli;
Expand Down Expand Up @@ -37,16 +37,16 @@ type = "docs"

<p>For a full description of the command-line syntax, invoke it with &ndash;help. </p>

<table><tr><th colspan="2"><h3 style="margin-top: 4px">Members</h3></th></tr><tr><td style="border-right-width: 0px; text-align: right;"><code>const char *const</code></td><td style="border-left-width: 0px"id="CommandLineInterface.kPathSeparator"><div style="padding-left: 16px; text-indent: -16px"><code><b>kPathSeparator</b></code></div></td></tr><tr><td style="border-right-width: 0px; text-align: right;"><code></code></td><td style="border-left-width: 0px"id="CommandLineInterface.CommandLineInterface"><div style="padding-left: 16px; text-indent: -16px"><code><b>CommandLineInterface</b>()</code></div></td></tr><tr><td style="border-right-width: 0px; text-align: right;"><code></code></td><td style="border-left-width: 0px"id="CommandLineInterface.~CommandLineInterface"><div style="padding-left: 16px; text-indent: -16px"><code><b>~CommandLineInterface</b>()</code></div></td></tr><tr><td style="border-right-width: 0px; text-align: right;"><code>void</code></td><td style="border-left-width: 0px"id="CommandLineInterface.RegisterGenerator"><div style="padding-left: 16px; text-indent: -16px"><code><b>RegisterGenerator</b>(const std::string &amp; flag_name, <a href='google.protobuf.compiler.code_generator#CodeGenerator'>CodeGenerator</a> * generator, const std::string &amp; help_text)</code></div><div style="font-style: italic; margin-top: 4px; margin-left: 16px;">Register a code generator for a language. <a href="#CommandLineInterface.RegisterGenerator.details">more...</a></div></td></tr><tr><td style="border-right-width: 0px; text-align: right;"><code>void</code></td><td style="border-left-width: 0px"id="CommandLineInterface.RegisterGenerator"><div style="padding-left: 16px; text-indent: -16px"><code><b>RegisterGenerator</b>(const std::string &amp; flag_name, const std::string &amp; option_flag_name, <a href='google.protobuf.compiler.code_generator#CodeGenerator'>CodeGenerator</a> * generator, const std::string &amp; help_text)</code></div><div style="font-style: italic; margin-top: 4px; margin-left: 16px;">Register a code generator for a language. <a href="#CommandLineInterface.RegisterGenerator.details">more...</a></div></td></tr><tr><td style="border-right-width: 0px; text-align: right;"><code>void</code></td><td style="border-left-width: 0px"id="CommandLineInterface.AllowPlugins"><div style="padding-left: 16px; text-indent: -16px"><code><b>AllowPlugins</b>(const std::string &amp; exe_name_prefix)</code></div><div style="font-style: italic; margin-top: 4px; margin-left: 16px;">Enables "plugins". <a href="#CommandLineInterface.AllowPlugins.details">more...</a></div></td></tr><tr><td style="border-right-width: 0px; text-align: right;"><code>int</code></td><td style="border-left-width: 0px"id="CommandLineInterface.Run"><div style="padding-left: 16px; text-indent: -16px"><code><b>Run</b>(int argc, const char *const argv)</code></div><div style="font-style: italic; margin-top: 4px; margin-left: 16px;">Run the Protocol Compiler with the given command-line parameters. <a href="#CommandLineInterface.Run.details">more...</a></div></td></tr><tr><td style="border-right-width: 0px; text-align: right;"><code>void</code></td><td style="border-left-width: 0px"id="CommandLineInterface.SetInputsAreProtoPathRelative"><div style="padding-left: 16px; text-indent: -16px"><code><b>SetInputsAreProtoPathRelative</b>(bool )</code></div><div style="font-style: italic; margin-top: 4px; margin-left: 16px;">DEPRECATED. <a href="#CommandLineInterface.SetInputsAreProtoPathRelative.details">more...</a></div></td></tr><tr><td style="border-right-width: 0px; text-align: right;"><code>void</code></td><td style="border-left-width: 0px"id="CommandLineInterface.SetVersionInfo"><div style="padding-left: 16px; text-indent: -16px"><code><b>SetVersionInfo</b>(const std::string &amp; text)</code></div><div style="font-style: italic; margin-top: 4px; margin-left: 16px;">Provides some text which will be printed when the &ndash;version flag is used. <a href="#CommandLineInterface.SetVersionInfo.details">more...</a></div></td></tr></table> <hr><h3 id="CommandLineInterface.RegisterGenerator.details"><code>void CommandLineInterface::RegisterGenerator(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; flag_name,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='google.protobuf.compiler.code_generator#CodeGenerator'>CodeGenerator</a> * generator,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; help_text)</code></h3><div style="margin-left: 16px"><p>Register a code generator for a language. </p><p>Parameters:</p>
<table><tr><th colspan="2"><h3 style="margin-top: 4px">Members</h3></th></tr><tr><td style="border-right-width: 0px; text-align: right;"><code>const char *const</code></td><td style="border-left-width: 0px"id="CommandLineInterface.kPathSeparator"><div style="padding-left: 16px; text-indent: -16px"><code><b>kPathSeparator</b></code></div></td></tr><tr><td style="border-right-width: 0px; text-align: right;"><code></code></td><td style="border-left-width: 0px"id="CommandLineInterface.CommandLineInterface"><div style="padding-left: 16px; text-indent: -16px"><code><b>CommandLineInterface</b>()</code></div></td></tr><tr><td style="border-right-width: 0px; text-align: right;"><code></code></td><td style="border-left-width: 0px"id="CommandLineInterface.~CommandLineInterface"><div style="padding-left: 16px; text-indent: -16px"><code><b>~CommandLineInterface</b>()</code></div></td></tr><tr><td style="border-right-width: 0px; text-align: right;"><code>void</code></td><td style="border-left-width: 0px"id="CommandLineInterface.RegisterGenerator"><div style="padding-left: 16px; text-indent: -16px"><code><b>RegisterGenerator</b>(const std::string &amp; flag_name, <a href='/reference/cpp/api-docs/google.protobuf.compiler.code_generator/#CodeGenerator'>CodeGenerator</a> * generator, const std::string &amp; help_text)</code></div><div style="font-style: italic; margin-top: 4px; margin-left: 16px;">Register a code generator for a language. <a href="#CommandLineInterface.RegisterGenerator.details">more...</a></div></td></tr><tr><td style="border-right-width: 0px; text-align: right;"><code>void</code></td><td style="border-left-width: 0px"id="CommandLineInterface.RegisterGenerator"><div style="padding-left: 16px; text-indent: -16px"><code><b>RegisterGenerator</b>(const std::string &amp; flag_name, const std::string &amp; option_flag_name, <a href='/reference/cpp/api-docs/google.protobuf.compiler.code_generator/#CodeGenerator'>CodeGenerator</a> * generator, const std::string &amp; help_text)</code></div><div style="font-style: italic; margin-top: 4px; margin-left: 16px;">Register a code generator for a language. <a href="#CommandLineInterface.RegisterGenerator.details">more...</a></div></td></tr><tr><td style="border-right-width: 0px; text-align: right;"><code>void</code></td><td style="border-left-width: 0px"id="CommandLineInterface.AllowPlugins"><div style="padding-left: 16px; text-indent: -16px"><code><b>AllowPlugins</b>(const std::string &amp; exe_name_prefix)</code></div><div style="font-style: italic; margin-top: 4px; margin-left: 16px;">Enables "plugins". <a href="#CommandLineInterface.AllowPlugins.details">more...</a></div></td></tr><tr><td style="border-right-width: 0px; text-align: right;"><code>int</code></td><td style="border-left-width: 0px"id="CommandLineInterface.Run"><div style="padding-left: 16px; text-indent: -16px"><code><b>Run</b>(int argc, const char *const argv)</code></div><div style="font-style: italic; margin-top: 4px; margin-left: 16px;">Run the Protocol Compiler with the given command-line parameters. <a href="#CommandLineInterface.Run.details">more...</a></div></td></tr><tr><td style="border-right-width: 0px; text-align: right;"><code>void</code></td><td style="border-left-width: 0px"id="CommandLineInterface.SetInputsAreProtoPathRelative"><div style="padding-left: 16px; text-indent: -16px"><code><b>SetInputsAreProtoPathRelative</b>(bool )</code></div><div style="font-style: italic; margin-top: 4px; margin-left: 16px;">DEPRECATED. <a href="#CommandLineInterface.SetInputsAreProtoPathRelative.details">more...</a></div></td></tr><tr><td style="border-right-width: 0px; text-align: right;"><code>void</code></td><td style="border-left-width: 0px"id="CommandLineInterface.SetVersionInfo"><div style="padding-left: 16px; text-indent: -16px"><code><b>SetVersionInfo</b>(const std::string &amp; text)</code></div><div style="font-style: italic; margin-top: 4px; margin-left: 16px;">Provides some text which will be printed when the &ndash;version flag is used. <a href="#CommandLineInterface.SetVersionInfo.details">more...</a></div></td></tr></table> <hr><h3 id="CommandLineInterface.RegisterGenerator.details"><code>void CommandLineInterface::RegisterGenerator(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; flag_name,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='/reference/cpp/api-docs/google.protobuf.compiler.code_generator/#CodeGenerator'>CodeGenerator</a> * generator,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; help_text)</code></h3><div style="margin-left: 16px"><p>Register a code generator for a language. </p><p>Parameters:</p>
<ul>
<li>flag_name: The command-line flag used to specify an output file of this type. The name must start with a '-'. If the name is longer than one letter, it must start with two '-'s.</li>
<li>generator: The <a href='google.protobuf.compiler.code_generator#CodeGenerator'>CodeGenerator</a> which will be called to generate files of this type.</li>
<li>generator: The <a href='/reference/cpp/api-docs/google.protobuf.compiler.code_generator/#CodeGenerator'>CodeGenerator</a> which will be called to generate files of this type.</li>
<li>help_text: Text describing this flag in the &ndash;help output.</li>
</ul>
<p>Some generators accept extra parameters. You can specify this parameter on the command-line by placing it before the output directory, separated by a colon: </p>
<pre>protoc --foo_out=enable_bar:outdir</pre>
<p> The text before the colon is passed to <a href='google.protobuf.compiler.code_generator#CodeGenerator.Generate'>CodeGenerator::Generate()</a> as the "parameter". </p>
</div> <hr><h3 id="CommandLineInterface.RegisterGenerator.details"><code>void CommandLineInterface::RegisterGenerator(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; flag_name,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; option_flag_name,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='google.protobuf.compiler.code_generator#CodeGenerator'>CodeGenerator</a> * generator,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; help_text)</code></h3><div style="margin-left: 16px"><p>Register a code generator for a language. </p><p>Besides flag_name you can specify another option_flag_name that could be used to pass extra parameters to the registered code generator. Suppose you have registered a generator by calling: </p>
<p> The text before the colon is passed to <a href='/reference/cpp/api-docs/google.protobuf.compiler.code_generator/#CodeGenerator.Generate'>CodeGenerator::Generate()</a> as the "parameter". </p>
</div> <hr><h3 id="CommandLineInterface.RegisterGenerator.details"><code>void CommandLineInterface::RegisterGenerator(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; flag_name,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; option_flag_name,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='/reference/cpp/api-docs/google.protobuf.compiler.code_generator/#CodeGenerator'>CodeGenerator</a> * generator,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; help_text)</code></h3><div style="margin-left: 16px"><p>Register a code generator for a language. </p><p>Besides flag_name you can specify another option_flag_name that could be used to pass extra parameters to the registered code generator. Suppose you have registered a generator by calling: </p>
<pre>command_line_interface.RegisterGenerator("--foo_out", "--foo_opt", ...)</pre>
<p> Then you could invoke the compiler with a command like: </p>
<pre>protoc --foo_out=enable_bar:outdir --foo_opt=enable_baz</pre>
Expand Down
Loading
Loading