ui-utilcpp 1.10.3
Data Structures | Namespaces | Typedefs | Functions
Text.hpp File Reference

Text, descriptors and sockets. More...

#include <string>
#include <vector>
#include <map>
#include <list>
#include <sstream>
#include <memory>
#include <cassert>
#include <iomanip>
#include <cerrno>
#include <ui-utilcpp/auto_ptr_compat.hpp>
#include <ui-utilcpp/Exception.hpp>
#include <boost/random.hpp>
Include dependency graph for Text.hpp:
This graph shows which files directly or indirectly include this file:

Data Structures

class  UI::Util::AlphaNumericKey
 Class using boost::mt19937 as random engine. More...
 
class  UI::Util::CStrArray
 Helper to construct/use C-String arrays ("char **"), occasionally needed by some c functions. More...
 
class  UI::Util::XConversion
 a class to convert between different systems. More...
 

Namespaces

namespace  UI
 Namespace for any Schlund+Partner C++ code.
 
namespace  UI::Util
 Namespace for ui-utilcpp.
 

Typedefs

typedef std::ios_base &(* UI::Util::StreamModifier) (std::ios_base &)
 Stream modifier function (is there a std:: type??).
 
Shortcuts for often used types and convenience stream operators.
typedef std::vector< std::string > UI::Util::StrVec
 
typedef std::list< std::string > UI::Util::StrList
 
typedef std::map< std::string, std::string > UI::Util::StrMap
 

Functions

std::string UI::Util::strVec2Str (StrVec const &strVec, std::string const &sep)
 
std::string UI::Util::strerror (int const &errNo=errno)
 Save wrapper for strerror. Always use this instead of strerror directly.
 
std::string UI::Util::getlineCRLF (std::istream &s)
 Like std::getline, but also rips of trailing "CR" when line break was CRLF.
 
std::string UI::Util::asciiCAPS (std::string const &in, bool const upper=true)
 ASCII CAPS converter for strings (using std::tolower|upper).
 
std::string & UI::Util::str2Ascii (std::string &s)
 Replace all non-ASCII characters to '?' in string.
 
template<typename T >
T UI::Util::Default ()
 Defaults values for some types via template specialization.
 
template<>
int UI::Util::Default< int > ()
 Default-Specialising.
 
template<>
float UI::Util::Default< float > ()
 Default-Specialising.
 
template<>
double UI::Util::Default< double > ()
 Default-Specialising.
 
template<>
long int UI::Util::Default< long int > ()
 Default-Specialising.
 
template<>
bool UI::Util::Default< bool > ()
 Default-Specialising.
 
template<>
std::string UI::Util::Default< std::string > ()
 Default-Specialising.
 
template<typename out_type >
std::pair< out_type, boolUI::Util::eato (std::string const &t, StreamModifier const m=0)
 String-to-anything converter with error handling.
 
template<typename out_type >
out_type UI::Util::ato (std::string const &t, StreamModifier const m=0)
 String-to-anything converter with default values on error.
 
template<typename in_type >
std::pair< std::string, boolUI::Util::etos (in_type const &t, StreamModifier const m=0, int w=0, char f=' ')
 Anything-to-string converter with error handling.
 
charUI::Util::strdup (char const *s)
 BSD style "strdup" implementation (is not C standard). See strdup(3).
 
template<typename C >
C UI::Util::strtok (std::string const &s, std::string const &delim=",", std::string const &prefix="", std::string const &postfix="")
 Generate any STL container of strings from a token string.
 
StrVec UI::Util::strtok (std::string const &s, std::string const &delim, std::string const &prefix, std::string const &postfix)
 
template<typename C >
C UI::Util::strtoks (std::string const &s, std::string const &delims=",", std::string const &prefix="", std::string const &postfix="")
 Like strtok, but you can use a list of one-char delimiters (delims in strtoks) instead of a fixed delimiter string (delim in strtok).
 
StrVec UI::Util::strtoks (std::string const &s, std::string const &delims, std::string const &prefix, std::string const &postfix)
 
template<typename C >
std::string UI::Util::join (std::string const &expr, C const &list)
 join a list,vector,set, ... with the connector string
 
template<typename Byte >
std::vector< ByteUI::Util::istream2Vector (std::istream &f, int const blockSize=1024)
 Read any stream into any byte vector.
 
std::string UI::Util::istream2String (std::istream &f, int const blockSize=1024)
 Istream-to-string converter.
 
std::string UI::Util::md5sum (std::string const &data)
 
Anything-to-string converter with empty string on error. @see etos.
template<typename in_type >
std::string UI::Util::tos (in_type const &t, StreamModifier const m=0, int w=0, char f=' ')
 
template<typename in_type >
std::string UI::Util::tos (in_type const &t, int w, char f=' ')
 
Check whether token is in tokens.
bool UI::Util::isToken (std::string const &token, StrVec const &tokensVec, int const match)
 
bool UI::Util::isToken (std::string const &token, std::string const &tokens, std::string const &delim, int const match)
 
Mass string replace.
std::string & UI::Util::strrpl (std::string &source, std::string const &token, std::string const &reptoken)
 
std::string UI::Util::strrpl (std::string const &source, std::string const &token, std::string const &reptoken)
 
Some convenience stream operators.
std::ostream & operator<< (std::ostream &os, UI::Util::StrVec const &sv)
 
std::ostream & operator<< (std::ostream &os, UI::Util::StrList const &sl)
 

Generate arbitrary length pseudo random keys with alphanumeric ASCII characters.

std::string UI::Util::genAlphaNumericKey (int len=8)
 For compatibility only.
 

Detailed Description

Text, descriptors and sockets.