|
OpenTop 1.3 | |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | Cross-Platform C++ | ||||
SUMMARY: CONSTRUCTOR | METHOD | DETAIL: CONSTRUCTOR | METHOD |
#include "ot/base/System.h"
Class module providing useful system-level functions as well as providing a well-known and accessible root from which to navigate to other essential services. Method Summary | |
static String |
GetAppMessage(const String& org, const String& app, size_t messageID, const char* szDefault) Retrieves the text for a user-defined message. |
static String |
GetEnvironmentString(const String& name) Returns the specified environment variable as a String. |
static const String& |
GetLineEnding() Returns a String containing the line ending character(s) for the platform. |
static RefPtr< MessageFactory > |
GetMessageFactory() Returns the MessageFactory for the application if one has been previously installed. |
static ObjectManager& |
GetObjectManager() Returns a reference to the global ObjectManager, which can be used to hold instances of reference-counted objects for the lifetime of the application. |
static String |
GetProperty(const String& name) Returns the system property with the supplied name. |
static String |
GetProperty(const String& name, const String& defaultValue) Returns the system property with the supplied name. |
static bool |
GetPropertyBool(const String& name, bool bDefault) Returns the value of the named property as a boolean value. |
static long |
GetPropertyLong(const String& name, long defaultValue) Returns the value of the named property as a long integer. |
static String |
GetSysMessage(const String& lib, size_t messageID, const char* szDefault) Retrieves the text for a system message. |
static unsigned long |
GetVersion() Returns the current version of the OpenTop library. |
static String |
GetVersionAsString() Returns the version of OpenTop as a formatted string. |
static void |
SetMessageFactory(MessageFactory* pFactory) Sets the MessageFactory global object. |
static void |
SetProperty(const String& name, const String& value) Creates a system property with the specified name and assigns it the supplied value. |
static void |
SetPropertyBool(const String& name, bool bSet) Creates a system property with the specified name and assigns it the supplied value. |
static void |
SetPropertyLong(const String& name, long value) Creates a system property with the specified name and assigns it the supplied value. |
static void |
Terminate() Called by the application when it is about to terminate. |
Method Detail |
static String GetAppMessage(const String& org, const String& app, size_t messageID, const char* szDefault)
The requested message is identified by the 3 parameters: org, app and messageID. These are passed to the application-supplied MessageFactory to locate the requested message. If the MessageFactory cannot provide the message then szDefault is converted into a String and returned.
org
- app
- messageID
- szDefault
- static String GetEnvironmentString(const String& name)
name
- static const String& GetLineEnding()
static RefPtr< MessageFactory > GetMessageFactory()
static ObjectManager& GetObjectManager()
static String GetProperty(const String& name)
name
- static String GetProperty(const String& name, const String& defaultValue)
name
- defaultValue
- static bool GetPropertyBool(const String& name, bool bDefault)
name
- bDefault
- static long GetPropertyLong(const String& name, long defaultValue)
name
- defaultValue
- static String GetSysMessage(const String& lib, size_t messageID, const char* szDefault)
This function is used throughout the OpenTop library to access internationalized error and informational messages.
lib
- messageID
- szDefault
- static unsigned long GetVersion()
unsigned long version = (_OPENTOP_MAJOR_VERSION * 100000) + (_OPENTOP_MINOR_VERSION * 1000) + _OPENTOP_MINOR_RELEASE;
The OpenTop version may also be obtained at compile time from the _OPENTOP_VERSION macro.
static String GetVersionAsString()
static void SetMessageFactory(MessageFactory* pFactory)
To ensure that the passed object exists for as long as the application needs it, the MessageFactory object is registered with the system's ObjectManager which holds a (counted) reference to it until system termination.
static void SetProperty(const String& name, const String& value)
name
- value
- static void SetPropertyBool(const String& name, bool bSet)
name
- bSet
- static void SetPropertyLong(const String& name, long value)
name
- value
- static void Terminate()
It is always a good idea for an application to call Terminate() to allow the OpenTop library to perform clean-up operations. This is especially true when using OpenTop threads because System::Terminate() is responsible for ensuring that all user threads have terminated before it returns to the caller.
It is also a good idea to ensure Terminate() is called correctly when using a memory-leak checker such as BoundsChecker or the debug version of the Microsoft C Run-time Library.
For safety, if the application has created daemon threads which are still active, Terminate() will not free the memory for global objects. The daemon threads will terminate when the process terminates.
To ensure that Terminate() is called even after an application throws an exception, it is recommended that the application make use of the SystemMonitor class rather than attempting to call Terminate() directly.
|
OpenTop 1.3 | |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | Cross-Platform C++ | ||||
SUMMARY: CONSTRUCTOR | METHOD | DETAIL: CONSTRUCTOR | METHOD |