Apply tidy after updating to clang-format 5.0.0

The behavior of clang-format slightly changed in Clang 5.0.0:
http://releases.llvm.org/5.0.0/tools/clang/docs/ReleaseNotes.html#clang-format
This commit is contained in:
Martchus 2017-09-17 21:45:23 +02:00
parent 12be122d66
commit e52fd5a4af
33 changed files with 56 additions and 51 deletions

View File

@ -852,6 +852,6 @@ inline ConfigValueArgument::ConfigValueArgument(
setRequiredValueCount(valueNames.size()); setRequiredValueCount(valueNames.size());
setValueNames(valueNames); setValueNames(valueNames);
} }
} } // namespace ApplicationUtilities
#endif // APPLICATION_UTILITIES_ARGUMENTPARSER_H #endif // APPLICATION_UTILITIES_ARGUMENTPARSER_H

View File

@ -31,6 +31,6 @@ public:
/// \brief Whether completion mode is enabled. In this case reading args will be continued even if an denotation is unknown (regardless of unknownArgumentBehavior()). /// \brief Whether completion mode is enabled. In this case reading args will be continued even if an denotation is unknown (regardless of unknownArgumentBehavior()).
bool completionMode; bool completionMode;
}; };
} } // namespace ApplicationUtilities
#endif // APPLICATION_UTILITIES_ARGUMENTPARSER_PRIVATE_H #endif // APPLICATION_UTILITIES_ARGUMENTPARSER_PRIVATE_H

View File

@ -41,4 +41,4 @@ const char *Failure::what() const USE_NOTHROW
{ {
return m_what.c_str(); return m_what.c_str();
} }
} } // namespace ApplicationUtilities

View File

@ -19,6 +19,6 @@ public:
private: private:
std::string m_what; std::string m_what;
}; };
} } // namespace ApplicationUtilities
#endif // APPLICATION_UTILITIES_FAILURE_H #endif // APPLICATION_UTILITIES_FAILURE_H

View File

@ -490,7 +490,7 @@ inline DateTime &DateTime::operator-=(const TimeSpan &timeSpan)
m_ticks -= timeSpan.m_ticks; m_ticks -= timeSpan.m_ticks;
return *this; return *this;
} }
} } // namespace ChronoUtilities
namespace std { namespace std {
template <> struct hash<ChronoUtilities::DateTime> { template <> struct hash<ChronoUtilities::DateTime> {
@ -499,6 +499,6 @@ template <> struct hash<ChronoUtilities::DateTime> {
return hash<decltype(dateTime.totalTicks())>()(dateTime.totalTicks()); return hash<decltype(dateTime.totalTicks())>()(dateTime.totalTicks());
} }
}; };
} } // namespace std
#endif // CHRONO_UTILITIES_DATETIME_H #endif // CHRONO_UTILITIES_DATETIME_H

View File

@ -27,4 +27,4 @@ Period::Period(const DateTime &beg, const DateTime &end)
--m_years; --m_years;
} }
} }
} } // namespace ChronoUtilities

View File

@ -41,6 +41,6 @@ inline int Period::days() const
{ {
return m_days; return m_days;
} }
} } // namespace ChronoUtilities
#endif // CHRONO_UTILITIES_PERIOD_H #endif // CHRONO_UTILITIES_PERIOD_H

View File

@ -402,7 +402,7 @@ constexpr inline bool TimeSpan::isInfinity() const
{ {
return m_ticks == std::numeric_limits<decltype(m_ticks)>::max(); return m_ticks == std::numeric_limits<decltype(m_ticks)>::max();
} }
} } // namespace ChronoUtilities
namespace std { namespace std {
template <> struct hash<ChronoUtilities::TimeSpan> { template <> struct hash<ChronoUtilities::TimeSpan> {
@ -411,6 +411,6 @@ template <> struct hash<ChronoUtilities::TimeSpan> {
return hash<decltype(timeSpan.totalTicks())>()(timeSpan.totalTicks()); return hash<decltype(timeSpan.totalTicks())>()(timeSpan.totalTicks());
} }
}; };
} } // namespace std
#endif // CHRONO_UTILITIES_TIMESPAN_H #endif // CHRONO_UTILITIES_TIMESPAN_H

View File

@ -172,6 +172,6 @@ CPP_UTILITIES_EXPORT constexpr uint64 swapOrder(uint64 value)
| ((value & 0x000000FF00000000) >> (1 * 8)) | ((value & 0x00000000FF000000) << (1 * 8)) | ((value & 0x0000000000FF0000) << (3 * 8)) | ((value & 0x000000FF00000000) >> (1 * 8)) | ((value & 0x00000000FF000000) << (1 * 8)) | ((value & 0x0000000000FF0000) << (3 * 8))
| ((value & 0x000000000000FF00) << (5 * 8)) | ((value) << (7 * 8)); | ((value & 0x000000000000FF00) << (5 * 8)) | ((value) << (7 * 8));
} }
} } // namespace ConversionUtilities
#endif // CONVERSION_UTILITIES_BINARY_CONVERSION_H #endif // CONVERSION_UTILITIES_BINARY_CONVERSION_H

View File

@ -29,4 +29,4 @@ ConversionException::ConversionException(const std::string &what) USE_NOTHROW :
ConversionException::~ConversionException() USE_NOTHROW ConversionException::~ConversionException() USE_NOTHROW
{ {
} }
} } // namespace ConversionUtilities

View File

@ -14,6 +14,6 @@ public:
ConversionException(const std::string &what) USE_NOTHROW; ConversionException(const std::string &what) USE_NOTHROW;
~ConversionException() USE_NOTHROW; ~ConversionException() USE_NOTHROW;
}; };
} } // namespace ConversionUtilities
#endif // CONVERSION_UTILITIES_CONVERSIONEXCEPTION_H #endif // CONVERSION_UTILITIES_CONVERSIONEXCEPTION_H

View File

@ -34,8 +34,9 @@ constexpr std::size_t computeTupleElementSize(CharType)
return 1; return 1;
} }
template <class StringType, typename IntegralType, Traits::EnableIf<Traits::Not<std::is_same<typename StringType::value_type, IntegralType>>, template <class StringType, typename IntegralType,
std::is_integral<IntegralType>, std::is_unsigned<IntegralType>>...> Traits::EnableIf<Traits::Not<std::is_same<typename StringType::value_type, IntegralType>>, std::is_integral<IntegralType>,
std::is_unsigned<IntegralType>>...>
std::size_t computeTupleElementSize(IntegralType number, typename StringType::value_type base = 10) std::size_t computeTupleElementSize(IntegralType number, typename StringType::value_type base = 10)
{ {
std::size_t size = 0; std::size_t size = 0;
@ -44,8 +45,9 @@ std::size_t computeTupleElementSize(IntegralType number, typename StringType::va
return size; return size;
} }
template <class StringType, typename IntegralType, Traits::EnableIf<Traits::Not<std::is_same<typename StringType::value_type, IntegralType>>, template <class StringType, typename IntegralType,
std::is_integral<IntegralType>, std::is_signed<IntegralType>>...> Traits::EnableIf<Traits::Not<std::is_same<typename StringType::value_type, IntegralType>>, std::is_integral<IntegralType>,
std::is_signed<IntegralType>>...>
std::size_t computeTupleElementSize(IntegralType number, typename StringType::value_type base = 10) std::size_t computeTupleElementSize(IntegralType number, typename StringType::value_type base = 10)
{ {
std::size_t size = number < 0 ? 1 : 0; std::size_t size = number < 0 ? 1 : 0;
@ -76,8 +78,9 @@ void append(StringType &target, CharType c)
target += c; target += c;
} }
template <class StringType, typename IntegralType, Traits::EnableIf<Traits::Not<std::is_same<typename StringType::value_type, IntegralType>>, template <class StringType, typename IntegralType,
std::is_integral<IntegralType>, std::is_unsigned<IntegralType>>...> Traits::EnableIf<Traits::Not<std::is_same<typename StringType::value_type, IntegralType>>, std::is_integral<IntegralType>,
std::is_unsigned<IntegralType>>...>
void append(StringType &target, IntegralType number, typename StringType::value_type base = 10) void append(StringType &target, IntegralType number, typename StringType::value_type base = 10)
{ {
const auto start = target.begin() + target.size(); const auto start = target.begin() + target.size();
@ -87,8 +90,9 @@ void append(StringType &target, IntegralType number, typename StringType::value_
} while (number); } while (number);
} }
template <class StringType, typename IntegralType, Traits::EnableIf<Traits::Not<std::is_same<typename StringType::value_type, IntegralType>>, template <class StringType, typename IntegralType,
std::is_integral<IntegralType>, std::is_signed<IntegralType>>...> Traits::EnableIf<Traits::Not<std::is_same<typename StringType::value_type, IntegralType>>, std::is_integral<IntegralType>,
std::is_signed<IntegralType>>...>
void append(StringType &target, IntegralType number, typename StringType::value_type base = 10) void append(StringType &target, IntegralType number, typename StringType::value_type base = 10)
{ {
if (number < 0) { if (number < 0) {
@ -126,7 +130,7 @@ template <class StringType, class Tuple> struct TupleToString<StringType, Tuple,
Helper::append(str, std::get<0>(tuple)); Helper::append(str, std::get<0>(tuple));
} }
}; };
} } // namespace Helper
/// \endcond /// \endcond
/*! /*!
@ -254,6 +258,6 @@ inline std::string operator+(const Tuple &lhs, IntegralType rhs)
{ {
return tupleToString(std::tuple_cat(lhs, std::make_tuple(rhs))); return tupleToString(std::tuple_cat(lhs, std::make_tuple(rhs)));
} }
} } // namespace ConversionUtilities
#endif // CONVERSION_UTILITIES_STRINGBUILDER_H #endif // CONVERSION_UTILITIES_STRINGBUILDER_H

View File

@ -363,4 +363,4 @@ pair<unique_ptr<byte[]>, uint32> decodeBase64(const char *encodedStr, const uint
} }
return make_pair(move(buffer), decodedSize); return make_pair(move(buffer), decodedSize);
} }
} } // namespace ConversionUtilities

View File

@ -531,6 +531,6 @@ CPP_UTILITIES_EXPORT std::string dataSizeToString(uint64 sizeInByte, bool includ
CPP_UTILITIES_EXPORT std::string bitrateToString(double speedInKbitsPerSecond, bool useByteInsteadOfBits = false); CPP_UTILITIES_EXPORT std::string bitrateToString(double speedInKbitsPerSecond, bool useByteInsteadOfBits = false);
CPP_UTILITIES_EXPORT std::string encodeBase64(const byte *data, uint32 dataSize); CPP_UTILITIES_EXPORT std::string encodeBase64(const byte *data, uint32 dataSize);
CPP_UTILITIES_EXPORT std::pair<std::unique_ptr<byte[]>, uint32> decodeBase64(const char *encodedStr, const uint32 strSize); CPP_UTILITIES_EXPORT std::pair<std::unique_ptr<byte[]>, uint32> decodeBase64(const char *encodedStr, const uint32 strSize);
} } // namespace ConversionUtilities
#endif // CONVERSION_UTILITIES_STRINGCONVERSION_H #endif // CONVERSION_UTILITIES_STRINGCONVERSION_H

View File

@ -46,6 +46,6 @@ private:
std::locale m_loc; std::locale m_loc;
const std::ctype<E> *m_pctype; const std::ctype<E> *m_pctype;
}; };
} } // namespace ConversionUtilities
#endif // CONVERSION_UTILITIES_WIDEN_H #endif // CONVERSION_UTILITIES_WIDEN_H

View File

@ -79,6 +79,6 @@ inline void eraseLine(std::ostream &stream)
{ {
stream << "\33[2K"; stream << "\33[2K";
} }
} } // namespace EscapeCodes
#endif // IOUTILITIES_ANSIESCAPECODES #endif // IOUTILITIES_ANSIESCAPECODES

View File

@ -557,6 +557,6 @@ inline float32 BinaryReader::readFixed16LE()
{ {
return ConversionUtilities::toFloat32(readUInt32LE()); return ConversionUtilities::toFloat32(readUInt32LE());
} }
} } // namespace IoUtilities
#endif // IOUTILITIES_BINERYREADER_H #endif // IOUTILITIES_BINERYREADER_H

View File

@ -525,6 +525,6 @@ inline void BinaryWriter::writeFixed16LE(float32 valueToConvertAndWrite)
{ {
writeUInt32LE(ConversionUtilities::toFixed16(valueToConvertAndWrite)); writeUInt32LE(ConversionUtilities::toFixed16(valueToConvertAndWrite));
} }
} } // namespace IoUtilities
#endif // IO_UTILITIES_BINARYWRITER_H #endif // IO_UTILITIES_BINARYWRITER_H

View File

@ -38,4 +38,4 @@ void throwIoFailure(const char *what)
{ {
throw ios_base::failure(what); throw ios_base::failure(what);
} }
} } // namespace IoUtilities

View File

@ -9,6 +9,6 @@ namespace IoUtilities {
CPP_UTILITIES_EXPORT const char *catchIoFailure(); CPP_UTILITIES_EXPORT const char *catchIoFailure();
CPP_UTILITIES_EXPORT void throwIoFailure(const char *what); CPP_UTILITIES_EXPORT void throwIoFailure(const char *what);
} } // namespace IoUtilities
#endif // IOUTILITIES_CATCHIOFAILURE_H #endif // IOUTILITIES_CATCHIOFAILURE_H

View File

@ -84,6 +84,6 @@ template <std::size_t bufferSize> char *CopyHelper<bufferSize>::buffer()
{ {
return m_buffer; return m_buffer;
} }
} } // namespace IoUtilities
#endif // IOUTILITIES_COPY_H #endif // IOUTILITIES_COPY_H

View File

@ -29,4 +29,4 @@ string readFile(const string &path, std::string::size_type maxSize)
res.assign((istreambuf_iterator<char>(file)), istreambuf_iterator<char>()); res.assign((istreambuf_iterator<char>(file)), istreambuf_iterator<char>());
return res; return res;
} }
} } // namespace IoUtilities

View File

@ -112,8 +112,8 @@ bool settingsDirectory(std::string &result, std::string applicationDirectoryName
#if defined(PLATFORM_UNIX) #if defined(PLATFORM_UNIX)
struct stat sb; struct stat sb;
return (stat(result.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode)); return (stat(result.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode));
#else // PLATFORM_WINDOWS #else // PLATFORM_WINDOWS \
// FIXME: use UTF-16 API to support unicode, or rewrite using fs abstraction lib // FIXME: use UTF-16 API to support unicode, or rewrite using fs abstraction lib
DWORD ftyp = GetFileAttributesA(result.c_str()); DWORD ftyp = GetFileAttributesA(result.c_str());
return (ftyp != INVALID_FILE_ATTRIBUTES) && (ftyp & FILE_ATTRIBUTE_DIRECTORY); return (ftyp != INVALID_FILE_ATTRIBUTES) && (ftyp & FILE_ATTRIBUTE_DIRECTORY);
#endif #endif
@ -209,4 +209,4 @@ std::list<std::string> directoryEntries(const char *path, DirectoryEntryType typ
return list<string>(); // TODO return list<string>(); // TODO
#endif #endif
} }
} } // namespace IoUtilities

View File

@ -46,6 +46,6 @@ CPP_UTILITIES_EXPORT void removeInvalidChars(std::string &fileName);
CPP_UTILITIES_EXPORT bool settingsDirectory( CPP_UTILITIES_EXPORT bool settingsDirectory(
std::string &result, std::string applicationDirectoryName = std::string(), bool createApplicationDirectory = false); std::string &result, std::string applicationDirectoryName = std::string(), bool createApplicationDirectory = false);
CPP_UTILITIES_EXPORT std::list<std::string> directoryEntries(const char *path, DirectoryEntryType types = DirectoryEntryType::All); CPP_UTILITIES_EXPORT std::list<std::string> directoryEntries(const char *path, DirectoryEntryType types = DirectoryEntryType::All);
} } // namespace IoUtilities
#endif // IOUTILITIES_PATHHELPER_H #endif // IOUTILITIES_PATHHELPER_H

View File

@ -90,4 +90,4 @@ uint64 orderModulo(const uint64 number, const uint64 module)
; ;
return order != module ? order : 0; return order != module ? order : 0;
} }
} } // namespace MathUtilities

View File

@ -12,6 +12,6 @@ CPP_UTILITIES_EXPORT int factorial(int number);
CPP_UTILITIES_EXPORT uint64 powerModulo(uint64 base, uint64 expontent, uint64 module); CPP_UTILITIES_EXPORT uint64 powerModulo(uint64 base, uint64 expontent, uint64 module);
CPP_UTILITIES_EXPORT int64 inverseModulo(int64 number, int64 module); CPP_UTILITIES_EXPORT int64 inverseModulo(int64 number, int64 module);
CPP_UTILITIES_EXPORT uint64 orderModulo(uint64 number, uint64 module); CPP_UTILITIES_EXPORT uint64 orderModulo(uint64 number, uint64 module);
} } // namespace MathUtilities
#endif // MATHUTILITIES_H #endif // MATHUTILITIES_H

View File

@ -35,7 +35,7 @@ template <typename _Tp> inline typename _MakeUniq<_Tp>::__array make_unique(size
/// Disable std::make_unique for arrays of known bound /// Disable std::make_unique for arrays of known bound
template <typename _Tp, typename... _Args> inline typename _MakeUniq<_Tp>::__invalid_type make_unique(_Args &&...) = delete; template <typename _Tp, typename... _Args> inline typename _MakeUniq<_Tp>::__invalid_type make_unique(_Args &&...) = delete;
} } // namespace std
#endif #endif
/// \endcond /// \endcond

View File

@ -124,4 +124,4 @@ void generateRandomCharacterSequence(char *result, unsigned int length, bool use
generateRandomCharacterSequence( generateRandomCharacterSequence(
result, length, rand, RAND_MAX, useSmallLetters, useCapitalLetters, useNumbers, useSymbols, useAtLeastOneOfEachCategory); result, length, rand, RAND_MAX, useSmallLetters, useCapitalLetters, useNumbers, useSymbols, useAtLeastOneOfEachCategory);
} }
} } // namespace RandomUtilities

View File

@ -12,6 +12,6 @@ CPP_UTILITIES_EXPORT void generateRandomCharacterSequence(char *result, unsigned
CPP_UTILITIES_EXPORT void generateRandomCharacterSequence(char *result, unsigned int length, std::function<int()> randomizer, int maximalRandomNumber, CPP_UTILITIES_EXPORT void generateRandomCharacterSequence(char *result, unsigned int length, std::function<int()> randomizer, int maximalRandomNumber,
bool useSmallLetters = true, bool useCapitalLetters = true, bool useNumbers = true, bool useSymbols = true, bool useSmallLetters = true, bool useCapitalLetters = true, bool useNumbers = true, bool useSymbols = true,
bool useAtLeastOneOfEachCategory = true); bool useAtLeastOneOfEachCategory = true);
} } // namespace RandomUtilities
#endif // RANDOMUTILS_H #endif // RANDOMUTILS_H

View File

@ -65,10 +65,10 @@ auto isIteratableImpl(int) -> decltype(
void(*begin(std::declval<T &>())), Bool<true>{}); void(*begin(std::declval<T &>())), Bool<true>{});
template <typename T> Bool<false> isIteratableImpl(...); template <typename T> Bool<false> isIteratableImpl(...);
} } // namespace Detail
/// \endcond /// \endcond
template <typename T> using IsIteratable = decltype(Detail::isIteratableImpl<T>(0)); template <typename T> using IsIteratable = decltype(Detail::isIteratableImpl<T>(0));
} } // namespace Traits
#endif // CPP_UTILITIES_TRAITS_H #endif // CPP_UTILITIES_TRAITS_H

View File

@ -134,10 +134,11 @@ void IoTests::testBinaryReader()
CPPUNIT_ASSERT(reader.readBool() == true); CPPUNIT_ASSERT(reader.readBool() == true);
CPPUNIT_ASSERT(reader.readString(3) == "abc"); CPPUNIT_ASSERT(reader.readString(3) == "abc");
CPPUNIT_ASSERT(reader.readLengthPrefixedString() == "ABC"); CPPUNIT_ASSERT(reader.readLengthPrefixedString() == "ABC");
CPPUNIT_ASSERT(reader.readLengthPrefixedString() == "01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901" CPPUNIT_ASSERT(reader.readLengthPrefixedString()
"23456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" == "01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901"
"45678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345" "23456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123"
"678901234567890123456789"); "45678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345"
"678901234567890123456789");
CPPUNIT_ASSERT(reader.readTerminatedString() == "def"); CPPUNIT_ASSERT(reader.readTerminatedString() == "def");
CPPUNIT_ASSERT_THROW(reader.readLengthPrefixedString(), ConversionException); CPPUNIT_ASSERT_THROW(reader.readLengthPrefixedString(), ConversionException);
CPPUNIT_ASSERT_MESSAGE("pos in stream not advanced on conversion error", reader.readByte() == 0); CPPUNIT_ASSERT_MESSAGE("pos in stream not advanced on conversion error", reader.readByte() == 0);

View File

@ -392,4 +392,4 @@ int execHelperApp(const char *appPath, const char *const *args, std::string &out
return execAppInternal(appPath, args, output, errors, suppressLogging, timeout, string()); return execAppInternal(appPath, args, output, errors, suppressLogging, timeout, string());
} }
#endif #endif
} } // namespace TestUtilities

View File

@ -217,7 +217,7 @@ constexpr int64 operator"" _int64(unsigned long long size)
{ {
return static_cast<int64>(size); return static_cast<int64>(size);
} }
} } // namespace Literals
} } // namespace TestUtilities
#endif // TESTUTILS_H #endif // TESTUTILS_H