copasi API  0.1
Defines | Functions
copasi/utilities/utility.cpp File Reference
#include "mathematics.h"
#include <stdio.h>
#include <time.h>
#include <limits>
#include <string>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include "copasi.h"
#include "utility.h"

Defines

#define toBeEscaped   "\\\""

Functions

std::string ISODateTime (tm *pTime)
std::string LocalTimeStamp ()
std::string UTCTimeStamp ()
bool isNumber (const std::string &str)
std::string StringPrint (const char *format,...)
std::string unQuote (const std::string &name)
std::string quote (const std::string &name, const std::string &additionalEscapes)
void FixSName (const std::string &original, std::string &fixed)
void FixXHTML (const std::string &original, std::string &fixed)
std::string utf8ToLocale (const std::string &utf8)
std::string localeToUtf8 (const std::string &locale)
double strToDouble (const char *str, char const **pTail)

Define Documentation

#define toBeEscaped   "\\\""

Function Documentation

void FixSName ( const std::string &  original,
std::string &  fixed 
)
void FixXHTML ( const std::string &  original,
std::string &  fixed 
)
bool isNumber ( const std::string &  str)

Check whether the given string represents a number

Parameters:
conststd::string & str
Returns:
bool isNumber
std::string ISODateTime ( tm *  pTime)

Returns the time pointed to by pTime in ISO format

std::string localeToUtf8 ( const std::string &  locale)

Convert a string in the local used code page to utf8 This only has an effect on Windows as utf8 is the local code page everywhere else

Parameters:
conststd::string & locale
Returns:
std::string utf8
std::string LocalTimeStamp ( )

Returns the current local time in ISO format

std::string quote ( const std::string &  name,
const std::string &  additionalEscapes = "" 
)

Surround a name with quotes if the name contains a space or double quote else the name is returned unmodified. In the quoted name " and \ are escaped. The parameter additionalEscapes forces quotes around names containing any of the character in the parameter.

Parameters:
conststd::string & name
conststd::string & additionalEscapes (default: "")
Returns:
std::string quote
std::string StringPrint ( const char *  format,
  ... 
)

sprintf like function for strings

Parameters:
const char *format sprintf like format string
...
Returns:
"string"
double strToDouble ( const char *  str,
char const **  pTail = NULL 
)

Convert a character sequence to a double

Parameters:
constchar * str
charconst ** pTail (default: NULL)
Returns:
double
std::string unQuote ( const std::string &  name)

Unesacape a quoted name. If the name is surrounded by quotes these are removed and included escape sequences '\.' are reduced to '.' else the name is returned unmodified.

Parameters:
conststd::string & name
Returns:
std::string unQuote
std::string UTCTimeStamp ( )

Returns the current time in ISO format

std::string utf8ToLocale ( const std::string &  utf8)

Convert a utf8 string to the local used code page This only has an effect on Windows as utf8 is the local code page everywhere else

Parameters:
conststd::string & utf8
Returns:
std::string locale
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines