blob: 182f050279b9cbf5b0b761bbf32e7341ddc8b231 [file] [log] [blame]
// Copyright 2015 The Shaderc Authors. All rights reserved.
//
// 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 LIBSHADERC_UTIL_FORMAT_H_
#define LIBSHADERC_UTIL_FORMAT_H_
#include <sstream>
namespace shaderc_util {
// Returns a string containing <prefix><key><infix><value><postfix> for every
// key-value entry in map.
template <typename Map>
std::string format(const Map& map, const std::string& prefix,
const std::string& infix, const std::string& postfix) {
std::stringstream s;
for (const auto& pair : map) {
s << prefix << pair.first << infix << pair.second << postfix;
}
return s.str();
}
} // namespace shaderc_util
#endif // LIBSHADERC_UTIL_FORMAT_H_