chromium/components/attribution_reporting/parsing_utils.cc

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

#include "components/attribution_reporting/parsing_utils.h"

#include <stddef.h>
#include <stdint.h>

#include <algorithm>
#include <cmath>
#include <optional>
#include <sstream>
#include <string>
#include <string_view>
#include <utility>
#include <vector>

#include "base/check.h"
#include "base/containers/flat_set.h"
#include "base/containers/flat_tree.h"
#include "base/numerics/safe_conversions.h"
#include "base/ranges/algorithm.h"
#include "base/strings/abseil_string_number_conversions.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "base/types/expected.h"
#include "base/types/expected_macros.h"
#include "base/values.h"
#include "components/aggregation_service/parsing_utils.h"
#include "components/attribution_reporting/constants.h"
#include "components/attribution_reporting/suitable_origin.h"
#include "third_party/abseil-cpp/absl/numeric/int128.h"
#include "url/origin.h"

namespace attribution_reporting {

namespace {

constexpr char kDebugKey[] =;
constexpr char kDebugReporting[] =;

template <typename T>
base::expected<std::optional<T>, ParseError> ParseIntegerFromString(
    const base::Value::Dict& dict,
    std::string_view key,
    bool (*parse)(std::string_view, T*)) {}

}  // namespace

base::expected<absl::uint128, ParseError> ParseAggregationKeyPiece(
    const base::Value& value) {}

bool AggregationKeyIdHasValidLength(const std::string& key) {}

std::string HexEncodeAggregationKey(absl::uint128 value) {}

base::expected<std::optional<uint64_t>, ParseError> ParseUint64(
    const base::Value::Dict& dict,
    std::string_view key) {}

base::expected<std::optional<int64_t>, ParseError> ParseInt64(
    const base::Value::Dict& dict,
    std::string_view key) {}

base::expected<int64_t, ParseError> ParsePriority(
    const base::Value::Dict& dict) {}

std::optional<uint64_t> ParseDebugKey(const base::Value::Dict& dict) {}

base::expected<std::optional<uint64_t>, ParseError> ParseDeduplicationKey(
    const base::Value::Dict& dict) {}

bool ParseDebugReporting(const base::Value::Dict& dict) {}

bool HasFractionalPart(double v) {}

template <typename T>
base::expected<T, ParseError> ParseIntFromIntOrDouble(
    const base::Value& value) {}

base::expected<base::TimeDelta, ParseError> ParseLegacyDuration(
    const base::Value& value,
    const base::TimeDelta clamp_min,
    const base::TimeDelta clamp_max) {}

base::expected<base::TimeDelta, ParseError> ParseDuration(
    const base::Value& value) {}

base::expected<std::optional<SuitableOrigin>, ParseError>
ParseAggregationCoordinator(const base::Value::Dict& dict) {}

void SerializeUint64(base::Value::Dict& dict,
                     std::string_view key,
                     uint64_t value) {}

void SerializeInt64(base::Value::Dict& dict,
                    std::string_view key,
                    int64_t value) {}

void SerializePriority(base::Value::Dict& dict, int64_t priority) {}

void SerializeDebugKey(base::Value::Dict& dict,
                       std::optional<uint64_t> debug_key) {}

void SerializeDebugReporting(base::Value::Dict& dict, bool debug_reporting) {}

void SerializeDeduplicationKey(base::Value::Dict& dict,
                               std::optional<uint64_t> dedup_key) {}

void SerializeTimeDeltaInSeconds(base::Value::Dict& dict,
                                 std::string_view key,
                                 base::TimeDelta value) {}

base::expected<int, ParseError> ParseInt(const base::Value& value) {}

base::expected<uint32_t, ParseError> ParseUint32(const base::Value& value) {}

base::expected<uint32_t, ParseError> ParsePositiveUint32(
    const base::Value& value) {}

base::Value Uint32ToJson(uint32_t value) {}

base::expected<base::flat_set<std::string>, StringSetError> ExtractStringSet(
    base::Value::List list,
    const size_t max_string_size,
    const size_t max_set_size) {}

}  // namespace attribution_reporting