Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b72d057e authored by Lloyd Pique's avatar Lloyd Pique Committed by android-build-merger
Browse files

Merge "audio: Remove redundant PrintTo definitions" am: 7582ba18

am: c93cb2e4

Change-Id: I4e6e65be595b0d4df466c235904ad8b4c7d3ea75
parents b891c445 c93cb2e4
Loading
Loading
Loading
Loading
+0 −60
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 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 ANDROID_HARDWARE_AUDIO_COMMON_TEST_UTILITY_PRETTY_PRINT_AUDIO_TYPES_H
#define ANDROID_HARDWARE_AUDIO_COMMON_TEST_UTILITY_PRETTY_PRINT_AUDIO_TYPES_H

#include <iosfwd>
#include <utility>

/** @file Use HIDL generated toString methods to pretty print gtest errors
 *        Unfortunately Gtest does not offer a template to specialize, only
 *        overloading PrintTo.
 *  @note that this overload can NOT be template because
 *        the fallback is already template, resulting in ambiguity.
 *  @note that the overload MUST be in the exact namespace
 *        the type is declared in, as per the ADL rules.
 */

namespace android {
namespace hardware {
namespace audio {

#define DEFINE_GTEST_PRINT_TO(T) \
    inline void PrintTo(const T& val, ::std::ostream* os) { *os << toString(val); }

namespace CPP_VERSION {
DEFINE_GTEST_PRINT_TO(IPrimaryDevice::TtyMode)
DEFINE_GTEST_PRINT_TO(Result)
}  // namespace CPP_VERSION

namespace common {
namespace CPP_VERSION {
DEFINE_GTEST_PRINT_TO(AudioConfig)
DEFINE_GTEST_PRINT_TO(AudioMode)
DEFINE_GTEST_PRINT_TO(AudioDevice)
DEFINE_GTEST_PRINT_TO(AudioFormat)
DEFINE_GTEST_PRINT_TO(AudioChannelMask)
}  // namespace CPP_VERSION
}  // namespace common

#undef DEFINE_GTEST_PRINT_TO

}  // namespace audio
}  // namespace hardware
}  // namespace android

#endif  // ANDROID_HARDWARE_AUDIO_COMMON_TEST_UTILITY_PRETTY_PRINT_AUDIO_TYPES_H
+0 −1
Original line number Diff line number Diff line
@@ -58,7 +58,6 @@

#include "utility/AssertOk.h"
#include "utility/Documentation.h"
#include "utility/PrettyPrintAudioTypes.h"
#include "utility/ReturnIn.h"
#include "utility/ValidateXml.h"