/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * 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. */ #pragma once #include #include #include namespace apache::thrift::conformance::data { namespace detail { template struct GetTestTypeName : type::detail::GetName {}; template struct GetTestTypeName> { const std::string& operator()() const { FOLLY_EXPORT static const auto* kName = new std::string(fmt::format("list<{}>", GetTestTypeName()())); return *kName; } }; template struct GetTestTypeName> { const std::string& operator()() const { FOLLY_EXPORT static const auto* kName = new std::string(fmt::format("set<{}>", GetTestTypeName()())); return *kName; } }; template struct GetTestTypeName> { const std::string& operator()() const { FOLLY_EXPORT static const auto* kName = new std::string(fmt::format( "map<{},{}>", GetTestTypeName()(), GetTestTypeName()())); return *kName; } }; // Note just annotating all adapters like this, if any specific adapters need // different names, create a more specialized template template struct GetTestTypeName> { const std::string& operator()() const { FOLLY_EXPORT static const auto* kName = new std::string(fmt::format("adapted<{}>", GetTestTypeName()())); return *kName; } }; } // namespace detail // When called, returns a std::string representing the given // type tag's name for conformance tests template inline static constexpr detail::GetTestTypeName getTestTypeName; } // namespace apache::thrift::conformance::data