Image Component Library (ICL)
Classes | Namespaces | Functions
StringUtils.h File Reference
#include <ICLUtils/CompatMacros.h>
#include <ICLUtils/BasicTypes.h>
#include <ICLUtils/Exception.h>
#include <ICLUtils/Time.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <iostream>

Go to the source code of this file.

Classes

struct  icl::utils::MatchResult
 Utility structure for matching results. More...
 
struct  icl::utils::MatchResult::Match
 

Namespaces

 icl
 undocument this line if you encounter any issues!
 
 icl::utils
 

Functions

template<class T >
std::ostream & icl::utils::icl_to_stream (std::ostream &s, T t)
 compatibility function that writes a datatype instance into a stream More...
 
template<class T >
std::istream & icl::utils::icl_from_stream (std::istream &s, T &t)
 compability function that reads a datatype instance from a stream More...
 
ICLUtils_API std::string & icl::utils::toLowerI (std::string &s)
 inplace lower case conversion More...
 
ICLUtils_API std::string & icl::utils::toUpperI (std::string &s)
 inplace upper case conversion More...
 
ICLUtils_API std::string icl::utils::toLower (const std::string &s)
 lower case conversion More...
 
ICLUtils_API std::string icl::utils::toUpper (const std::string &s)
 upper case conversion More...
 
ICLUtils_API std::vector< std::string > icl::utils::tok (const std::string &s, const std::string &delims=" ", bool singleCharDelims=true, char escapeChar='\0')
 tokenizes a string with given delimiters (internally using a temporary StrTok instance) More...
 
ICLUtils_API std::vector< std::string > & icl::utils::tok (const std::string &s, const std::string &delim, std::vector< std::string > &dst, bool singleCharDelims=true, char escapeChar='\0')
 tokenize a string with given delimiters into a result vector (optimized) More...
 
ICLUtils_API std::string icl::utils::cat (const std::vector< std::string > &v)
 concatinates at string-vector to a single string More...
 
ICLUtils_API std::string icl::utils::toStr (int i, const char *format, char *buf=0)
 creates a string from a given integer More...
 
ICLUtils_API std::string icl::utils::toStr (double d, const char *format, char *buf=0)
 creates a string from a given double/float More...
 
ICLUtils_API std::string icl::utils::toStr (int i, char *buf=0)
 create a string from given integer using format string "%d" More...
 
ICLUtils_API std::string icl::utils::toStr (double d, char *buf=0)
 create a string from given float using format string "%f" More...
 
template<class T >
std::string icl::utils::str (const T &t)
 convert a data type into a string using an std::ostringstream instance More...
 
template<>
std::string icl::utils::str (const icl8u &t)
 specialized for icl8u More...
 
template<>
std::string icl::utils::str (const bool &b)
 specialized for bool More...
 
template<>
std::string icl::utils::str (const std::string &s)
 specialized for std::string input (this is quiet silly) More...
 
template<>
std::string icl::utils::str (char *const &pc)
 specialized for char const pointers More...
 
template<>
std::string icl::utils::str (const char *const &pc)
 specialized for const char const pointers More...
 
template<class T >
std::string icl::utils::cat (const std::vector< T > &v, const std::string &delim=",")
 creates a delim-separated string of str'ed values of given vector More...
 
template<class T >
icl::utils::parse (const std::string &s)
 parses a string into template parameter (defined for iclXX and std::string) More...
 
template<>
const char * icl::utils::parse (const std::string &s)
 
ICLUtils_API icl8u icl::utils::to8u (const std::string &s)
 cast a string to an icl8u (parse) More...
 
ICLUtils_API icl16s icl::utils::to16s (const std::string &s)
 cast a string to an icl16s (parse) More...
 
ICLUtils_API icl32s icl::utils::to32s (const std::string &s)
 cast a string to an icl32ss (parse) More...
 
ICLUtils_API icl32f icl::utils::to32f (const std::string &s)
 cast a string to an icl32f (parse) More...
 
ICLUtils_API icl64f icl::utils::to64f (const std::string &s)
 cast a string to an icl64f (parse) More...
 
template<class T >
std::vector< T > icl::utils::parseVec (const std::vector< std::string > &v)
 parse a vector of strings into a vector of T's More...
 
template<class T >
std::vector< T > icl::utils::parseVecStr (const std::string &vecStr, const std::string &delims=",")
 parse a delims seperated string into a vector of T's More...
 
template<class T >
std::vector< std::string > icl::utils::strVec (const std::vector< T > &v)
 convert a vector of T's into a vector of strings More...
 
ICLUtils_API MatchResult icl::utils::match (const std::string &text, const std::string &regex, int numSubMatches=0)
 Applies a regular expression match on given text and regex pattern (internally using regex.h) More...
 
ICLUtils_API std::string icl::utils::time2str (Time::value_type x)
 converts a Time::value_type (long int) into a string More...
 
ICLUtils_API std::string icl::utils::skipWhitespaces (const std::string &s)
 crops trailing whitespaces of a string More...
 
ICLUtils_API bool icl::utils::endsWith (const std::string &s, const std::string &suffix)
 returns whether a given string ends with a given suffix More...
 
ICLUtils_API bool icl::utils::startsWith (const std::string &s, const std::string &prefix)
 returns whether a given string begins with a given prefix More...
 
ICLUtils_API void icl::utils::analyseHashes (const std::string &sFileName, unsigned int &nHashes, std::string::size_type &iPostfixPos)
 analyses a file pattern with hash-characters More...