From 0dda4c06b17b8d3693c6612b23f232b9a309476d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 23 Oct 2020 11:23:50 +0200 Subject: [PATCH] util/TemplateString: no indent after `namespace` --- src/util/TemplateString.hxx | 150 ++++++++++++++++++------------------ 1 file changed, 76 insertions(+), 74 deletions(-) diff --git a/src/util/TemplateString.hxx b/src/util/TemplateString.hxx index 90c45738b..0ea13beeb 100644 --- a/src/util/TemplateString.hxx +++ b/src/util/TemplateString.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2016 Max Kellermann + * Copyright 2015-2020 Max Kellermann * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,94 +33,96 @@ #include namespace TemplateString { - /** - * Construct a null-terminated string from a list of chars. - */ - template - struct Construct { - static constexpr char value[] = {_value..., 0}; - static constexpr size_t size = sizeof...(_value); - }; - template - constexpr char Construct<_value...>::value[]; +/** + * Construct a null-terminated string from a list of chars. + */ +template +struct Construct { + static constexpr char value[] = {_value..., 0}; + static constexpr size_t size = sizeof...(_value); +}; - /** - * An empty string. - */ - struct Empty : Construct<> {}; +template +constexpr char Construct<_value...>::value[]; - /** - * A string consisting of a single character. - */ - template - struct CharAsString : Construct {}; +/** + * An empty string. + */ +struct Empty : Construct<> {}; - /** - * Invoke #F, pass all characters in #src from #i to #length - * as variadic arguments. - */ - template class F, - const char *src, size_t length, size_t i, - char... _value> - struct VariadicChars : VariadicChars { - static_assert(length > 0, "Wrong length"); - }; +/** + * A string consisting of a single character. + */ +template +struct CharAsString : Construct {}; - template class F, - const char *src, size_t length, - char... _value> - struct VariadicChars : F<_value...> {}; +/** + * Invoke #F, pass all characters in #src from #i to #length + * as variadic arguments. + */ +template class F, + const char *src, size_t length, size_t i, + char... _value> +struct VariadicChars : VariadicChars { + static_assert(length > 0, "Wrong length"); +}; - /** - * Like #VariadicChars, but pass an additional argument to #F. - */ - template class F, typename Arg, - const char *src, size_t length, size_t i, - char... _value> - struct VariadicChars1 : VariadicChars1 { - static_assert(length > 0, "Wrong length"); - }; +template class F, + const char *src, size_t length, + char... _value> +struct VariadicChars : F<_value...> {}; - template class F, typename Arg, - const char *src, size_t length, - char... _value> - struct VariadicChars1 : F {}; +/** + * Like #VariadicChars, but pass an additional argument to #F. + */ +template class F, typename Arg, + const char *src, size_t length, size_t i, + char... _value> +struct VariadicChars1 : VariadicChars1 { + static_assert(length > 0, "Wrong length"); +}; - template - struct _BuildString : VariadicChars {}; +template class F, typename Arg, + const char *src, size_t length, + char... _value> +struct VariadicChars1 : F {}; - template - struct InsertBefore : _BuildString {}; +template +struct _BuildString : VariadicChars {}; - /** - * Concatenate several strings. - */ - template - struct Concat; +template +struct InsertBefore : _BuildString {}; - template - struct _Concat : Concat, Args...> {}; +/** + * Concatenate several strings. + */ +template +struct Concat; - template - struct Concat : _Concat {}; +template +struct _Concat : Concat, Args...> {}; - template - struct _Concat2 : _BuildString {}; +template +struct Concat : _Concat {}; - template - struct Concat - :VariadicChars1<_Concat2, Second, - First::value, First::size, 0> {}; +template +struct _Concat2 : _BuildString {}; - template - struct Concat : First {}; +template +struct Concat + :VariadicChars1<_Concat2, Second, + First::value, First::size, 0> {}; - template<> - struct Concat<> : Empty {}; -} +template +struct Concat : First {}; + +template<> +struct Concat<> : Empty {}; + +} // namespace TemplateString #endif