Wrappers of STL for convenient functions. More...
#include <list>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <stdlib.h>
Go to the source code of this file.
Functions | |
template<class V > | |
void | uAppend (std::list< V > &list, const std::list< V > &newItems) |
int | uCompareVersion (const std::string &version, int major, int minor=-1, int patch=-1) |
template<class V > | |
bool | uContains (const std::list< V > &list, const V &value) |
template<class K , class V > | |
bool | uContains (const std::map< K, V > &map, const K &key) |
template<class K , class V > | |
bool | uContains (const std::multimap< K, V > &map, const K &key) |
template<class V > | |
int | uIndexOf (const std::vector< V > &list, const V &value) |
template<class K , class V > | |
void | uInsert (std::map< K, V > &map, const std::pair< K, V > &pair) |
template<class K , class V > | |
void | uInsert (std::map< K, V > &map, const std::map< K, V > &items) |
bool | uIsDigit (const char c) |
bool | uIsInteger (const std::string &str, bool checkForSign=true) |
bool | uIsNumber (const std::string &str) |
template<class V > | |
std::list< V >::iterator | uIteratorAt (std::list< V > &list, const unsigned int &pos) |
template<class V > | |
std::list< V >::const_iterator | uIteratorAt (const std::list< V > &list, const unsigned int &pos) |
template<class V > | |
std::set< V >::iterator | uIteratorAt (std::set< V > &set, const unsigned int &pos) |
template<class V > | |
std::set< V >::const_iterator | uIteratorAt (const std::set< V > &set, const unsigned int &pos) |
template<class V > | |
std::vector< V >::iterator | uIteratorAt (std::vector< V > &v, const unsigned int &pos) |
template<class V > | |
std::vector< V >::const_iterator | uIteratorAt (const std::vector< V > &v, const unsigned int &pos) |
std::string | uJoin (const std::list< std::string > &strings, const std::string &separator="") |
template<class K , class V > | |
std::vector< K > | uKeys (const std::multimap< K, V > &mm) |
template<class K , class V > | |
std::vector< K > | uKeys (const std::map< K, V > &m) |
template<class K , class V > | |
std::list< K > | uKeysList (const std::multimap< K, V > &mm) |
template<class K , class V > | |
std::list< K > | uKeysList (const std::map< K, V > &m) |
template<class K , class V > | |
std::set< K > | uKeysSet (const std::map< K, V > &m) |
template<class V > | |
std::vector< V > | uListToVector (const std::list< V > &list) |
template<class K , class V > | |
std::map< K, V > | uMultimapToMap (const std::multimap< K, V > &m) |
template<class K , class V > | |
std::map< K, V > | uMultimapToMapUnique (const std::multimap< K, V > &m) |
std::list< std::string > | uSplit (const std::string &str, char separator= ' ') |
std::list< std::string > | uSplitNumChar (const std::string &str) |
bool | uStrContains (const std::string &string, const std::string &substring) |
int | uStrNumCmp (const std::string &a, const std::string &b) |
template<class K , class V > | |
V | uTake (std::map< K, V > &m, const K &key, const V &defaultValue=V()) |
template<class K , class V > | |
std::list< K > | uUniqueKeys (const std::multimap< K, V > &mm) |
template<class K , class V > | |
V | uValue (const std::map< K, V > &m, const K &key, const V &defaultValue=V()) |
template<class V > | |
V & | uValueAt (std::list< V > &list, const unsigned int &pos) |
template<class V > | |
const V & | uValueAt (const std::list< V > &list, const unsigned int &pos) |
template<class K , class V > | |
std::vector< V > | uValues (const std::multimap< K, V > &mm) |
template<class K , class V > | |
std::list< V > | uValues (const std::multimap< K, V > &mm, const K &key) |
template<class K , class V > | |
std::vector< V > | uValues (const std::map< K, V > &m) |
template<class K , class V > | |
std::list< V > | uValuesList (const std::multimap< K, V > &mm) |
template<class K , class V > | |
std::list< V > | uValuesList (const std::map< K, V > &m) |
template<class V > | |
std::list< V > | uVectorToList (const std::vector< V > &v) |
Wrappers of STL for convenient functions.
All functions you will find here are here for the use of STL in a more convenient way.
Definition in file UStl.h.
void uAppend | ( | std::list< V > & | list, |
const std::list< V > & | newItems | ||
) | [inline] |
int uCompareVersion | ( | const std::string & | version, |
int | major, | ||
int | minor = -1 , |
||
int | patch = -1 |
||
) | [inline] |
bool uContains | ( | const std::list< V > & | list, |
const V & | value | ||
) | [inline] |
bool uContains | ( | const std::map< K, V > & | map, |
const K & | key | ||
) | [inline] |
bool uContains | ( | const std::multimap< K, V > & | map, |
const K & | key | ||
) | [inline] |
int uIndexOf | ( | const std::vector< V > & | list, |
const V & | value | ||
) | [inline] |
void uInsert | ( | std::map< K, V > & | map, |
const std::pair< K, V > & | pair | ||
) | [inline] |
void uInsert | ( | std::map< K, V > & | map, |
const std::map< K, V > & | items | ||
) | [inline] |
bool uIsDigit | ( | const char | c | ) | [inline] |
bool uIsInteger | ( | const std::string & | str, |
bool | checkForSign = true |
||
) | [inline] |
bool uIsNumber | ( | const std::string & | str | ) | [inline] |
std::list<V>::iterator uIteratorAt | ( | std::list< V > & | list, |
const unsigned int & | pos | ||
) | [inline] |
std::list<V>::const_iterator uIteratorAt | ( | const std::list< V > & | list, |
const unsigned int & | pos | ||
) | [inline] |
std::set<V>::iterator uIteratorAt | ( | std::set< V > & | set, |
const unsigned int & | pos | ||
) | [inline] |
std::set<V>::const_iterator uIteratorAt | ( | const std::set< V > & | set, |
const unsigned int & | pos | ||
) | [inline] |
std::vector<V>::iterator uIteratorAt | ( | std::vector< V > & | v, |
const unsigned int & | pos | ||
) | [inline] |
std::vector<V>::const_iterator uIteratorAt | ( | const std::vector< V > & | v, |
const unsigned int & | pos | ||
) | [inline] |
std::string uJoin | ( | const std::list< std::string > & | strings, |
const std::string & | separator = "" |
||
) | [inline] |
Join multiple strings into one string with optional separator. Example:
std::list<std::string> v; v.push_back("Hello"); v.push_back("world!"); std::string joined = split(v, " ");
The output string is "Hello world!"
strings | a list of strings |
separator | the separator string |
std::vector<K> uKeys | ( | const std::multimap< K, V > & | mm | ) | [inline] |
std::vector<K> uKeys | ( | const std::map< K, V > & | m | ) | [inline] |
std::list<K> uKeysList | ( | const std::multimap< K, V > & | mm | ) | [inline] |
std::list<K> uKeysList | ( | const std::map< K, V > & | m | ) | [inline] |
std::set<K> uKeysSet | ( | const std::map< K, V > & | m | ) | [inline] |
std::vector<V> uListToVector | ( | const std::list< V > & | list | ) | [inline] |
std::map<K, V> uMultimapToMap | ( | const std::multimap< K, V > & | m | ) | [inline] |
Convert a std::multimap to a std::map
std::map<K, V> uMultimapToMapUnique | ( | const std::multimap< K, V > & | m | ) | [inline] |
std::list<std::string> uSplit | ( | const std::string & | str, |
char | separator = ' ' |
||
) | [inline] |
Split a string into multiple string around the specified separator. Example:
std::list<std::string> v = split("Hello the world!", ' ');
The list v will contain {"Hello", "the", "world!"}
str | the string |
separator | the separator character |
std::list<std::string> uSplitNumChar | ( | const std::string & | str | ) | [inline] |
bool uStrContains | ( | const std::string & | string, |
const std::string & | substring | ||
) | [inline] |
int uStrNumCmp | ( | const std::string & | a, |
const std::string & | b | ||
) | [inline] |
Compare two alphanumeric strings. Useful to sort filenames (human-like sorting). Example:
std::string a = "Image9.jpg"; std::string b = "Image10.jpg"; int r = uStrNumCmp(a, b); // r returns -1 (a is smaller than b). In contrast, std::strcmp(a, b) would return 1.
a | the first string |
b | the second string |
V uTake | ( | std::map< K, V > & | m, |
const K & | key, | ||
const V & | defaultValue = V() |
||
) | [inline] |
std::list<K> uUniqueKeys | ( | const std::multimap< K, V > & | mm | ) | [inline] |
V uValue | ( | const std::map< K, V > & | m, |
const K & | key, | ||
const V & | defaultValue = V() |
||
) | [inline] |
V& uValueAt | ( | std::list< V > & | list, |
const unsigned int & | pos | ||
) | [inline] |
const V& uValueAt | ( | const std::list< V > & | list, |
const unsigned int & | pos | ||
) | [inline] |
std::vector<V> uValues | ( | const std::multimap< K, V > & | mm | ) | [inline] |
std::list<V> uValues | ( | const std::multimap< K, V > & | mm, |
const K & | key | ||
) | [inline] |
std::vector<V> uValues | ( | const std::map< K, V > & | m | ) | [inline] |
std::list<V> uValuesList | ( | const std::multimap< K, V > & | mm | ) | [inline] |
std::list<V> uValuesList | ( | const std::map< K, V > & | m | ) | [inline] |
std::list<V> uVectorToList | ( | const std::vector< V > & | v | ) | [inline] |