Itasca C++ Interface
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 string = std::string
 
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

 INTELWARNING (186) PUSHWARNING INTELWARNING(280) POPWARNING using wstring
 
BASE_EXPORT std::tuple< int32, bool > isInt32 (const string &in)
 
BASE_EXPORT std::tuple< uint32, bool > isUInt32 (const string &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 &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 &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 &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 &in, const string &out="on,off,true,false,yes,no")
 
template<typename T , typename ... Args>
toStringConv (const string &in, Args...args, bool te, std::tuple< T, bool >(*f)(const string &, Args...))
 
int32 toInt32 (const string &in, bool throwException=false)
 
uint32 toUInt32 (const string &in, bool throwException=false)
 
int64 toInt64 (const string &in, bool throwException=false)
 
uint64 toUInt64 (const string &in, bool throwException=false)
 
double toDouble (const string &in, bool throwException=false)
 
bool toBool (const string &in, const string &out="on,off,true,false,yes,no", bool throwException=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)
 
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 std::string_view &s)
 
BASE_EXPORT std::u32string tou32string (const std::string &s)
 
BASE_EXPORT std::u32string tou32string (const std::string_view &s)
 
BASE_EXPORT string toUpper (const string &s)
 
BASE_EXPORT string toLower (const string &s)
 
BASE_EXPORT string capitalizeFirstLetter (const string &s)
 
template<typename T , typename U >
join (const std::vector< T > &s, const U &sep)
 
BASE_EXPORT std::vector< string > split (const string &s, const string &sep, bool keepEmptyParts=false)
 
BASE_EXPORT std::vector< string > splitRegex (const string &s, const string &regex, bool keepEmptyParts=false)
 
BASE_EXPORT string matchRegex (const string &s, const string &regex, string::size_type start=0)
 
BASE_EXPORT string replaceRegex (const string &s, const string &regex, const string &after)
 
BASE_EXPORT string::size_type findRegex (const string &s, const string &regex, string::size_type start=0)
 
BASE_EXPORT bool exactMatchRegex (const string &s, const string &regex)
 
BASE_EXPORT string trimmed (const string &s)
 
BASE_EXPORT string simplified (const string &s)
 
BASE_EXPORT string replaceAll (const string &s, const string &sub, const string &newsub)
 
BASE_EXPORT string toBase64 (const std::vector< char > &in)
 
BASE_EXPORT std::vector< char > fromBase64 (const string &in)
 
BASE_EXPORT bool startsWith (const string &in, const string &check, bool caseSensitive=false)
 
BASE_EXPORT bool endsWith (const string &in, const string &check, bool caseSensitive=false)
 
BASE_EXPORT string clipLen (const string &in, string::size_type length)
 
BASE_EXPORT string cleanupTypename (const char *name)
 
BASE_EXPORT string convertPercentToBracket (const string &s)
 
BASE_EXPORT string remove (const string &s, char c)
 
BASE_EXPORT int32 caseInsensitiveCompare (const string &s1, const string &s2)
 
BASE_EXPORT int32 caseInsensitiveCompare (const string &s1, const std::string_view &s2)
 
int32 caseInsensitiveCompare (const string &s1, const char *str)
 
BASE_EXPORT uint64 caseInsensitiveHash (const string &s)
 
BASE_EXPORT uint64 caseInsensitiveFind (const string &s1, const string &s2, string::size_type start=0)
 
BASE_EXPORT string caseInsensitiveReplace (const string &start, const string &before, const string &after)
 
BASE_EXPORT bool caseInsensitiveContains (const std::vector< string > &all, const string &s2)
 
BASE_EXPORT uint64 caseInsensitiveFind (const std::vector< string > &all, const string &s2)
 
BASE_EXPORT bool checkLeft (const string &s, const string &c)
 
bool equal (const string &s, const string &c)
 
bool contains (const string &s, const string &s2)
 
BASE_EXPORT bool match (const string &keyword, const string &token)
 ‍** More...
 
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<typename T >
base::fs (const string &, [[maybe_unused]] bool throwException=false)
 
template<>
int32 base::fs (const string &in, bool throwException)
 

Detailed Description

QString helper functions, plus some additions.

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