Apply clang-format

This commit is contained in:
Martchus 2018-05-08 00:35:51 +02:00
parent f0b777207e
commit 1aa8b387e1
4 changed files with 31 additions and 29 deletions

View File

@ -12,23 +12,23 @@ namespace ConversionUtilities {
/// \cond
namespace Helper {
template <class StringType, Traits::EnableIf<std::is_class<StringType>>* = nullptr> std::size_t computeTupleElementSize(const StringType *str)
template <class StringType, Traits::EnableIf<std::is_class<StringType>> * = nullptr> std::size_t computeTupleElementSize(const StringType *str)
{
return str->size();
}
template <class StringType, Traits::EnableIf<std::is_class<StringType>>* = nullptr> std::size_t computeTupleElementSize(const StringType &str)
template <class StringType, Traits::EnableIf<std::is_class<StringType>> * = nullptr> std::size_t computeTupleElementSize(const StringType &str)
{
return str.size();
}
template <class StringType, class CharType, Traits::EnableIf<std::is_same<typename StringType::value_type, CharType>>* = nullptr>
template <class StringType, class CharType, Traits::EnableIf<std::is_same<typename StringType::value_type, CharType>> * = nullptr>
std::size_t computeTupleElementSize(const CharType *str)
{
return std::char_traits<CharType>::length(str);
}
template <class StringType, class CharType, Traits::EnableIf<std::is_same<typename StringType::value_type, CharType>>* = nullptr>
template <class StringType, class CharType, Traits::EnableIf<std::is_same<typename StringType::value_type, CharType>> * = nullptr>
constexpr std::size_t computeTupleElementSize(CharType)
{
return 1;
@ -36,7 +36,7 @@ constexpr std::size_t computeTupleElementSize(CharType)
template <class StringType, typename IntegralType,
Traits::EnableIf<Traits::Not<std::is_same<typename StringType::value_type, IntegralType>>, std::is_integral<IntegralType>,
std::is_unsigned<IntegralType>>* = nullptr>
std::is_unsigned<IntegralType>> * = nullptr>
std::size_t computeTupleElementSize(IntegralType number, typename StringType::value_type base = 10)
{
std::size_t size = 0;
@ -47,7 +47,7 @@ std::size_t computeTupleElementSize(IntegralType number, typename StringType::va
template <class StringType, typename IntegralType,
Traits::EnableIf<Traits::Not<std::is_same<typename StringType::value_type, IntegralType>>, std::is_integral<IntegralType>,
std::is_signed<IntegralType>>* = nullptr>
std::is_signed<IntegralType>> * = nullptr>
std::size_t computeTupleElementSize(IntegralType number, typename StringType::value_type base = 10)
{
std::size_t size = number < 0 ? 1 : 0;
@ -56,23 +56,23 @@ std::size_t computeTupleElementSize(IntegralType number, typename StringType::va
return size;
}
template <class StringType, Traits::EnableIf<std::is_class<StringType>>* = nullptr> void append(StringType &target, const StringType *str)
template <class StringType, Traits::EnableIf<std::is_class<StringType>> * = nullptr> void append(StringType &target, const StringType *str)
{
target.append(*str);
}
template <class StringType, Traits::EnableIf<std::is_class<StringType>>* = nullptr> void append(StringType &target, const StringType &str)
template <class StringType, Traits::EnableIf<std::is_class<StringType>> * = nullptr> void append(StringType &target, const StringType &str)
{
target.append(str);
}
template <class StringType, class CharType, Traits::EnableIf<std::is_same<typename StringType::value_type, CharType>>* = nullptr>
template <class StringType, class CharType, Traits::EnableIf<std::is_same<typename StringType::value_type, CharType>> * = nullptr>
void append(StringType &target, const CharType *str)
{
target.append(str);
}
template <class StringType, class CharType, Traits::EnableIf<std::is_same<typename StringType::value_type, CharType>>* = nullptr>
template <class StringType, class CharType, Traits::EnableIf<std::is_same<typename StringType::value_type, CharType>> * = nullptr>
void append(StringType &target, CharType c)
{
target += c;
@ -80,7 +80,7 @@ void append(StringType &target, CharType c)
template <class StringType, typename IntegralType,
Traits::EnableIf<Traits::Not<std::is_same<typename StringType::value_type, IntegralType>>, std::is_integral<IntegralType>,
std::is_unsigned<IntegralType>>* = nullptr>
std::is_unsigned<IntegralType>> * = nullptr>
void append(StringType &target, IntegralType number, typename StringType::value_type base = 10)
{
const auto start = target.begin() + target.size();
@ -92,7 +92,7 @@ void append(StringType &target, IntegralType number, typename StringType::value_
template <class StringType, typename IntegralType,
Traits::EnableIf<Traits::Not<std::is_same<typename StringType::value_type, IntegralType>>, std::is_integral<IntegralType>,
std::is_signed<IntegralType>>* = nullptr>
std::is_signed<IntegralType>> * = nullptr>
void append(StringType &target, IntegralType number, typename StringType::value_type base = 10)
{
if (number < 0) {
@ -168,7 +168,7 @@ template <class Tuple> constexpr auto operator%(const Tuple &lhs, const char *rh
/*!
* \brief Allows construction of string-tuples via %-operator, eg. string1 % "string2" % string3.
*/
template <class Tuple, typename IntegralType, Traits::EnableIf<std::is_integral<IntegralType>>* = nullptr>
template <class Tuple, typename IntegralType, Traits::EnableIf<std::is_integral<IntegralType>> * = nullptr>
constexpr auto operator%(const Tuple &lhs, IntegralType rhs) -> decltype(std::tuple_cat(lhs, std::make_tuple(rhs)))
{
return std::tuple_cat(lhs, std::make_tuple(rhs));
@ -223,7 +223,7 @@ constexpr auto operator%(char lhs, const std::string &rhs) -> decltype(std::make
* printVelocity("velocity: " % numberToString(velocityExample) % " km/h (" % numberToString(velocityExample / 3.6) + " m/s)"));
* ```
*/
template <class Tuple, Traits::EnableIf<Traits::IsSpecializationOf<Tuple, std::tuple>>* = nullptr>
template <class Tuple, Traits::EnableIf<Traits::IsSpecializationOf<Tuple, std::tuple>> * = nullptr>
inline std::string operator+(const Tuple &lhs, const std::string &rhs)
{
return tupleToString(std::tuple_cat(lhs, std::make_tuple(&rhs)));
@ -238,7 +238,7 @@ inline std::string operator+(const Tuple &lhs, const std::string &rhs)
* printVelocity("velocity: " % numberToString(velocityExample) % " km/h (" % numberToString(velocityExample / 3.6) + " m/s)"));
* ```
*/
template <class Tuple, Traits::EnableIf<Traits::IsSpecializationOf<Tuple, std::tuple>>* = nullptr>
template <class Tuple, Traits::EnableIf<Traits::IsSpecializationOf<Tuple, std::tuple>> * = nullptr>
inline std::string operator+(const Tuple &lhs, const char *rhs)
{
return tupleToString(std::tuple_cat(lhs, std::make_tuple(rhs)));
@ -253,7 +253,8 @@ inline std::string operator+(const Tuple &lhs, const char *rhs)
* printVelocity("velocity: " % numberToString(velocityExample) % " km/h (" % numberToString(velocityExample / 3.6) + " m/s)"));
* ```
*/
template <class Tuple, typename IntegralType, Traits::EnableIf<Traits::IsSpecializationOf<Tuple, std::tuple>, std::is_integral<IntegralType>>* = nullptr>
template <class Tuple, typename IntegralType,
Traits::EnableIf<Traits::IsSpecializationOf<Tuple, std::tuple>, std::is_integral<IntegralType>> * = nullptr>
inline std::string operator+(const Tuple &lhs, IntegralType rhs)
{
return tupleToString(std::tuple_cat(lhs, std::make_tuple(rhs)));

View File

@ -287,7 +287,7 @@ template <typename CharType> constexpr CharType digitToChar(CharType digit)
* \sa stringToNumber()
*/
template <typename IntegralType, class StringType = std::string,
Traits::EnableIf<std::is_integral<IntegralType>, std::is_unsigned<IntegralType>>* = nullptr>
Traits::EnableIf<std::is_integral<IntegralType>, std::is_unsigned<IntegralType>> * = nullptr>
StringType numberToString(IntegralType number, typename StringType::value_type base = 10)
{
std::size_t resSize = 0;
@ -308,7 +308,8 @@ StringType numberToString(IntegralType number, typename StringType::value_type b
* \tparam StringType The string type (should be an instantiation of the basic_string class template).
* \sa stringToNumber()
*/
template <typename IntegralType, class StringType = std::string, Traits::EnableIf<std::is_integral<IntegralType>, std::is_signed<IntegralType>>* = nullptr>
template <typename IntegralType, class StringType = std::string,
Traits::EnableIf<std::is_integral<IntegralType>, std::is_signed<IntegralType>> * = nullptr>
StringType numberToString(IntegralType number, typename StringType::value_type base = 10)
{
const bool negative = number < 0;
@ -340,7 +341,7 @@ StringType numberToString(IntegralType number, typename StringType::value_type b
* \a base and types).
* \sa stringToNumber(), bufferToNumber()
*/
template <typename FloatingType, class StringType = std::string, Traits::EnableIf<std::is_floating_point<FloatingType>>* = nullptr>
template <typename FloatingType, class StringType = std::string, Traits::EnableIf<std::is_floating_point<FloatingType>> * = nullptr>
StringType numberToString(FloatingType number, typename StringType::value_type base = 10)
{
std::basic_stringstream<typename StringType::value_type> ss;
@ -377,7 +378,7 @@ template <typename CharType> CharType charToDigit(CharType character, CharType b
* \throws A ConversionException will be thrown if the provided \a string is not a valid number.
* \sa numberToString(), bufferToNumber()
*/
template <typename IntegralType, typename StringType, Traits::EnableIf<std::is_integral<IntegralType>, std::is_unsigned<IntegralType>>* = nullptr>
template <typename IntegralType, typename StringType, Traits::EnableIf<std::is_integral<IntegralType>, std::is_unsigned<IntegralType>> * = nullptr>
IntegralType stringToNumber(const StringType &string, typename StringType::value_type base = 10)
{
IntegralType result = 0;
@ -398,7 +399,7 @@ IntegralType stringToNumber(const StringType &string, typename StringType::value
* \throws A ConversionException will be thrown if the provided \a string is not a valid number.
* \sa numberToString(), bufferToNumber()
*/
template <typename IntegralType, class StringType, Traits::EnableIf<std::is_integral<IntegralType>, std::is_signed<IntegralType>>* = nullptr>
template <typename IntegralType, class StringType, Traits::EnableIf<std::is_integral<IntegralType>, std::is_signed<IntegralType>> * = nullptr>
IntegralType stringToNumber(const StringType &string, typename StringType::value_type base = 10)
{
auto i = string.begin();
@ -432,7 +433,7 @@ IntegralType stringToNumber(const StringType &string, typename StringType::value
* \a base and types).
* \sa numberToString(), bufferToNumber()
*/
template <typename FloatingType, class StringType, Traits::EnableIf<std::is_floating_point<FloatingType>>* = nullptr>
template <typename FloatingType, class StringType, Traits::EnableIf<std::is_floating_point<FloatingType>> * = nullptr>
FloatingType stringToNumber(const StringType &string, typename StringType::value_type base = 10)
{
std::basic_stringstream<typename StringType::value_type> ss;
@ -452,7 +453,7 @@ FloatingType stringToNumber(const StringType &string, typename StringType::value
* \throws A ConversionException will be thrown if the provided \a string is not a valid number.
* \sa numberToString(), bufferToNumber()
*/
template <typename IntegralType, class CharType, Traits::EnableIf<std::is_integral<IntegralType>, std::is_unsigned<IntegralType>>* = nullptr>
template <typename IntegralType, class CharType, Traits::EnableIf<std::is_integral<IntegralType>, std::is_unsigned<IntegralType>> * = nullptr>
IntegralType stringToNumber(const CharType *string, unsigned char base = 10)
{
IntegralType result = 0;
@ -473,7 +474,7 @@ IntegralType stringToNumber(const CharType *string, unsigned char base = 10)
* \throws A ConversionException will be thrown if the provided \a string is not a valid number.
* \sa numberToString(), stringToNumber()
*/
template <typename IntegralType, class CharType, Traits::EnableIf<std::is_integral<IntegralType>, std::is_unsigned<IntegralType>>* = nullptr>
template <typename IntegralType, class CharType, Traits::EnableIf<std::is_integral<IntegralType>, std::is_unsigned<IntegralType>> * = nullptr>
IntegralType bufferToNumber(const CharType *string, std::size_t size, unsigned char base = 10)
{
IntegralType result = 0;
@ -494,7 +495,7 @@ IntegralType bufferToNumber(const CharType *string, std::size_t size, unsigned c
* \throws A ConversionException will be thrown if the provided \a string is not a valid number.
* \sa numberToString(), bufferToNumber()
*/
template <typename IntegralType, class CharType, Traits::EnableIf<std::is_integral<IntegralType>, std::is_signed<IntegralType>>* = nullptr>
template <typename IntegralType, class CharType, Traits::EnableIf<std::is_integral<IntegralType>, std::is_signed<IntegralType>> * = nullptr>
IntegralType stringToNumber(const CharType *string, unsigned char base = 10)
{
if (!*string) {
@ -527,7 +528,7 @@ IntegralType stringToNumber(const CharType *string, unsigned char base = 10)
* \throws A ConversionException will be thrown if the provided \a string is not a valid number.
* \sa numberToString(), stringToNumber()
*/
template <typename IntegralType, class CharType, Traits::EnableIf<std::is_integral<IntegralType>, std::is_signed<IntegralType>>* = nullptr>
template <typename IntegralType, class CharType, Traits::EnableIf<std::is_integral<IntegralType>, std::is_signed<IntegralType>> * = nullptr>
IntegralType bufferToNumber(const CharType *string, std::size_t size, unsigned char base = 10)
{
if (!size) {

View File

@ -120,7 +120,7 @@ constexpr auto color(Color foreground, ColorContext context, TextAttribute displ
template <typename TupleType,
Traits::EnableIfAny<std::is_same<TupleType, std::tuple<Color, Color, TextAttribute>>,
std::is_same<TupleType, std::tuple<Color, ColorContext, TextAttribute>>>* = nullptr>
std::is_same<TupleType, std::tuple<Color, ColorContext, TextAttribute>>> * = nullptr>
inline std::ostream &operator<<(std::ostream &stream, TupleType displayAttribute)
{
setStyle(stream, std::get<0>(displayAttribute), std::get<1>(displayAttribute), std::get<2>(displayAttribute));

View File

@ -192,7 +192,7 @@ template <typename T> AsHexNumber<T> asHexNumber(const T &value)
/*!
* \brief Allows printing pairs so key/values of maps/hashes can be asserted using CPPUNIT_ASSERT_EQUAL.
*/
template <typename Pair, Traits::EnableIf<Traits::IsSpecializationOf<Pair, std::pair>>* = nullptr>
template <typename Pair, Traits::EnableIf<Traits::IsSpecializationOf<Pair, std::pair>> * = nullptr>
inline std::ostream &operator<<(std::ostream &out, const Pair &pair)
{
return out << "key: " << pair.first << "; value: " << pair.second << '\n';
@ -201,7 +201,7 @@ inline std::ostream &operator<<(std::ostream &out, const Pair &pair)
/*!
* \brief Allows printing iteratable objects so those can be asserted using CPPUNIT_ASSERT_EQUAL.
*/
template <typename Iteratable, Traits::EnableIf<Traits::IsIteratable<Iteratable>, Traits::Not<Traits::IsString<Iteratable>>>* = nullptr>
template <typename Iteratable, Traits::EnableIf<Traits::IsIteratable<Iteratable>, Traits::Not<Traits::IsString<Iteratable>>> * = nullptr>
inline std::ostream &operator<<(std::ostream &out, const Iteratable &iteratable)
{
out << '\n';