GetSet  .9
A c++ library for load/saving typed and named properties and automatic GUI.
StringUtil.hxx File Reference
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <vector>

Go to the source code of this file.

Macros

#define STRING_UTIL_VECTOR_SPECIALIZATION(TYPE)

Functions

template<typename T >
std::string toString (const T &in)
template<typename T >
stringTo (const std::string &in)
template<>
std::string toString (const std::string &in)
template<>
std::string stringTo (const std::string &in)
template<>
std::string toString (const bool &in)
template<typename T >
std::string vectorToString (const std::vector< T > &in, const std::string &delim=" ")
template<typename T >
std::vector< T > stringToVector (const std::string &in, const char delim=' ')
template<>
std::string toString (const std::vector< bool > &in)
template<>
std::string toString (const std::vector< int > &in)
template<>
std::string toString (const std::vector< double > &in)
template<>
std::string toString (const std::vector< std::string > &in)
void rtrim (std::string &str, const std::string &t=" \t")
 Right trim.
void ltrim (std::string &str, const std::string &t=" \t")
 Left trim.
void trim (std::string &str, const std::string &t=" \t")
 Trim.
std::string splitRight (std::string &str, const std::string &delim)
 Remove the part right of last occurence of delim and return it.
std::string splitNameFromPath (std::string &path)
 Remove filename from an absolute path and return it.
template<typename T >
std::string toString (T in, int width, char fill='0')
 Overload of string conversion for specific lengths.
std::vector< std::pair< int,
std::string > > 
listFileNameEnum (std::string prefix, std::string postfix, int width, int minidx=0, int maxidx=0)
 Scan for files matching path pattern prefix###postfix, where ### is a number between 0 and max.

Macro Definition Documentation

#define STRING_UTIL_VECTOR_SPECIALIZATION (   TYPE)
Value:
template <> inline std::string toString<>(const std::vector<TYPE>& in) {return vectorToString(in);} \
template <> inline std::vector<TYPE> stringTo<>(const std::string& in) {return stringToVector<TYPE>(in);}

Function Documentation

std::vector<std::pair<int,std::string> > listFileNameEnum ( std::string  prefix,
std::string  postfix,
int  width,
int  minidx = 0,
int  maxidx = 0 
)
inline

Scan for files matching path pattern prefix###postfix, where ### is a number between 0 and max.

void ltrim ( std::string &  str,
const std::string &  t = " \t" 
)
inline

Left trim.

void rtrim ( std::string &  str,
const std::string &  t = " \t" 
)
inline

Right trim.

std::string splitNameFromPath ( std::string &  path)
inline

Remove filename from an absolute path and return it.

std::string splitRight ( std::string &  str,
const std::string &  delim 
)
inline

Remove the part right of last occurence of delim and return it.

template<typename T >
T stringTo ( const std::string &  in)
inline
template<>
std::vector< std::string > stringTo ( const std::string &  in)
inline
template<typename T >
std::vector<T> stringToVector ( const std::string &  in,
const char  delim = ' ' 
)
inline
template<typename T >
std::string toString ( const T &  in)
inline
template<>
std::string toString ( const std::string &  in)
inline
template<>
std::string toString ( const bool &  in)
inline
template<>
std::string toString ( const std::vector< bool > &  in)
inline
template<>
std::string toString ( const std::vector< int > &  in)
inline
template<>
std::string toString ( const std::vector< double > &  in)
inline
template<>
std::string toString ( const std::vector< std::string > &  in)
inline
template<typename T >
std::string toString ( in,
int  width,
char  fill = '0' 
)
inline

Overload of string conversion for specific lengths.

void trim ( std::string &  str,
const std::string &  t = " \t" 
)
inline

Trim.

template<typename T >
std::string vectorToString ( const std::vector< T > &  in,
const std::string &  delim = " " 
)
inline