Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
elm::sys::System Class Reference

#include <elm/sys/System.h>

Public Types

typedef int access_t
 

Static Public Member Functions

static Pair< SystemInStream
*, SystemOutStream * > 
pipe (void) throw (SystemException)
 
static unsigned int random (unsigned int top)
 
static io::OutStreamcreateFile (const Path &path) throw (SystemException)
 
static io::OutStreamappendFile (const Path &path) throw (SystemException)
 
static io::InStreamreadFile (const Path &path) throw (SystemException)
 
static io::RandomAccessStreamopenRandomFile (const Path &path, access_t access=READ) throw (SystemException)
 
static io::RandomAccessStreamcreateRandomFile (const Path &path, access_t access=READ) throw (SystemException)
 
static Path getUnitPath (void *address)
 
static cstring getEnv (cstring key)
 
static bool hasEnv (cstring key)
 
static string getLibraryFileName (const string &name)
 
static string getPluginFileName (const string &name)
 

Static Public Attributes

static const int READ = 1
 
static const int WRITE = 2
 
static const int READ_WRITE = READ | WRITE
 
static cstring library_prefix = "lib"
 
static cstring library_suffix
 
static cstring exec_suffix
 

Detailed Description

Non-instatiable object giving access to system facilities.

Member Typedef Documentation

Member Function Documentation

io::OutStream * elm::sys::System::appendFile ( const Path path)
throw (SystemException
)
static

Open a file for appending write. The opened file must be fried by the caller (causing the closure).

Parameters
pathPath of the file to open.
Returns
Opened file.
Exceptions
SystemExceptionThrown if there is an error.
io::OutStream * elm::sys::System::createFile ( const Path path)
throw (SystemException
)
static

Create a new file and open it to write. The created file must be fried by the caller (causing the file closure).

Parameters
pathPath of the file to open.
Returns
Opened file.
Exceptions
SystemExceptionThrown if there is an error.
io::RandomAccessStream * elm::sys::System::createRandomFile ( const Path path,
access_t  access = READ 
)
throw (SystemException
)
static

Create a random access stream from a file, removing it if it already exists.

Parameters
pathPath of the file to open.
accessType of access (one of READ, WRITE, READ_WRITE).
Returns
Opened file.
Exceptions
IOExceptionThrown if there is an error.

References elm::_.

Referenced by elm::io::RandomAccessStream::createFile().

static cstring elm::sys::System::getEnv ( cstring  key)
static
static string elm::sys::System::getLibraryFileName ( const string name)
static
static string elm::sys::System::getPluginFileName ( const string name)
static
Path elm::sys::System::getUnitPath ( void *  address)
static

Get the path of the object item (library, program) containing the symbol whose address is given.

Parameters
addressAddress of the looked symbol.
Returns
Path to the object containing the symbol or an empty path if it can not be found. This method gives a usable result only when the GLIBC is used. Be careful: it may be hard to get object path of an external symbol due to relocation function stub and due to duplication of some small data.

References elm::sys::Path::canonical(), and elm::mod().

static bool elm::sys::System::hasEnv ( cstring  key)
static
io::RandomAccessStream * elm::sys::System::openRandomFile ( const Path path,
access_t  access = READ 
)
throw (SystemException
)
static

Open a random access stream from a file.

Parameters
pathPath of the file to open.
accessType of access (one of READ, WRITE, READ_WRITE).
Returns
Opened file.
Exceptions
IOExceptionThrown if there is an error.

References elm::_.

Referenced by elm::io::RandomAccessStream::openFile().

Pair< SystemInStream *, SystemOutStream * > elm::sys::System::pipe ( void  )
throw (SystemException
)
static

Create a pipe with input / output end streams.

Returns
Linked streams.
Exceptions
Systemexception.

References elm::win::getErrorMessage(), and elm::pair().

unsigned int elm::sys::System::random ( unsigned int  top)
static

Generate an integer random number in interval [0, top[.

Parameters
topMaximum exclusive value.
Returns
Random number.
io::InStream * elm::sys::System::readFile ( const Path path)
throw (SystemException
)
static

Open a file for reading. The opened file must be fried by the caller (causing the closure).

Parameters
pathPath of the file to open.
Returns
Opened file.
Exceptions
SystemExceptionThrown if there is an error.

Referenced by elm::ini::File::load(), and elm::sys::Plugger::plugFile().

Member Data Documentation

cstring elm::sys::System::exec_suffix
static
cstring elm::sys::System::library_prefix = "lib"
static

Prefix of the dynamic libraries of the current OS.

cstring elm::sys::System::library_suffix
static
const int elm::sys::System::READ = 1
static
const int elm::sys::System::READ_WRITE = READ | WRITE
static
const int elm::sys::System::WRITE = 2
static

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