chromium/third_party/perfetto/src/trace_processor/importers/proto/pigweed_detokenizer.h

/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_PIGWEED_DETOKENIZER_H_
#define SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_PIGWEED_DETOKENIZER_H_

#include <string_view>
#include <variant>

#include "perfetto/ext/base/flat_hash_map.h"
#include "perfetto/ext/base/status_or.h"
#include "perfetto/protozero/field.h"

namespace perfetto::trace_processor::pigweed {

// We only distinguish between the int types that we need to; we need
// to know different lengths for unsigned due to varint encoding.
// Strings are not supported.
enum ArgType {};

// Representation of an arg in a formatting string: where it is,
// its contents, and its type.
struct Arg {};

// A parsed format string from the database.
class FormatString {};

// A string that we have detokenized, along with any information we gathered
// along the way.
class DetokenizedString {};

class PigweedDetokenizer {};

PigweedDetokenizer CreateNullDetokenizer();

base::StatusOr<PigweedDetokenizer> CreateDetokenizer(
    const protozero::ConstBytes& blob);

}  // namespace perfetto::trace_processor::pigweed

#endif  // SRC_TRACE_PROCESSOR_IMPORTERS_PROTO_PIGWEED_DETOKENIZER_H_