protobuf解析1-基本使用方法

[motadou@localhost ~]$ protoc -h
Usage: protoc [OPTION] PROTO_FILES
Parse PROTO_FILES and generate output based on the options given:
  -IPATH, --proto_path=PATH   指定包含文件的搜索目录。
                              可以同时指定多个,程序按指定的顺序搜索特定的文件。
                              如果没有指定,其默认值为当前目录。

  --version                   打印版本号,并退出程序

  -h, --help                  打印帮助信息,并退出程序

  --encode=MESSAGE_TYPE       Read a text-format message of the given type
                              from standard input and write it in binary
                              to standard output.  The message type must
                              be defined in PROTO_FILES or their imports.
  --decode=MESSAGE_TYPE       Read a binary message of the given type from
                              standard input and write it in text format
                              to standard output.  The message type must
                              be defined in PROTO_FILES or their imports.
  --decode_raw                Read an arbitrary protocol message from
                              standard input and write the raw tag/value
                              pairs in text format to standard output.  No
                              PROTO_FILES should be given when using this
                              flag.
  -oFILE,                     Writes a FileDescriptorSet (a protocol buffer,
    --descriptor_set_out=FILE defined in descriptor.proto) containing all of
                              the input files to FILE.
  --include_imports           When using --descriptor_set_out, also include
                              all dependencies of the input files in the
                              set, so that the set is self-contained.
  --include_source_info       When using --descriptor_set_out, do not strip
                              SourceCodeInfo from the FileDescriptorProto.
                              This results in vastly larger descriptors that
                              include information about the original
                              location of each decl in the source file as
                              well as surrounding comments.
  --error_format=FORMAT       Set the format in which to print errors.
                              FORMAT may be 'gcc' (the default) or 'msvs'
                              (Microsoft Visual Studio format).
  --print_free_field_numbers  Print the free field numbers of the messages
                              defined in the given proto files. Groups share
                              the same field number space with the parent 
                              message. Extension ranges are counted as 
                              occupied fields numbers.
  --plugin=EXECUTABLE         Specifies a plugin executable to use.
                              Normally, protoc searches the PATH for
                              plugins, but you may specify additional
                              executables not in the path using this flag.
                              Additionally, EXECUTABLE may be of the form
                              NAME=PATH, in which case the given plugin name
                              is mapped to the given executable even if
                              the executable's own name differs.
  --cpp_out=OUT_DIR           生成C++语言的头文件以及代码文件,OUT_DIR为生成代码的存放路径
  --java_out=OUT_DIR          生成Java语言的代码文件,OUT_DIR为生成代码的存放路径
  --javanano_out=OUT_DIR      生成Java语言精简版的代码文件,OUT_DIR为生成代码的存放路径
  --python_out=OUT_DIR        生成Python语言的代码文件,OUT_DIR为生成代码的存放路径
  --ruby_out=OUT_DIR          生成Ruby语言的代码文件,,OUT_DIR为生成代码的存放路径
posted @ 2010-12-28 22:40  酱油和醋  阅读(787)  评论(0编辑  收藏  举报