ionflux.org | Impressum

General tools

Collaboration diagram for General tools:

General tools and utility classes and functions. More...

Classes

class  Ionflux::Tools::ByteDump
 Byte dump. More...
class  Ionflux::Tools::Canvas
 Drawing canvas. More...
class  Ionflux::Tools::ClassInfo
 Class information. More...
struct  Ionflux::Tools::Color
 Color. More...
struct  Ionflux::Tools::Color8bpp
 Color (8 bits per pixel, RGBA). More...
class  Ionflux::Tools::EMailAddress
 EMail address. More...
class  Ionflux::Tools::File
 File. More...
class  Ionflux::Tools::GtkCairoArea
 GTK+/Cairo drawing area. More...
class  Ionflux::Tools::ManagedObject
 Base class for managed objects. More...
class  Ionflux::Tools::Object
 Object. More...

Typedefs

typedef std::map< const std::string,
const Color * > 
Ionflux::Tools::ColorMap
 Maps for color lookup by name.

Functions

Color8bpp Ionflux::Tools::to8bpp (const Color &color)
 Get 8 bpp representation.
std::string Ionflux::Tools::toHex (const Color &color)
 Get hexadecimal representation.
Color Ionflux::Tools::createColorFromHex (const std::string &hexColor)
 Create color from hexadecimal representation.
void Ionflux::Tools::addBasicColors (ColorMap &colorMap)
 Add basic colors.
const Color * Ionflux::Tools::getByName (const std::string &colorName, ColorMap &colorMap)
 Get color by name.
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::isAlpha (const std::string &bytes)
 Check whether a string represents an alpha.
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::socketShutdown ()
 Shutdown socket API.
void Ionflux::Tools::daemonize ()
 Daemonize.
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.
std::string Ionflux::Tools::getCurrentDir ()
 Get current working directory.
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.
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.

Variables

const Color Ionflux::Tools::COLOR_ALICEBLUE
 Basic colors as defined by the SVG 1.1 specification.
const Color Ionflux::Tools::COLOR_ANTIQUEWHITE
const Color Ionflux::Tools::COLOR_AQUA
const Color Ionflux::Tools::COLOR_AQUAMARINE
const Color Ionflux::Tools::COLOR_AZURE
const Color Ionflux::Tools::COLOR_BEIGE
const Color Ionflux::Tools::COLOR_BISQUE
const Color Ionflux::Tools::COLOR_BLACK
const Color Ionflux::Tools::COLOR_BLANCHEDALMOND
const Color Ionflux::Tools::COLOR_BLUE
const Color Ionflux::Tools::COLOR_BLUEVIOLET
const Color Ionflux::Tools::COLOR_BROWN
const Color Ionflux::Tools::COLOR_BURLYWOOD
const Color Ionflux::Tools::COLOR_CADETBLUE
const Color Ionflux::Tools::COLOR_CHARTREUSE
const Color Ionflux::Tools::COLOR_CHOCOLATE
const Color Ionflux::Tools::COLOR_CORAL
const Color Ionflux::Tools::COLOR_CORNFLOWERBLUE
const Color Ionflux::Tools::COLOR_CORNSILK
const Color Ionflux::Tools::COLOR_CRIMSON
const Color Ionflux::Tools::COLOR_CYAN
const Color Ionflux::Tools::COLOR_DARKBLUE
const Color Ionflux::Tools::COLOR_DARKCYAN
const Color Ionflux::Tools::COLOR_DARKGOLDENROD
const Color Ionflux::Tools::COLOR_DARKGRAY
const Color Ionflux::Tools::COLOR_DARKGREEN
const Color Ionflux::Tools::COLOR_DARKGREY
const Color Ionflux::Tools::COLOR_DARKKHAKI
const Color Ionflux::Tools::COLOR_DARKMAGENTA
const Color Ionflux::Tools::COLOR_DARKOLIVEGREEN
const Color Ionflux::Tools::COLOR_DARKORANGE
const Color Ionflux::Tools::COLOR_DARKORCHID
const Color Ionflux::Tools::COLOR_DARKRED
const Color Ionflux::Tools::COLOR_DARKSALMON
const Color Ionflux::Tools::COLOR_DARKSEAGREEN
const Color Ionflux::Tools::COLOR_DARKSLATEBLUE
const Color Ionflux::Tools::COLOR_DARKSLATEGRAY
const Color Ionflux::Tools::COLOR_DARKSLATEGREY
const Color Ionflux::Tools::COLOR_DARKTURQUOISE
const Color Ionflux::Tools::COLOR_DARKVIOLET
const Color Ionflux::Tools::COLOR_DEEPPINK
const Color Ionflux::Tools::COLOR_DEEPSKYBLUE
const Color Ionflux::Tools::COLOR_DIMGRAY
const Color Ionflux::Tools::COLOR_DIMGREY
const Color Ionflux::Tools::COLOR_DODGERBLUE
const Color Ionflux::Tools::COLOR_FIREBRICK
const Color Ionflux::Tools::COLOR_FLORALWHITE
const Color Ionflux::Tools::COLOR_FORESTGREEN
const Color Ionflux::Tools::COLOR_FUCHSIA
const Color Ionflux::Tools::COLOR_GAINSBORO
const Color Ionflux::Tools::COLOR_GHOSTWHITE
const Color Ionflux::Tools::COLOR_GOLD
const Color Ionflux::Tools::COLOR_GOLDENROD
const Color Ionflux::Tools::COLOR_GRAY
const Color Ionflux::Tools::COLOR_GREY
const Color Ionflux::Tools::COLOR_GREEN
const Color Ionflux::Tools::COLOR_GREENYELLOW
const Color Ionflux::Tools::COLOR_HONEYDEW
const Color Ionflux::Tools::COLOR_HOTPINK
const Color Ionflux::Tools::COLOR_INDIANRED
const Color Ionflux::Tools::COLOR_INDIGO
const Color Ionflux::Tools::COLOR_IVORY
const Color Ionflux::Tools::COLOR_KHAKI
const Color Ionflux::Tools::COLOR_LAVENDER
const Color Ionflux::Tools::COLOR_LAVENDERBLUSH
const Color Ionflux::Tools::COLOR_LAWNGREEN
const Color Ionflux::Tools::COLOR_LEMONCHIFFON
const Color Ionflux::Tools::COLOR_LIGHTBLUE
const Color Ionflux::Tools::COLOR_LIGHTCORAL
const Color Ionflux::Tools::COLOR_LIGHTCYAN
const Color Ionflux::Tools::COLOR_LIGHTGOLDENRODYELLOW
const Color Ionflux::Tools::COLOR_LIGHTGRAY
const Color Ionflux::Tools::COLOR_LIGHTGREEN
const Color Ionflux::Tools::COLOR_LIGHTGREY
const Color Ionflux::Tools::COLOR_LIGHTPINK
const Color Ionflux::Tools::COLOR_LIGHTSALMON
const Color Ionflux::Tools::COLOR_LIGHTSEAGREEN
const Color Ionflux::Tools::COLOR_LIGHTSKYBLUE
const Color Ionflux::Tools::COLOR_LIGHTSLATEGRAY
const Color Ionflux::Tools::COLOR_LIGHTSLATEGREY
const Color Ionflux::Tools::COLOR_LIGHTSTEELBLUE
const Color Ionflux::Tools::COLOR_LIGHTYELLOW
const Color Ionflux::Tools::COLOR_LIME
const Color Ionflux::Tools::COLOR_LIMEGREEN
const Color Ionflux::Tools::COLOR_LINEN
const Color Ionflux::Tools::COLOR_MAGENTA
const Color Ionflux::Tools::COLOR_MAROON
const Color Ionflux::Tools::COLOR_MEDIUMAQUAMARINE
const Color Ionflux::Tools::COLOR_MEDIUMBLUE
const Color Ionflux::Tools::COLOR_MEDIUMORCHID
const Color Ionflux::Tools::COLOR_MEDIUMPURPLE
const Color Ionflux::Tools::COLOR_MEDIUMSEAGREEN
const Color Ionflux::Tools::COLOR_MEDIUMSLATEBLUE
const Color Ionflux::Tools::COLOR_MEDIUMSPRINGGREEN
const Color Ionflux::Tools::COLOR_MEDIUMTURQUOISE
const Color Ionflux::Tools::COLOR_MEDIUMVIOLETRED
const Color Ionflux::Tools::COLOR_MIDNIGHTBLUE
const Color Ionflux::Tools::COLOR_MINTCREAM
const Color Ionflux::Tools::COLOR_MISTYROSE
const Color Ionflux::Tools::COLOR_MOCCASIN
const Color Ionflux::Tools::COLOR_NAVAJOWHITE
const Color Ionflux::Tools::COLOR_NAVY
const Color Ionflux::Tools::COLOR_OLDLACE
const Color Ionflux::Tools::COLOR_OLIVE
const Color Ionflux::Tools::COLOR_OLIVEDRAB
const Color Ionflux::Tools::COLOR_ORANGE
const Color Ionflux::Tools::COLOR_ORANGERED
const Color Ionflux::Tools::COLOR_ORCHID
const Color Ionflux::Tools::COLOR_PALEGOLDENROD
const Color Ionflux::Tools::COLOR_PALEGREEN
const Color Ionflux::Tools::COLOR_PALETURQUOISE
const Color Ionflux::Tools::COLOR_PALEVIOLETRED
const Color Ionflux::Tools::COLOR_PAPAYAWHIP
const Color Ionflux::Tools::COLOR_PEACHPUFF
const Color Ionflux::Tools::COLOR_PERU
const Color Ionflux::Tools::COLOR_PINK
const Color Ionflux::Tools::COLOR_PLUM
const Color Ionflux::Tools::COLOR_POWDERBLUE
const Color Ionflux::Tools::COLOR_PURPLE
const Color Ionflux::Tools::COLOR_RED
const Color Ionflux::Tools::COLOR_ROSYBROWN
const Color Ionflux::Tools::COLOR_ROYALBLUE
const Color Ionflux::Tools::COLOR_SADDLEBROWN
const Color Ionflux::Tools::COLOR_SALMON
const Color Ionflux::Tools::COLOR_SANDYBROWN
const Color Ionflux::Tools::COLOR_SEAGREEN
const Color Ionflux::Tools::COLOR_SEASHELL
const Color Ionflux::Tools::COLOR_SIENNA
const Color Ionflux::Tools::COLOR_SILVER
const Color Ionflux::Tools::COLOR_SKYBLUE
const Color Ionflux::Tools::COLOR_SLATEBLUE
const Color Ionflux::Tools::COLOR_SLATEGRAY
const Color Ionflux::Tools::COLOR_SLATEGREY
const Color Ionflux::Tools::COLOR_SNOW
const Color Ionflux::Tools::COLOR_SPRINGGREEN
const Color Ionflux::Tools::COLOR_STEELBLUE
const Color Ionflux::Tools::COLOR_TAN
const Color Ionflux::Tools::COLOR_TEAL
const Color Ionflux::Tools::COLOR_THISTLE
const Color Ionflux::Tools::COLOR_TOMATO
const Color Ionflux::Tools::COLOR_TURQUOISE
const Color Ionflux::Tools::COLOR_VIOLET
const Color Ionflux::Tools::COLOR_WHEAT
const Color Ionflux::Tools::COLOR_WHITE
const Color Ionflux::Tools::COLOR_WHITESMOKE
const Color Ionflux::Tools::COLOR_YELLOW
const Color Ionflux::Tools::COLOR_YELLOWGREEN
const Color Ionflux::Tools::COLOR_NONE
 Basic colors defined by the Ionflux Tools.
const Color Ionflux::Tools::COLOR_GREY_10
const Color Ionflux::Tools::COLOR_GREY_20
const Color Ionflux::Tools::COLOR_GREY_30
const Color Ionflux::Tools::COLOR_GREY_40
const Color Ionflux::Tools::COLOR_GREY_50
const Color Ionflux::Tools::COLOR_GREY_60
const Color Ionflux::Tools::COLOR_GREY_70
const Color Ionflux::Tools::COLOR_GREY_80
const Color Ionflux::Tools::COLOR_GREY_90
const std::string Ionflux::Tools::MODULE_NAME = "Ionflux Tools"
 Module name.
const std::string Ionflux::Tools::MODULE_VERSION = "0.2.3"
 Module version.
const int Ionflux::Tools::READ_BUFFER_SIZE = 1024
 Default size for read buffers.
const int Ionflux::Tools::COMPRESS_BUFFER_SIZE = 1024
 Default size for compression (and decompression) buffers.
const int Ionflux::Tools::DIR_BUFFER_SIZE = 1024
 Default size for directory name buffers.
const int Ionflux::Tools::DIR_BUFFER_SIZE_MAX = 65536
 Maximum size for directory name buffers.
const char Ionflux::Tools::DIR_SEPARATOR = '/'
 Directory separator.

Detailed Description

General tools and utility classes and functions.


Typedef Documentation

typedef std::map<const std::string, const Color*> Ionflux::Tools::ColorMap
 

Maps for color lookup by name.


Function Documentation

void Ionflux::Tools::addBasicColors ColorMap colorMap  ) 
 

Add basic colors.

Add basic colors to a color map.

Parameters:
colorMap Color map.

std::string Ionflux::Tools::appendDirSeparator const std::string &  path,
unsigned char  separator = DIR_SEPARATOR
 

Append directory separator.

Append directory separator to path, if not already present.

Parameters:
path Path to which a directory separator should be appended.
separator Directory separator to be used.
Returns:
Path with directory separator appended.

bool Ionflux::Tools::bz2Compress const std::string &  inputData,
std::string &  outputBuffer
 

Compress data.

Compresses data using bzip2.

Parameters:
inputData The data to be compressed.
outputBuffer Where to store the compressed data.
Returns:
true on success, false otherwise.

bool Ionflux::Tools::bz2Decompress const std::string &  inputData,
std::string &  outputBuffer
 

Decompress data.

Decompresses data using bzip2.

Parameters:
inputData The data to be decompressed.
outputBuffer Where to store the decompressed data.
Returns:
true on success, false otherwise.

Color Ionflux::Tools::createColorFromHex const std::string &  hexColor  ) 
 

Create color from hexadecimal representation.

Create a color from a hexadecimal representation.

Parameters:
hexColor Hexadecimal color.
Returns:
Color.

void Ionflux::Tools::daemonize  ) 
 

Daemonize.

Detaches the process from the terminal.

std::string Ionflux::Tools::escape const std::string &  source,
const std::string &  escapeWhat = " '\""
 

Escape string.

Escapes a string so it may be used (for example) with a function like explodeQuoted(), or anything else thar requires quotes and whitespace to be escaped.

Parameters:
source String to be escaped.
escapeWhat Characters which should be escaped.
Returns:
Escaped string.
See also:
explodeQuoted()

void Ionflux::Tools::explode const std::string &  bytes,
const std::string &  splitString,
std::vector< std::string > &  result
 

Explode a string.

Splits up a string of bytes at 'splitString', creating a vector containing the separated elements.

Parameters:
bytes Byte String to be exploded.
splitString Separator string.
result Vector to store the result in.

void Ionflux::Tools::explodeQuoted const std::string &  bytes,
std::vector< std::string > &  result
 

Explode a string.

Explodes a string using whitespace separators. Quoted parts of the string are treated as a single element. Valid quote characters are ' and ". Quote characters may be escaped using '\'.

Parameters:
bytes Byte String to be exploded.
result Vector to store the result in.

const Color * Ionflux::Tools::getByName const std::string &  colorName,
ColorMap colorMap
 

Get color by name.

Get a color from a color map by name.

Parameters:
colorName Color name.
colorMap Color map.
Returns:
Color with specified name, or 0 if no matching color is found.

const CharTypeMap & Ionflux::Tools::getCharTypes  ) 
 

Get character type lookup map.

Get a static character type lookup map.

Returns:
Character type lookup map.

std::string Ionflux::Tools::getCurrentDir  ) 
 

Get current working directory.

Returns:
The current working directory.

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.

Get a list of files from a list of paths. The specified paths may be searched recursively and an optional regular expression may be specified as a filter.

Parameters:
pathList List of files and directories.
target Where to store the file names.
recursive Whether to search for files recursively.
filterExpr Regular expression to match file names with.
Returns:
true on success, false otherwise.

int Ionflux::Tools::getOpPrecedence const std::string &  op,
bool  unary = false
 

Get operator precedence.

Get a numeric value indicating the order of precedence of the specified operator. The value thus obtained may be used to determine the precedence of one operator over another operator.

Note:
unary needs to be specified only for operators for which unary-ness is ambiguous. i.e. which exist as both a unary and a binary operator.
Parameters:
op Operator.
unary Whether the operator should be treated as an unary operator (applies only if unary-ness of operator is amiguous).
Returns:
Non-negative numeric value indicating order of precedence, or -1 if the operator is not recognized.

void Ionflux::Tools::getPassword const std::string &  prompt,
std::string &  password
 

Get a password.

Reads a password from standard input.

Parameters:
prompt Password prompt.
password Where to store the password.

void Ionflux::Tools::getRandomBytes std::string &  bytes,
unsigned int  n,
MTRand *  source
 

Get random bytes.

Gets a specified number of random bytes.

Note:
You can specify an MTRand object to be used for random number generation. If you pass null, a random number source will be generated automatically (not recommended).
Parameters:
bytes Buffer in which to store the random bytes.
n Number of random bytes.
source Random number source.

void Ionflux::Tools::getRandomIdentifier std::string &  bytes,
unsigned int  n,
MTRand *  source
 

Get random identifier.

Gets a random identifier of specified length.

Note:
You can specify an MTRand object to be used for random number generation. If you pass null, a random number source will be generated automatically (not recommended).
Parameters:
bytes Buffer in which to store the random identifier.
n Length of random identifier.
source Random number source.

MTRand & Ionflux::Tools::getRandomizer  ) 
 

Get randomizer.

Get a (static) MT randomizer.

Returns:
MT randomizer.

bool Ionflux::Tools::isAlpha const std::string &  bytes  ) 
 

Check whether a string represents an alpha.

Returns true if the string represents a (latin) alpha, false otherwise.

Parameters:
bytes String to be checked.
Returns:
true if the string represents a (latin) alpha, false otherwise.

bool Ionflux::Tools::isFloat const std::string &  bytes  ) 
 

Check whether a string represents a float.

Returns true if the string represents a (decimal) floating point value (positive or negative), false otherwise.

Parameters:
bytes String to be checked.
Returns:
true if the string represents a (decimal) floating point value, false otherwise.

bool Ionflux::Tools::isIdentifier const std::string &  bytes  ) 
 

Check whether a string represents an identifier.

Returns true if the string represents an idenifier, false otherwise.

Note:
For purposes of this function, an identifier is a byte string consisting of alphanumeric characters or underscores '_' (in 8-bit ISO-8859-1 encoding).
Parameters:
bytes String to be checked.
Returns:
true if the string represents an idenifier, false otherwise.

bool Ionflux::Tools::isInteger const std::string &  bytes  ) 
 

Check whether a string represents an integer.

Returns true if the string represents a (decimal) integer value (positive or negative), false otherwise.

Parameters:
bytes String to be checked.
Returns:
true if the string represents a (decimal) integer, false otherwise.

bool Ionflux::Tools::isNumber const std::string &  bytes  ) 
 

Check whether a string represents a number.

Returns true if the string represents a (decimal) number, false otherwise.

Parameters:
bytes String to be checked.
Returns:
true if the string represents a (decimal) number, false otherwise.

bool Ionflux::Tools::isOneOf char  c,
const std::string &  testChars
 

Check type of a character.

Returns true if the character 'c' is one of the characters of 'testChars'.

Parameters:
c Character to be checked.
testChars String of characters.
Returns:
true if the character 'c' is one of the characters of 'testChars', false otherwise.

std::string Ionflux::Tools::makeHex const std::string &  inputData  ) 
 

Make readable hexadecimal code.

Convert a string that not necessarily contains readable characters to readable hexadecimal code.

Parameters:
inputData A string of bytes to be converted.
Returns:
Hexadecimal string.

std::string Ionflux::Tools::makeNiceHex const std::string &  hex,
const std::string &  readable,
int  bytesPerLine,
int  groupBytes
 

Make nice hexadecimal output.

This function generates a nice human readable hexadecimal output from a string of hexadecimal bytes and a readable representation of that string, similar to the display of a hex editor.

Parameters:
hex String of bytes in hexadecimal representation.
readable Readable representation of the string.
bytesPerLine How many bytes to display per line.
groupBytes How many bytes to display in each group.
Returns:
Nicely formatted hexadecimal output.

std::string Ionflux::Tools::makeReadable const std::string &  inputData,
const std::string &  replacement
 

Replace unreadable characters.

Convert a string that not necessarily contains readable characters to readable characters, replacing characters considered unreadable with 'replacement'.

Parameters:
inputData A string of bytes to be converted.
replacement A string with which to replace unreadable characters.
Returns:
String composed of readable characters.

std::string Ionflux::Tools::packBool bool  data  ) 
 

Pack boolean.

Packs a boolean value into a byte string (in network byte order).

Note:
Although a boolean may be represented as a single bit, the resulting string will be 1 byte long.
Parameters:
data The boolean to be packed.
Returns:
A byte equivalent the boolean value true (different from zero) or false (equal to zero).

std::string Ionflux::Tools::packDouble double  data  ) 
 

Pack double.

Packs a double precision floating point value into a byte string (in host byte order).

Parameters:
data The double to be packed.
Returns:
The bytes of the double, in host byte order.

std::string Ionflux::Tools::packInt int  data  ) 
 

Pack integer.

Packs an integer value into a byte string (in network byte order).

Parameters:
data The integer to be packed.
Returns:
The bytes of the integer, in network byte order.

std::string Ionflux::Tools::parseHex const std::string &  inputData  ) 
 

Parse hex string.

Parse a hex string into a byte string.

Parameters:
inputData The hex string to be parsed.
Returns:
The bytes represented by the hexadecimal string.

std::string Ionflux::Tools::prependDirSeparator const std::string &  path,
unsigned char  separator = DIR_SEPARATOR
 

Prepend directory separator.

Prepend direc