xoreos  0.0.5
Namespaces | Functions
strutil.cpp File Reference

Utility templates and functions for working with strings and streams. More...

#include <cctype>
#include <climits>
#include <cerrno>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include "src/common/system.h"
#include "src/common/strutil.h"
#include "src/common/util.h"
#include "src/common/error.h"
#include "src/common/ustring.h"
#include "src/common/scopedptr.h"
#include "src/common/memreadstream.h"
Include dependency graph for strutil.cpp:

Go to the source code of this file.

Namespaces

 Common
 

Functions

void Common::printDataHex (SeekableReadStream &stream, size_t size=SIZE_MAX)
 Print a quick hex dump of the given data. More...
 
void Common::printDataHex (const byte *data, size_t size)
 Print a quick hex dump of the given data. More...
 
static bool Common::tagToString (uint32 tag, bool trim, UString &str)
 
UString Common::debugTag (uint32 tag, bool trim=false)
 Create an elaborate string from an integer tag, for debugging purposes. More...
 
static void Common::errorOnSign (const char *str)
 
static void Common::parse (const char *nptr, char **endptr, signed long long &value)
 
static void Common::parse (const char *nptr, char **endptr, unsigned long long &value)
 
static void Common::parse (const char *nptr, char **endptr, signed long &value)
 
static void Common::parse (const char *nptr, char **endptr, unsigned long &value)
 
static void Common::parse (const char *nptr, char **endptr, signed int &value)
 
static void Common::parse (const char *nptr, char **endptr, unsigned int &value)
 
static void Common::parse (const char *nptr, char **endptr, signed short &value)
 
static void Common::parse (const char *nptr, char **endptr, unsigned short &value)
 
static void Common::parse (const char *nptr, char **endptr, signed char &value)
 
static void Common::parse (const char *nptr, char **endptr, unsigned char &value)
 
static void Common::parse (const char *nptr, char **endptr, float &value)
 
static void Common::parse (const char *nptr, char **endptr, double &value)
 
template<typename T >
void Common::parseString (const UString &str, T &value, bool allowEmpty=false)
 Parse a string into any POD integer, float/double or bool type. More...
 
template<>
void Common::parseString (const UString &str, bool &value, bool allowEmpty)
 
template void Common::parseString< signed char > (const UString &str, signed char &value, bool allowEmpty)
 
template void Common::parseString< unsigned char > (const UString &str, unsigned char &value, bool allowEmpty)
 
template void Common::parseString< signed short > (const UString &str, signed short &value, bool allowEmpty)
 
template void Common::parseString< unsigned short > (const UString &str, unsigned short &value, bool allowEmpty)
 
template void Common::parseString< signed int > (const UString &str, signed int &value, bool allowEmpty)
 
template void Common::parseString< unsigned int > (const UString &str, unsigned int &value, bool allowEmpty)
 
template void Common::parseString< signed long > (const UString &str, signed long &value, bool allowEmpty)
 
template void Common::parseString< unsigned long > (const UString &str, unsigned long &value, bool allowEmpty)
 
template void Common::parseString< signed long long > (const UString &str, signed long long &value, bool allowEmpty)
 
template void Common::parseString< unsigned long long > (const UString &str, unsigned long long &value, bool allowEmpty)
 
template void Common::parseString< float > (const UString &str, float &value, bool allowEmpty)
 
template void Common::parseString< double > (const UString &str, double &value, bool allowEmpty)
 
template<typename T >
UString Common::composeString (T value)
 Convert any POD integer, float/double or bool type into a string. More...
 
template<>
UString Common::composeString (bool value)
 
template<>
UString Common::composeString (float value)
 
template<>
UString Common::composeString (double value)
 
template UString Common::composeString< signed char > (signed char value)
 
template UString Common::composeString< unsigned char > (unsigned char value)
 
template UString Common::composeString< signed short > (signed short value)
 
template UString Common::composeString< unsigned short > (unsigned short value)
 
template UString Common::composeString< signed int > (signed int value)
 
template UString Common::composeString< unsigned int > (unsigned int value)
 
template UString Common::composeString< signed long > (signed long value)
 
template UString Common::composeString< unsigned long > (unsigned long value)
 
template UString Common::composeString< signed long long > (signed long long value)
 
template UString Common::composeString< unsigned long long > (unsigned long long value)
 
size_t Common::searchBackwards (SeekableReadStream &haystack, const byte *needle, size_t needleSize, size_t maxReadBack=SIZE_MAX)
 Search the stream, backwards, for the last occurrence of a set of bytes. More...
 

Detailed Description

Utility templates and functions for working with strings and streams.

Definition in file strutil.cpp.