util_functions.hpp
Go to the documentation of this file.
111 EXPORT_SYMBOLS bool startsWith(const std::string& str, const std::string& prefix, bool case_sensitive=true); 114 EXPORT_SYMBOLS bool iequals(const std::string& a, const std::string& b, bool case_sensitive=false); 117 EXPORT_SYMBOLS std::vector<std::string> split(const std::string& input, const std::string& delimiter); Definition: util_functions.hpp:123 const str buildtime_scratch Return the path to the build-time scratch directory. Definition: util_functions.hpp:70 EXPORT_SYMBOLS str dir_name(const str &path) Get directory name from full path+filename (POSIX) Definition: util_functions.cpp:245 EXPORT_SYMBOLS std::vector< std::string > split(const std::string &input, const std::string &delimiter) Split string into vector of strings, using a delimiter string. Definition: util_functions.cpp:187 EXPORT_SYMBOLS str replace_leading_namespace(str s, str ns, str ns_new) Replaces a namespace at the start of a string, or after "const". Definition: util_functions.cpp:93 std::chrono::time_point< std::chrono::system_clock > time_point Definition: logging.hpp:46 EXPORT_SYMBOLS void strip_parentheses(str &) Strips leading and/or trailing parentheses from a string. Definition: util_functions.cpp:111 EXPORT_SYMBOLS bool sspairset_contains(const str &, const std::set< sspair > &) Test if a set of str,str pairs contains any entry with first element matching a given string... General small utility classes, typedefs, etc. EXPORT_SYMBOLS bool isInteger(const std::string &) Check if a string represents an integer From: http://stackoverflow.com/a/2845275/1447953. Definition: util_functions.cpp:153 EXPORT_SYMBOLS std::vector< str > ls_dir(const str &dir) Return a vector of strings listing the contents of a directory (POSIX) Definition: util_functions.cpp:220 EXPORT_SYMBOLS double sqr(double a) returns square of double - saves tedious repetition Definition: util_functions.cpp:360 EXPORT_SYMBOLS bool endsWith(const std::string &str, const std::string &suffix) Checks whether `str' ends with `suffix'. Definition: util_functions.cpp:367 EXPORT_SYMBOLS str return_time_and_date(const time_point &in) Get date and time. Definition: util_functions.cpp:303 EXPORT_SYMBOLS void strcpy2f(char *, int, str) Copy a str to a character array, stripping the null termination character. Definition: util_functions.cpp:164 EXPORT_SYMBOLS bool startsWith(const std::string &str, const std::string &prefix, bool case_sensitive=true) Checks whether `str' begins with `prefix'. Definition: util_functions.cpp:379 bool check2(const str &s1, const str &s2) Sub-check for are_similar. Definition: util_functions.cpp:340 EXPORT_SYMBOLS bool file_exists(const std::string &filename) Check if a file exists. Definition: util_functions.cpp:210 EXPORT_SYMBOLS int remove_all_files_in(const str &dirname, bool error_if_absent=true) Delete all files in a directory (does not act recursively) Definition: util_functions.cpp:265 EXPORT_SYMBOLS void strip_whitespace_except_after_const(str &) Strip all whitespace except that following "const", in which case the whitespace is replaced by a sin... Definition: util_functions.cpp:101 EXPORT_SYMBOLS bool iequals(const std::string &a, const std::string &b, bool case_sensitive=false) Perform a (possibly) case-insensitive string comparison. Definition: util_functions.cpp:173 EXPORT_SYMBOLS str base_name(const str &path) Get file name from full path+filename (POSIX) Definition: util_functions.cpp:255 T * beginA(T(&arr)[N]) Get pointers to beginning and end of array. Definition: util_functions.hpp:148 bool is_disjoint(const Set1 &set1, const Set2 &set2) Test if two sets are disjoint (works on any sorted std container I think) Definition: util_functions.hpp:155 EXPORT_SYMBOLS const str & ensure_path_exists(const str &) Ensure that a path exists (and then return the path, for chaining purposes) Definition: util_functions.cpp:196 EXPORT_SYMBOLS const str & runtime_scratch() Return the path the the run-specific scratch directory. Definition: util_functions.cpp:58 EXPORT_SYMBOLS std::vector< str > delimiterSplit(str s, str delim) Split a string into a vector of strings, using a delimiter, and removing any whitespace around the de... Definition: util_functions.cpp:71 bool check1(const str &s1, const str &s2) Sub-check for are_similar. Definition: util_functions.cpp:323 EXPORT_SYMBOLS str strip_leading_namespace(str s, str ns) Strips namespace from the start of a string, or after "const". Definition: util_functions.cpp:85 uintptr_t memaddress_to_uint(T *ptr) Convert the memory address a pointer points to to an unsigned integer (The size of uintptr_t depends ... Definition: util_functions.hpp:61 T byVal(T t) Redirection function to turn an lvalue into an rvalue, so that it is correctly passed by value when d... Definition: util_functions.hpp:49 EXPORT_SYMBOLS str str_fixed_len(str, int) Created a str of a specified length. Definition: util_functions.cpp:137 EXPORT_SYMBOLS bool are_similar(const str &s1, const str &s2) Check if two strings are a "close" match Used for "did you mean?" type checking during command line a... Definition: util_functions.cpp:314 |