tConsole Class Reference

#include <tConsole.h>

Inheritance diagram for tConsole:

Inheritance graph
[legend]
Collaboration diagram for tConsole:

Collaboration graph
[legend]

List of all members.

Public Member Functions

typedef bool MessageCallback (const tOutput &message, const tOutput &interpretation, REAL timeout)
typedef bool IdleCallback ()
virtual ~tConsole ()
tConsolePrint (tString s)
template<class T>
tConsoleoperator<< (const T &x)
void CenterDisplay (tString s, REAL timeout=5, REAL r=1, REAL g=1, REAL b=1)
virtual tString ColorString (REAL r, REAL g, REAL b) const

Static Public Member Functions

static bool Message (const tOutput &message, const tOutput &interpetation, REAL timeout=-1)
static bool Idle ()
static void RegisterMessageCallback (MessageCallback *callback)
static void RegisterIdleCallback (IdleCallback *callback)

Static Protected Member Functions

static void RegisterBetterConsole (tConsole *better)

Private Member Functions

virtual tConsoleDoPrint (const tString &s)
virtual void DoCenterDisplay (const tString &s, REAL timeout=5, REAL r=1, REAL g=1, REAL b=1)

Static Private Attributes

static tConsoles_betterConsole = NULL


Detailed Description

Definition at line 69 of file tConsole.h.


Constructor & Destructor Documentation

tConsole::~tConsole (  )  [virtual]

Definition at line 158 of file tConsole.cpp.

References NULL, and s_betterConsole.

00158                    {
00159     if (s_betterConsole == this)
00160         s_betterConsole = NULL;
00161 }


Member Function Documentation

typedef bool tConsole::MessageCallback ( const tOutput message,
const tOutput interpretation,
REAL  timeout 
)

typedef bool tConsole::IdleCallback (  ) 

tConsole & tConsole::Print ( tString  s  ) 

Definition at line 166 of file tConsole.cpp.

References DoPrint(), FilterLine(), line_, s_betterConsole, and tString::Size().

Referenced by operator<<().

00167 {
00168     // append to line
00169     line_ += s;
00170 
00171     // determine if a newline was received
00172     bool newline = false;
00173     for ( int i = s.Size()-1; i>=0; --i )
00174         if ( s(i) == '\n' )
00175             newline = true;
00176 
00177     if ( newline )
00178     {
00179         // filter
00180         FilterLine( line_ );
00181 
00182         // print
00183         if (s_betterConsole)
00184             s_betterConsole->DoPrint( line_ );
00185         else
00186             DoPrint( line_ );
00187 
00188         line_ = "";
00189     }
00190 
00191     return *this;
00192 }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T>
tConsole& tConsole::operator<< ( const T &  x  )  [inline]

Definition at line 83 of file tConsole.h.

References Print().

00083                                                       {
00084         tColoredString s;
00085         s << x;
00086         return Print(s);
00087     }

Here is the call graph for this function:

void tConsole::CenterDisplay ( tString  s,
REAL  timeout = 5,
REAL  r = 1,
REAL  g = 1,
REAL  b = 1 
)

Definition at line 194 of file tConsole.cpp.

References DoCenterDisplay(), FilterLine(), and s_betterConsole.

Referenced by gGame::GameLoop().

00195 {
00196     FilterLine(s);
00197 
00198     if (s_betterConsole)
00199         s_betterConsole->DoCenterDisplay(s,timeout,r,g,b);
00200     else
00201         DoCenterDisplay(s,timeout,r,g,b);
00202 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool tConsole::Message ( const tOutput message,
const tOutput interpetation,
REAL  timeout = -1 
) [static]

Definition at line 233 of file tConsole.cpp.

References con, and s_messageCallback.

Referenced by nServerInfo::GetFromMaster(), uMenu::HandleEvent(), main(), se_DeletePasswords(), and sg_NetworkError().

00233                                                                                          {
00234     if (s_messageCallback)
00235         return (*s_messageCallback)(message, interpretation, timeout);
00236     else
00237     {
00238         con << tString(message) << ":\n";
00239         con << tString(interpretation) << '\n';
00240         return true;
00241     }
00242 }

Here is the caller graph for this function:

bool tConsole::Idle (  )  [static]

Definition at line 250 of file tConsole.cpp.

References s_idleCallback.

00250                    {
00251     if (s_idleCallback)
00252     {
00253         return (*s_idleCallback)();
00254     }
00255     else
00256     {
00257         return false;
00258     }
00259 }

tString tConsole::ColorString ( REAL  r,
REAL  g,
REAL  b 
) const [virtual]

Reimplemented in rConsole.

Definition at line 219 of file tConsole.cpp.

References ColorString(), and s_betterConsole.

Referenced by ColorString(), and nConfItem< tString >::NetReadVal().

00219                                                          {
00220     if (s_betterConsole)
00221         return s_betterConsole->ColorString(r,g,b);
00222     else
00223         return tString("");
00224 }

Here is the call graph for this function:

Here is the caller graph for this function:

void tConsole::RegisterMessageCallback ( MessageCallback *  callback  )  [static]

Definition at line 228 of file tConsole.cpp.

References s_messageCallback.

Referenced by main().

00229 {
00230     s_messageCallback = a_callback;
00231 }

Here is the caller graph for this function:

void tConsole::RegisterIdleCallback ( IdleCallback *  callback  )  [static]

Definition at line 245 of file tConsole.cpp.

References s_idleCallback.

Referenced by main().

00246 {
00247     s_idleCallback = a_callback;
00248 }

Here is the caller graph for this function:

void tConsole::RegisterBetterConsole ( tConsole better  )  [static, protected]

Definition at line 215 of file tConsole.cpp.

References s_betterConsole.

Referenced by nCon::nCon(), and rConsole::rConsole().

00215                                                     {
00216     s_betterConsole = better;
00217 }

Here is the caller graph for this function:

tConsole & tConsole::DoPrint ( const tString s  )  [private, virtual]

Reimplemented in rConsole.

Definition at line 204 of file tConsole.cpp.

Referenced by Print().

00204                                             {
00205     std::cout << s;
00206     std::cout.flush();
00207     return *this;
00208 }

Here is the caller graph for this function:

void tConsole::DoCenterDisplay ( const tString s,
REAL  timeout = 5,
REAL  r = 1,
REAL  g = 1,
REAL  b = 1 
) [private, virtual]

Reimplemented in rConsole.

Definition at line 210 of file tConsole.cpp.

Referenced by CenterDisplay().

00210                                                                                 {
00211     std::cout << s;
00212     std::cout.flush();
00213 }

Here is the caller graph for this function:


Member Data Documentation

tConsole * tConsole::s_betterConsole = NULL [static, private]

Definition at line 106 of file tConsole.h.

Referenced by CenterDisplay(), ColorString(), Print(), RegisterBetterConsole(), and ~tConsole().


The documentation for this class was generated from the following files:
Generated on Sat Mar 15 23:55:47 2008 for Armagetron Advanced by  doxygen 1.5.4