MySQL  8.0.18
Source Code Documentation
mysql_harness::utility Namespace Reference

Classes

class  Range
 Class to turn C array into range. More...
 
class  RangeReverse
 Class for creating a reverse range from another range. More...
 

Functions

std::vector< std::string > HARNESS_EXPORT wrap_string (const std::string &to_wrap, std::size_t width, std::size_t indent_size)
 
bool HARNESS_EXPORT ends_with (const std::string &str, const std::string &suffix)
 Checks whether string ends with the specified suffix. More...
 
bool HARNESS_EXPORT starts_with (const std::string &str, const std::string &prefix)
 Checks whether string starts with the specified prefix. More...
 
bool matches_glob (const std::string &word, const std::string &pattern)
 
void sleep_seconds (unsigned int seconds)
 
bool regex_pattern_matches (const std::string &s, const std::string &pattern)
 
std::string get_message_error (int errcode)
 
string dirname (const string &path)
 
string basename (const string &path)
 
void strip (string *str, const char *chars)
 
string strip_copy (string str, const char *chars)
 
string string_format (const char *format,...)
 
vector< string > wrap_string (const string &to_wrap, size_t width, size_t indent_size)
 
template<class Type >
Range< Type > make_range (Type *ptr, size_t length)
 Create a range from a plain C array. More...
 
template<typename Range >
RangeReverse< Rangereverse (Range &x)
 Iterate over a range in reverse. More...
 
template<class Map >
std::pair< typename Map::iterator, typename Map::iterator > find_range_first (Map &assoc, const typename Map::key_type::first_type &first, typename Map::iterator start)
 
template<class Map >
std::pair< typename Map::iterator, typename Map::iterator > find_range_first (Map &assoc, const typename Map::key_type::first_type &first)
 
template<class Map >
std::pair< typename Map::const_iterator, typename Map::const_iterator > find_range_first (const Map &assoc, const typename Map::key_type::first_type &first, typename Map::const_iterator start)
 
template<class Map >
std::pair< typename Map::const_iterator, typename Map::const_iterator > find_range_first (const Map &assoc, const typename Map::key_type::first_type &first)
 
std::string dirname (const std::string &path)
 
std::string basename (const std::string &path)
 
void strip (std::string *str, const char *chars=" \\\)
 Remove starting and trailing delimiters from string. More...
 
HARNESS_EXPORT std::string strip_copy (std::string str, const char *chars=" \\\)
 

Function Documentation

◆ basename() [1/2]

string mysql_harness::utility::basename ( const string &  path)

◆ basename() [2/2]

std::string mysql_harness::utility::basename ( const std::string &  path)

◆ dirname() [1/2]

string mysql_harness::utility::dirname ( const string &  path)

◆ dirname() [2/2]

std::string mysql_harness::utility::dirname ( const std::string &  path)

◆ ends_with()

bool mysql_harness::utility::ends_with ( const std::string &  str,
const std::string &  suffix 
)

Checks whether string ends with the specified suffix.

Returns true if the string ends with the given suffix.

Returns
bool

◆ find_range_first() [1/4]

template<class Map >
std::pair<typename Map::iterator, typename Map::iterator> mysql_harness::utility::find_range_first ( Map &  assoc,
const typename Map::key_type::first_type &  first,
typename Map::iterator  start 
)

◆ find_range_first() [2/4]

template<class Map >
std::pair<typename Map::iterator, typename Map::iterator> mysql_harness::utility::find_range_first ( Map &  assoc,
const typename Map::key_type::first_type &  first 
)

◆ find_range_first() [3/4]

template<class Map >
std::pair<typename Map::const_iterator, typename Map::const_iterator> mysql_harness::utility::find_range_first ( const Map &  assoc,
const typename Map::key_type::first_type &  first,
typename Map::const_iterator  start 
)

◆ find_range_first() [4/4]

template<class Map >
std::pair<typename Map::const_iterator, typename Map::const_iterator> mysql_harness::utility::find_range_first ( const Map &  assoc,
const typename Map::key_type::first_type &  first 
)

◆ get_message_error()

std::string mysql_harness::utility::get_message_error ( int  errcode)

◆ make_range()

template<class Type >
Range<Type> mysql_harness::utility::make_range ( Type *  ptr,
size_t  length 
)

Create a range from a plain C array.

This function create a range from a plain array so that arrays can be used in range-based loops.

See also
Range

◆ matches_glob()

bool mysql_harness::utility::matches_glob ( const std::string &  word,
const std::string &  pattern 
)

◆ regex_pattern_matches()

bool mysql_harness::utility::regex_pattern_matches ( const std::string &  s,
const std::string &  pattern 
)

◆ reverse()

template<typename Range >
RangeReverse<Range> mysql_harness::utility::reverse ( Range x)

Iterate over a range in reverse.

Function take a range, which can be any sequence container, and return a reverse range that iterate the sequence in reverse.

Typical use-case is:

for (auto item : reverse_iterate(my_list)) {
...
}

◆ sleep_seconds()

void mysql_harness::utility::sleep_seconds ( unsigned int  seconds)

◆ starts_with()

bool mysql_harness::utility::starts_with ( const std::string &  str,
const std::string &  prefix 
)

Checks whether string starts with the specified prefix.

Returns true if the string begins with the given prefix.

Returns
bool

◆ string_format()

HARNESS_EXPORT std::string mysql_harness::utility::string_format ( const char *  format,
  ... 
)

◆ strip() [1/2]

void mysql_harness::utility::strip ( string *  str,
const char *  chars 
)

◆ strip() [2/2]

void mysql_harness::utility::strip ( std::string *  str)

Remove starting and trailing delimiters from string.

◆ strip_copy() [1/2]

string mysql_harness::utility::strip_copy ( string  str,
const char *  chars 
)

◆ strip_copy() [2/2]

HARNESS_EXPORT std::string mysql_harness::utility::strip_copy ( std::string  str)

◆ wrap_string() [1/2]

std::vector<std::string> HARNESS_EXPORT mysql_harness::utility::wrap_string ( const std::string &  to_wrap,
std::size_t  width,
std::size_t  indent_size 
)

◆ wrap_string() [2/2]

vector<string> mysql_harness::utility::wrap_string ( const string &  to_wrap,
size_t  width,
size_t  indent_size 
)