source : https://developers.google.com/protocol-buffers/docs/reference/cpp/index
C++ API
Packages | |
---|---|
Core components of the Protocol Buffers runtime library.
| |
Auxiliary classes used for I/O.
| |
google::protobuf
Core components of the Protocol Buffers runtime library.
The files in this package represent the core of the Protocol Buffer system. All of them are part of the libprotobuf library.
A note on thread-safety:
Thread-safety in the Protocol Buffer library follows a simple rule: unless explicitly noted otherwise, it is always safe to use an object from multiple threads simultaneously as long as the object is declared const in all threads (or, it is only used in ways that would be allowed if it were declared const). However, if an object is accessed in one thread in a way that would not be allowed if it were const, then it is not safe to access that object in any other thread simultaneously.
Put simply, read-only access to an object can happen in multiple threads simultaneously, but write access can only happen in a single thread at a time.
The implementation does contain some "const" methods which actually modify the object behind the scenes -- e.g., to cache results -- but in these cases mutex locking is used to make the access thread-safe.
Files | |
---|---|
This file contains classes which describe a type of protocol message.
| |
Protocol buffer representations of descriptors.
| |
Interface for manipulating databases of descriptors.
| |
Defines an implementation of
Message which can emulate types which are not known at compile-time.
| |
Defines
Message, the abstract interface implemented by non-lite protocol message objects.
| |
Defines
MessageLite, the abstract interface implemented by all (lite and non-lite) protocol message objects.
| |
RepeatedField and
RepeatedPtrField are used by generated protocol message classes to manipulate repeated fields.
| |
DEPRECATED: This module declares the abstract interfaces underlying proto2 RPC services.
| |
Utilities for printing and parsing protocol messages in a human-readable, text-based format.
| |
Contains classes used to keep track of unrecognized fields seen while parsing a protocol message.
| |
Contains basic types and utilities used by the rest of the library.
|
google::protobuf::io
Auxiliary classes used for I/O.
The Protocol Buffer library uses the classes in this package to deal with I/O and encoding/decoding raw bytes. Most users will not need to deal with this package. However, users who want to adapt the system to work with their own I/O abstractions -- e.g., to allow Protocol Buffers to be read from a different kind of input stream without the need for a temporary buffer -- should take a closer look.
Files | |
---|---|
This file contains the
CodedInputStream and
CodedOutputStream classes, which wrap a
ZeroCopyInputStream or
ZeroCopyOutputStream, respectively, and allow you to read or write individual pieces of data in various formats.
| |
This file contains the definition for classes
GzipInputStream and
GzipOutputStream.
| |
Utility class for writing text to a
ZeroCopyOutputStream.
| |
Class for parsing tokenized text from a
ZeroCopyInputStream.
| |
This file contains the
ZeroCopyInputStream and
ZeroCopyOutputStream interfaces, which represent abstract I/O streams to and from which protocol buffers can be read and written.
| |
This file contains common implementations of the interfaces defined in
zero_copy_stream.h which are only included in the full (non-lite) protobuf library.
| |
This file contains common implementations of the interfaces defined in
zero_copy_stream.h which are included in the "lite" protobuf library.
|
google::protobuf::compiler
Implementation of the Protocol Buffer compiler.
This package contains code for parsing .proto files and generating code based on them. There are two reasons you might be interested in this package:
- You want to parse .proto files at runtime. In this case, you should look at importer.h. Since this functionality is widely useful, it is included in the libprotobuf base library; you do not have to link against libprotoc.
- You want to write a custom protocol compiler which generates different kinds of code, e.g. code in a different language which is not supported by the official compiler. For this purpose, command_line_interface.h provides you with a complete compiler front-end, so all you need to do is write a custom implementation of CodeGenerator and a trivial main() function. You can even make your compiler support the official languages in addition to your own. Since this functionality is only useful to those writing custom compilers, it is in a separate library called "libprotoc" which you will have to link against.
Files | |
---|---|
Defines the abstract interface implemented by each of the language-specific code generators.
| |
Implements the Protocol Compiler front-end such that it may be reused by custom compilers written to support other languages.
| |
This file is the public interface to the .proto file parser.
| |
Implements parsing of .proto files to FileDescriptorProtos.
| |
Front-end for protoc code generator plugins written in C++.
| |
API for protoc plugins.
| |
Generates C++ code for a given .proto file.
| |
Generates Java code for a given .proto file.
| |
Generates Python code for a given .proto file.
|