eVaf
eVaf::Common Namespace Reference

Common eVaf library. More...

Namespaces

 Internal
 Internal implementation of the common eVaf library.
 

Classes

class  Event
 Event class for all the eVaf events. More...
 
class  iApp
 eVaf application interface More...
 
class  iConfig
 eVaf configuration interface. More...
 
class  iEventQueue
 The eVaf event queue interface. More...
 
class  iLogger
 Logger interface for eVaf modules and applications. More...
 
class  IniFile
 Class for reading and writing parameter values in INI files. More...
 
class  iProp
 Global properties and variables for eVaf applications. More...
 
class  iRegistry
 Common registry for interfaces. More...
 

Typedefs

typedef void(* FatalMsgHandler) (QString const &msg, QString const &source, QString const &where)
 Prototype for custom fatal message handler. More...
 

Functions

COMMON_EXPORT QByteArray binFromEscapedCharArray (QByteArray const &str)
 Converts escaped 7-bit character arrays to binary arrays. More...
 
COMMON_EXPORT QByteArray binToEscapedCharArray (QByteArray const &src)
 Converts binary arrays to escaped 7-bit character arrays. More...
 
bool COMMON_EXPORT init ()
 eVaf common library initialized More...
 
bool isFalse (QString const &str)
 Tests if the string means 'false'. More...
 
bool isTrue (QString const &str)
 Tests if the string means 'true'. More...
 
COMMON_EXPORT QString strFromEscapedCharArray (QByteArray const &str)
 Converts escaped 7-bit character arrays to unicode string. More...
 
COMMON_EXPORT QByteArray strToEscapedCharArray (QString const &str)
 Converts unicode strings to escaped 7-bit character arrays. More...
 
COMMON_EXPORT QVariant toVariant (QString const &value, QVariant const &defaultValue)
 Converts strings to variant values. More...
 

Detailed Description

Common eVaf library.

This library contains interfaces, classes and functions shared by all the eVaf applications and modules. This library is the required dependency for all the other libraries, modules and applications.

The common eVaf library shall be initialized with the eVaf::Common::init() function.

Typedef Documentation

typedef void(* eVaf::Common::FatalMsgHandler) (QString const &msg, QString const &source, QString const &where)

Prototype for custom fatal message handler.

This is a typedef for a pointer to a function with the following signature:

void myFatalMessageHandler(QString const & msg, QString const & source, QString const & where);
See also
iLogger::installFatalMsgHandler()

Definition at line 43 of file ilogger.h.

Function Documentation

COMMON_EXPORT QByteArray eVaf::Common::binFromEscapedCharArray ( QByteArray const &  str)

Converts escaped 7-bit character arrays to binary arrays.

Parameters
strEscaped 7-bit character array
Returns
Binary array

This function converts an escaped 7-bit character array to the binary array. Numeric character references and character entoty references are expanded to characters and binary bytes.

COMMON_EXPORT QByteArray eVaf::Common::binToEscapedCharArray ( QByteArray const &  src)

Converts binary arrays to escaped 7-bit character arrays.

Parameters
srcBinary array
Returns
Escaped 7-bit character array

This function converts a binary array to the escaped 7-bit character array. Bytes that cannot be output directly as printable 7-bit characters are output as numeric character references. The result can be directly inserted into XML or HTML documents and later converted back with the eVaf::Common::binFromEscapedCharArray() function.

For example, "Hello\r\n" becomes "Hello
".

bool COMMON_EXPORT eVaf::Common::init ( )

eVaf common library initialized

Returns
True if ok; false if the initialization failed

Call this function to initialize the common eVaf library after creating the Qt application object and before loading any of the modules.

bool eVaf::Common::isFalse ( QString const &  str)
inline

Tests if the string means 'false'.

Parameters
strThe string
Returns
True if the string is 'no', 'false', 'off' or '0'.

This function tests if the string means 'false'. Use this function when the default value should be 'true'.

Definition at line 52 of file util.h.

bool eVaf::Common::isTrue ( QString const &  str)
inline

Tests if the string means 'true'.

Parameters
strThe string
Returns
True if the string is 'yes', 'true', 'on' or '1'.

This function tests if the string means 'true'. Use this function when the default value should be 'false'.

Definition at line 39 of file util.h.

COMMON_EXPORT QString eVaf::Common::strFromEscapedCharArray ( QByteArray const &  str)

Converts escaped 7-bit character arrays to unicode string.

Parameters
strEscaped 7-bit character array
Returns
Unicode string

This function converts an escaped 7-bit character array to the unicode string. Numeric character references and character entity references are expanded to actual unicode characters.

COMMON_EXPORT QByteArray eVaf::Common::strToEscapedCharArray ( QString const &  str)

Converts unicode strings to escaped 7-bit character arrays.

Parameters
strUnicode string
Returns
Escaped 7-bit character array

This function converts a unicode (or any) string to the escaped 7-bit character array. Characters that cannot be output directly as a printable 7-bit character are output as numeric character references. The result can be directly inserted into XML or HTML documents and later converted back with the eVaf::Common::strFromEscapedCharArray() function.

For example, "GroƟ" becomes "Groß".

COMMON_EXPORT QVariant eVaf::Common::toVariant ( QString const &  value,
QVariant const &  defaultValue 
)

Converts strings to variant values.

Parameters
valueThe string
defaultValueThe default value
Returns
value converted from the string or the default if failed

This function converts strings to variant values. The type of the expected value is determined from the default value. If the string fails to convert to the expected type, returns the default value.

If the default value is of one of the following types, then the following conversion rules are applied:

  • QVariant::UInt - if the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise base 10 is used;
  • QVariant::Int - base 10 is used;
  • QVariant::Double - the decimal point is expecte to be '.' regardless which locale is used;
  • QVariant::Bool - tries to use isTrue() and isFalse() methods; otherwise performs a conversion to QVariant::uint;
  • QVariant::Char - if the string begins with "\0x", expects it to be a UTF-16 code in hex; if the string begins with "\0", expects it to be a UTF-16 code in oct; if the string begins with "&", expects it to be a numeric character reference ("&#nnnn;" or "&#xhhhh;") or a predefined character entity reference; otherwise uses the first character in the string;