// Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. // https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Author: [email protected] (Kenton Varda) // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. // // Contains classes used to keep track of unrecognized fields seen while // parsing a protocol message. #ifndef GOOGLE_PROTOBUF_UNKNOWN_FIELD_SET_H__ #define GOOGLE_PROTOBUF_UNKNOWN_FIELD_SET_H__ #include <assert.h> #include <string> #include <vector> #include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/logging.h> #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/io/zero_copy_stream_impl_lite.h> #include <google/protobuf/port.h> #include <google/protobuf/message_lite.h> #include <google/protobuf/parse_context.h> // Must be included last. #include <google/protobuf/port_def.inc> #ifdef SWIG #error "You cannot SWIG proto headers" #endif namespace google { namespace protobuf { namespace internal { class InternalMetadata; // metadata_lite.h class WireFormat; // wire_format.h class MessageSetFieldSkipperUsingCord; // extension_set_heavy.cc } // namespace internal class Message; // message.h class UnknownField; // below // 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. class PROTOBUF_EXPORT UnknownFieldSet { … }; namespace internal { inline void WriteVarint(uint32_t num, uint64_t val, UnknownFieldSet* unknown) { … } inline void WriteLengthDelimited(uint32_t num, StringPiece val, UnknownFieldSet* unknown) { … } PROTOBUF_EXPORT const char* UnknownGroupParse(UnknownFieldSet* unknown, const char* ptr, ParseContext* ctx); PROTOBUF_EXPORT const char* UnknownFieldParse(uint64_t tag, UnknownFieldSet* unknown, const char* ptr, ParseContext* ctx); } // namespace internal // Represents one field in an UnknownFieldSet. class PROTOBUF_EXPORT UnknownField { … }; // =================================================================== // inline implementations inline UnknownFieldSet::UnknownFieldSet() { … } inline UnknownFieldSet::~UnknownFieldSet() { … } inline void UnknownFieldSet::ClearAndFreeMemory() { … } inline void UnknownFieldSet::Clear() { … } inline bool UnknownFieldSet::empty() const { … } inline void UnknownFieldSet::Swap(UnknownFieldSet* x) { … } inline int UnknownFieldSet::field_count() const { … } inline const UnknownField& UnknownFieldSet::field(int index) const { … } inline UnknownField* UnknownFieldSet::mutable_field(int index) { … } inline void UnknownFieldSet::AddLengthDelimited(int number, const std::string& value) { … } inline int UnknownField::number() const { … } inline UnknownField::Type UnknownField::type() const { … } inline uint64_t UnknownField::varint() const { … } inline uint32_t UnknownField::fixed32() const { … } inline uint64_t UnknownField::fixed64() const { … } inline const std::string& UnknownField::length_delimited() const { … } inline const UnknownFieldSet& UnknownField::group() const { … } inline void UnknownField::set_varint(uint64_t value) { … } inline void UnknownField::set_fixed32(uint32_t value) { … } inline void UnknownField::set_fixed64(uint64_t value) { … } inline void UnknownField::set_length_delimited(const std::string& value) { … } inline std::string* UnknownField::mutable_length_delimited() { … } inline UnknownFieldSet* UnknownField::mutable_group() { … } template <typename MessageType> bool UnknownFieldSet::MergeFromMessage(const MessageType& message) { … } inline size_t UnknownField::GetLengthDelimitedSize() const { … } inline void UnknownField::SetType(Type type) { … } } // namespace protobuf } // namespace google #include <google/protobuf/port_undef.inc> #endif // GOOGLE_PROTOBUF_UNKNOWN_FIELD_SET_H__