UltraScan III
List of all members | Static Public Member Functions | Static Private Member Functions
US_Util Class Reference

General utilities for UltraScan. More...

#include "us_util.h"

Static Public Member Functions

static QString getToken (QString &, const QString &)
 Returns the next string component where the components are separated by a common delimiter. The function modifies the passed string. More...
 
static QString new_guid (void)
 Generates and returns a new Global Identifier (guid) More...
 
static QString md5sum_file (QString)
 Generates a string for a file with md5 hash and file size. More...
 
static QString toUTCDatetimeText (QString, bool)
 Converts a DateTime string to unambiguous UTC form. More...
 
static QString toISODatetimeText (QString)
 Converts a DateTime string to Qt's ISODate form. More...
 
static void uuid_parse (const QString &, unsigned char *)
 Convert a QString uuid to a 16-byte binary character array. More...
 
static QString uuid_unparse (unsigned char *)
 Convert a binary uuid to a QString. More...
 
static QString compressed_triple (const QString &)
 Create a compressed (ccw) form of a triple (c/c/w) string. More...
 
static QString expanded_triple (const QString &, bool=true)
 Create an expanded (c/c/w) form of a triple (ccw) string. More...
 
static bool ithTime (int=10000)
 Return a flag if this is the i'th time an error occurs. More...
 
static bool bool_flag (const QString)
 Return a flag if an XML attribute string implies true/false. More...
 
static QString bool_string (const bool)
 Return an XML attribute string for true or false. More...
 

Static Private Member Functions

static unsigned char hex2int (unsigned char c)
 

Detailed Description

General utilities for UltraScan.

This class provides a number of general utility functions. All methods are static.

Definition at line 18 of file us_util.h.

Member Function Documentation

bool US_Util::bool_flag ( const QString  xmlattr)
static

Return a flag if an XML attribute string implies true/false.

Parameters
xmlattrXML attribute string ("T", "F", "1", "0"). returns Boolean flag if the implied boolean is true or false.

Definition at line 220 of file us_util.cpp.

QString US_Util::bool_string ( const bool  boolval)
static

Return an XML attribute string for true or false.

Parameters
boolvalBoolean value to represent as an XML attribute string. returns XML attribute string representation ("0" or "1").

Definition at line 226 of file us_util.cpp.

QString US_Util::compressed_triple ( const QString &  ccw)
static

Create a compressed (ccw) form of a triple (c/c/w) string.

Parameters
ccwExpanded triple string ("c/c/w" or "c / c / w")
Returns
Compressed form of the triple string ("ccw")

Definition at line 155 of file us_util.cpp.

QString US_Util::expanded_triple ( const QString &  ccw,
bool  spaces = true 
)
static

Create an expanded (c/c/w) form of a triple (ccw) string.

Parameters
ccwCompressed triple string ("ccw")
spacesFlag to insert spaces around slashes.
Returns
Uncompressed triple string ("c/c/w" or "c / c / w")

Definition at line 164 of file us_util.cpp.

QString US_Util::getToken ( QString &  s,
const QString &  separator 
)
static

Returns the next string component where the components are separated by a common delimiter. The function modifies the passed string.

This function is designed to be called iteratively. On each call, the leading substring in the given string is returned and the full string is modified by having that substring and the immediately following delimiter removed.

Parameters
sString to search
separatorDelimiter to use for parsing
Returns
Next token in the string (substring before delimiter)

Definition at line 5 of file us_util.cpp.

unsigned char US_Util::hex2int ( unsigned char  c)
staticprivate

Definition at line 185 of file us_util.cpp.

bool US_Util::ithTime ( int  timeinc = 10000)
static

Return a flag if this is the i'th time an error occurs.

Parameters
timeincIncidence increment to detect (default=10000). returns Boolean flag if this is i'th time.

Definition at line 213 of file us_util.cpp.

QString US_Util::md5sum_file ( QString  filename)
static

Generates a string for a file with md5 hash and file size.

An MD5 hash is performed on the file whose full path name is given. The size of the file in bytes is also determined. The returned string combines the hash and size separated by a blank: "hash size".

Parameters
filenamePull path name of file for md5 hash and size
Returns
A string in the form of "hash size" for the file

Definition at line 44 of file us_util.cpp.

QString US_Util::new_guid ( void  )
static

Generates and returns a new Global Identifier (guid)

This function generates a new Global Identifier (guid) string. The returned string is 36 characters in length and is in the standard uuid form: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".

Returns
New GUID 36-character string

Definition at line 38 of file us_util.cpp.

QString US_Util::toISODatetimeText ( QString  dttext)
static

Converts a DateTime string to Qt's ISODate form.

This function converts a DateTime string into the form created or expected with a Qt::DateFormat of Qt::ISODate. That is, the output is something like "2010-08-10T09:42:16". The input may already be in ISO form; may be in UTC form; or may be an unknown format assumed to be Qt:TextDate, such as "Mon Aug 9 23:24:45 2010".

Parameters
dttextDateTime text string in UTC, ISO, or other form
Returns
A DateTime string in ISO form ("2010-08-14T21:41:22")

Definition at line 125 of file us_util.cpp.

QString US_Util::toUTCDatetimeText ( QString  dttext,
bool  knownUTC 
)
static

Converts a DateTime string to unambiguous UTC form.

This function converts a DateTime string into an unambiguous UTC form, as would be output by the Unix "date" command with arguments of "-u +%F\ %T\ %Z"; a "yyyy-mm-dd HH:MM:SS UTC" form. The input DateTime string may be in ISO form (e.g., "2010-08-10T09:42:16"), already in UTC form, or in the default locale format, such as "Mon Aug 9 23:24:45 2010". A boolean argument specifies whether the implied time is already in UTC. If "false" and no " UTC" is in the input string, the underlying DateTime is converted from local time to Universal Time Coordinates. No time conversion occurs if the boolean argument is "true".

Parameters
dttextDateTime text string in ISO or other form
knownUTCA boolean whether the input string is known to represent date and time in Universal Time Coordinates.
Returns
A DateTime string in "yyyy-mm-dd HH:MM:SS UTC" form

Definition at line 66 of file us_util.cpp.

void US_Util::uuid_parse ( const QString &  in,
unsigned char *  uu 
)
static

Convert a QString uuid to a 16-byte binary character array.

Parameters
inUuid string to be converted
uuA pointer to a 16-byte character array for the converted data

Definition at line 195 of file us_util.cpp.

QString US_Util::uuid_unparse ( unsigned char *  uu)
static

Convert a binary uuid to a QString.

Parameters
uuA pointer to a 16-byte array holding a binary uuid

Definition at line 144 of file us_util.cpp.


The documentation for this class was generated from the following files: