dvi2bitmap  dvi2bitmap1.0
Functions | Variables
Util Namespace Reference

Various utility functions. More...

Functions

string_listtokenise_string (string str)
 Tokenise string at whitespace. More...
 
char ** string_list_to_array (string_list &l)
 Convert a string_list to a null-terminated array of character pointers. More...
 
void delete_string_array (char **sl)
 Deletes the array of strings returned by string_list_to_array. More...
 
bool parseRGB (Bitmap::BitmapColour &, const char *)
 Parse an RGB specification. More...
 
void verbosity (const verbosities level)
 Sets the verbosity of the methods in this class. More...
 

Variables

verbosities verbosity_ = normal
 

Detailed Description

Various utility functions.

Function Documentation

void Util::delete_string_array ( char **  sl)

Deletes the array of strings returned by string_list_to_array.

Parameters
sla null-terminated array of strings
bool Util::parseRGB ( Bitmap::BitmapColour rgb,
const char *  s 
)

Parse an RGB specification.

This is either a sequence of three integers separated by slashes (or in fact any non-number character), or else a string of the form #RRGGBB. Set the `rgb' structure to the resulting numbers. The integers must be in the range [0,255], and may be specified in decimal, octal, or hex.

Parameters
rgbthe BitmapColour corresponding to the s argument
sthe RGB specification
Returns
true if the parse is successful.

References Bitmap::BitmapColour_s::blue, Bitmap::BitmapColour_s::green, and Bitmap::BitmapColour_s::red.

Referenced by main().

char ** Util::string_list_to_array ( string_list l)

Convert a string_list to a null-terminated array of character pointers.

The resulting array can conveniently be deleted using delete_string_array.

Parameters
la string_list
Returns
a pointer to a null-terminated array of null-terminated character arrays

Referenced by PipeStream::PipeStream().

string_list & Util::tokenise_string ( string  str)

Tokenise string at whitespace.

Parameters
strthe string to be tokenised
Returns
a list containing the whitespace-separated tokens in the string

References normal, and verbosity_.

Referenced by main(), and PipeStream::PipeStream().

void Util::verbosity ( const verbosities  level)

Sets the verbosity of the methods in this class.

Parameters
levelhow verbose the class's methods should be

References verbosity_.

Referenced by main().

Variable Documentation

verbosities Util::verbosity_ = normal