Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

lrt::System Class Reference

Class System provides methods to access the system console and exit the application. More...

#include <rtsystem.h>

List of all members.

Public Types

typedef void(* BreakFunction )(BreakType)
 A break handler function (see System::setOnBreak()).

enum  BreakType { CTRL_C, TERMINATE }
 Possible break types. More...


Static Public Methods

void setAppName (const String &appName)
 Sets the application name. More...

void setInteractive (bool)
 Sets if we're in interactive mode. More...

bool isInteractive ()
 Returns the current interactive mode.

void message (const String &str)
 Print a message to the user. More...

void exit ()
 Exits the application.

void exit (int)
 Exits the application with a specified return code.

void exit (int, const String &)
 Exits the application abnormally, with a specified return code and error message.

void exit (int, const char *)
 Exits the application abnormally, with a specified return code and error message. More...

void setOnBreak (BreakFunction func, bool catchKill)
 Sets a signal handler function, which will be called when the user presses CTRL+C on the command line. More...

void print (const char *cStr)
 Prints some characters to the system console.

void print (const String &str)
 Prints a String to the system console.

void println ()
 Prints a newline to the system console.

void println (const String &str)
 Prints a String to the console and finishes the line.

char read ()
 Reads a single character from the system input. More...

String readLine (const String &query)
 Reads a whole line from the system input. More...

void setPos (int x, int y)
 Sets the console position to these new coordinates.

bool isLittleEndian ()
 Returns true if the underlying system is little-endian, false if it is big-endian.

void fillMemory (void *ptr, int length, char value)
 Fills a block of memory with the given byte value. More...

void copyMemory (const void *src, void *dest, int length)
 Copies a given block of memory. More...


Static Public Attributes

BreakFunction lastBreakFunction = 0


Detailed Description

Class System provides methods to access the system console and exit the application.


Member Enumeration Documentation

enum lrt::System::BreakType
 

Possible break types.

Enumeration values:
CTRL_C  as by CTRL+C in the command line.
TERMINATE  as by kill command.


Member Function Documentation

void lrt::System::copyMemory (  const void *    src,
void *    dest,
int    length
)  [static]
 

Copies a given block of memory.

Parameters:
src  Source pointer
dest  Destination pointer
length  Number of bytes to copy

void lrt::System::exit (  int   ,
const char *   
)  [static]
 

Exits the application abnormally, with a specified return code and error message.

Note: There are some places where you can't even use lrt::String.

void lrt::System::fillMemory (  void *    ptr,
int    length,
char    value
)  [static]
 

Fills a block of memory with the given byte value.

Parameters:
ptr  Location of the block
length  Number of bytes to fill
data  Value to fill the bytes with

void lrt::System::message (  const String &    str )  [static]
 

Print a message to the user.

If we're in interactive mode and it is supported on the current system, a GUI element (message box) will be used to present the message. Otherwise, the console will be used.

char lrt::System::read (    )  [static]
 

Reads a single character from the system input.

(This is usually the keyboard.)

String lrt::System::readLine (  const String &    query )  [static]
 

Reads a whole line from the system input.

(This is usually the keyboard.) The line ending character (usually '
') is never included in the returned string.

Parameters:
query  The query string for the input.

void lrt::System::setAppName (  const String &    appName )  [static]
 

Sets the application name.

It is used in message box titles, for example.

void lrt::System::setInteractive (  bool    )  [static]
 

Sets if we're in interactive mode.

By default, this is true. If libRT is in interactive mode, some actions may be presented to the user using GUI elements (message boxes), e.g. the functions message() and exit(int, String). If not, the console will be used in every case.

void lrt::System::setOnBreak (  BreakFunction    func,
bool    catchKill
)  [static]
 

Sets a signal handler function, which will be called when the user presses CTRL+C on the command line.

As soon as you set such a signal handler, the program will no longer just exit (which it would do otherwise); instead your function will be called, whereafter the program continues normally.

Parameters:
func  The function to call. May be 0, which restores the default behaviour.
catchKill  (optional) If given, the 'normal' kill command (without -SIGKILL) is caught by your function, too. (This only works on Unix. The Windows Task manager ignores this parameter.)


The documentation for this class was generated from the following files:
This is the RoboTour API documentation version 0.1 • Copyright (C) by Florian Fischer