Functions
UStl.h File Reference

Wrappers of STL for convenient functions. More...

#include <list>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
Include dependency graph for UStl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<class V >
void uAppend (std::list< V > &list, const std::list< V > &newItems)
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)
bool uIsDigit (const char c)
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::vector< V >::iterator uIteratorAt (std::vector< V > &v, const unsigned int &pos)
template<class K , class V >
std::list< 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::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)
std::list< std::string > uSplit (const std::string &str, char separator= ' ')
std::list< std::string > uSplitNumChar (const std::string &str)
int uStrNumCmp (const std::string &a, const std::string &b)
template<class K , class 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 >
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::list< 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::map< K, V > &m)
template<class V >
std::list< V > uVectorToList (const std::vector< V > &v)

Detailed Description

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.


Function Documentation

template<class V >
void uAppend ( std::list< V > &  list,
const std::list< V > &  newItems 
) [inline]

Append a list to another list.

Parameters:
listthe list on which the other list will be appended
newItemsthe list of items to be appended

Definition at line 398 of file UStl.h.

template<class V >
bool uContains ( const std::list< V > &  list,
const V &  value 
) [inline]

Check if the list contains the specified value.

Parameters:
listthe list
valuethe value
Returns:
true if the value is found in the list, otherwise false

Definition at line 327 of file UStl.h.

template<class K , class V >
bool uContains ( const std::map< K, V > &  map,
const K &  key 
) [inline]

Check if the map contains the specified key.

Parameters:
mapthe map
keythe key
Returns:
true if the value is found in the map, otherwise false

Definition at line 339 of file UStl.h.

template<class K , class V >
bool uContains ( const std::multimap< K, V > &  map,
const K &  key 
) [inline]

Check if the multimap contains the specified key.

Parameters:
mapthe map
keythe key
Returns:
true if the value is found in the map, otherwise false

Definition at line 351 of file UStl.h.

template<class V >
int uIndexOf ( const std::vector< V > &  list,
const V &  value 
) [inline]

Get the index in the list of the specified value. S negative index is returned if the value is not found.

Parameters:
listthe list
valuethe value
Returns:
the index of the value in the list

Definition at line 411 of file UStl.h.

template<class K , class V >
void uInsert ( std::map< K, V > &  map,
const std::pair< K, V > &  pair 
) [inline]

Insert an item in the map. Contrary to the insert in the STL, if the key already exists, the value will be replaced by the new one.

Definition at line 361 of file UStl.h.

bool uIsDigit ( const char  c) [inline]

Check if a character is a digit.

Parameters:
cthe character
Returns:
if the character is a digit (if c >= '0' && c <= '9')

Definition at line 466 of file UStl.h.

template<class V >
std::list<V>::iterator uIteratorAt ( std::list< V > &  list,
const unsigned int &  pos 
) [inline]

Get the iterator at a specified position in a std::list. If the position is out of range, the result is the end iterator of the list.

Parameters:
listthe list
posthe index position in the list
Returns:
the iterator at the specified index

Definition at line 251 of file UStl.h.

template<class V >
std::list<V>::const_iterator uIteratorAt ( const std::list< V > &  list,
const unsigned int &  pos 
) [inline]

Get the iterator at a specified position in a std::list. If the position is out of range, the result is the end iterator of the list.

Parameters:
listthe list
posthe index position in the list
Returns:
the iterator at the specified index

Definition at line 269 of file UStl.h.

template<class V >
std::vector<V>::iterator uIteratorAt ( std::vector< V > &  v,
const unsigned int &  pos 
) [inline]

Get the iterator at a specified position in a std::vector. If the position is out of range, the result is the end iterator of the vector.

Parameters:
vthe vector
posthe index position in the vector
Returns:
the iterator at the specified index

Definition at line 287 of file UStl.h.

template<class K , class V >
std::list<K> uKeys ( const std::multimap< K, V > &  mm) [inline]

Get all keys from a std::multimap.

Parameters:
mmthe multimap
Returns:
the list which contains all keys (may contains duplicated keys)

Definition at line 68 of file UStl.h.

template<class K , class V >
std::vector<K> uKeys ( const std::map< K, V > &  m) [inline]

Get all keys from a std::map.

Parameters:
mthe map
Returns:
the vector of keys

Definition at line 119 of file UStl.h.

template<class K , class V >
std::list<K> uKeysList ( const std::map< K, V > &  m) [inline]

Get all keys from a std::map.

Parameters:
mthe map
Returns:
the list of keys

Definition at line 137 of file UStl.h.

template<class K , class V >
std::set<K> uKeysSet ( const std::map< K, V > &  m) [inline]

Get all keys from a std::map.

Parameters:
mthe map
Returns:
the set of keys

Definition at line 153 of file UStl.h.

template<class V >
std::vector<V> uListToVector ( const std::list< V > &  list) [inline]

Convert a std::list to a std::vector.

Parameters:
listthe list
Returns:
the vector

Definition at line 376 of file UStl.h.

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!"}

Parameters:
strthe string
separatorthe separator character
Returns:
the list of strings

Definition at line 438 of file UStl.h.

std::list<std::string> uSplitNumChar ( const std::string &  str) [inline]

Split a string into number and character strings. Example:

                std::list<std::string> v = uSplit("Hello 03 my 65 world!");

The list v will contain {"Hello ", "03", " my ", "65", " world!"}

Parameters:
strthe string
Returns:
the list of strings

Definition at line 481 of file UStl.h.

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.
Parameters:
athe first string
bthe second string
Returns:
-1 if a<b, 0 if a=b and 1 if a>b

Definition at line 528 of file UStl.h.

template<class K , class V >
V uTake ( std::map< K, V > &  m,
const K &  key,
const V &  defaultValue = V() 
) [inline]

Get the value of a specified key from a std::map. This will remove the value from the map;

Parameters:
mthe map
keythe key
defaultValuethe default value used if the key is not found
Returns:
the value

Definition at line 227 of file UStl.h.

template<class K , class V >
std::list<K> uUniqueKeys ( const std::multimap< K, V > &  mm) [inline]

Get unique keys from a std::multimap.

Parameters:
mmthe multimap
Returns:
the list which contains unique keys

Definition at line 47 of file UStl.h.

template<class K , class V >
V uValue ( const std::map< K, V > &  m,
const K &  key,
const V &  defaultValue = V() 
) [inline]

Get the value of a specified key from a std::map.

Parameters:
mthe map
keythe key
defaultValuethe default value used if the key is not found
Returns:
the value

Definition at line 207 of file UStl.h.

template<class V >
V& uValueAt ( std::list< V > &  list,
const unsigned int &  pos 
) [inline]

Get the value at a specified position in a std::list. If the position is out of range, the result is undefined.

Parameters:
listthe list
posthe index position in the list
Returns:
the value at the specified index

Definition at line 300 of file UStl.h.

template<class V >
const V& uValueAt ( const std::list< V > &  list,
const unsigned int &  pos 
) [inline]

Get the value at a specified position in a std::list. If the position is out of range, the result is undefined.

Parameters:
listthe list
posthe index position in the list
Returns:
the value at the specified index

Definition at line 314 of file UStl.h.

template<class K , class V >
std::list<V> uValues ( const std::multimap< K, V > &  mm) [inline]

Get all values from a std::multimap.

Parameters:
mmthe multimap
Returns:
the list which contains all values (contains values from duplicated keys)

Definition at line 84 of file UStl.h.

template<class K , class V >
std::list<V> uValues ( const std::multimap< K, V > &  mm,
const K &  key 
) [inline]

Get values for a specified key from a std::multimap.

Parameters:
mmthe multimap
keythe key
Returns:
the list which contains the values of the key

Definition at line 101 of file UStl.h.

template<class K , class V >
std::vector<V> uValues ( const std::map< K, V > &  m) [inline]

Get all values from a std::map.

Parameters:
mthe map
Returns:
the vector of values

Definition at line 171 of file UStl.h.

template<class K , class V >
std::list<V> uValuesList ( const std::map< K, V > &  m) [inline]

Get all values from a std::map.

Parameters:
mthe map
Returns:
the list of values

Definition at line 189 of file UStl.h.

template<class V >
std::list<V> uVectorToList ( const std::vector< V > &  v) [inline]

Convert a std::vector to a std::list.

Parameters:
vthe vector
Returns:
the list

Definition at line 387 of file UStl.h.



find_object_2d
Author(s): Mathieu Labbe
autogenerated on Thu Feb 11 2016 22:57:56