blob: 78e130fc82058905dc8c282969e2b98ac84207ff [file] [log] [blame]
// chromeos/services/machine_learning/public/mojom/document_scanner_param_types.mojom-shared.cc is auto generated by mojom_bindings_generator.py, do not edit
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromeos/services/machine_learning/public/mojom/document_scanner_param_types.mojom-shared.h"
// Used to support stream output operator for enums.
// TODO(dcheng): Consider omitting this somehow if not needed.
#include <ostream>
#include <utility>
#include "base/strings/stringprintf.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/lib/validation_util.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"
#include "chromeos/services/machine_learning/public/mojom/document_scanner_param_types.mojom-params-data.h"
namespace chromeos {
namespace machine_learning {
namespace mojom {
static NOINLINE const char* RotationToStringHelper(Rotation value) {
// Defined in a helper function to ensure that Clang generates a lookup table.
switch(value) {
case Rotation::ROTATION_0:
return "ROTATION_0";
case Rotation::ROTATION_90:
return "ROTATION_90";
case Rotation::ROTATION_180:
return "ROTATION_180";
case Rotation::ROTATION_270:
return "ROTATION_270";
default:
return nullptr;
}
}
std::string RotationToString(Rotation value) {
const char *str = RotationToStringHelper(value);
if (!str) {
return base::StringPrintf("Unknown Rotation value: %i", static_cast<int32_t>(value));
}
return str;
}
std::ostream& operator<<(std::ostream& os, Rotation value) {
return os << RotationToString(value);
}
namespace internal {
} // namespace internal
} // namespace mojom
} // namespace machine_learning
} // namespace chromeos
namespace perfetto {
// static
void TraceFormatTraits<::chromeos::machine_learning::mojom::Rotation>::WriteIntoTrace(
perfetto::TracedValue context, ::chromeos::machine_learning::mojom::Rotation value) {
return std::move(context).WriteString(::chromeos::machine_learning::mojom::RotationToString(value));
}
} // namespace perfetto