#include <google/protobuf/unknown_field_set.h>
namespace google::protobuf
Contains classes used to keep track of unrecognized fields seen while parsing a protocol message.
Classes in this file | |
|---|---|
An UnknownFieldSet contains fields that were encountered while parsing a message but were not defined by its type. | |
Represents one field in an UnknownFieldSet. | |
#include <google/protobuf/unknown_field_set.h>
namespace google::protobuf
An UnknownFieldSet contains fields that were encountered while parsing a message but were not defined by its type.
Keeping track of these can be useful, especially in that they may be written if the message is serialized again without being cleared in between. This means that software which simply receives messages and forwards them to other servers does not need to be updated every time a new field is added to the message definition.
To get the UnknownFieldSet attached to any message, call Reflection::GetUnknownFields().
This class is necessarily tied to the protocol buffer wire format, unlike the Reflection interface which is independent of any serialization scheme.
Members | |
|---|---|
| UnknownFieldSet() |
| ~UnknownFieldSet() |
void | Clear()Remove all fields. |
bool | empty() constIs this set empty? |
void | MergeFrom(const UnknownFieldSet & other)Merge the contents of some other UnknownFieldSet with this one. |
void | Swap(UnknownFieldSet * x)Swaps the contents of some other UnknownFieldSet with this one. |
int | SpaceUsedExcludingSelf() constComputes (an estimate of) the total number of bytes currently used for storing the unknown fields in memory. more... |
int | SpaceUsed() constVersion of SpaceUsed() including sizeof(*this). |
int | field_count() constReturns the number of fields present in the UnknownFieldSet. |
const UnknownField & | field(int index) constGet a field in the set, where 0 <= index < field_count(). more... |
UnknownField * | mutable_field(int index)Get a mutable pointer to a field in the set, where 0 <= index < field_count(). more... |
Adding fields | |
void | AddVarint(int number, uint64 value) |
void | AddFixed32(int number, uint32 value) |
void | AddFixed64(int number, uint64 value) |
void | AddLengthDelimited(int number, const string & value) |
string * | AddLengthDelimited(int number) |
UnknownFieldSet * | AddGroup(int number) |
void | AddField(const UnknownField & field)Adds an unknown field from another set. |
Parsing helpersThese work exactly like the similarly-named methods of Message. | |
bool | MergeFromCodedStream(io::CodedInputStream * input) |
bool | ParseFromCodedStream(io::CodedInputStream * input) |
bool | ParseFromZeroCopyStream(io::ZeroCopyInputStream * input) |
bool | ParseFromArray(const void * data, int size) |
bool | ParseFromString(const string & data) |
int UnknownFieldSet::SpaceUsedExcludingSelf() constComputes (an estimate of) the total number of bytes currently used for storing the unknown fields in memory.
Does NOT include sizeof(*this) in the calculation.
const UnknownField &
UnknownFieldSet::field(
int index) constGet a field in the set, where 0 <= index < field_count().
The fields appear in the order in which they were added.
UnknownField * UnknownFieldSet::mutable_field(
int index)Get a mutable pointer to a field in the set, where 0 <= index < field_count().
The fields appear in the order in which they were added.
#include <google/protobuf/unknown_field_set.h>
namespace google::protobuf
Represents one field in an UnknownFieldSet.
Members | |
|---|---|
enum | Type |
uint64 | varint_ |
uint32 | fixed32_ |
uint64 | fixed64_ |
string * | length_delimited_ |
UnknownFieldSet * | group_ |
int | number() constThe field's tag number, as seen on the wire. |
Type | type() constThe field type. |
AccessorsEach method works only for UnknownFields of the corresponding type. | |
uint64 | varint() const |
uint32 | fixed32() const |
uint64 | fixed64() const |
const string & | length_delimited() const |
const UnknownFieldSet & | group() const |
void | set_varint(uint64 value) |
void | set_fixed32(uint32 value) |
void | set_fixed64(uint64 value) |
void | set_length_delimited(const string & value) |
string * | mutable_length_delimited() |
UnknownFieldSet * | mutable_group() |
enum UnknownField::Type {
TYPE_VARINT,
TYPE_FIXED32,
TYPE_FIXED64,
TYPE_LENGTH_DELIMITED,
TYPE_GROUP
}| TYPE_VARINT | |
| TYPE_FIXED32 | |
| TYPE_FIXED64 | |
| TYPE_LENGTH_DELIMITED | |
| TYPE_GROUP |