ionflux.org | Impressum

tools.cpp File Reference

Various tools & helper functions implementation. More...

#include "ionflux/tools.hpp"
#include "ionflux/File.hpp"
#include "ionflux/RegExp.hpp"

Include dependency graph for tools.cpp:


Namespaces

namespace  Ionflux
namespace  Ionflux::Tools

Functions

std::string Ionflux::Tools::makeHex (const std::string &inputData)
 Make readable hexadecimal code.
std::string Ionflux::Tools::makeReadable (const std::string &inputData, const std::string &replacement)
 Replace unreadable characters.
std::string Ionflux::Tools::makeNiceHex (const std::string &hex, const std::string &readable, int bytesPerLine, int groupBytes)
 Make nice hexadecimal output.
std::string Ionflux::Tools::sha1 (const std::string &secret, bool hexOut=false)
 Calculate SHA-1 hash.
void Ionflux::Tools::explode (const std::string &bytes, const std::string &splitString, std::vector< std::string > &result)
 Explode a string.
void Ionflux::Tools::explodeQuoted (const std::string &bytes, std::vector< std::string > &result)
 Explode a string.
bool Ionflux::Tools::isOneOf (char c, const std::string &testChars)
 Check type of a character.
bool Ionflux::Tools::isNumber (const std::string &bytes)
 Check whether a string represents a number.
bool Ionflux::Tools::isInteger (const std::string &bytes)
 Check whether a string represents an integer.
bool Ionflux::Tools::isFloat (const std::string &bytes)
 Check whether a string represents a float.
bool Ionflux::Tools::isIdentifier (const std::string &bytes)
 Check whether a string represents an identifier.
std::string Ionflux::Tools::readFile (const std::string &fileName)
 Read a file.
bool Ionflux::Tools::writeFile (const std::string &fileName, const std::string &data, char writeMode)
 Write to file.
bool Ionflux::Tools::bz2Compress (const std::string &inputData, std::string &outputBuffer)
 Compress data.
bool Ionflux::Tools::bz2Decompress (const std::string &inputData, std::string &outputBuffer)
 Decompress data.
std::string Ionflux::Tools::packInt (int data)
 Pack integer.
std::string Ionflux::Tools::packDouble (double data)
 Pack double.
std::string Ionflux::Tools::packBool (bool data)
 Pack boolean.
int Ionflux::Tools::unpackInt (const std::string &data)
 Unpack integer.
double Ionflux::Tools::unpackDouble (const std::string &data)
 Unpack double.
bool Ionflux::Tools::unpackBool (const std::string &data)
 Unpack boolean.
void Ionflux::Tools::socketInit ()
 Initialize socket API.
void Ionflux::Tools::daemonize ()
 Daemonize.
void Ionflux::Tools::socketShutdown ()
 Shutdown socket API.
std::string Ionflux::Tools::parseHex (const std::string &inputData)
 Parse hex string.
void Ionflux::Tools::getPassword (const std::string &prompt, std::string &password)
 Get a password.
void Ionflux::Tools::getRandomBytes (std::string &bytes, unsigned int n, MTRand *source)
 Get random bytes.
void Ionflux::Tools::getRandomIdentifier (std::string &bytes, unsigned int n, MTRand *source)
 Get random identifier.
bool Ionflux::Tools::readDir (const std::string &dirName, std::vector< std::string > &target, bool prependDirName=false, bool recursive=false)
 Read directory entries.
bool Ionflux::Tools::getFileList (const std::vector< std::string > &pathList, std::vector< std::string > &target, bool recursive=false, const std::string &filterExpr="")
 Get file list.
std::string Ionflux::Tools::getCurrentDir ()
 Get current working directory.
int Ionflux::Tools::getOpPrecedence (const std::string &op, bool unary=false)
 Get operator precedence.
std::string Ionflux::Tools::escape (const std::string &source, const std::string &escapeWhat=" '\"")
 Escape string.
std::string Ionflux::Tools::toUpper (const std::string &text, unsigned int numChars=0, unsigned int offset=0)
 Convert string to upper case.
std::string Ionflux::Tools::toLower (const std::string &text, unsigned int numChars=0, unsigned int offset=0)
 Convert string to lower case.
bool Ionflux::Tools::toBool (const std::string &text)
 Convert string to bool.
unsigned int Ionflux::Tools::utf8GetSize (unsigned char byte)
 Get UTF-8 character size.
unsigned int Ionflux::Tools::utf8GetSize (const std::string &bytes)
 Get UTF-8 character string size.
bool Ionflux::Tools::utf8ToUInt (const std::string &bytes, unsigned int &target)
 Convert UTF-8 character to unsigned int.
bool Ionflux::Tools::utf8ToUInt (const std::string &bytes, std::vector< unsigned int > &target)
 Convert UTF-8 character string to unsigned int vector.
std::string Ionflux::Tools::uintToUtf8 (unsigned int uniChar)
 Convert unsigned int to UTF-8 character.
void Ionflux::Tools::uintToUtf8 (const std::vector< unsigned int > &uniChars, std::string &target)
 Convert unsigned int vector to UTF-8 character string.
std::string Ionflux::Tools::utf8Trim (const std::string &bytes, bool leftTrim=true, bool rightTrim=true)
 Trim UTF-8 string.
bool Ionflux::Tools::utf8IsOneOf (unsigned int c, const std::string &testChars)
 Check type of Unicode character.
bool Ionflux::Tools::utf8IsOneOf (unsigned int c, const std::vector< unsigned int > &testChars)
 Check type of Unicode character.
std::string Ionflux::Tools::utf8Escape (const std::string &source)
 Escape UTF-8 string.
std::string Ionflux::Tools::utf8Unescape (const std::string &source)
 Unescape ASCII string.
std::string Ionflux::Tools::quote (const std::string &source, const unsigned char quoteChar= '\'')
 Quote string.
std::string Ionflux::Tools::unquote (const std::string &source, const std::string &addQuoteChars="")
 Unquote string.
std::string Ionflux::Tools::trim (const std::string &bytes, bool leftTrim=true, bool rightTrim=true)
 Trim byte string.
const CharTypeMap & Ionflux::Tools::getCharTypes ()
 Get character type lookup map.
std::string Ionflux::Tools::urlEncode (const std::string &bytes)
 URL-encode bytes.
std::string Ionflux::Tools::urlDecode (const std::string &bytes)
 URL-decode bytes.
std::string Ionflux::Tools::appendDirSeparator (const std::string &path, unsigned char separator=DIR_SEPARATOR)
 Append directory separator.
std::string Ionflux::Tools::prependDirSeparator (const std::string &path, unsigned char separator=DIR_SEPARATOR)
 Prepend directory separator.
bool Ionflux::Tools::validatePath (const std::string &path, int mask=0755)
 Validate path.
std::string Ionflux::Tools::xmlEscape (const std::string &bytes)
 Escape XML markup.
MTRand & Ionflux::Tools::getRandomizer ()
 Get randomizer.

Detailed Description

Various tools & helper functions implementation.


Generated on Tue Mar 14 21:06:19 2006 for Ionflux Tools Class Library (iftools) by  doxygen 1.4.6