The Micro C++ Library
|
The System class provides access to shared static data structures that need to exist exactly once in each process like the System properties or the System mutex. More...
#include <micxx.hxx>
Public Member Functions | |
System (int argc=0, const char *const *args=0) | |
Create the System singleton. | |
virtual | ~System () |
Static Public Member Functions | |
static void | arrayCopy (void *dest, std::size_t destSize, const void *src, std::size_t srcSize, unsigned char destInit=0) |
Copies min(destSize, srcSize) bytes from src to dest. | |
static std::vector < std::wstring > & | getArgs () |
The command line arguments from the statically shared System singleton instance. | |
static bool | getBool (const std::wstring &property) |
The boolean value of system property. | |
static bool | getBool (const Properties &aproperties, const std::wstring &property) |
The boolean value of property. | |
static char | getInt8 (const std::wstring &property, bool mandatory=false) |
Same as getInt8(System::getProperties(), property, mandatory) | |
static char | getInt8 (const Properties &aproperties, const std::wstring &property, bool mandatory=false) |
The signed integer value of property. | |
static short | getInt16 (const std::wstring &property, bool mandatory=false) |
Same as getInt16(System::getProperties(), property, mandatory) | |
static short | getInt16 (const Properties &aproperties, const std::wstring &property, bool mandatory=false) |
The signed integer value of property. | |
static long | getInt32 (const std::wstring &property, bool mandatory=false) |
Same as getInt32(System::getProperties(), property, mandatory) | |
static long | getInt32 (const Properties &aproperties, const std::wstring &property, bool mandatory=false) |
The signed integer value of property. | |
static long long | getInt64 (const std::wstring &property, bool mandatory=false) |
Same as getInt64(System::getProperties(), property, mandatory) | |
static long long | getInt64 (const Properties &aproperties, const std::wstring &property, bool mandatory=false) |
The signed integer value of property. | |
static unsigned long long | getMillis () |
The milliseconds since January 1, 1970 (UTC). | |
static Mutex & | getMutex () |
The statically shared System::mutex. | |
static Properties & | getProperties () |
The statically shared System properties. | |
static std::string | getString (const std::wstring &property, bool mandatory=false) |
Same as getString(System::getProperties(), property, mandatory) | |
static std::string | getString (const Properties &aproperties, const std::wstring &aproperty, bool mandatory=false) |
The string value of property. | |
static SYSTEMTIME | getTime (unsigned long long millis=0) |
The localized time as milliseconds since January 1, 1970 (UTC). | |
static unsigned char | getUInt8 (const std::wstring &property, bool mandatory=false) |
Same as getUInt8(System::getProperties(), property, mandatory) | |
static unsigned char | getUInt8 (const Properties &aproperties, const std::wstring &property, bool mandatory=false) |
The unsigned integer value of property. | |
static unsigned short | getUInt16 (const std::wstring &property, bool mandatory=false) |
Same as getUInt16(System::getProperties(), property, mandatory) | |
static unsigned short | getUInt16 (const Properties &aproperties, const std::wstring &property, bool mandatory=false) |
The unsigned integer value of property. | |
static unsigned long | getUInt32 (const std::wstring &property, bool mandatory=false) |
Same as getUInt32(System::getProperties(), property, mandatory) | |
static unsigned long | getUInt32 (const Properties &aproperties, const std::wstring &property, bool mandatory=false) |
The unsigned integer value of property. | |
static unsigned long long | getUInt64 (const std::wstring &property, bool mandatory=false) |
Same as getUInt64(System::getProperties(), property, mandatory) | |
static unsigned long long | getUInt64 (const Properties &aproperties, const std::wstring &property, bool mandatory=false) |
The unsigned integer value of property. | |
static std::wstring | getWString (const std::wstring &property, bool mandatory=false) |
Same as getSString(System::getProperties(), property, mandatory) | |
static std::wstring | getWString (const Properties &aproperties, const std::wstring &aproperty, bool mandatory=false) |
The string value of property. | |
static void | parseArgs (int argc, const char *const *args, std::vector< std::wstring > &arglist, Properties &aproperties) |
Parses args into arglist and aproperties. | |
static void | parseArgs (int argc, const wchar_t *const *wargs, std::vector< std::wstring > &arglist, Properties &aproperties) |
Parses wargs into arglist and aproperties. | |
static void | parseArgs (const std::list< std::wstring > &awargs, std::vector< std::wstring > &arglist, Properties &aproperties) |
Parses all awargs into arglist and aproperties. | |
static void | parseProperties (const std::string &filename, Properties &aproperties) |
Parses properties from the file given by filename. | |
static void | parseProperties (const std::wstring &wfilename, Properties &aproperties) |
Parses properties from the file given by filename. | |
static std::string & | toString (std::string &dest, const SYSTEMTIME &systemTime) |
Format the SYSTEMTIME systemTime into a default string representation. |
The System class provides access to shared static data structures that need to exist exactly once in each process like the System properties or the System mutex.
See Quick Start Guide for an introduction to the System class.
micxx::System::System | ( | int | argc = 0 , |
const char *const * | args = 0 |
||
) |
Create the System singleton.
A single System instance initializes the list of command line arguments System::getArgs(), the System properties System::getProperties() and the logging system, see Log::configure(const Properties&) using the parsed System properties from the list of command line arguments.
virtual micxx::System::~System | ( | ) | [virtual] |
static void micxx::System::arrayCopy | ( | void * | dest, |
std::size_t | destSize, | ||
const void * | src, | ||
std::size_t | srcSize, | ||
unsigned char | destInit = 0 |
||
) | [static] |
Copies min(destSize, srcSize)
bytes from src to dest.
If srcSize < destSize
, then the remaining destSize - srcSize
are initialized with destInit.
static std::vector<std::wstring>& micxx::System::getArgs | ( | ) | [static] |
The command line arguments from the statically shared System singleton instance.
static bool micxx::System::getBool | ( | const Properties & | aproperties, |
const std::wstring & | property | ||
) | [static] |
The boolean value of property.
property
, or false
, if the property does not exist in aproperties. static bool micxx::System::getBool | ( | const std::wstring & | property | ) | [static] |
The boolean value of system property.
true
, if system property has the value true
; false
otherwise, static short micxx::System::getInt16 | ( | const Properties & | aproperties, |
const std::wstring & | property, | ||
bool | mandatory = false |
||
) | [static] |
The signed integer value of property.
0
if property does not exist in aproperties and mandatory is false
; otherwise an exception is thrown. static short micxx::System::getInt16 | ( | const std::wstring & | property, |
bool | mandatory = false |
||
) | [static] |
Same as getInt16(System::getProperties(), property, mandatory)
static long micxx::System::getInt32 | ( | const std::wstring & | property, |
bool | mandatory = false |
||
) | [static] |
Same as getInt32(System::getProperties(), property, mandatory)
static long micxx::System::getInt32 | ( | const Properties & | aproperties, |
const std::wstring & | property, | ||
bool | mandatory = false |
||
) | [static] |
The signed integer value of property.
0
if property does not exist in aproperties and mandatory is false
; otherwise an exception is thrown. static long long micxx::System::getInt64 | ( | const std::wstring & | property, |
bool | mandatory = false |
||
) | [static] |
Same as getInt64(System::getProperties(), property, mandatory)
static long long micxx::System::getInt64 | ( | const Properties & | aproperties, |
const std::wstring & | property, | ||
bool | mandatory = false |
||
) | [static] |
The signed integer value of property.
0
if property does not exist in aproperties and mandatory is false
; otherwise an exception is thrown. static char micxx::System::getInt8 | ( | const std::wstring & | property, |
bool | mandatory = false |
||
) | [static] |
Same as getInt8(System::getProperties(), property, mandatory)
static char micxx::System::getInt8 | ( | const Properties & | aproperties, |
const std::wstring & | property, | ||
bool | mandatory = false |
||
) | [static] |
The signed integer value of property.
0
if property does not exist in aproperties and mandatory is false
; otherwise an exception is thrown. static unsigned long long micxx::System::getMillis | ( | ) | [static] |
The milliseconds since January 1, 1970 (UTC).
static Mutex& micxx::System::getMutex | ( | ) | [static] |
The statically shared System::mutex.
static Properties& micxx::System::getProperties | ( | ) | [static] |
The statically shared System properties.
static std::string micxx::System::getString | ( | const std::wstring & | property, |
bool | mandatory = false |
||
) | [static] |
Same as getString(System::getProperties(), property, mandatory)
static std::string micxx::System::getString | ( | const Properties & | aproperties, |
const std::wstring & | aproperty, | ||
bool | mandatory = false |
||
) | [static] |
The string value of property.
false
; otherwise an exception is thrown. static SYSTEMTIME micxx::System::getTime | ( | unsigned long long | millis = 0 | ) | [static] |
The localized time as milliseconds since January 1, 1970 (UTC).
On most Systems this may be customized by setting the environment variable TZ
, e.g.
export TZ=GMT+1
static unsigned short micxx::System::getUInt16 | ( | const std::wstring & | property, |
bool | mandatory = false |
||
) | [static] |
Same as getUInt16(System::getProperties(), property, mandatory)
static unsigned short micxx::System::getUInt16 | ( | const Properties & | aproperties, |
const std::wstring & | property, | ||
bool | mandatory = false |
||
) | [static] |
The unsigned integer value of property.
0
if property does not exist in aproperties and mandatory is false
; otherwise an exception is thrown. static unsigned long micxx::System::getUInt32 | ( | const Properties & | aproperties, |
const std::wstring & | property, | ||
bool | mandatory = false |
||
) | [static] |
The unsigned integer value of property.
0
if property does not exist in aproperties and mandatory is false
; otherwise an exception is thrown. static unsigned long micxx::System::getUInt32 | ( | const std::wstring & | property, |
bool | mandatory = false |
||
) | [static] |
Same as getUInt32(System::getProperties(), property, mandatory)
static unsigned long long micxx::System::getUInt64 | ( | const std::wstring & | property, |
bool | mandatory = false |
||
) | [static] |
Same as getUInt64(System::getProperties(), property, mandatory)
static unsigned long long micxx::System::getUInt64 | ( | const Properties & | aproperties, |
const std::wstring & | property, | ||
bool | mandatory = false |
||
) | [static] |
The unsigned integer value of property.
0
if property does not exist in aproperties and mandatory is false
; otherwise an exception is thrown. static unsigned char micxx::System::getUInt8 | ( | const std::wstring & | property, |
bool | mandatory = false |
||
) | [static] |
Same as getUInt8(System::getProperties(), property, mandatory)
static unsigned char micxx::System::getUInt8 | ( | const Properties & | aproperties, |
const std::wstring & | property, | ||
bool | mandatory = false |
||
) | [static] |
The unsigned integer value of property.
0
if property does not exist in aproperties and mandatory is false
; otherwise an exception is thrown. static std::wstring micxx::System::getWString | ( | const std::wstring & | property, |
bool | mandatory = false |
||
) | [static] |
Same as getSString(System::getProperties(), property, mandatory)
static std::wstring micxx::System::getWString | ( | const Properties & | aproperties, |
const std::wstring & | aproperty, | ||
bool | mandatory = false |
||
) | [static] |
The string value of property.
false
; otherwise an exception is thrown. static void micxx::System::parseArgs | ( | int | argc, |
const wchar_t *const * | wargs, | ||
std::vector< std::wstring > & | arglist, | ||
Properties & | aproperties | ||
) | [static] |
Parses wargs into arglist and aproperties.
Parses all commandline arguments from wargs into arglist, by calling parseArgs(const std::list<std::wstring>&, std::vector<std::wstring>&, Properties&)
static void micxx::System::parseArgs | ( | const std::list< std::wstring > & | awargs, |
std::vector< std::wstring > & | arglist, | ||
Properties & | aproperties | ||
) | [static] |
Parses all awargs into arglist and aproperties.
Parses all properties passed on the command line in awargs into the properties aproperties and all other commandline arguments from awargs into arglist.
static void micxx::System::parseArgs | ( | int | argc, |
const char *const * | args, | ||
std::vector< std::wstring > & | arglist, | ||
Properties & | aproperties | ||
) | [static] |
Parses args into arglist and aproperties.
Parses all commandline arguments from args into arglist, by calling parseArgs(const std::list<std::wstring>&, std::vector<std::wstring>&, Properties&)
static void micxx::System::parseProperties | ( | const std::wstring & | wfilename, |
Properties & | aproperties | ||
) | [static] |
Parses properties from the file given by filename.
The new parsed properties are added to the already existing ones by overwriting the values for properties that already exist.
static void micxx::System::parseProperties | ( | const std::string & | filename, |
Properties & | aproperties | ||
) | [static] |
Parses properties from the file given by filename.
The new parsed properties are added to the already existing ones by overwriting the values for properties that already exist.
static std::string& micxx::System::toString | ( | std::string & | dest, |
const SYSTEMTIME & | systemTime | ||
) | [static] |
Format the SYSTEMTIME systemTime into a default string representation.