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

rtsystem.h

Go to the documentation of this file.
00001 /*
00002  * rtsystem.h
00003  * 
00004  * Copyright (c) 2000-2004 by Florian Fischer (florianfischer@gmx.de)
00005  * and Martin Trautmann (martintrautmann@gmx.de) 
00006  * 
00007  * This file may be distributed and/or modified under the terms of the 
00008  * GNU General Public License version 2 as published by the Free Software 
00009  * Foundation. 
00010  * 
00011  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013  * 
00014  */
00015 
00037 #ifndef __LRT_SYSTEM__
00038 #define __LRT_SYSTEM__
00039 
00040 // System forward declares
00041 #ifdef __SYMBIAN32__
00042 class CConsoleBase;
00043 class CLineEdit;
00044 class CTrapCleanup;
00045 #endif
00046 
00047 namespace lrt {
00048 
00049 // Forward declares
00050 class String;
00051 template<class T> class Array;
00052 
00057 class Time
00058 {
00059 public:
00061         static Time getCurrentTime();
00062 
00064         Time() : sec(0), msec(0) {}
00065 
00067         Time(int sec, int msec) : sec(sec), msec(msec) {}
00068 
00073         Time(const String&);
00074 
00077         Time operator-(const Time& t);
00078 
00082         int toInt();
00083 
00087         String toString();
00088 
00089 
00091         int sec;
00093         int msec;
00094 
00095 private:
00096         // an array of 12 month names
00097         static String months[];
00098         // convert 'Jan' etc. to a number
00099         int getMonthNum(const String& monthName);
00100 };
00101 
00102 
00105 class System
00106 {
00107 public:
00109 
00110         enum BreakType { CTRL_C,        
00111                                          TERMINATE      
00112         };
00114         typedef void (*BreakFunction)(BreakType);
00115 
00117         static void setAppName(const String& appName);
00122         static void setInteractive(bool);
00124         static bool isInteractive();
00125 
00129         static void message(const String& str);
00130 
00132         static void exit();
00134         static void exit(int);
00136         static void exit(int, const String &);
00139         static void exit(int, const char*);
00149         static void setOnBreak(BreakFunction func, bool catchKill);
00150 
00152         static void print(const char *cStr);
00154         static void print(const String &str);
00156         static void println();
00158         static void println(const String &str);
00160         static char read();
00164         static String readLine(const String &query);
00165 
00167         static void setPos(int x, int y);
00168 
00171         static bool isLittleEndian();
00177         static void fillMemory(void* ptr, int length, char value);
00183         static void copyMemory(const void* src, void* dest, int length);
00184 
00185 #ifdef __SYMBIAN32__
00186         static CTrapCleanup *cleanup; // need to set it from main()
00187 #endif
00188 public: // internal API
00189         static BreakFunction lastBreakFunction; // required for Windows, where it must be given on un-registration
00190 private:
00191         static bool init;
00192         static bool interactive;
00193         static String* appName;
00194 #ifdef __SYMBIAN32__
00195         static CConsoleBase *console;
00196         static CLineEdit *edit;
00197         static void printInternal(const char *cStr, bool isLong, bool addLine);
00198 #endif
00199         static void initialize();
00200         static void finalize();
00201 
00202         System() {}
00203         ~System() {}
00204 };
00205 
00208 template<class T> int stdCompare(const T& elem1, const T& elem2);
00209 int stdCompare(char elem1, char elem2);
00210 
00211 } // namespace
00212 
00213 #include "rtsystem.templ.cpp"
00214 
00215 #endif

This is the RoboTour API documentation version 0.1 • Copyright (C) by Florian Fischer