From 59390cd2f83a1339a99c9553d7a51ee523e6f459 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 16 Mar 2024 00:01:49 +0100 Subject: [PATCH] Library: reorder some pervasively used includes reduce footprint of lib/util.hpp (Note: it is not possible to forward-declare std::string here) define the shorthand "cStr()" in lib/symbol.hpp reorder relevant includes to ensure std::hash is "hijacked" first --- research/gtk-style-experiment.cpp | 1 - src/common/advice/binding.cpp | 4 +- src/common/appstate.cpp | 1 - src/common/configfacade.cpp | 2 - src/common/option.cpp | 1 - src/common/subsystem-runner.hpp | 1 - src/include/interfaceproxy.hpp | 1 - src/lib/cmdline.cpp | 2 +- src/lib/diff/diff-language.hpp | 1 - src/lib/diff/tree-diff-application.hpp | 1 - src/lib/diff/tree-diff.cpp | 1 - src/lib/error-exception.cpp | 1 - src/lib/format-string.hpp | 2 +- src/lib/lifecycle.cpp | 1 - src/lib/symbol-impl.cpp | 15 ++-- src/lib/symbol.hpp | 42 ++++++----- src/lib/test/suite.cpp | 1 - src/lib/time/digxel.hpp | 3 +- src/lib/util.hpp | 72 ++++++++++--------- src/stage/ctrl/ui-manager.cpp | 1 - src/stage/ctrl/window-locator.cpp | 1 - src/stage/notification-service.cpp | 1 - src/stage/workspace/ui-style.cpp | 1 - src/steam/asset.cpp | 1 - src/steam/asset/meta/time-grid.cpp | 1 - src/steam/control/command-def.hpp | 1 - src/steam/control/command.cpp | 3 +- src/steam/control/handling-pattern.cpp | 1 - src/steam/control/session-command-service.cpp | 1 - src/steam/control/steam-dispatcher.cpp | 2 +- .../session/dummy-session-connection.cpp | 1 - src/steam/mobject/session/placement-index.hpp | 2 +- src/steam/mobject/test-dummy-mobject.hpp | 1 - tests/basics/time/time-parsing-test.cpp | 1 - .../application/subsystem-runner-test.cpp | 1 - .../mobject/builder/builder-tool-test.cpp | 1 - .../mobject/session/defs-manager-test.cpp | 1 - .../session/session-element-query-test.cpp | 1 - tests/library/format-helper-test.cpp | 46 ++++++------ tests/library/iter-source-test.cpp | 1 - tests/library/sub-id-test.cpp | 1 - 41 files changed, 105 insertions(+), 119 deletions(-) diff --git a/research/gtk-style-experiment.cpp b/research/gtk-style-experiment.cpp index f52402615..e0555892f 100644 --- a/research/gtk-style-experiment.cpp +++ b/research/gtk-style-experiment.cpp @@ -60,7 +60,6 @@ #include -using util::cStr; using util::join; using std::string; diff --git a/src/common/advice/binding.cpp b/src/common/advice/binding.cpp index 159948333..6abe95fa7 100644 --- a/src/common/advice/binding.cpp +++ b/src/common/advice/binding.cpp @@ -30,9 +30,9 @@ */ -#include "lib/util.hpp" -#include "lib/symbol.hpp" #include "common/advice/binding.hpp" +#include "lib/symbol.hpp" +#include "lib/util.hpp" #include #include diff --git a/src/common/appstate.cpp b/src/common/appstate.cpp index a0a6294d5..2eb8d6700 100644 --- a/src/common/appstate.cpp +++ b/src/common/appstate.cpp @@ -48,7 +48,6 @@ extern "C" { #include "lib/util.hpp" -using util::cStr; using lib::Literal; using std::unique_ptr; diff --git a/src/common/configfacade.cpp b/src/common/configfacade.cpp index 74d915aea..de5e6e049 100644 --- a/src/common/configfacade.cpp +++ b/src/common/configfacade.cpp @@ -70,7 +70,6 @@ extern "C" { namespace lumiera { - using util::cStr; using util::isnil; using lib::Literal; @@ -135,7 +134,6 @@ extern "C" { /* ==== implementation C interface for accessing setup.ini ======= using lumiera::Config; using lib::SearchPathSplitter; using util::isnil; - using util::cStr; diff --git a/src/common/option.cpp b/src/common/option.cpp index 268bfa63b..9672d5f14 100644 --- a/src/common/option.cpp +++ b/src/common/option.cpp @@ -39,7 +39,6 @@ typedef boost::program_options::variables_map VarMap; namespace op = boost::program_options; using lib::VectS; -using util::cStr; namespace lumiera { diff --git a/src/common/subsystem-runner.hpp b/src/common/subsystem-runner.hpp index a07059855..01728ed89 100644 --- a/src/common/subsystem-runner.hpp +++ b/src/common/subsystem-runner.hpp @@ -66,7 +66,6 @@ namespace lumiera { using std::vector; using std::string; using util::_Fmt; - using util::cStr; using util::isnil; using util::and_all; using util::for_each; diff --git a/src/include/interfaceproxy.hpp b/src/include/interfaceproxy.hpp index f9b315a3a..c912c655b 100644 --- a/src/include/interfaceproxy.hpp +++ b/src/include/interfaceproxy.hpp @@ -128,7 +128,6 @@ #include "lib/error.hpp" #include "lib/util.hpp" -using util::cStr; namespace lumiera { namespace facade { diff --git a/src/lib/cmdline.cpp b/src/lib/cmdline.cpp index a0125562f..45dc63504 100644 --- a/src/lib/cmdline.cpp +++ b/src/lib/cmdline.cpp @@ -27,8 +27,8 @@ -#include "lib/util.hpp" #include "include/logging.h" +#include "lib/hash-standard.hpp" #include "lib/cmdline.hpp" #include "lib/format-util.hpp" diff --git a/src/lib/diff/diff-language.hpp b/src/lib/diff/diff-language.hpp index 724856472..8929ad85c 100644 --- a/src/lib/diff/diff-language.hpp +++ b/src/lib/diff/diff-language.hpp @@ -177,7 +177,6 @@ namespace diff{ void applyTo (Interpreter& interpreter) { - using util::cStr; TRACE (diff, "verb %4s(%s)", cStr(verb()), cStr(elm()) ); verb().applyTo (interpreter, elm()); } diff --git a/src/lib/diff/tree-diff-application.hpp b/src/lib/diff/tree-diff-application.hpp index 7c8f84e68..843964554 100644 --- a/src/lib/diff/tree-diff-application.hpp +++ b/src/lib/diff/tree-diff-application.hpp @@ -244,7 +244,6 @@ namespace diff{ /* ======= Implementation of Tree Diff Application via TreeMutator ======= */ using util::unConst; - using util::cStr; using util::_Fmt; using std::move; using std::swap; diff --git a/src/lib/diff/tree-diff.cpp b/src/lib/diff/tree-diff.cpp index c5ee09a16..04510240a 100644 --- a/src/lib/diff/tree-diff.cpp +++ b/src/lib/diff/tree-diff.cpp @@ -59,7 +59,6 @@ namespace diff{ /* ======= Implementation of Tree Diff Application via TreeMutator ======= */ using util::unConst; - using util::cStr; using util::_Fmt; using std::move; using std::swap; diff --git a/src/lib/error-exception.cpp b/src/lib/error-exception.cpp index 5033772e4..e356d8ff4 100644 --- a/src/lib/error-exception.cpp +++ b/src/lib/error-exception.cpp @@ -41,7 +41,6 @@ #include #include -using util::cStr; using util::isnil; using std::exception; diff --git a/src/lib/format-string.hpp b/src/lib/format-string.hpp index 7e265ed77..607253f62 100644 --- a/src/lib/format-string.hpp +++ b/src/lib/format-string.hpp @@ -117,7 +117,7 @@ -namespace std { // forward declaration to avoid including +namespace std {// forward declaration to avoid including template struct char_traits; diff --git a/src/lib/lifecycle.cpp b/src/lib/lifecycle.cpp index 0a05d5eeb..f42c5a6a4 100644 --- a/src/lib/lifecycle.cpp +++ b/src/lib/lifecycle.cpp @@ -31,7 +31,6 @@ #include "lib/lifecycleregistry.hpp" #include "lib/util.hpp" -using util::cStr; diff --git a/src/lib/symbol-impl.cpp b/src/lib/symbol-impl.cpp index 191d34adc..28f9c0feb 100644 --- a/src/lib/symbol-impl.cpp +++ b/src/lib/symbol-impl.cpp @@ -36,13 +36,10 @@ #include "lib/symbol.hpp" #include "lib/symbol-table.hpp" -#include "include/limits.hpp" -extern "C" { -#include "lib/safeclib.h" -} #include #include +#include #include using std::size_t; @@ -66,6 +63,12 @@ namespace lib { static SymbolTable theSymbolTable; return theSymbolTable; // Meyer's Singleton } + + inline int + strNcmp (CStr a, CStr b, size_t len) + { + return a == b ? 0 : std::strncmp (a?a:"", b?b:"", len); + } } @@ -96,9 +99,9 @@ namespace lib { /** equality on Literal and Symbol values is defined * based on the content, not the address. */ bool - Literal::operator== (const char* cString) const + Literal::operator== (CStr charPtr) const { - return !lumiera_strncmp (this->str_, cString, STRING_MAX_RELEVANT); + return 0 == strNcmp (this->str_, charPtr, STRING_MAX_RELEVANT); } diff --git a/src/lib/symbol.hpp b/src/lib/symbol.hpp index 3754d7a6c..95fc84a8d 100644 --- a/src/lib/symbol.hpp +++ b/src/lib/symbol.hpp @@ -60,6 +60,16 @@ #include #include +using CStr = const char*; + +/** convenience shortcut: forced conversion to c-String via string. + * usable for printf with objects providing to-string conversion. */ +inline CStr +cStr (std::string const& rendered) +{ + return rendered.c_str(); +} + namespace lib { @@ -74,7 +84,7 @@ namespace lib { */ class Literal { - const char * str_; + CStr str_; public: /** empty string by default */ @@ -88,8 +98,8 @@ namespace lib { : str_(o.str_) { } - operator const char* () const { return str_; } - const char* c() const { return str_; } + operator CStr() const { return str_; } + const char* c() const { return str_; } bool empty() const @@ -97,11 +107,11 @@ namespace lib { return !str_ || 0 == std::strlen(str_); } - bool operator== (const char* cString) const; + bool operator== (CStr cString) const; protected: /** Assignment generally prohibited */ - Literal& operator= (const char* newStr) noexcept + Literal& operator= (CStr newStr) noexcept { str_ = newStr; return *this; @@ -122,7 +132,7 @@ namespace lib { static Symbol BOTTOM; static Symbol FAILURE; - Symbol (const char* lit =NULL) + Symbol (CStr lit =NULL) : Symbol{std::string(lit? lit : BOTTOM.c())} { } @@ -137,7 +147,7 @@ namespace lib { : Symbol{std::string(base)+"."+ext} { } - Symbol (Literal const& base, const char* ext) + Symbol (Literal const& base, CStr ext) : Symbol{base, std::string(ext)} { } @@ -180,9 +190,9 @@ namespace lib { /* === mixed comparisons === */ - inline bool operator== (const char* s1, Literal s2) { return s2.operator== (s1); } - inline bool operator== (Symbol s1, const char* s2) { return s1.operator== (s2); } - inline bool operator== (const char* s1, Symbol s2) { return s2.operator== (s1); } + inline bool operator== (CStr s1, Literal s2) { return s2.operator== (s1); } + inline bool operator== (Symbol s1, CStr s2) { return s1.operator== (s2); } + inline bool operator== (CStr s1, Symbol s2) { return s2.operator== (s1); } inline bool operator== (Literal s1, Symbol s2) { return s1.operator== (s2.c()); } inline bool operator== (Symbol s1, Literal s2) { return s2.operator== (s1.c()); } inline bool operator== (Literal s1, std::string s2) { return s1.operator== (s2.c_str()); } @@ -194,10 +204,10 @@ namespace lib { inline bool operator!= (Literal const& s1, Literal const& s2) { return not s1.operator== (s2.c()); } inline bool operator!= (Symbol const& s1, Symbol const& s2) { return not (s1.c() == s2.c()); } - inline bool operator!= (Literal s1, const char* s2) { return not s1.operator== (s2); } - inline bool operator!= (const char* s1, Literal s2) { return not s2.operator== (s1); } - inline bool operator!= (Symbol s1, const char* s2) { return not s1.operator== (s2); } - inline bool operator!= (const char* s1, Symbol s2) { return not s2.operator== (s1); } + inline bool operator!= (Literal s1, CStr s2) { return not s1.operator== (s2); } + inline bool operator!= (CStr s1, Literal s2) { return not s2.operator== (s1); } + inline bool operator!= (Symbol s1, CStr s2) { return not s1.operator== (s2); } + inline bool operator!= (CStr s1, Symbol s2) { return not s2.operator== (s1); } inline bool operator!= (Literal s1, Symbol s2) { return not s1.operator== (s2.c()); } inline bool operator!= (Symbol s1, Literal s2) { return not s2.operator== (s1.c()); } inline bool operator!= (Literal s1, std::string s2) { return not s1.operator== (s2.c_str()); } @@ -211,14 +221,14 @@ namespace lib { inline std::string operator+ (std::string str, Literal const& sym) { - const char* symP (sym); + CStr symP (sym); return str + symP; } inline std::string operator+ (Literal const& sym, std::string str) { - const char* symP (sym); + CStr symP (sym); return symP + str; } diff --git a/src/lib/test/suite.cpp b/src/lib/test/suite.cpp index c2c8b4b85..cb13cf310 100644 --- a/src/lib/test/suite.cpp +++ b/src/lib/test/suite.cpp @@ -52,7 +52,6 @@ namespace test { using std::shared_ptr; using boost::algorithm::trim; - using util::cStr; using util::isnil; using util::contains; using util::typeStr; diff --git a/src/lib/time/digxel.hpp b/src/lib/time/digxel.hpp index 2ef8f214c..c43b5e5ea 100644 --- a/src/lib/time/digxel.hpp +++ b/src/lib/time/digxel.hpp @@ -84,11 +84,10 @@ namespace time { namespace digxel { - using util::cStr; using lib::Literal; using boost::lexical_cast; - typedef const char* CBuf; + using CBuf = CStr; /** diff --git a/src/lib/util.hpp b/src/lib/util.hpp index 72431a5ca..936571b9b 100644 --- a/src/lib/util.hpp +++ b/src/lib/util.hpp @@ -40,15 +40,30 @@ #include "include/limits.hpp" #include "lib/hash-standard.hpp" -#include #include -#include + +namespace std {// forward declarations to avoid pervasive includes + + template + class allocator; + template + class set; + + template + IT find (IT, IT, V const&); + template + IT remove (IT, IT, V const&); +} + + +const char* cStr (std::string const&); namespace util { using std::string; + using CStr = const char*; template @@ -101,31 +116,33 @@ namespace util { * @return always a number, 0 in case of unparseable text, * limited to 0 <= num <= LUMIERA_MAX_ORDINAL_NUMBER */ inline uint - uNum (const char* pCStr) + uNum (CStr charPtr) { - if (!pCStr) return 0; - int parsedNumber(std::atoi (pCStr)); + if (!charPtr) return 0; + int parsedNumber (std::atoi (charPtr)); return limited (0, parsedNumber, LUMIERA_MAX_ORDINAL_NUMBER); } inline int - sNum (const char* pCStr) + sNum (CStr charPtr) { - if (!pCStr) return 0; - int parsedNumber(std::atoi (pCStr)); + if (!charPtr) return 0; + int parsedNumber (std::atoi (charPtr)); return limited (-LUMIERA_MAX_ORDINAL_NUMBER, parsedNumber, LUMIERA_MAX_ORDINAL_NUMBER); } + template inline uint - uNum (string const& spec) + uNum (OBJ const& spec) { - return uNum (spec.c_str()); + return uNum (cStr(spec)); } + template inline int - sNum (string const& spec) + sNum (OBJ const& spec) { - return sNum (spec.c_str()); + return sNum (cStr(spec)); } @@ -156,9 +173,9 @@ namespace util { } inline bool - isnil (const char* pCStr) + isnil (CStr charPtr) { - return !pCStr or !(*pCStr); + return !charPtr or !(*charPtr); } @@ -167,13 +184,13 @@ namespace util { inline bool startsWith (string const& str, string const& prefix) { - return 0 == str.rfind(prefix, 0); + return 0 == str.rfind (prefix, 0); } inline bool - startsWith (string const& str, const char* prefix) + startsWith (string const& str, CStr prefix) { - return 0 == str.rfind(prefix, 0); + return 0 == str.rfind (prefix, 0); } /** check if string ends with the given suffix */ @@ -183,11 +200,11 @@ namespace util { size_t l = suffix.length(); if (l > str.length()) return false; size_t pos = str.length() - l; - return pos == str.find(suffix, pos); + return pos == str.find (suffix, pos); } inline bool - endsWith (string const& str, const char* suffix) + endsWith (string const& str, CStr suffix) { return endsWith (str, string(suffix)); } @@ -216,9 +233,9 @@ namespace util { } /** shortcut for set value containment test */ - template + template inline bool - contains (std::set const& set, T const& val) + contains (std::set const& set, T const& val) { return set.end() != set.find (val); } @@ -448,19 +465,6 @@ namespace util { */ bool isYes (string const&) noexcept; - - - - /** convenience shortcut: conversion to c-String via string. - * usable for printf with objects providing to-string conversion. - */ - inline const char* - cStr (string const& org) - { - return org.c_str(); - } - - } // namespace util diff --git a/src/stage/ctrl/ui-manager.cpp b/src/stage/ctrl/ui-manager.cpp index 7ef614f28..bcf5961cc 100644 --- a/src/stage/ctrl/ui-manager.cpp +++ b/src/stage/ctrl/ui-manager.cpp @@ -45,7 +45,6 @@ #include -using util::cStr; using util::isnil; diff --git a/src/stage/ctrl/window-locator.cpp b/src/stage/ctrl/window-locator.cpp index 574f5696e..a1e16833d 100644 --- a/src/stage/ctrl/window-locator.cpp +++ b/src/stage/ctrl/window-locator.cpp @@ -37,7 +37,6 @@ #include #include -using util::cStr; using util::isnil; using std::list; diff --git a/src/stage/notification-service.cpp b/src/stage/notification-service.cpp index 3b300c09f..eb5850de8 100644 --- a/src/stage/notification-service.cpp +++ b/src/stage/notification-service.cpp @@ -78,7 +78,6 @@ using lib::diff::TreeMutator; using lib::diff::MutationMessage; using stage::ctrl::UiDispatcher; using stage::ctrl::BusTerm; -using util::cStr; using util::_Fmt; using std::string; diff --git a/src/stage/workspace/ui-style.cpp b/src/stage/workspace/ui-style.cpp index 221efe88b..36920d137 100644 --- a/src/stage/workspace/ui-style.cpp +++ b/src/stage/workspace/ui-style.cpp @@ -44,7 +44,6 @@ using Gtk::IconSize; using Gtk::IconFactory; -using util::cStr; namespace stage { diff --git a/src/steam/asset.cpp b/src/steam/asset.cpp index 85055c5c8..4ae65fc58 100644 --- a/src/steam/asset.cpp +++ b/src/steam/asset.cpp @@ -44,7 +44,6 @@ using util::removeall; using util::for_each; using util::and_all; using util::isnil; -using util::cStr; using util::_Fmt; diff --git a/src/steam/asset/meta/time-grid.cpp b/src/steam/asset/meta/time-grid.cpp index 3975dfe4b..d65ae93a9 100644 --- a/src/steam/asset/meta/time-grid.cpp +++ b/src/steam/asset/meta/time-grid.cpp @@ -38,7 +38,6 @@ #include using util::_Fmt; -using util::cStr; using util::isnil; using std::string; diff --git a/src/steam/control/command-def.hpp b/src/steam/control/command-def.hpp index 80d42c83b..c4db54c24 100644 --- a/src/steam/control/command-def.hpp +++ b/src/steam/control/command-def.hpp @@ -84,7 +84,6 @@ namespace control { using std::placeholders::_1; using std::tuple_size; using lib::Symbol; - using util::cStr; using lib::meta::_Fun; using lib::meta::NullType; diff --git a/src/steam/control/command.cpp b/src/steam/control/command.cpp index 9f09f10f5..c74c3b549 100644 --- a/src/steam/control/command.cpp +++ b/src/steam/control/command.cpp @@ -39,7 +39,6 @@ */ -#include "lib/util.hpp" #include "lib/error.hpp" #include "lib/symbol.hpp" #include "lib/format-string.hpp" @@ -49,6 +48,7 @@ #include "steam/control/command-registry.hpp" #include "steam/control/command-impl-clone-builder.hpp" #include "steam/control/handling-pattern.hpp" +#include "lib/util.hpp" #include #include @@ -57,7 +57,6 @@ using std::ostringstream; using std::string; using std::move; -using util::cStr; using util::_Fmt; diff --git a/src/steam/control/handling-pattern.cpp b/src/steam/control/handling-pattern.cpp index 0ef4cc92b..37d6a8651 100644 --- a/src/steam/control/handling-pattern.cpp +++ b/src/steam/control/handling-pattern.cpp @@ -36,7 +36,6 @@ using util::isnil; -using util::cStr; using util::_Fmt; diff --git a/src/steam/control/session-command-service.cpp b/src/steam/control/session-command-service.cpp index c09853aa9..d046efe33 100644 --- a/src/steam/control/session-command-service.cpp +++ b/src/steam/control/session-command-service.cpp @@ -52,7 +52,6 @@ namespace control { using lib::Symbol; using std::string; - using util::cStr; Symbol diff --git a/src/steam/control/steam-dispatcher.cpp b/src/steam/control/steam-dispatcher.cpp index a97fbc223..60aef090d 100644 --- a/src/steam/control/steam-dispatcher.cpp +++ b/src/steam/control/steam-dispatcher.cpp @@ -315,7 +315,7 @@ namespace control { } if (cmd) { - INFO (command, "+++ dispatch %s", util::cStr(cmd)); ///////////////////////////////TICKET #211 actually use a command logging and execution strategy here + INFO (command, "+++ dispatch %s", cStr(cmd)); ////////////////////////////////////////TICKET #211 actually use a command logging and execution strategy here //////////////////////////////////////////////////////TODO : magic to invoke commands from unit tests if (util::startsWith (string(cmd.getID()), "test")) diff --git a/src/steam/mobject/session/dummy-session-connection.cpp b/src/steam/mobject/session/dummy-session-connection.cpp index 4d8843d38..4a7e128b3 100644 --- a/src/steam/mobject/session/dummy-session-connection.cpp +++ b/src/steam/mobject/session/dummy-session-connection.cpp @@ -35,7 +35,6 @@ ** */ -#include "lib/util.hpp" //#include "lib/symbol.hpp" //#include "include/logging.h" #include "steam/mobject/session/dummy-session-connection.hpp" diff --git a/src/steam/mobject/session/placement-index.hpp b/src/steam/mobject/session/placement-index.hpp index 31c642609..c958b3a9c 100644 --- a/src/steam/mobject/session/placement-index.hpp +++ b/src/steam/mobject/session/placement-index.hpp @@ -106,13 +106,13 @@ #ifndef STEAM_MOBJECT_PLACEMENT_INDEX_H #define STEAM_MOBJECT_PLACEMENT_INDEX_H -#include "lib/util.hpp" #include "lib/error.hpp" #include "lib/symbol.hpp" #include "lib/itertools.hpp" #include "steam/mobject/placement.hpp" #include "steam/mobject/placement-ref.hpp" #include "lib/nocopy.hpp" +#include "lib/util.hpp" #include #include diff --git a/src/steam/mobject/test-dummy-mobject.hpp b/src/steam/mobject/test-dummy-mobject.hpp index 3d9226b13..969ce5126 100644 --- a/src/steam/mobject/test-dummy-mobject.hpp +++ b/src/steam/mobject/test-dummy-mobject.hpp @@ -53,7 +53,6 @@ #include using util::_Fmt; -using util::cStr; using std::string; using std::rand; diff --git a/tests/basics/time/time-parsing-test.cpp b/tests/basics/time/time-parsing-test.cpp index 3a20977cf..b10d503d2 100644 --- a/tests/basics/time/time-parsing-test.cpp +++ b/tests/basics/time/time-parsing-test.cpp @@ -34,7 +34,6 @@ #include "lib/util.hpp" using lib::Symbol; -using util::cStr; namespace lib { diff --git a/tests/core/application/subsystem-runner-test.cpp b/tests/core/application/subsystem-runner-test.cpp index ac88a2e41..464d856a7 100644 --- a/tests/core/application/subsystem-runner-test.cpp +++ b/tests/core/application/subsystem-runner-test.cpp @@ -47,7 +47,6 @@ #include using util::isnil; -using util::cStr; using test::Test; using lib::Literal; using lib::query::extractID; diff --git a/tests/core/steam/mobject/builder/builder-tool-test.cpp b/tests/core/steam/mobject/builder/builder-tool-test.cpp index 21c7002b6..c75a6c783 100644 --- a/tests/core/steam/mobject/builder/builder-tool-test.cpp +++ b/tests/core/steam/mobject/builder/builder-tool-test.cpp @@ -38,7 +38,6 @@ #include "lib/format-cout.hpp" #include "lib/util.hpp" -using util::cStr; using std::string; diff --git a/tests/core/steam/mobject/session/defs-manager-test.cpp b/tests/core/steam/mobject/session/defs-manager-test.cpp index 7e6498e69..76d23aa2c 100644 --- a/tests/core/steam/mobject/session/defs-manager-test.cpp +++ b/tests/core/steam/mobject/session/defs-manager-test.cpp @@ -50,7 +50,6 @@ namespace mobject { namespace session { namespace test { - using util::cStr; using lib::Symbol; using asset::ID; using asset::Asset; diff --git a/tests/core/steam/mobject/session/session-element-query-test.cpp b/tests/core/steam/mobject/session/session-element-query-test.cpp index 3a7ba1338..fd86968c6 100644 --- a/tests/core/steam/mobject/session/session-element-query-test.cpp +++ b/tests/core/steam/mobject/session/session-element-query-test.cpp @@ -48,7 +48,6 @@ namespace test { using std::bind; using std::string; - using util::cStr; using util::contains; diff --git a/tests/library/format-helper-test.cpp b/tests/library/format-helper-test.cpp index e3b544e75..1e7f41af8 100644 --- a/tests/library/format-helper-test.cpp +++ b/tests/library/format-helper-test.cpp @@ -235,31 +235,33 @@ namespace test { void checkPrefixSuffix() { - CHECK (startsWith ("abcdef", "abcdef")); - CHECK (startsWith ("abcdef", "abcde")); - CHECK (startsWith ("abcdef", "abcd")); - CHECK (startsWith ("abcdef", "abc")); - CHECK (startsWith ("abcdef", "ab")); - CHECK (startsWith ("abcdef", "a")); - CHECK (startsWith ("abcdef", "")); - CHECK (startsWith ("", "")); + string abcdef{"abcdef"}; + CHECK (startsWith (abcdef, "abcdef")); + CHECK (startsWith (abcdef, "abcde")); + CHECK (startsWith (abcdef, "abcd")); + CHECK (startsWith (abcdef, "abc")); + CHECK (startsWith (abcdef, "ab")); + CHECK (startsWith (abcdef, "a")); + CHECK (startsWith (abcdef, "")); - CHECK (not startsWith ("abc", "abcd")); - CHECK (not startsWith ("a", "ä")); - CHECK (not startsWith ("ä", "a")); + CHECK (endsWith (abcdef, "abcdef")); + CHECK (endsWith (abcdef, "bcdef")); + CHECK (endsWith (abcdef, "cdef")); + CHECK (endsWith (abcdef, "def")); + CHECK (endsWith (abcdef, "ef")); + CHECK (endsWith (abcdef, "f")); + CHECK (endsWith (abcdef, "")); - CHECK (endsWith ("abcdef", "abcdef")); - CHECK (endsWith ("abcdef", "bcdef")); - CHECK (endsWith ("abcdef", "cdef")); - CHECK (endsWith ("abcdef", "def")); - CHECK (endsWith ("abcdef", "ef")); - CHECK (endsWith ("abcdef", "f")); - CHECK (endsWith ("abcdef", "")); - CHECK (endsWith ("", "")); + CHECK (startsWith (string{}, "")); + CHECK (endsWith (string{}, "")); - CHECK (not endsWith ("abc", " abc")); - CHECK (not endsWith ("a", "ä")); - CHECK (not endsWith ("ä", "a")); + CHECK (not startsWith (string{"abc"}, "abcd")); + CHECK (not startsWith (string{"a"}, "ä")); + CHECK (not startsWith (string{"ä"}, "a")); + + CHECK (not endsWith (string{"abc"}, " abc")); + CHECK (not endsWith (string{"a"}, "ä")); + CHECK (not endsWith (string{"ä"}, "a")); string abc{"abcdef"}; removePrefix(abc, "ab"); diff --git a/tests/library/iter-source-test.cpp b/tests/library/iter-source-test.cpp index c800a6370..06eb1c527 100644 --- a/tests/library/iter-source-test.cpp +++ b/tests/library/iter-source-test.cpp @@ -52,7 +52,6 @@ namespace test{ using lib::test::randStr; using lib::test::randTime; using util::isnil; - using util::cStr; using std::make_pair; using std::string; using std::list; diff --git a/tests/library/sub-id-test.cpp b/tests/library/sub-id-test.cpp index a29a953de..7e773767e 100644 --- a/tests/library/sub-id-test.cpp +++ b/tests/library/sub-id-test.cpp @@ -43,7 +43,6 @@ namespace lib { namespace test{ - using util::cStr; using util::for_each; using std::bind; using std::placeholders::_1;