This section contains reference documentation for working with protocol buffer classes in C++.
#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.
class 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.
void
ClearAndFreeMemory()
Remove all fields and deallocate internal data objects.
bool
empty() const
Is this set empty?
void
MergeFrom(const UnknownFieldSet & other)
Merge the contents of some other
UnknownFieldSetwith this one.
void
MergeFromAndDestroy(UnknownFieldSet * other)
Similar to above, but this function will destroy the contents of other.
void
Swap(UnknownFieldSet * x)
Swaps the contents of some other
UnknownFieldSetwith this one.
size_t
SpaceUsedExcludingSelfLong() const
Computes (an estimate of) the total number of bytes currently used for storing the unknown fields in memory.
more...int
SpaceUsedExcludingSelf() const
size_t
SpaceUsedLong() const
Version of SpaceUsed() including sizeof(*this).
int
SpaceUsed() const
int
field_count() const
Returns the number of fields present in the
UnknownFieldSet.
const UnknownField &
field(int index) const
Get 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...static void
MergeToInternalMetadata(const UnknownFieldSet & other, internal::InternalMetadata * metadata)
Merge the contents an
UnknownFieldSetwith the
UnknownFieldSetin *metadata, if there is one.
more... Adding fieldsvoid
AddVarint(int number, uint64 value)
void
AddFixed32(int number, uint32 value)
void
AddFixed64(int number, uint64 value)
void
AddLengthDelimited(int number, const std::string & value)
std::string *
AddLengthDelimited(int number)
UnknownFieldSet *
AddGroup(int number)
void
AddField(const UnknownField & field)
Adds an unknown field from another set.
void
DeleteSubrange(int start, int num)
Delete fields with indices in the range [start .
more...void
DeleteByNumber(int number)
Delete all fields with a specific field number.
more... 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 std::string & data)
template bool
MergeFromMessage(const MessageType & message)
Merges this message's unknown field data (if any).
more...static const UnknownFieldSet &
default_instance()
size_t UnknownFieldSet::SpaceUsedExcludingSelfLong() const
Computes (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) const
Get 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.
static void UnknownFieldSet::MergeToInternalMetadata(
const UnknownFieldSet & other,
internal::InternalMetadata * metadata)
void UnknownFieldSet::DeleteSubrange(
int start,
int num)
Delete fields with indices in the range [start .
. start+num-1]. Caution: implementation moves all fields with indices [start+num .. ].
void UnknownFieldSet::DeleteByNumber(
int number)
Delete all fields with a specific field number.
The order of left fields is preserved. Caution: implementation moves all fields after the first deleted field.
template bool UnknownFieldSet::MergeFromMessage(
const MessageType & message)
Merges this message's unknown field data (if any).
This works whether the message is a lite or full proto (for legacy reasons, lite and full return different types for MessageType::unknown_fields()).
class UnknownField#include <google/protobuf/unknown_field_set.h>
namespace google::protobuf
Represents one field in an UnknownFieldSet.
Membersenum
Type
uint64
varint_
uint32
fixed32_
uint64
fixed64_
union LengthDelimited
length_delimited_
UnknownFieldSet *
group_
int
number() const
The field's field number, as seen on the wire.
Type
type() const
The field type.
AccessorsEach method works only for UnknownFields of the corresponding type.
uint32
number_
uint32
type_
union google::protobuf::UnknownField::@35
data_
uint64
varint() const
uint32
fixed32() const
uint64
fixed64() const
const std::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 std::string & value)
std::string *
mutable_length_delimited()
UnknownFieldSet *
mutable_group()
void
SerializeLengthDelimitedNoTag(io::CodedOutputStream * output) const
Serialization API.
more...size_t
GetLengthDelimitedSize() const
uint8 *
InternalSerializeLengthDelimitedNoTag(uint8 * target, io::EpsCopyOutputStream * stream) const
void
Delete()
If this
UnknownFieldcontains a pointer, delete it.
void
DeepCopy(const UnknownField & other)
Make a deep copy of any pointers in this
UnknownField.
void
SetType(Type type)
Set the wire type of this
UnknownField.
more...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 void UnknownField::SerializeLengthDelimitedNoTag(
io::CodedOutputStream * output) const
Serialization API.
These methods can take advantage of the underlying implementation and may achieve a better performance than using getters to retrieve the data and do the serialization yourself.
void UnknownField::SetType(
Type type)
union UnknownField::LengthDelimited
#include <google/protobuf/unknown_field_set.h>
namespace google::protobuf
std::string *
string_value
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4