// media/mojo/mojom/speech_recognition_error_code.mojom-shared.cc is auto generated by mojom_bindings_generator.py, do not edit

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

#include "media/mojo/mojom/speech_recognition_error_code.mojom-shared.h"
#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 "media/mojo/mojom/speech_recognition_error_code.mojom-params-data.h"
namespace media {
namespace mojom {

NOINLINE static const char* SpeechRecognitionErrorCodeToStringHelper(SpeechRecognitionErrorCode value) {
  // Defined in a helper function to ensure that Clang generates a lookup table.
  switch(value) {
    case SpeechRecognitionErrorCode::kNone:
      return "kNone";
    case SpeechRecognitionErrorCode::kNoSpeech:
      return "kNoSpeech";
    case SpeechRecognitionErrorCode::kAborted:
      return "kAborted";
    case SpeechRecognitionErrorCode::kAudioCapture:
      return "kAudioCapture";
    case SpeechRecognitionErrorCode::kNetwork:
      return "kNetwork";
    case SpeechRecognitionErrorCode::kNotAllowed:
      return "kNotAllowed";
    case SpeechRecognitionErrorCode::kServiceNotAllowed:
      return "kServiceNotAllowed";
    case SpeechRecognitionErrorCode::kBadGrammar:
      return "kBadGrammar";
    case SpeechRecognitionErrorCode::kLanguageNotSupported:
      return "kLanguageNotSupported";
    case SpeechRecognitionErrorCode::kNoMatch:
      return "kNoMatch";
    case SpeechRecognitionErrorCode::kPhrasesNotSupported:
      return "kPhrasesNotSupported";
    default:
      return nullptr;
  }
}

std::string SpeechRecognitionErrorCodeToString(SpeechRecognitionErrorCode value) {
  const char *str = SpeechRecognitionErrorCodeToStringHelper(value);
  if (!str) {
    return base::StringPrintf("Unknown SpeechRecognitionErrorCode value: %i", static_cast<int32_t>(value));
  }
  return str;
}

std::ostream& operator<<(std::ostream& os, SpeechRecognitionErrorCode value) {
  return os << SpeechRecognitionErrorCodeToString(value);
}

namespace internal {

}  // namespace internal
}  // namespace mojom
}  // namespace media

namespace perfetto {

// static
void TraceFormatTraits<::media::mojom::SpeechRecognitionErrorCode>::WriteIntoTrace(
   perfetto::TracedValue context, ::media::mojom::SpeechRecognitionErrorCode value) {
  return std::move(context).WriteString(::media::mojom::SpeechRecognitionErrorCodeToString(value));
}

} // namespace perfetto