Files
tubestation/toolkit/components/cookiebanners/cookieBanner.pb.cc
Tim Huang e46e8c4abc Bug 1874741 - Part 1: Add a protobuf implementation for parsing Google's SOCS cookie. r=anti-tracking-reviewers,pbz
This patch adds a protobuf implementation for parsing the SOCS cookies
from Google. Note that the protobuf definition for the SOCS cookie
isn't accurate, but it allows us to parse the cookie properly to get the
information we want.

Differential Revision: https://phabricator.services.mozilla.com/D205442
2024-03-29 23:15:11 +00:00

984 lines
35 KiB
C++

// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: cookieBanner.proto
#include "cookieBanner.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 mozilla {
namespace cookieBanner {
PROTOBUF_CONSTEXPR GoogleSOCSCookie_extraData::GoogleSOCSCookie_extraData(
::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_._has_bits_)*/{}
, /*decltype(_impl_._cached_size_)*/{}
, /*decltype(_impl_.platform_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
, /*decltype(_impl_.region_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
, /*decltype(_impl_.unused1_)*/0u
, /*decltype(_impl_.unused2_)*/0u} {}
struct GoogleSOCSCookie_extraDataDefaultTypeInternal {
PROTOBUF_CONSTEXPR GoogleSOCSCookie_extraDataDefaultTypeInternal()
: _instance(::_pbi::ConstantInitialized{}) {}
~GoogleSOCSCookie_extraDataDefaultTypeInternal() {}
union {
GoogleSOCSCookie_extraData _instance;
};
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 GoogleSOCSCookie_extraDataDefaultTypeInternal _GoogleSOCSCookie_extraData_default_instance_;
PROTOBUF_CONSTEXPR GoogleSOCSCookie_timeData::GoogleSOCSCookie_timeData(
::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_._has_bits_)*/{}
, /*decltype(_impl_._cached_size_)*/{}
, /*decltype(_impl_.timestamp_)*/uint64_t{0u}} {}
struct GoogleSOCSCookie_timeDataDefaultTypeInternal {
PROTOBUF_CONSTEXPR GoogleSOCSCookie_timeDataDefaultTypeInternal()
: _instance(::_pbi::ConstantInitialized{}) {}
~GoogleSOCSCookie_timeDataDefaultTypeInternal() {}
union {
GoogleSOCSCookie_timeData _instance;
};
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 GoogleSOCSCookie_timeDataDefaultTypeInternal _GoogleSOCSCookie_timeData_default_instance_;
PROTOBUF_CONSTEXPR GoogleSOCSCookie::GoogleSOCSCookie(
::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_._has_bits_)*/{}
, /*decltype(_impl_._cached_size_)*/{}
, /*decltype(_impl_.data_)*/nullptr
, /*decltype(_impl_.time_)*/nullptr
, /*decltype(_impl_.gdpr_choice_)*/0u} {}
struct GoogleSOCSCookieDefaultTypeInternal {
PROTOBUF_CONSTEXPR GoogleSOCSCookieDefaultTypeInternal()
: _instance(::_pbi::ConstantInitialized{}) {}
~GoogleSOCSCookieDefaultTypeInternal() {}
union {
GoogleSOCSCookie _instance;
};
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 GoogleSOCSCookieDefaultTypeInternal _GoogleSOCSCookie_default_instance_;
} // namespace cookieBanner
} // namespace mozilla
namespace mozilla {
namespace cookieBanner {
// ===================================================================
class GoogleSOCSCookie_extraData::_Internal {
public:
using HasBits = decltype(std::declval<GoogleSOCSCookie_extraData>()._impl_._has_bits_);
static void set_has_unused1(HasBits* has_bits) {
(*has_bits)[0] |= 4u;
}
static void set_has_platform(HasBits* has_bits) {
(*has_bits)[0] |= 1u;
}
static void set_has_region(HasBits* has_bits) {
(*has_bits)[0] |= 2u;
}
static void set_has_unused2(HasBits* has_bits) {
(*has_bits)[0] |= 8u;
}
static bool MissingRequiredFields(const HasBits& has_bits) {
return ((has_bits[0] & 0x0000000f) ^ 0x0000000f) != 0;
}
};
GoogleSOCSCookie_extraData::GoogleSOCSCookie_extraData(::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:mozilla.cookieBanner.GoogleSOCSCookie.extraData)
}
GoogleSOCSCookie_extraData::GoogleSOCSCookie_extraData(const GoogleSOCSCookie_extraData& from)
: ::PROTOBUF_NAMESPACE_ID::MessageLite() {
GoogleSOCSCookie_extraData* const _this = this; (void)_this;
new (&_impl_) Impl_{
decltype(_impl_._has_bits_){from._impl_._has_bits_}
, /*decltype(_impl_._cached_size_)*/{}
, decltype(_impl_.platform_){}
, decltype(_impl_.region_){}
, decltype(_impl_.unused1_){}
, decltype(_impl_.unused2_){}};
_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
_impl_.platform_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.platform_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_platform()) {
_this->_impl_.platform_.Set(from._internal_platform(),
_this->GetArenaForAllocation());
}
_impl_.region_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.region_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (from._internal_has_region()) {
_this->_impl_.region_.Set(from._internal_region(),
_this->GetArenaForAllocation());
}
::memcpy(&_impl_.unused1_, &from._impl_.unused1_,
static_cast<size_t>(reinterpret_cast<char*>(&_impl_.unused2_) -
reinterpret_cast<char*>(&_impl_.unused1_)) + sizeof(_impl_.unused2_));
// @@protoc_insertion_point(copy_constructor:mozilla.cookieBanner.GoogleSOCSCookie.extraData)
}
inline void GoogleSOCSCookie_extraData::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_.platform_){}
, decltype(_impl_.region_){}
, decltype(_impl_.unused1_){0u}
, decltype(_impl_.unused2_){0u}
};
_impl_.platform_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.platform_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.region_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.region_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
GoogleSOCSCookie_extraData::~GoogleSOCSCookie_extraData() {
// @@protoc_insertion_point(destructor:mozilla.cookieBanner.GoogleSOCSCookie.extraData)
if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
(void)arena;
return;
}
SharedDtor();
}
inline void GoogleSOCSCookie_extraData::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
_impl_.platform_.Destroy();
_impl_.region_.Destroy();
}
void GoogleSOCSCookie_extraData::SetCachedSize(int size) const {
_impl_._cached_size_.Set(size);
}
void GoogleSOCSCookie_extraData::Clear() {
// @@protoc_insertion_point(message_clear_start:mozilla.cookieBanner.GoogleSOCSCookie.extraData)
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) {
_impl_.platform_.ClearNonDefaultToEmpty();
}
if (cached_has_bits & 0x00000002u) {
_impl_.region_.ClearNonDefaultToEmpty();
}
}
if (cached_has_bits & 0x0000000cu) {
::memset(&_impl_.unused1_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&_impl_.unused2_) -
reinterpret_cast<char*>(&_impl_.unused1_)) + sizeof(_impl_.unused2_));
}
_impl_._has_bits_.Clear();
_internal_metadata_.Clear<std::string>();
}
const char* GoogleSOCSCookie_extraData::_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) {
// required uint32 unused1 = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
_Internal::set_has_unused1(&has_bits);
_impl_.unused1_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
// required string platform = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
auto str = _internal_mutable_platform();
ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
} else
goto handle_unusual;
continue;
// required string region = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
auto str = _internal_mutable_region();
ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
} else
goto handle_unusual;
continue;
// required uint32 unused2 = 4;
case 4:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) {
_Internal::set_has_unused2(&has_bits);
_impl_.unused2_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&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* GoogleSOCSCookie_extraData::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mozilla.cookieBanner.GoogleSOCSCookie.extraData)
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _impl_._has_bits_[0];
// required uint32 unused1 = 1;
if (cached_has_bits & 0x00000004u) {
target = stream->EnsureSpace(target);
target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_unused1(), target);
}
// required string platform = 2;
if (cached_has_bits & 0x00000001u) {
target = stream->WriteStringMaybeAliased(
2, this->_internal_platform(), target);
}
// required string region = 3;
if (cached_has_bits & 0x00000002u) {
target = stream->WriteStringMaybeAliased(
3, this->_internal_region(), target);
}
// required uint32 unused2 = 4;
if (cached_has_bits & 0x00000008u) {
target = stream->EnsureSpace(target);
target = ::_pbi::WireFormatLite::WriteUInt32ToArray(4, this->_internal_unused2(), 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:mozilla.cookieBanner.GoogleSOCSCookie.extraData)
return target;
}
size_t GoogleSOCSCookie_extraData::RequiredFieldsByteSizeFallback() const {
// @@protoc_insertion_point(required_fields_byte_size_fallback_start:mozilla.cookieBanner.GoogleSOCSCookie.extraData)
size_t total_size = 0;
if (_internal_has_platform()) {
// required string platform = 2;
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_platform());
}
if (_internal_has_region()) {
// required string region = 3;
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_region());
}
if (_internal_has_unused1()) {
// required uint32 unused1 = 1;
total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_unused1());
}
if (_internal_has_unused2()) {
// required uint32 unused2 = 4;
total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_unused2());
}
return total_size;
}
size_t GoogleSOCSCookie_extraData::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mozilla.cookieBanner.GoogleSOCSCookie.extraData)
size_t total_size = 0;
if (((_impl_._has_bits_[0] & 0x0000000f) ^ 0x0000000f) == 0) { // All required fields are present.
// required string platform = 2;
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_platform());
// required string region = 3;
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_region());
// required uint32 unused1 = 1;
total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_unused1());
// required uint32 unused2 = 4;
total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_unused2());
} else {
total_size += RequiredFieldsByteSizeFallback();
}
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
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 GoogleSOCSCookie_extraData::CheckTypeAndMergeFrom(
const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
MergeFrom(*::_pbi::DownCast<const GoogleSOCSCookie_extraData*>(
&from));
}
void GoogleSOCSCookie_extraData::MergeFrom(const GoogleSOCSCookie_extraData& from) {
GoogleSOCSCookie_extraData* const _this = this;
// @@protoc_insertion_point(class_specific_merge_from_start:mozilla.cookieBanner.GoogleSOCSCookie.extraData)
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 & 0x0000000fu) {
if (cached_has_bits & 0x00000001u) {
_this->_internal_set_platform(from._internal_platform());
}
if (cached_has_bits & 0x00000002u) {
_this->_internal_set_region(from._internal_region());
}
if (cached_has_bits & 0x00000004u) {
_this->_impl_.unused1_ = from._impl_.unused1_;
}
if (cached_has_bits & 0x00000008u) {
_this->_impl_.unused2_ = from._impl_.unused2_;
}
_this->_impl_._has_bits_[0] |= cached_has_bits;
}
_this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}
void GoogleSOCSCookie_extraData::CopyFrom(const GoogleSOCSCookie_extraData& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mozilla.cookieBanner.GoogleSOCSCookie.extraData)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool GoogleSOCSCookie_extraData::IsInitialized() const {
if (_Internal::MissingRequiredFields(_impl_._has_bits_)) return false;
return true;
}
void GoogleSOCSCookie_extraData::InternalSwap(GoogleSOCSCookie_extraData* 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]);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
&_impl_.platform_, lhs_arena,
&other->_impl_.platform_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
&_impl_.region_, lhs_arena,
&other->_impl_.region_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(GoogleSOCSCookie_extraData, _impl_.unused2_)
+ sizeof(GoogleSOCSCookie_extraData::_impl_.unused2_)
- PROTOBUF_FIELD_OFFSET(GoogleSOCSCookie_extraData, _impl_.unused1_)>(
reinterpret_cast<char*>(&_impl_.unused1_),
reinterpret_cast<char*>(&other->_impl_.unused1_));
}
std::string GoogleSOCSCookie_extraData::GetTypeName() const {
return "mozilla.cookieBanner.GoogleSOCSCookie.extraData";
}
// ===================================================================
class GoogleSOCSCookie_timeData::_Internal {
public:
using HasBits = decltype(std::declval<GoogleSOCSCookie_timeData>()._impl_._has_bits_);
static void set_has_timestamp(HasBits* has_bits) {
(*has_bits)[0] |= 1u;
}
static bool MissingRequiredFields(const HasBits& has_bits) {
return ((has_bits[0] & 0x00000001) ^ 0x00000001) != 0;
}
};
GoogleSOCSCookie_timeData::GoogleSOCSCookie_timeData(::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:mozilla.cookieBanner.GoogleSOCSCookie.timeData)
}
GoogleSOCSCookie_timeData::GoogleSOCSCookie_timeData(const GoogleSOCSCookie_timeData& from)
: ::PROTOBUF_NAMESPACE_ID::MessageLite() {
GoogleSOCSCookie_timeData* const _this = this; (void)_this;
new (&_impl_) Impl_{
decltype(_impl_._has_bits_){from._impl_._has_bits_}
, /*decltype(_impl_._cached_size_)*/{}
, decltype(_impl_.timestamp_){}};
_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
_this->_impl_.timestamp_ = from._impl_.timestamp_;
// @@protoc_insertion_point(copy_constructor:mozilla.cookieBanner.GoogleSOCSCookie.timeData)
}
inline void GoogleSOCSCookie_timeData::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_.timestamp_){uint64_t{0u}}
};
}
GoogleSOCSCookie_timeData::~GoogleSOCSCookie_timeData() {
// @@protoc_insertion_point(destructor:mozilla.cookieBanner.GoogleSOCSCookie.timeData)
if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
(void)arena;
return;
}
SharedDtor();
}
inline void GoogleSOCSCookie_timeData::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void GoogleSOCSCookie_timeData::SetCachedSize(int size) const {
_impl_._cached_size_.Set(size);
}
void GoogleSOCSCookie_timeData::Clear() {
// @@protoc_insertion_point(message_clear_start:mozilla.cookieBanner.GoogleSOCSCookie.timeData)
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
_impl_.timestamp_ = uint64_t{0u};
_impl_._has_bits_.Clear();
_internal_metadata_.Clear<std::string>();
}
const char* GoogleSOCSCookie_timeData::_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) {
// required uint64 timeStamp = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
_Internal::set_has_timestamp(&has_bits);
_impl_.timestamp_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&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* GoogleSOCSCookie_timeData::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mozilla.cookieBanner.GoogleSOCSCookie.timeData)
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _impl_._has_bits_[0];
// required uint64 timeStamp = 1;
if (cached_has_bits & 0x00000001u) {
target = stream->EnsureSpace(target);
target = ::_pbi::WireFormatLite::WriteUInt64ToArray(1, this->_internal_timestamp(), 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:mozilla.cookieBanner.GoogleSOCSCookie.timeData)
return target;
}
size_t GoogleSOCSCookie_timeData::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mozilla.cookieBanner.GoogleSOCSCookie.timeData)
size_t total_size = 0;
// required uint64 timeStamp = 1;
if (_internal_has_timestamp()) {
total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_timestamp());
}
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
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 GoogleSOCSCookie_timeData::CheckTypeAndMergeFrom(
const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
MergeFrom(*::_pbi::DownCast<const GoogleSOCSCookie_timeData*>(
&from));
}
void GoogleSOCSCookie_timeData::MergeFrom(const GoogleSOCSCookie_timeData& from) {
GoogleSOCSCookie_timeData* const _this = this;
// @@protoc_insertion_point(class_specific_merge_from_start:mozilla.cookieBanner.GoogleSOCSCookie.timeData)
GOOGLE_DCHECK_NE(&from, _this);
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
if (from._internal_has_timestamp()) {
_this->_internal_set_timestamp(from._internal_timestamp());
}
_this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}
void GoogleSOCSCookie_timeData::CopyFrom(const GoogleSOCSCookie_timeData& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mozilla.cookieBanner.GoogleSOCSCookie.timeData)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool GoogleSOCSCookie_timeData::IsInitialized() const {
if (_Internal::MissingRequiredFields(_impl_._has_bits_)) return false;
return true;
}
void GoogleSOCSCookie_timeData::InternalSwap(GoogleSOCSCookie_timeData* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
swap(_impl_.timestamp_, other->_impl_.timestamp_);
}
std::string GoogleSOCSCookie_timeData::GetTypeName() const {
return "mozilla.cookieBanner.GoogleSOCSCookie.timeData";
}
// ===================================================================
class GoogleSOCSCookie::_Internal {
public:
using HasBits = decltype(std::declval<GoogleSOCSCookie>()._impl_._has_bits_);
static void set_has_gdpr_choice(HasBits* has_bits) {
(*has_bits)[0] |= 4u;
}
static const ::mozilla::cookieBanner::GoogleSOCSCookie_extraData& data(const GoogleSOCSCookie* msg);
static void set_has_data(HasBits* has_bits) {
(*has_bits)[0] |= 1u;
}
static const ::mozilla::cookieBanner::GoogleSOCSCookie_timeData& time(const GoogleSOCSCookie* msg);
static void set_has_time(HasBits* has_bits) {
(*has_bits)[0] |= 2u;
}
static bool MissingRequiredFields(const HasBits& has_bits) {
return ((has_bits[0] & 0x00000007) ^ 0x00000007) != 0;
}
};
const ::mozilla::cookieBanner::GoogleSOCSCookie_extraData&
GoogleSOCSCookie::_Internal::data(const GoogleSOCSCookie* msg) {
return *msg->_impl_.data_;
}
const ::mozilla::cookieBanner::GoogleSOCSCookie_timeData&
GoogleSOCSCookie::_Internal::time(const GoogleSOCSCookie* msg) {
return *msg->_impl_.time_;
}
GoogleSOCSCookie::GoogleSOCSCookie(::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:mozilla.cookieBanner.GoogleSOCSCookie)
}
GoogleSOCSCookie::GoogleSOCSCookie(const GoogleSOCSCookie& from)
: ::PROTOBUF_NAMESPACE_ID::MessageLite() {
GoogleSOCSCookie* const _this = this; (void)_this;
new (&_impl_) Impl_{
decltype(_impl_._has_bits_){from._impl_._has_bits_}
, /*decltype(_impl_._cached_size_)*/{}
, decltype(_impl_.data_){nullptr}
, decltype(_impl_.time_){nullptr}
, decltype(_impl_.gdpr_choice_){}};
_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
if (from._internal_has_data()) {
_this->_impl_.data_ = new ::mozilla::cookieBanner::GoogleSOCSCookie_extraData(*from._impl_.data_);
}
if (from._internal_has_time()) {
_this->_impl_.time_ = new ::mozilla::cookieBanner::GoogleSOCSCookie_timeData(*from._impl_.time_);
}
_this->_impl_.gdpr_choice_ = from._impl_.gdpr_choice_;
// @@protoc_insertion_point(copy_constructor:mozilla.cookieBanner.GoogleSOCSCookie)
}
inline void GoogleSOCSCookie::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_.data_){nullptr}
, decltype(_impl_.time_){nullptr}
, decltype(_impl_.gdpr_choice_){0u}
};
}
GoogleSOCSCookie::~GoogleSOCSCookie() {
// @@protoc_insertion_point(destructor:mozilla.cookieBanner.GoogleSOCSCookie)
if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
(void)arena;
return;
}
SharedDtor();
}
inline void GoogleSOCSCookie::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
if (this != internal_default_instance()) delete _impl_.data_;
if (this != internal_default_instance()) delete _impl_.time_;
}
void GoogleSOCSCookie::SetCachedSize(int size) const {
_impl_._cached_size_.Set(size);
}
void GoogleSOCSCookie::Clear() {
// @@protoc_insertion_point(message_clear_start:mozilla.cookieBanner.GoogleSOCSCookie)
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_.data_ != nullptr);
_impl_.data_->Clear();
}
if (cached_has_bits & 0x00000002u) {
GOOGLE_DCHECK(_impl_.time_ != nullptr);
_impl_.time_->Clear();
}
}
_impl_.gdpr_choice_ = 0u;
_impl_._has_bits_.Clear();
_internal_metadata_.Clear<std::string>();
}
const char* GoogleSOCSCookie::_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) {
// required uint32 gdpr_choice = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
_Internal::set_has_gdpr_choice(&has_bits);
_impl_.gdpr_choice_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
// required .mozilla.cookieBanner.GoogleSOCSCookie.extraData data = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
ptr = ctx->ParseMessage(_internal_mutable_data(), ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
// required .mozilla.cookieBanner.GoogleSOCSCookie.timeData time = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
ptr = ctx->ParseMessage(_internal_mutable_time(), 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* GoogleSOCSCookie::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:mozilla.cookieBanner.GoogleSOCSCookie)
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
cached_has_bits = _impl_._has_bits_[0];
// required uint32 gdpr_choice = 1;
if (cached_has_bits & 0x00000004u) {
target = stream->EnsureSpace(target);
target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_gdpr_choice(), target);
}
// required .mozilla.cookieBanner.GoogleSOCSCookie.extraData data = 2;
if (cached_has_bits & 0x00000001u) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(2, _Internal::data(this),
_Internal::data(this).GetCachedSize(), target, stream);
}
// required .mozilla.cookieBanner.GoogleSOCSCookie.timeData time = 3;
if (cached_has_bits & 0x00000002u) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(3, _Internal::time(this),
_Internal::time(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:mozilla.cookieBanner.GoogleSOCSCookie)
return target;
}
size_t GoogleSOCSCookie::RequiredFieldsByteSizeFallback() const {
// @@protoc_insertion_point(required_fields_byte_size_fallback_start:mozilla.cookieBanner.GoogleSOCSCookie)
size_t total_size = 0;
if (_internal_has_data()) {
// required .mozilla.cookieBanner.GoogleSOCSCookie.extraData data = 2;
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.data_);
}
if (_internal_has_time()) {
// required .mozilla.cookieBanner.GoogleSOCSCookie.timeData time = 3;
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.time_);
}
if (_internal_has_gdpr_choice()) {
// required uint32 gdpr_choice = 1;
total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_gdpr_choice());
}
return total_size;
}
size_t GoogleSOCSCookie::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mozilla.cookieBanner.GoogleSOCSCookie)
size_t total_size = 0;
if (((_impl_._has_bits_[0] & 0x00000007) ^ 0x00000007) == 0) { // All required fields are present.
// required .mozilla.cookieBanner.GoogleSOCSCookie.extraData data = 2;
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.data_);
// required .mozilla.cookieBanner.GoogleSOCSCookie.timeData time = 3;
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.time_);
// required uint32 gdpr_choice = 1;
total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_gdpr_choice());
} else {
total_size += RequiredFieldsByteSizeFallback();
}
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
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 GoogleSOCSCookie::CheckTypeAndMergeFrom(
const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
MergeFrom(*::_pbi::DownCast<const GoogleSOCSCookie*>(
&from));
}
void GoogleSOCSCookie::MergeFrom(const GoogleSOCSCookie& from) {
GoogleSOCSCookie* const _this = this;
// @@protoc_insertion_point(class_specific_merge_from_start:mozilla.cookieBanner.GoogleSOCSCookie)
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_data()->::mozilla::cookieBanner::GoogleSOCSCookie_extraData::MergeFrom(
from._internal_data());
}
if (cached_has_bits & 0x00000002u) {
_this->_internal_mutable_time()->::mozilla::cookieBanner::GoogleSOCSCookie_timeData::MergeFrom(
from._internal_time());
}
if (cached_has_bits & 0x00000004u) {
_this->_impl_.gdpr_choice_ = from._impl_.gdpr_choice_;
}
_this->_impl_._has_bits_[0] |= cached_has_bits;
}
_this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}
void GoogleSOCSCookie::CopyFrom(const GoogleSOCSCookie& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mozilla.cookieBanner.GoogleSOCSCookie)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool GoogleSOCSCookie::IsInitialized() const {
if (_Internal::MissingRequiredFields(_impl_._has_bits_)) return false;
if (_internal_has_data()) {
if (!_impl_.data_->IsInitialized()) return false;
}
if (_internal_has_time()) {
if (!_impl_.time_->IsInitialized()) return false;
}
return true;
}
void GoogleSOCSCookie::InternalSwap(GoogleSOCSCookie* 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(GoogleSOCSCookie, _impl_.gdpr_choice_)
+ sizeof(GoogleSOCSCookie::_impl_.gdpr_choice_)
- PROTOBUF_FIELD_OFFSET(GoogleSOCSCookie, _impl_.data_)>(
reinterpret_cast<char*>(&_impl_.data_),
reinterpret_cast<char*>(&other->_impl_.data_));
}
std::string GoogleSOCSCookie::GetTypeName() const {
return "mozilla.cookieBanner.GoogleSOCSCookie";
}
// @@protoc_insertion_point(namespace_scope)
} // namespace cookieBanner
} // namespace mozilla
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::mozilla::cookieBanner::GoogleSOCSCookie_extraData*
Arena::CreateMaybeMessage< ::mozilla::cookieBanner::GoogleSOCSCookie_extraData >(Arena* arena) {
return Arena::CreateMessageInternal< ::mozilla::cookieBanner::GoogleSOCSCookie_extraData >(arena);
}
template<> PROTOBUF_NOINLINE ::mozilla::cookieBanner::GoogleSOCSCookie_timeData*
Arena::CreateMaybeMessage< ::mozilla::cookieBanner::GoogleSOCSCookie_timeData >(Arena* arena) {
return Arena::CreateMessageInternal< ::mozilla::cookieBanner::GoogleSOCSCookie_timeData >(arena);
}
template<> PROTOBUF_NOINLINE ::mozilla::cookieBanner::GoogleSOCSCookie*
Arena::CreateMaybeMessage< ::mozilla::cookieBanner::GoogleSOCSCookie >(Arena* arena) {
return Arena::CreateMessageInternal< ::mozilla::cookieBanner::GoogleSOCSCookie >(arena);
}
PROTOBUF_NAMESPACE_CLOSE
// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>