libIntegra
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Static Public Member Functions | Static Public Attributes | List of all members
integra_api::CStringHelper Class Reference

Common string routines. More...

#include "api/string_helper.h"

Collaboration diagram for integra_api::CStringHelper:
Collaboration graph
[legend]

Static Public Member Functions

static string date_to_string (const struct tm &date)
 Convert date/time to string. More...
 
static CError string_to_date (const string &string, struct tm &output)
 Convert string to date/time. More...
 
static bool validate_node_name (const string &name)
 Test whether the node name is valid. More...
 
static string string_vector_to_string (const string_vector &strings)
 Create string-representation of an array of strings. More...
 
static bool string_to_string_vector (const string &input, string_vector &output)
 Unpack single-string representation of an array of strings. More...
 
static string trim (const string &input)
 Trim whitespace from start and end of a string. More...
 

Static Public Attributes

static const string node_name_character_set
 The set of characters which may be used in node names.
 
static const int string_buffer_length = 1024
 A standard length for string buffers. More...
 

Detailed Description

Common string routines.

Note
CStringHelper need never be instantiated - all its methods are static and stateless.

Member Function Documentation

static string integra_api::CStringHelper::date_to_string ( const struct tm &  date)
static

Convert date/time to string.

Parameters
datethe date to convert
Returns
ISO 8601 formatted string representation of the date/time
static CError integra_api::CStringHelper::string_to_date ( const string &  string,
struct tm &  output 
)
static

Convert string to date/time.

Parameters
stringthe string to convert. Expects string in ISO 8601 form eg 2012-07-20T14:42
[out]theconverted date/time
Returns
CError::SUCCESS or CError::INPUT_ERROR
static bool integra_api::CStringHelper::string_to_string_vector ( const string &  input,
string_vector &  output 
)
static

Unpack single-string representation of an array of strings.

These packed strings are used by the AudioSettings and MidiSettings interfaces, to encode lists of drivers/devices. Each string in the array is prepended by its length and a colon, allowing unambiguous unpacking. Example: { "First Item", "Second Item" } becomes "10:First Item11:Second Item"

Parameters
inputA single string representing an array of strings
[out]outputContainer in which to store results
Returns
true if successful, false if input doesn't conform to packing format
static string integra_api::CStringHelper::string_vector_to_string ( const string_vector &  strings)
static

Create string-representation of an array of strings.

These packed strings are used by the AudioSettings and MidiSettings interfaces, to encode lists of drivers/devices. Each string in the array is prepended by its length and a colon, allowing unambiguous unpacking. Example: { "First Item", "Second Item" } becomes "10:First Item11:Second Item"

Parameters
stringsarray of strings to pack
Returns
the single packed string
static string integra_api::CStringHelper::trim ( const string &  input)
static

Trim whitespace from start and end of a string.

Parameters
inputthe string to trim
Returns
trimmed version of the string
static bool integra_api::CStringHelper::validate_node_name ( const string &  name)
static

Test whether the node name is valid.

Parameters
namethe node name to test
Returns
true if name contains no invalid characters, otherwise false

Member Data Documentation

const int integra_api::CStringHelper::string_buffer_length = 1024
static

A standard length for string buffers.

Note
wherever possible libIntegra uses resizable std::string. Fixed length string buffers are when required by external libraries such as minizip

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