libcommonc++  0.7
System Class Reference

Various system-level utility functions. More...

#include <System.h++>

Static Public Member Functions

static time_s_t currentTime ()
 Get the system time, in seconds since the epoch. More...
 
static time_ms_t currentTimeMillis ()
 Get the system time, in milliseconds since the epoch. More...
 
static void setSystemTime (const time_ms_t &time)
 Set the system time. More...
 
static String getEnvVariable (const String &name)
 Get the value of an environment variable. More...
 
static bool setEnvVariable (const String &name, const String &value)
 Set the value of an environment variable. More...
 
static bool delEnvVariable (const String &name)
 Delete (unset) an environment variable. More...
 
static String getUserName ()
 Get the username of the current user. More...
 
static String getOSName ()
 Get the name of the host OS. More...
 
static String getOSVersion ()
 Get the version of the host OS. More...
 
static String getArchitecture ()
 Get the name of the host system architecture. More...
 
static String getHostName ()
 Get the host name. More...
 
static String getHomeDir ()
 Get the current user's home directory. More...
 
static String getTempDir ()
 Get the system temporary directory. More...
 
static String getErrorString (const String &text=String::null)
 Get the system error message string for the most recent error. More...
 
static size_t getPageSize ()
 Get the system page size. More...
 
static void roundToPageSize (size_t &size)
 Round a value up to a multiple of the system page size. More...
 
static void printStackTrace (uint_t maxFrames=20)
 Print a stack trace to standard error. More...
 
static bool isPOSIX ()
 Test if the host OS is a POSIX OS. More...
 
static bool isMacOSX ()
 Test if the host OS is Mac OS X. More...
 
static bool isWindows ()
 Test if the host OS is Microsoft Windows. More...
 

Detailed Description

Various system-level utility functions.

Author
Mark Lindner

Member Function Documentation

◆ currentTime()

time_s_t currentTime ( )
static

Get the system time, in seconds since the epoch.

◆ currentTimeMillis()

ccxx::time_ms_t currentTimeMillis ( )
static

Get the system time, in milliseconds since the epoch.

◆ delEnvVariable()

bool delEnvVariable ( const String name)
static

Delete (unset) an environment variable.

Parameters
nameThe name of the variable.
Returns
true on success, false otherwise.

◆ getArchitecture()

String getArchitecture ( )
static

Get the name of the host system architecture.

◆ getEnvVariable()

String getEnvVariable ( const String name)
static

Get the value of an environment variable.

Parameters
nameThe name of the variable.
Returns
The value of the variable, or String::null if it is not defined.

◆ getErrorString()

String getErrorString ( const String text = String::null)
static

Get the system error message string for the most recent error.

Parameters
textOptional text to prepend to the resulting message.
Returns
The error message.

◆ getHomeDir()

String getHomeDir ( )
static

Get the current user's home directory.

◆ getHostName()

String getHostName ( )
static

Get the host name.

◆ getOSName()

String getOSName ( )
static

Get the name of the host OS.

◆ getOSVersion()

String getOSVersion ( )
static

Get the version of the host OS.

◆ getPageSize()

size_t getPageSize ( )
static

Get the system page size.

◆ getTempDir()

String getTempDir ( )
static

Get the system temporary directory.

◆ getUserName()

String getUserName ( )
static

Get the username of the current user.

◆ isMacOSX()

bool isMacOSX ( )
static

Test if the host OS is Mac OS X.

◆ isPOSIX()

bool isPOSIX ( )
static

Test if the host OS is a POSIX OS.

◆ isWindows()

bool isWindows ( )
static

Test if the host OS is Microsoft Windows.

◆ printStackTrace()

void printStackTrace ( uint_t  maxFrames = 20)
static

Print a stack trace to standard error.

◆ roundToPageSize()

void roundToPageSize ( size_t &  size)
static

Round a value up to a multiple of the system page size.

◆ setEnvVariable()

bool setEnvVariable ( const String name,
const String value 
)
static

Set the value of an environment variable.

Parameters
nameThe name of the variable.
valueThe vaule for the variable.
Returns
true on success, false otherwise.

◆ setSystemTime()

void setSystemTime ( const time_ms_t time)
static

Set the system time.

On most platforms, superuser or administrator privileges are required to set the system time.

Parameters
timeThe new time.
Exceptions
SystemExceptionIf an error occurs.

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