chromium/base/pickle.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include "base/pickle.h"

#include <algorithm>
#include <bit>
#include <cstdlib>
#include <limits>
#include <ostream>
#include <string_view>
#include <type_traits>

#include "base/bits.h"
#include "base/containers/span.h"
#include "base/numerics/safe_conversions.h"
#include "base/numerics/safe_math.h"
#include "build/build_config.h"

namespace base {

// static
const size_t Pickle::kPayloadUnit =;

static const size_t kCapacityReadOnly =;

PickleIterator::PickleIterator(const Pickle& pickle)
    :{}

template <typename Type>
inline bool PickleIterator::ReadBuiltinType(Type* result) {}

inline void PickleIterator::Advance(size_t size) {}

template <typename Type>
inline const char* PickleIterator::GetReadPointerAndAdvance() {}

const char* PickleIterator::GetReadPointerAndAdvance(size_t num_bytes) {}

inline const char* PickleIterator::GetReadPointerAndAdvance(
    size_t num_elements,
    size_t size_element) {}

bool PickleIterator::ReadBool(bool* result) {}

bool PickleIterator::ReadInt(int* result) {}

bool PickleIterator::ReadLong(long* result) {}

bool PickleIterator::ReadUInt16(uint16_t* result) {}

bool PickleIterator::ReadUInt32(uint32_t* result) {}

bool PickleIterator::ReadInt64(int64_t* result) {}

bool PickleIterator::ReadUInt64(uint64_t* result) {}

bool PickleIterator::ReadFloat(float* result) {}

bool PickleIterator::ReadDouble(double* result) {}

bool PickleIterator::ReadString(std::string* result) {}

bool PickleIterator::ReadStringPiece(std::string_view* result) {}

bool PickleIterator::ReadString16(std::u16string* result) {}

bool PickleIterator::ReadStringPiece16(std::u16string_view* result) {}

bool PickleIterator::ReadData(const char** data, size_t* length) {}

std::optional<base::span<const uint8_t>> PickleIterator::ReadData() {}

bool PickleIterator::ReadBytes(const char** data, size_t length) {}

Pickle::Attachment::Attachment() = default;

Pickle::Attachment::~Attachment() = default;

// Payload is uint32_t aligned.

Pickle::Pickle()
    :{}

Pickle::Pickle(size_t header_size)
    :{}

Pickle Pickle::WithData(span<const uint8_t> data) {}

Pickle Pickle::WithUnownedBuffer(span<const uint8_t> data) {}

Pickle::Pickle(UnownedData, span<const uint8_t> data)
    :{}

Pickle::Pickle(const Pickle& other)
    :{}

Pickle::~Pickle() {}

Pickle& Pickle::operator=(const Pickle& other) {}

void Pickle::WriteString(std::string_view value) {}

void Pickle::WriteString16(std::u16string_view value) {}

void Pickle::WriteData(const char* data, size_t length) {}

void Pickle::WriteData(std::string_view data) {}

void Pickle::WriteData(base::span<const uint8_t> data) {}

void Pickle::WriteBytes(const void* data, size_t length) {}

void Pickle::WriteBytes(span<const uint8_t> data) {}

void Pickle::Reserve(size_t length) {}

bool Pickle::WriteAttachment(scoped_refptr<Attachment> attachment) {}

bool Pickle::ReadAttachment(base::PickleIterator* iter,
                            scoped_refptr<Attachment>* attachment) const {}

bool Pickle::HasAttachments() const {}

void Pickle::Resize(size_t new_capacity) {}

void* Pickle::ClaimBytes(size_t num_bytes) {}

size_t Pickle::GetTotalAllocatedSize() const {}

// static
const char* Pickle::FindNext(size_t header_size,
                             const char* start,
                             const char* end) {}

// static
bool Pickle::PeekNext(size_t header_size,
                      const char* start,
                      const char* end,
                      size_t* pickle_size) {}

template <size_t length>
void Pickle::WriteBytesStatic(const void* data) {}

template void Pickle::WriteBytesStatic<2>(const void* data);
template void Pickle::WriteBytesStatic<4>(const void* data);
template void Pickle::WriteBytesStatic<8>(const void* data);

inline void* Pickle::ClaimUninitializedBytesInternal(size_t length) {}

inline void Pickle::WriteBytesCommon(span<const uint8_t> data) {}

}  // namespace base