Files
libsession-util/proto/WebSocketResources.pb.cc
dr7anaandJason Rhinelander 43384d7f92 Protobuf integration & config wrapping/unwrapping
This adds support for automatic wrapping and unwrapping of config
messages that may be wrapped in protobuf; this was unintentional, but is
out in the wild in current Session releases.  The long-term plan is to
stop doing this eventually, but supporting it here allows us to change
from the current mode (always wrap/unwrap affected message types) to
a mode where we only unwrap, and then finally we can drop unwrapping as
well.

For now: we wrap/unwrap the existing released message types (user
profile, conversation info, and so on) but not the new groups configs
(which should always be un-wrapped).

Various notes:

- protobuf added as external dependency.

- protobuf 21.12 is used, which is an older release, but is what is
  still being used by lots of projects and Linux distributions because
  Google applied huge amounts of extra bloat in v22 (including pulling a
  massive pile of crap in abseil), broke the build system in various
  ways, and made everything suck to the point that many Linux
  distributions have just stuck with the latest 21.12 because of all the
  broken crap Google imposed on everyone in v22 and newer.

- SessionProtos.pro and WebSocketResources.proto looped in from
  session-ios codebase, with one minor change to let us use it in "lite"
  mode (which is still very bloated, but nothing like non-lite mode).

- Added pregenerated header/cpp files; we experimented with building
  them as part of the build, but that ended up neigh impossible for our
  various cross-compiled builds.  (These also get excluded from
  format.sh because they break if formatted.  Hurray.)

- Add protobuf::libprotobuf-lite to the static build list.

- Adds a dummy test script that does nothing, but tests that we can
  probably link against the combined archive (when building with
  `-DSTATIC_BUILD=ON`).
2023-10-04 11:06:33 -03:00

1224 lines
43 KiB
C++

// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: WebSocketResources.proto
#include "WebSocketResources.pb.h"
#include <algorithm>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>
PROTOBUF_PRAGMA_INIT_SEG
namespace _pb = ::PROTOBUF_NAMESPACE_ID;
namespace _pbi = _pb::internal;
namespace WebSocketProtos {
PROTOBUF_CONSTEXPR WebSocketRequestMessage::WebSocketRequestMessage(
::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_._has_bits_)*/{}
, /*decltype(_impl_._cached_size_)*/{}
, /*decltype(_impl_.headers_)*/{}
, /*decltype(_impl_.verb_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
, /*decltype(_impl_.path_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
, /*decltype(_impl_.body_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
, /*decltype(_impl_.requestid_)*/uint64_t{0u}} {}
struct WebSocketRequestMessageDefaultTypeInternal {
PROTOBUF_CONSTEXPR WebSocketRequestMessageDefaultTypeInternal()
: _instance(::_pbi::ConstantInitialized{}) {}
~WebSocketRequestMessageDefaultTypeInternal() {}
union {
WebSocketRequestMessage _instance;
};
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 WebSocketRequestMessageDefaultTypeInternal _WebSocketRequestMessage_default_instance_;
PROTOBUF_CONSTEXPR WebSocketResponseMessage::WebSocketResponseMessage(
::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_._has_bits_)*/{}
, /*decltype(_impl_._cached_size_)*/{}
, /*decltype(_impl_.headers_)*/{}
, /*decltype(_impl_.message_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
, /*decltype(_impl_.body_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
, /*decltype(_impl_.requestid_)*/uint64_t{0u}
, /*decltype(_impl_.status_)*/0u} {}
struct WebSocketResponseMessageDefaultTypeInternal {
PROTOBUF_CONSTEXPR WebSocketResponseMessageDefaultTypeInternal()
: _instance(::_pbi::ConstantInitialized{}) {}
~WebSocketResponseMessageDefaultTypeInternal() {}
union {
WebSocketResponseMessage _instance;
};
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 WebSocketResponseMessageDefaultTypeInternal _WebSocketResponseMessage_default_instance_;
PROTOBUF_CONSTEXPR WebSocketMessage::WebSocketMessage(
::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_._has_bits_)*/{}
, /*decltype(_impl_._cached_size_)*/{}
, /*decltype(_impl_.request_)*/nullptr
, /*decltype(_impl_.response_)*/nullptr
, /*decltype(_impl_.type_)*/0} {}
struct WebSocketMessageDefaultTypeInternal {
PROTOBUF_CONSTEXPR WebSocketMessageDefaultTypeInternal()
: _instance(::_pbi::ConstantInitialized{}) {}
~WebSocketMessageDefaultTypeInternal() {}
union {
WebSocketMessage _instance;
};
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 WebSocketMessageDefaultTypeInternal _WebSocketMessage_default_instance_;
} // namespace WebSocketProtos
namespace WebSocketProtos {
bool WebSocketMessage_Type_IsValid(int value) {
switch (value) {
case 0:
case 1:
case 2:
return true;
default:
return false;
}
}
static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> WebSocketMessage_Type_strings[3] = {};
static const char WebSocketMessage_Type_names[] =
"REQUEST"
"RESPONSE"
"UNKNOWN";
static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry WebSocketMessage_Type_entries[] = {
{ {WebSocketMessage_Type_names + 0, 7}, 1 },
{ {WebSocketMessage_Type_names + 7, 8}, 2 },
{ {WebSocketMessage_Type_names + 15, 7}, 0 },
};
static const int WebSocketMessage_Type_entries_by_number[] = {
2, // 0 -> UNKNOWN
0, // 1 -> REQUEST
1, // 2 -> RESPONSE
};
const std::string& WebSocketMessage_Type_Name(
WebSocketMessage_Type value) {
static const bool dummy =
::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings(
WebSocketMessage_Type_entries,
WebSocketMessage_Type_entries_by_number,
3, WebSocketMessage_Type_strings);
(void) dummy;
int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName(
WebSocketMessage_Type_entries,
WebSocketMessage_Type_entries_by_number,
3, value);
return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() :
WebSocketMessage_Type_strings[idx].get();
}
bool WebSocketMessage_Type_Parse(
::PROTOBUF_NAMESPACE_ID::ConstStringParam name, WebSocketMessage_Type* value) {
int int_value;
bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue(
WebSocketMessage_Type_entries, 3, name, &int_value);
if (success) {
*value = static_cast<WebSocketMessage_Type>(int_value);
}
return success;
}
#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
constexpr WebSocketMessage_Type WebSocketMessage::UNKNOWN;
constexpr WebSocketMessage_Type WebSocketMessage::REQUEST;
constexpr WebSocketMessage_Type WebSocketMessage::RESPONSE;
constexpr WebSocketMessage_Type WebSocketMessage::Type_MIN;
constexpr WebSocketMessage_Type WebSocketMessage::Type_MAX;
constexpr int WebSocketMessage::Type_ARRAYSIZE;
#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
// ===================================================================
class WebSocketRequestMessage::_Internal {
public:
using HasBits = decltype(std::declval<WebSocketRequestMessage>()._impl_._has_bits_);
static void set_has_verb(HasBits* has_bits) {
(*has_bits)[0] |= 1u;
}
static void set_has_path(HasBits* has_bits) {
(*has_bits)[0] |= 2u;
}
static void set_has_body(HasBits* has_bits) {
(*has_bits)[0] |= 4u;
}
static void set_has_requestid(HasBits* has_bits) {
(*has_bits)[0] |= 8u;
}
};
WebSocketRequestMessage::WebSocketRequestMessage(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:WebSocketProtos.WebSocketRequestMessage)
}
WebSocketRequestMessage::WebSocketRequestMessage(const WebSocketRequestMessage& from)
: ::PROTOBUF_NAMESPACE_ID::MessageLite() {
WebSocketRequestMessage* const _this = this; (void)_this;
new (&_impl_) Impl_{
decltype(_impl_._has_bits_){from._impl_._has_bits_}
, /*decltype(_impl_._cached_size_)*/{}
, decltype(_impl_.headers_){from._impl_.headers_}
, decltype(_impl_.verb_){}
, decltype(_impl_.path_){}
, decltype(_impl_.body_){}
, decltype(_impl_.requestid_){}};
_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
_impl_.verb_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.verb_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_verb()) {
_this->_impl_.verb_.Set(from._internal_verb(),
_this->GetArenaForAllocation());
}
_impl_.path_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.path_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_path()) {
_this->_impl_.path_.Set(from._internal_path(),
_this->GetArenaForAllocation());
}
_impl_.body_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.body_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_body()) {
_this->_impl_.body_.Set(from._internal_body(),
_this->GetArenaForAllocation());
}
_this->_impl_.requestid_ = from._impl_.requestid_;
// @@protoc_insertion_point(copy_constructor:WebSocketProtos.WebSocketRequestMessage)
}
inline void WebSocketRequestMessage::SharedCtor(
::_pb::Arena* arena, bool is_message_owned) {
(void)arena;
(void)is_message_owned;
new (&_impl_) Impl_{
decltype(_impl_._has_bits_){}
, /*decltype(_impl_._cached_size_)*/{}
, decltype(_impl_.headers_){arena}
, decltype(_impl_.verb_){}
, decltype(_impl_.path_){}
, decltype(_impl_.body_){}
, decltype(_impl_.requestid_){uint64_t{0u}}
};
_impl_.verb_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.verb_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.path_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.path_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.body_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.body_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
WebSocketRequestMessage::~WebSocketRequestMessage() {
// @@protoc_insertion_point(destructor:WebSocketProtos.WebSocketRequestMessage)
if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
(void)arena;
return;
}
SharedDtor();
}
inline void WebSocketRequestMessage::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
_impl_.headers_.~RepeatedPtrField();
_impl_.verb_.Destroy();
_impl_.path_.Destroy();
_impl_.body_.Destroy();
}
void WebSocketRequestMessage::SetCachedSize(int size) const {
_impl_._cached_size_.Set(size);
}
void WebSocketRequestMessage::Clear() {
// @@protoc_insertion_point(message_clear_start:WebSocketProtos.WebSocketRequestMessage)
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
_impl_.headers_.Clear();
cached_has_bits = _impl_._has_bits_[0];
if (cached_has_bits & 0x00000007u) {
if (cached_has_bits & 0x00000001u) {
_impl_.verb_.ClearNonDefaultToEmpty();
}
if (cached_has_bits & 0x00000002u) {
_impl_.path_.ClearNonDefaultToEmpty();
}
if (cached_has_bits & 0x00000004u) {
_impl_.body_.ClearNonDefaultToEmpty();
}
}
_impl_.requestid_ = uint64_t{0u};
_impl_._has_bits_.Clear();
_internal_metadata_.Clear<std::string>();
}
const char* WebSocketRequestMessage::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
uint32_t tag;
ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional string verb = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
auto str = _internal_mutable_verb();
ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
} else
goto handle_unusual;
continue;
// optional string path = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
auto str = _internal_mutable_path();
ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
} else
goto handle_unusual;
continue;
// optional bytes body = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
auto str = _internal_mutable_body();
ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
} else
goto handle_unusual;
continue;
// optional uint64 requestId = 4;
case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) {
_Internal::set_has_requestid(&has_bits);
_impl_.requestid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
// repeated string headers = 5;
case 5:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
ptr -= 1;
do {
ptr += 1;
auto str = _internal_add_headers();
ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
} while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<42>(ptr));
} else
goto handle_unusual;
continue;
default:
goto handle_unusual;
} // switch
handle_unusual:
if ((tag == 0) || ((tag & 7) == 4)) {
CHK_(ptr);
ctx->SetLastTag(tag);
goto message_done;
}
ptr = UnknownFieldParse(
tag,
_internal_metadata_.mutable_unknown_fields<std::string>(),
ptr, ctx);
CHK_(ptr != nullptr);
} // while
message_done:
_impl_._has_bits_.Or(has_bits);
return ptr;
failure:
ptr = nullptr;
goto message_done;
#undef CHK_
}
uint8_t* WebSocketRequestMessage::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:WebSocketProtos.WebSocketRequestMessage)
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _impl_._has_bits_[0];
// optional string verb = 1;
if (cached_has_bits & 0x00000001u) {
target = stream->WriteStringMaybeAliased(
1, this->_internal_verb(), target);
}
// optional string path = 2;
if (cached_has_bits & 0x00000002u) {
target = stream->WriteStringMaybeAliased(
2, this->_internal_path(), target);
}
// optional bytes body = 3;
if (cached_has_bits & 0x00000004u) {
target = stream->WriteBytesMaybeAliased(
3, this->_internal_body(), target);
}
// optional uint64 requestId = 4;
if (cached_has_bits & 0x00000008u) {
target = stream->EnsureSpace(target);
target = ::_pbi::WireFormatLite::WriteUInt64ToArray(4, this->_internal_requestid(), target);
}
// repeated string headers = 5;
for (int i = 0, n = this->_internal_headers_size(); i < n; i++) {
const auto& s = this->_internal_headers(i);
target = stream->WriteString(5, s, target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
}
// @@protoc_insertion_point(serialize_to_array_end:WebSocketProtos.WebSocketRequestMessage)
return target;
}
size_t WebSocketRequestMessage::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:WebSocketProtos.WebSocketRequestMessage)
size_t total_size = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// repeated string headers = 5;
total_size += 1 *
::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(_impl_.headers_.size());
for (int i = 0, n = _impl_.headers_.size(); i < n; i++) {
total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
_impl_.headers_.Get(i));
}
cached_has_bits = _impl_._has_bits_[0];
if (cached_has_bits & 0x0000000fu) {
// optional string verb = 1;
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_verb());
}
// optional string path = 2;
if (cached_has_bits & 0x00000002u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_path());
}
// optional bytes body = 3;
if (cached_has_bits & 0x00000004u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
this->_internal_body());
}
// optional uint64 requestId = 4;
if (cached_has_bits & 0x00000008u) {
total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_requestid());
}
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
}
int cached_size = ::_pbi::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void WebSocketRequestMessage::CheckTypeAndMergeFrom(
const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
MergeFrom(*::_pbi::DownCast<const WebSocketRequestMessage*>(
&from));
}
void WebSocketRequestMessage::MergeFrom(const WebSocketRequestMessage& from) {
WebSocketRequestMessage* const _this = this;
// @@protoc_insertion_point(class_specific_merge_from_start:WebSocketProtos.WebSocketRequestMessage)
GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
_this->_impl_.headers_.MergeFrom(from._impl_.headers_);
cached_has_bits = from._impl_._has_bits_[0];
if (cached_has_bits & 0x0000000fu) {
if (cached_has_bits & 0x00000001u) {
_this->_internal_set_verb(from._internal_verb());
}
if (cached_has_bits & 0x00000002u) {
_this->_internal_set_path(from._internal_path());
}
if (cached_has_bits & 0x00000004u) {
_this->_internal_set_body(from._internal_body());
}
if (cached_has_bits & 0x00000008u) {
_this->_impl_.requestid_ = from._impl_.requestid_;
}
_this->_impl_._has_bits_[0] |= cached_has_bits;
}
_this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}
void WebSocketRequestMessage::CopyFrom(const WebSocketRequestMessage& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:WebSocketProtos.WebSocketRequestMessage)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool WebSocketRequestMessage::IsInitialized() const {
return true;
}
void WebSocketRequestMessage::InternalSwap(WebSocketRequestMessage* other) {
using std::swap;
auto* lhs_arena = GetArenaForAllocation();
auto* rhs_arena = other->GetArenaForAllocation();
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
_impl_.headers_.InternalSwap(&other->_impl_.headers_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
&_impl_.verb_, lhs_arena,
&other->_impl_.verb_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
&_impl_.path_, lhs_arena,
&other->_impl_.path_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
&_impl_.body_, lhs_arena,
&other->_impl_.body_, rhs_arena
);
swap(_impl_.requestid_, other->_impl_.requestid_);
}
std::string WebSocketRequestMessage::GetTypeName() const {
return "WebSocketProtos.WebSocketRequestMessage";
}
// ===================================================================
class WebSocketResponseMessage::_Internal {
public:
using HasBits = decltype(std::declval<WebSocketResponseMessage>()._impl_._has_bits_);
static void set_has_requestid(HasBits* has_bits) {
(*has_bits)[0] |= 4u;
}
static void set_has_status(HasBits* has_bits) {
(*has_bits)[0] |= 8u;
}
static void set_has_message(HasBits* has_bits) {
(*has_bits)[0] |= 1u;
}
static void set_has_body(HasBits* has_bits) {
(*has_bits)[0] |= 2u;
}
};
WebSocketResponseMessage::WebSocketResponseMessage(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:WebSocketProtos.WebSocketResponseMessage)
}
WebSocketResponseMessage::WebSocketResponseMessage(const WebSocketResponseMessage& from)
: ::PROTOBUF_NAMESPACE_ID::MessageLite() {
WebSocketResponseMessage* const _this = this; (void)_this;
new (&_impl_) Impl_{
decltype(_impl_._has_bits_){from._impl_._has_bits_}
, /*decltype(_impl_._cached_size_)*/{}
, decltype(_impl_.headers_){from._impl_.headers_}
, decltype(_impl_.message_){}
, decltype(_impl_.body_){}
, decltype(_impl_.requestid_){}
, decltype(_impl_.status_){}};
_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
_impl_.message_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.message_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_message()) {
_this->_impl_.message_.Set(from._internal_message(),
_this->GetArenaForAllocation());
}
_impl_.body_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.body_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_body()) {
_this->_impl_.body_.Set(from._internal_body(),
_this->GetArenaForAllocation());
}
::memcpy(&_impl_.requestid_, &from._impl_.requestid_,
static_cast<size_t>(reinterpret_cast<char*>(&_impl_.status_) -
reinterpret_cast<char*>(&_impl_.requestid_)) + sizeof(_impl_.status_));
// @@protoc_insertion_point(copy_constructor:WebSocketProtos.WebSocketResponseMessage)
}
inline void WebSocketResponseMessage::SharedCtor(
::_pb::Arena* arena, bool is_message_owned) {
(void)arena;
(void)is_message_owned;
new (&_impl_) Impl_{
decltype(_impl_._has_bits_){}
, /*decltype(_impl_._cached_size_)*/{}
, decltype(_impl_.headers_){arena}
, decltype(_impl_.message_){}
, decltype(_impl_.body_){}
, decltype(_impl_.requestid_){uint64_t{0u}}
, decltype(_impl_.status_){0u}
};
_impl_.message_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.message_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.body_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.body_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
WebSocketResponseMessage::~WebSocketResponseMessage() {
// @@protoc_insertion_point(destructor:WebSocketProtos.WebSocketResponseMessage)
if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
(void)arena;
return;
}
SharedDtor();
}
inline void WebSocketResponseMessage::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
_impl_.headers_.~RepeatedPtrField();
_impl_.message_.Destroy();
_impl_.body_.Destroy();
}
void WebSocketResponseMessage::SetCachedSize(int size) const {
_impl_._cached_size_.Set(size);
}
void WebSocketResponseMessage::Clear() {
// @@protoc_insertion_point(message_clear_start:WebSocketProtos.WebSocketResponseMessage)
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
_impl_.headers_.Clear();
cached_has_bits = _impl_._has_bits_[0];
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000001u) {
_impl_.message_.ClearNonDefaultToEmpty();
}
if (cached_has_bits & 0x00000002u) {
_impl_.body_.ClearNonDefaultToEmpty();
}
}
if (cached_has_bits & 0x0000000cu) {
::memset(&_impl_.requestid_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&_impl_.status_) -
reinterpret_cast<char*>(&_impl_.requestid_)) + sizeof(_impl_.status_));
}
_impl_._has_bits_.Clear();
_internal_metadata_.Clear<std::string>();
}
const char* WebSocketResponseMessage::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
uint32_t tag;
ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional uint64 requestId = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
_Internal::set_has_requestid(&has_bits);
_impl_.requestid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
// optional uint32 status = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
_Internal::set_has_status(&has_bits);
_impl_.status_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
// optional string message = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
auto str = _internal_mutable_message();
ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
} else
goto handle_unusual;
continue;
// optional bytes body = 4;
case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
auto str = _internal_mutable_body();
ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
} else
goto handle_unusual;
continue;
// repeated string headers = 5;
case 5:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
ptr -= 1;
do {
ptr += 1;
auto str = _internal_add_headers();
ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
if (!ctx->DataAvailable(ptr)) break;
} while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<42>(ptr));
} else
goto handle_unusual;
continue;
default:
goto handle_unusual;
} // switch
handle_unusual:
if ((tag == 0) || ((tag & 7) == 4)) {
CHK_(ptr);
ctx->SetLastTag(tag);
goto message_done;
}
ptr = UnknownFieldParse(
tag,
_internal_metadata_.mutable_unknown_fields<std::string>(),
ptr, ctx);
CHK_(ptr != nullptr);
} // while
message_done:
_impl_._has_bits_.Or(has_bits);
return ptr;
failure:
ptr = nullptr;
goto message_done;
#undef CHK_
}
uint8_t* WebSocketResponseMessage::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:WebSocketProtos.WebSocketResponseMessage)
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _impl_._has_bits_[0];
// optional uint64 requestId = 1;
if (cached_has_bits & 0x00000004u) {
target = stream->EnsureSpace(target);
target = ::_pbi::WireFormatLite::WriteUInt64ToArray(1, this->_internal_requestid(), target);
}
// optional uint32 status = 2;
if (cached_has_bits & 0x00000008u) {
target = stream->EnsureSpace(target);
target = ::_pbi::WireFormatLite::WriteUInt32ToArray(2, this->_internal_status(), target);
}
// optional string message = 3;
if (cached_has_bits & 0x00000001u) {
target = stream->WriteStringMaybeAliased(
3, this->_internal_message(), target);
}
// optional bytes body = 4;
if (cached_has_bits & 0x00000002u) {
target = stream->WriteBytesMaybeAliased(
4, this->_internal_body(), target);
}
// repeated string headers = 5;
for (int i = 0, n = this->_internal_headers_size(); i < n; i++) {
const auto& s = this->_internal_headers(i);
target = stream->WriteString(5, s, target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
}
// @@protoc_insertion_point(serialize_to_array_end:WebSocketProtos.WebSocketResponseMessage)
return target;
}
size_t WebSocketResponseMessage::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:WebSocketProtos.WebSocketResponseMessage)
size_t total_size = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// repeated string headers = 5;
total_size += 1 *
::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(_impl_.headers_.size());
for (int i = 0, n = _impl_.headers_.size(); i < n; i++) {
total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
_impl_.headers_.Get(i));
}
cached_has_bits = _impl_._has_bits_[0];
if (cached_has_bits & 0x0000000fu) {
// optional string message = 3;
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_message());
}
// optional bytes body = 4;
if (cached_has_bits & 0x00000002u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
this->_internal_body());
}
// optional uint64 requestId = 1;
if (cached_has_bits & 0x00000004u) {
total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_requestid());
}
// optional uint32 status = 2;
if (cached_has_bits & 0x00000008u) {
total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_status());
}
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
}
int cached_size = ::_pbi::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void WebSocketResponseMessage::CheckTypeAndMergeFrom(
const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
MergeFrom(*::_pbi::DownCast<const WebSocketResponseMessage*>(
&from));
}
void WebSocketResponseMessage::MergeFrom(const WebSocketResponseMessage& from) {
WebSocketResponseMessage* const _this = this;
// @@protoc_insertion_point(class_specific_merge_from_start:WebSocketProtos.WebSocketResponseMessage)
GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
_this->_impl_.headers_.MergeFrom(from._impl_.headers_);
cached_has_bits = from._impl_._has_bits_[0];
if (cached_has_bits & 0x0000000fu) {
if (cached_has_bits & 0x00000001u) {
_this->_internal_set_message(from._internal_message());
}
if (cached_has_bits & 0x00000002u) {
_this->_internal_set_body(from._internal_body());
}
if (cached_has_bits & 0x00000004u) {
_this->_impl_.requestid_ = from._impl_.requestid_;
}
if (cached_has_bits & 0x00000008u) {
_this->_impl_.status_ = from._impl_.status_;
}
_this->_impl_._has_bits_[0] |= cached_has_bits;
}
_this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}
void WebSocketResponseMessage::CopyFrom(const WebSocketResponseMessage& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:WebSocketProtos.WebSocketResponseMessage)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool WebSocketResponseMessage::IsInitialized() const {
return true;
}
void WebSocketResponseMessage::InternalSwap(WebSocketResponseMessage* other) {
using std::swap;
auto* lhs_arena = GetArenaForAllocation();
auto* rhs_arena = other->GetArenaForAllocation();
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
_impl_.headers_.InternalSwap(&other->_impl_.headers_);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
&_impl_.message_, lhs_arena,
&other->_impl_.message_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
&_impl_.body_, lhs_arena,
&other->_impl_.body_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(WebSocketResponseMessage, _impl_.status_)
+ sizeof(WebSocketResponseMessage::_impl_.status_)
- PROTOBUF_FIELD_OFFSET(WebSocketResponseMessage, _impl_.requestid_)>(
reinterpret_cast<char*>(&_impl_.requestid_),
reinterpret_cast<char*>(&other->_impl_.requestid_));
}
std::string WebSocketResponseMessage::GetTypeName() const {
return "WebSocketProtos.WebSocketResponseMessage";
}
// ===================================================================
class WebSocketMessage::_Internal {
public:
using HasBits = decltype(std::declval<WebSocketMessage>()._impl_._has_bits_);
static void set_has_type(HasBits* has_bits) {
(*has_bits)[0] |= 4u;
}
static const ::WebSocketProtos::WebSocketRequestMessage& request(const WebSocketMessage* msg);
static void set_has_request(HasBits* has_bits) {
(*has_bits)[0] |= 1u;
}
static const ::WebSocketProtos::WebSocketResponseMessage& response(const WebSocketMessage* msg);
static void set_has_response(HasBits* has_bits) {
(*has_bits)[0] |= 2u;
}
};
const ::WebSocketProtos::WebSocketRequestMessage&
WebSocketMessage::_Internal::request(const WebSocketMessage* msg) {
return *msg->_impl_.request_;
}
const ::WebSocketProtos::WebSocketResponseMessage&
WebSocketMessage::_Internal::response(const WebSocketMessage* msg) {
return *msg->_impl_.response_;
}
WebSocketMessage::WebSocketMessage(::PROTOBUF_NAMESPACE_ID::Arena* arena,
bool is_message_owned)
: ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
SharedCtor(arena, is_message_owned);
// @@protoc_insertion_point(arena_constructor:WebSocketProtos.WebSocketMessage)
}
WebSocketMessage::WebSocketMessage(const WebSocketMessage& from)
: ::PROTOBUF_NAMESPACE_ID::MessageLite() {
WebSocketMessage* const _this = this; (void)_this;
new (&_impl_) Impl_{
decltype(_impl_._has_bits_){from._impl_._has_bits_}
, /*decltype(_impl_._cached_size_)*/{}
, decltype(_impl_.request_){nullptr}
, decltype(_impl_.response_){nullptr}
, decltype(_impl_.type_){}};
_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
if (from._internal_has_request()) {
_this->_impl_.request_ = new ::WebSocketProtos::WebSocketRequestMessage(*from._impl_.request_);
}
if (from._internal_has_response()) {
_this->_impl_.response_ = new ::WebSocketProtos::WebSocketResponseMessage(*from._impl_.response_);
}
_this->_impl_.type_ = from._impl_.type_;
// @@protoc_insertion_point(copy_constructor:WebSocketProtos.WebSocketMessage)
}
inline void WebSocketMessage::SharedCtor(
::_pb::Arena* arena, bool is_message_owned) {
(void)arena;
(void)is_message_owned;
new (&_impl_) Impl_{
decltype(_impl_._has_bits_){}
, /*decltype(_impl_._cached_size_)*/{}
, decltype(_impl_.request_){nullptr}
, decltype(_impl_.response_){nullptr}
, decltype(_impl_.type_){0}
};
}
WebSocketMessage::~WebSocketMessage() {
// @@protoc_insertion_point(destructor:WebSocketProtos.WebSocketMessage)
if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
(void)arena;
return;
}
SharedDtor();
}
inline void WebSocketMessage::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
if (this != internal_default_instance()) delete _impl_.request_;
if (this != internal_default_instance()) delete _impl_.response_;
}
void WebSocketMessage::SetCachedSize(int size) const {
_impl_._cached_size_.Set(size);
}
void WebSocketMessage::Clear() {
// @@protoc_insertion_point(message_clear_start:WebSocketProtos.WebSocketMessage)
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
cached_has_bits = _impl_._has_bits_[0];
if (cached_has_bits & 0x00000003u) {
if (cached_has_bits & 0x00000001u) {
GOOGLE_DCHECK(_impl_.request_ != nullptr);
_impl_.request_->Clear();
}
if (cached_has_bits & 0x00000002u) {
GOOGLE_DCHECK(_impl_.response_ != nullptr);
_impl_.response_->Clear();
}
}
_impl_.type_ = 0;
_impl_._has_bits_.Clear();
_internal_metadata_.Clear<std::string>();
}
const char* WebSocketMessage::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
_Internal::HasBits has_bits{};
while (!ctx->Done(&ptr)) {
uint32_t tag;
ptr = ::_pbi::ReadTag(ptr, &tag);
switch (tag >> 3) {
// optional .WebSocketProtos.WebSocketMessage.Type type = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
CHK_(ptr);
if (PROTOBUF_PREDICT_TRUE(::WebSocketProtos::WebSocketMessage_Type_IsValid(val))) {
_internal_set_type(static_cast<::WebSocketProtos::WebSocketMessage_Type>(val));
} else {
::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields());
}
} else
goto handle_unusual;
continue;
// optional .WebSocketProtos.WebSocketRequestMessage request = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
ptr = ctx->ParseMessage(_internal_mutable_request(), ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
// optional .WebSocketProtos.WebSocketResponseMessage response = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
ptr = ctx->ParseMessage(_internal_mutable_response(), ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
default:
goto handle_unusual;
} // switch
handle_unusual:
if ((tag == 0) || ((tag & 7) == 4)) {
CHK_(ptr);
ctx->SetLastTag(tag);
goto message_done;
}
ptr = UnknownFieldParse(
tag,
_internal_metadata_.mutable_unknown_fields<std::string>(),
ptr, ctx);
CHK_(ptr != nullptr);
} // while
message_done:
_impl_._has_bits_.Or(has_bits);
return ptr;
failure:
ptr = nullptr;
goto message_done;
#undef CHK_
}
uint8_t* WebSocketMessage::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:WebSocketProtos.WebSocketMessage)
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _impl_._has_bits_[0];
// optional .WebSocketProtos.WebSocketMessage.Type type = 1;
if (cached_has_bits & 0x00000004u) {
target = stream->EnsureSpace(target);
target = ::_pbi::WireFormatLite::WriteEnumToArray(
1, this->_internal_type(), target);
}
// optional .WebSocketProtos.WebSocketRequestMessage request = 2;
if (cached_has_bits & 0x00000001u) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(2, _Internal::request(this),
_Internal::request(this).GetCachedSize(), target, stream);
}
// optional .WebSocketProtos.WebSocketResponseMessage response = 3;
if (cached_has_bits & 0x00000002u) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(3, _Internal::response(this),
_Internal::response(this).GetCachedSize(), target, stream);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
}
// @@protoc_insertion_point(serialize_to_array_end:WebSocketProtos.WebSocketMessage)
return target;
}
size_t WebSocketMessage::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:WebSocketProtos.WebSocketMessage)
size_t total_size = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
cached_has_bits = _impl_._has_bits_[0];
if (cached_has_bits & 0x00000007u) {
// optional .WebSocketProtos.WebSocketRequestMessage request = 2;
if (cached_has_bits & 0x00000001u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.request_);
}
// optional .WebSocketProtos.WebSocketResponseMessage response = 3;
if (cached_has_bits & 0x00000002u) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.response_);
}
// optional .WebSocketProtos.WebSocketMessage.Type type = 1;
if (cached_has_bits & 0x00000004u) {
total_size += 1 +
::_pbi::WireFormatLite::EnumSize(this->_internal_type());
}
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
}
int cached_size = ::_pbi::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void WebSocketMessage::CheckTypeAndMergeFrom(
const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
MergeFrom(*::_pbi::DownCast<const WebSocketMessage*>(
&from));
}
void WebSocketMessage::MergeFrom(const WebSocketMessage& from) {
WebSocketMessage* const _this = this;
// @@protoc_insertion_point(class_specific_merge_from_start:WebSocketProtos.WebSocketMessage)
GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = from._impl_._has_bits_[0];
if (cached_has_bits & 0x00000007u) {
if (cached_has_bits & 0x00000001u) {
_this->_internal_mutable_request()->::WebSocketProtos::WebSocketRequestMessage::MergeFrom(
from._internal_request());
}
if (cached_has_bits & 0x00000002u) {
_this->_internal_mutable_response()->::WebSocketProtos::WebSocketResponseMessage::MergeFrom(
from._internal_response());
}
if (cached_has_bits & 0x00000004u) {
_this->_impl_.type_ = from._impl_.type_;
}
_this->_impl_._has_bits_[0] |= cached_has_bits;
}
_this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}
void WebSocketMessage::CopyFrom(const WebSocketMessage& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:WebSocketProtos.WebSocketMessage)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool WebSocketMessage::IsInitialized() const {
return true;
}
void WebSocketMessage::InternalSwap(WebSocketMessage* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(WebSocketMessage, _impl_.type_)
+ sizeof(WebSocketMessage::_impl_.type_)
- PROTOBUF_FIELD_OFFSET(WebSocketMessage, _impl_.request_)>(
reinterpret_cast<char*>(&_impl_.request_),
reinterpret_cast<char*>(&other->_impl_.request_));
}
std::string WebSocketMessage::GetTypeName() const {
return "WebSocketProtos.WebSocketMessage";
}
// @@protoc_insertion_point(namespace_scope)
} // namespace WebSocketProtos
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::WebSocketProtos::WebSocketRequestMessage*
Arena::CreateMaybeMessage< ::WebSocketProtos::WebSocketRequestMessage >(Arena* arena) {
return Arena::CreateMessageInternal< ::WebSocketProtos::WebSocketRequestMessage >(arena);
}
template<> PROTOBUF_NOINLINE ::WebSocketProtos::WebSocketResponseMessage*
Arena::CreateMaybeMessage< ::WebSocketProtos::WebSocketResponseMessage >(Arena* arena) {
return Arena::CreateMessageInternal< ::WebSocketProtos::WebSocketResponseMessage >(arena);
}
template<> PROTOBUF_NOINLINE ::WebSocketProtos::WebSocketMessage*
Arena::CreateMaybeMessage< ::WebSocketProtos::WebSocketMessage >(Arena* arena) {
return Arena::CreateMessageInternal< ::WebSocketProtos::WebSocketMessage >(arena);
}
PROTOBUF_NAMESPACE_CLOSE
// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>