Itasca C++ Interface
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
basestring.h File Reference

QString helper functions, plus some additions. More...

#include "basedef.h"
#include "to.h"
#include <cctype>
#include <cwctype>
#include <string>
#include <vector>
#include <string_view>
#include "../fmt/format.h"
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>

Go to the source code of this file.

Classes

class  StringList
 
class  Buffer
 
struct  StringCILess
 
struct  StringCIEqual
 
struct  StringCIHash
 

Typedefs

using wstring = std::wstring
 
using string = std::string
 
using string_view = std::string_view
 
template<typename T >
using StringMap = std::map<string, T, StringCILess>
 
template<typename T >
using StringMultiMap = std::multimap<string, T, StringCILess>
 
template<typename T >
using StringHashMap = std::unordered_map<string, T, StringCIHash, StringCIEqual>
 
using StringSet = std::set<string, StringCILess>
 
using StringHashSet = std::unordered_set<string, StringCIHash, StringCIEqual>
 

Functions

BASE_EXPORT std::tuple< int32, bool > isInt32 (const string_view &in)
 
BASE_EXPORT std::tuple< uint32, bool > isUInt32 (const string_view &in)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
BASE_EXPORT std::tuple< int64, bool > isInt64 (const string_view &in)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
BASE_EXPORT std::tuple< uint64, bool > isUInt64 (const string_view &in)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
BASE_EXPORT std::tuple< double, bool > isDouble (const string_view &in)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
BASE_EXPORT std::tuple< bool, bool > isBool (const string_view &in, const string_view &out="on,off,true,false,yes,no")
 
std::tuple< int32, bool > isInt32 (const string &in)
 
std::tuple< uint32, bool > isUInt32 (const string &in)
 
std::tuple< int64, bool > isInt64 (const string &in)
 
std::tuple< uint64, bool > isUInt64 (const string &in)
 
std::tuple< double, bool > isDouble (const string &in)
 
std::tuple< bool, bool > isBool (const string &in, const string_view &out="on,off,true,false,yes,no")
 
std::tuple< int32, bool > isInt32v (const string_view &in)
 
std::tuple< uint32, bool > isUInt32v (const string_view &in)
 
std::tuple< int64, bool > isInt64v (const string_view &in)
 
std::tuple< uint64, bool > isUInt64v (const string_view &in)
 
std::tuple< double, bool > isDoublev (const string_view &in)
 
std::tuple< bool, bool > isBoolv (const string_view &in, const string_view &out="on,off,true,false,yes,no")
 
template<typename T , typename ... Args>
toStringConv (const string_view &in, Args...args, bool te, std::tuple< T, bool >(*f)(const string_view &, Args...))
 
int32 toInt32 (const string_view &in, bool throwException=false)
 
uint32 toUInt32 (const string_view &in, bool throwException=false)
 
int64 toInt64 (const string_view &in, bool throwException=false)
 
uint64 toUInt64 (const string_view &in, bool throwException=false)
 
double toDouble (const string_view &in, bool throwException=false)
 
bool toBool (const string_view &in, const string_view &out="on,off,true,false,yes,no", bool throwException=false)
 
BASE_EXPORT std::vector< string > toStringList (const std::vector< string_view > &v)
 
BASE_EXPORT bool contains (const std::vector< string > &all, const string &s2, bool caseSensitivity=false)
 
BASE_EXPORT string tostring (const std::wstring &s)
 
BASE_EXPORT string tostring (const std::u16string &s)
 
BASE_EXPORT string tostring (const std::u32string &s)
 
string tostring (const string_view &s)
 
BASE_EXPORT std::wstring towstring (const string &s)
 
BASE_EXPORT std::wstring towstring (const std::u16string &s)
 
BASE_EXPORT std::u16string tou16string (const string &s)
 
BASE_EXPORT std::u16string tou16string (const std::wstring &s)
 
BASE_EXPORT std::u16string tou16string (const string_view &s)
 
BASE_EXPORT std::u32string tou32string (const string &s)
 
BASE_EXPORT std::u32string tou32string (const string_view &s)
 
BASE_EXPORT string toUpper (const string_view &s)
 
BASE_EXPORT string toLower (const string_view &s)
 
BASE_EXPORT string capitalizeFirstLetter (const string_view &s)
 
template<typename T , typename U >
join (const std::vector< T > &s, const U &sep)
 
BASE_EXPORT std::vector< string_view > splitView (const string_view &s, const string_view &sep, bool keepEmptyParts=false)
 
std::vector< string > split (const string_view &s, const string_view &sep, bool keepEmptyParts=false)
 
BASE_EXPORT std::vector< string_view > splitViewRegex (const string_view &s, const string_view &regex, bool keepEmptyParts=false)
 
std::vector< string > splitRegex (const string_view &s, const string_view &regex, bool keepEmptyParts=false)
 
BASE_EXPORT string_view matchViewRegex (const string_view &s, const string_view &regex, string::size_type start=0)
 
string matchRegex (const string_view &s, const string_view &regex, string::size_type start=0)
 
BASE_EXPORT string replaceRegex (const string &s, const string_view &regex, const string &after)
 
BASE_EXPORT string::size_type find (const string_view &s1, const string_view &s2, string::size_type start=0, bool caseSensitive=false)
 
BASE_EXPORT string::size_type findRegex (const string_view &s, const string_view &regex, string::size_type start=0)
 
BASE_EXPORT bool exactMatchRegex (const string_view &s, const string_view &regex)
 
BASE_EXPORT string_view trimmed_view (const string_view &s)
 
string trimmed (const string_view &s)
 
BASE_EXPORT string simplified (const string_view &s)
 
BASE_EXPORT string replace (string s, const string_view &sub, const string_view &newsub, bool caseSensitive=false)
 
BASE_EXPORT string toBase64 (const std::vector< char > &in)
 
BASE_EXPORT std::vector< char > fromBase64 (const string &in)
 
BASE_EXPORT bool startsWith (const string_view &in, const string_view &check, bool caseSensitive=false)
 
BASE_EXPORT bool endsWith (const string_view &in, const string_view &check, bool caseSensitive=false)
 
BASE_EXPORT bool contains (const string_view &in, const string_view &check, bool caseSensitive=false)
 
BASE_EXPORT string clipLen (string in, string::size_type length)
 
BASE_EXPORT string cleanupTypename (const char *name)
 
BASE_EXPORT string convertPercentToBracket (const string_view &s)
 
BASE_EXPORT string remove (string s, char c)
 
string remove (string s, const string_view &sub, bool caseSensitive=false)
 
BASE_EXPORT int32 compare (const string_view &s1, const string_view &s2, bool caseSensitive=false)
 
BASE_EXPORT uint64 caseInsensitiveHash (const string_view &s)
 
BASE_EXPORT uint64 firstNonBlankCharacter (const string_view &s)
 
BASE_EXPORT bool checkLeft (const string_view &s, const string_view &c)
 
bool equal (const string_view &s, const string_view &c, bool caseSensitive=false)
 
BASE_EXPORT bool match (const string &keyword, const string &token)
 ‍**
 
BASE_EXPORT void matchSynonymsAllowed (bool b)
 
BASE_EXPORT bool matchSynonymsAllowed ()
 
BASE_EXPORT string buildFormat (int64 width, char notation='\0', int precision=-1, char fill=' ')
 
template<class T >
string base::ts (const T &t, int width=0, char notation='\0', int precision=-1, char fill=' ')
 
template<typename T >
std::tuple< T, bool > base::fsTest (const string &)
 
template<>
std::tuple< int32, bool > base::fsTest (const string &in)
 
template<>
std::tuple< uint32, bool > base::fsTest (const string &in)
 
template<>
std::tuple< int64, bool > base::fsTest (const string &in)
 
template<>
std::tuple< uint64, bool > base::fsTest (const string &in)
 
template<>
std::tuple< double, bool > base::fsTest (const string &in)
 
template<>
std::tuple< bool, bool > base::fsTest (const string &in)
 
template<>
std::tuple< string, bool > base::fsTest (const string &in)
 
template<typename T >
base::fs (const string &, bool throwException=false)
 
template<>
int32 base::fs (const string &in, bool throwException)
 
template<>
uint32 base::fs (const string &in, bool throwException)
 
template<>
int64 base::fs (const string &in, bool throwException)
 
template<>
uint64 base::fs (const string &in, bool throwException)
 
template<>
double base::fs (const string &in, bool throwException)
 
template<>
bool base::fs (const string &in, bool throwException)
 
template<>
string base::fs (const string &in, bool)
 

Detailed Description

QString helper functions, plus some additions.

includes std::string and additional functions not included in the standard.