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
This commit is contained in:
parent
aa93bf9285
commit
59390cd2f8
41 changed files with 105 additions and 119 deletions
|
|
@ -60,7 +60,6 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
using util::cStr;
|
||||
using util::join;
|
||||
using std::string;
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <boost/functional/hash.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ extern "C" {
|
|||
#include "lib/util.hpp"
|
||||
|
||||
|
||||
using util::cStr;
|
||||
using lib::Literal;
|
||||
using std::unique_ptr;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ typedef boost::program_options::variables_map VarMap;
|
|||
namespace op = boost::program_options;
|
||||
|
||||
using lib::VectS;
|
||||
using util::cStr;
|
||||
|
||||
|
||||
namespace lumiera {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -128,7 +128,6 @@
|
|||
#include "lib/error.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
using util::cStr;
|
||||
|
||||
namespace lumiera {
|
||||
namespace facade {
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@
|
|||
#include <typeinfo>
|
||||
#include <iostream>
|
||||
|
||||
using util::cStr;
|
||||
using util::isnil;
|
||||
using std::exception;
|
||||
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@
|
|||
|
||||
|
||||
|
||||
namespace std { // forward declaration to avoid including <iostream>
|
||||
namespace std {// forward declaration to avoid including <iostream>
|
||||
|
||||
template<typename C>
|
||||
struct char_traits;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
#include "lib/lifecycleregistry.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
using util::cStr;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -36,13 +36,10 @@
|
|||
|
||||
#include "lib/symbol.hpp"
|
||||
#include "lib/symbol-table.hpp"
|
||||
#include "include/limits.hpp"
|
||||
extern "C" {
|
||||
#include "lib/safeclib.h"
|
||||
}
|
||||
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -60,6 +60,16 @@
|
|||
#include <string>
|
||||
#include <cstring>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -40,15 +40,30 @@
|
|||
#include "include/limits.hpp"
|
||||
#include "lib/hash-standard.hpp"
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
namespace std {// forward declarations to avoid pervasive includes
|
||||
|
||||
template<typename T>
|
||||
class allocator;
|
||||
template<typename K, typename CMP, class ALLO>
|
||||
class set;
|
||||
|
||||
template<typename IT, typename V>
|
||||
IT find (IT, IT, V const&);
|
||||
template<typename IT, typename V>
|
||||
IT remove (IT, IT, V const&);
|
||||
}
|
||||
|
||||
|
||||
const char* cStr (std::string const&);
|
||||
|
||||
|
||||
|
||||
namespace util {
|
||||
|
||||
using std::string;
|
||||
using CStr = const char*;
|
||||
|
||||
|
||||
template <class NUM>
|
||||
|
|
@ -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<class OBJ>
|
||||
inline uint
|
||||
uNum (string const& spec)
|
||||
uNum (OBJ const& spec)
|
||||
{
|
||||
return uNum (spec.c_str());
|
||||
return uNum (cStr(spec));
|
||||
}
|
||||
|
||||
template<class OBJ>
|
||||
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 <typename T>
|
||||
template <typename T, class CMP, class ALO>
|
||||
inline bool
|
||||
contains (std::set<T> const& set, T const& val)
|
||||
contains (std::set<T,CMP,ALO> 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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@
|
|||
|
||||
#include <gdlmm.h>
|
||||
|
||||
using util::cStr;
|
||||
using util::isnil;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
#include <memory>
|
||||
#include <list>
|
||||
|
||||
using util::cStr;
|
||||
using util::isnil;
|
||||
using std::list;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@
|
|||
using Gtk::IconSize;
|
||||
using Gtk::IconFactory;
|
||||
|
||||
using util::cStr;
|
||||
|
||||
|
||||
namespace stage {
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ using util::removeall;
|
|||
using util::for_each;
|
||||
using util::and_all;
|
||||
using util::isnil;
|
||||
using util::cStr;
|
||||
using util::_Fmt;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@
|
|||
#include <string>
|
||||
|
||||
using util::_Fmt;
|
||||
using util::cStr;
|
||||
using util::isnil;
|
||||
using std::string;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 <utility>
|
||||
#include <sstream>
|
||||
|
|
@ -57,7 +57,6 @@
|
|||
using std::ostringstream;
|
||||
using std::string;
|
||||
using std::move;
|
||||
using util::cStr;
|
||||
using util::_Fmt;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
|
||||
|
||||
using util::isnil;
|
||||
using util::cStr;
|
||||
using util::_Fmt;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ namespace control {
|
|||
|
||||
using lib::Symbol;
|
||||
using std::string;
|
||||
using util::cStr;
|
||||
|
||||
|
||||
Symbol
|
||||
|
|
|
|||
|
|
@ -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"))
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#include "lib/util.hpp"
|
||||
//#include "lib/symbol.hpp"
|
||||
//#include "include/logging.h"
|
||||
#include "steam/mobject/session/dummy-session-connection.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 <unordered_map>
|
||||
#include <memory>
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@
|
|||
#include <cstdlib>
|
||||
|
||||
using util::_Fmt;
|
||||
using util::cStr;
|
||||
using std::string;
|
||||
using std::rand;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@
|
|||
#include "lib/util.hpp"
|
||||
|
||||
using lib::Symbol;
|
||||
using util::cStr;
|
||||
|
||||
|
||||
namespace lib {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@
|
|||
#include <chrono>
|
||||
|
||||
using util::isnil;
|
||||
using util::cStr;
|
||||
using test::Test;
|
||||
using lib::Literal;
|
||||
using lib::query::extractID;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@
|
|||
#include "lib/format-cout.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
using util::cStr;
|
||||
using std::string;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ namespace mobject {
|
|||
namespace session {
|
||||
namespace test {
|
||||
|
||||
using util::cStr;
|
||||
using lib::Symbol;
|
||||
using asset::ID;
|
||||
using asset::Asset;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ namespace test {
|
|||
using std::bind;
|
||||
using std::string;
|
||||
|
||||
using util::cStr;
|
||||
using util::contains;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@
|
|||
namespace lib {
|
||||
namespace test{
|
||||
|
||||
using util::cStr;
|
||||
using util::for_each;
|
||||
using std::bind;
|
||||
using std::placeholders::_1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue