diff --git a/src/libcalamares/utils/String.cpp b/src/libcalamares/utils/String.cpp index c88c23693..f1708d5a3 100644 --- a/src/libcalamares/utils/String.cpp +++ b/src/libcalamares/utils/String.cpp @@ -19,7 +19,9 @@ #include -namespace CalamaresUtils +namespace Calamares +{ +namespace String { QString removeDiacritics( const QString& string ) @@ -124,7 +126,7 @@ obscure( const QString& string ) QString -truncateMultiLine( const QString& string, CalamaresUtils::LinesStartEnd lines, CalamaresUtils::CharCount chars ) +truncateMultiLine( const QString& string, LinesStartEnd lines, CharCount chars ) { const char NEWLINE = '\n'; const int maxLines = lines.atStart + lines.atEnd; @@ -246,4 +248,5 @@ removeTrailing( QString& string, QChar c ) string.remove( lastIndex, string.length() ); } -} // namespace CalamaresUtils +} // namespace String +} // namespace Calamares diff --git a/src/libcalamares/utils/String.h b/src/libcalamares/utils/String.h index 1adc2336a..30fca66d2 100644 --- a/src/libcalamares/utils/String.h +++ b/src/libcalamares/utils/String.h @@ -42,10 +42,15 @@ constexpr static const auto SplitKeepEmptyParts = #endif ; +namespace Calamares +{ /** - * @brief The CalamaresUtils namespace contains utility functions. + * @brief The Calamares::String namespace + * + * This namespace contains functions related to string-handling, + * string-expansion, etc. */ -namespace CalamaresUtils +namespace String { /** * @brief removeDiacritics replaces letters with diacritics and ligatures with @@ -113,6 +118,7 @@ DLLEXPORT void removeLeading( QString& string, QChar c ); */ DLLEXPORT void removeTrailing( QString& string, QChar c ); -} // namespace CalamaresUtils +} // namespace String +} // namespace Calamares #endif diff --git a/src/libcalamares/utils/Tests.cpp b/src/libcalamares/utils/Tests.cpp index ce1f5d24b..b4b2251cc 100644 --- a/src/libcalamares/utils/Tests.cpp +++ b/src/libcalamares/utils/Tests.cpp @@ -554,7 +554,7 @@ LibCalamaresTests::testStringTruncation() { Logger::setupLogLevel( Logger::LOGDEBUG ); - using namespace CalamaresUtils; + using namespace Calamares::String; const QString longString( R"(--- --- src/libcalamares/utils/String.h @@ -635,7 +635,7 @@ LibCalamaresTests::testStringTruncationShorter() { Logger::setupLogLevel( Logger::LOGDEBUG ); - using namespace CalamaresUtils; + using namespace Calamares::String; const QString longString( R"(Some strange string artifacts appeared, leading to `{1?}` being displayed in various user-facing messages. These have been removed @@ -730,7 +730,7 @@ LibCalamaresTests::testStringTruncationDegenerate() { Logger::setupLogLevel( Logger::LOGDEBUG ); - using namespace CalamaresUtils; + using namespace Calamares::String; // This is quite long, 1 line only, with no newlines const QString longString( "The portscout new distfile checker has detected that one or more of your " @@ -783,7 +783,7 @@ LibCalamaresTests::testStringRemoveLeading() QFETCH( QString, result ); const QString initial = string; - CalamaresUtils::removeLeading( string, c ); + Calamares::String::removeLeading( string, c ); QCOMPARE( string, result ); } @@ -813,7 +813,7 @@ LibCalamaresTests::testStringRemoveTrailing() QFETCH( QString, result ); const QString initial = string; - CalamaresUtils::removeTrailing( string, c ); + Calamares::String::removeTrailing( string, c ); QCOMPARE( string, result ); } @@ -993,7 +993,7 @@ LibCalamaresTests::testRunnerOutput() Calamares::Utils::Runner r( { "cat" } ); r.enableOutputProcessing().setInput( QStringLiteral( "hello\nworld\n\n!\n" ) ); - QObject::connect( &r, &decltype( r )::output, [&collectedOutput]( QString s ) { collectedOutput << s; } ); + QObject::connect( &r, &decltype( r )::output, [ &collectedOutput ]( QString s ) { collectedOutput << s; } ); { auto result = r.run();