SNAP Library 2.3, User Reference  2014-06-16 11:58:46
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TCon Class Reference

#include <console.h>

Public Member Functions

 TCon ()
 
 ~TCon ()
 
int PutCh (const int &Ch)
 
void PutBf (const void *LBf, const int &LBfL)
 
void Flush ()
 
TConoperator<< (const bool &Bool)
 
TConoperator<< (const uchar &UCh)
 
TConoperator<< (const char &Ch)
 
TConoperator<< (const int &Int)
 
TConoperator<< (const uint &Int)
 
TConoperator<< (const short &Sh)
 
TConoperator<< (const ushort &USh)
 
TConoperator<< (const float &Flt)
 
TConoperator<< (const double &Double)
 
TConoperator<< (const long double &LDouble)
 
TConoperator<< (const char *CStr)
 
TConoperator<< (const TStr &Str)
 
TConoperator<< (const TChA &ChA)
 
TConoperator<< (const TConManip &Mnp)
 
TConoperator<< (TCon &(*FuncPt)(TCon &))
 
void operator() (const char *FmtStr,...)
 

Private Member Functions

 TCon (const TCon &)
 
TConoperator= (const TCon &)
 

Detailed Description

Definition at line 19 of file console.h.

Constructor & Destructor Documentation

TCon::TCon ( const TCon )
private
TCon::TCon ( )

Definition at line 3 of file console.cpp.

3  {
4 #if defined (GLib_CreateConsole)
5  Ok = (AllocConsole() != 0);
6  HStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
7  IAssert(HStdOut != INVALID_HANDLE_VALUE);
8 #endif
9 }
#define IAssert(Cond)
Definition: bd.h:262
TCon::~TCon ( )

Definition at line 11 of file console.cpp.

11  {
12 #if defined (GLib_CreateConsole)
13  if (Ok) IAssert(FreeConsole());
14 #endif
15 }
#define IAssert(Cond)
Definition: bd.h:262

Member Function Documentation

void TCon::Flush ( )
inline

Definition at line 35 of file console.h.

35 { }
void TCon::operator() ( const char *  FmtStr,
  ... 
)

Definition at line 65 of file console.cpp.

65  {
66  static char Bf [2048];
67  va_list valist; va_start(valist, FmtStr);
68  int BfL=vsnprintf(Bf, 2048, FmtStr, valist); va_end(valist);
69  if (BfL!=-1){PutBf((void *) Bf, BfL);}
70  else {PutBf((void *) Bf, 2048);}
71 }
void PutBf(const void *LBf, const int &LBfL)
Definition: console.cpp:17
TCon& TCon::operator<< ( const bool &  Bool)
inline

Definition at line 37 of file console.h.

37 { PutCh(Bool ? 'T' : 'F'); return *this; }
int PutCh(const int &Ch)
Definition: console.h:33
TCon& TCon::operator<< ( const uchar UCh)
inline

Definition at line 38 of file console.h.

38 { PutBf(&UCh, sizeof(UCh)); return *this; }
void PutBf(const void *LBf, const int &LBfL)
Definition: console.cpp:17
TCon& TCon::operator<< ( const char &  Ch)
inline

Definition at line 39 of file console.h.

39 { PutBf(&Ch, sizeof(Ch)); return *this; }
void PutBf(const void *LBf, const int &LBfL)
Definition: console.cpp:17
TCon & TCon::operator<< ( const int &  Int)

Definition at line 29 of file console.cpp.

29  {
30  char Bf[255];
31  sprintf(Bf, "%d", Int);
32  PutBf((void *) Bf, int(strlen(Bf)));
33  return *this;
34 }
void PutBf(const void *LBf, const int &LBfL)
Definition: console.cpp:17
TCon & TCon::operator<< ( const uint Int)

Definition at line 36 of file console.cpp.

36  {
37  char Bf[255];
38  sprintf(Bf, "%u", UInt);
39  PutBf((void *) Bf, int(strlen(Bf)));
40  return *this;
41 }
void PutBf(const void *LBf, const int &LBfL)
Definition: console.cpp:17
TCon& TCon::operator<< ( const short &  Sh)
inline

Definition at line 42 of file console.h.

42 { operator<<((int) Sh); return *this; }
TCon & operator<<(const bool &Bool)
Definition: console.h:37
TCon& TCon::operator<< ( const ushort USh)
inline

Definition at line 43 of file console.h.

43 { operator<<((uint) USh); return *this; }
unsigned int uint
Definition: bd.h:11
TCon & operator<<(const bool &Bool)
Definition: console.h:37
TCon & TCon::operator<< ( const float &  Flt)

Definition at line 43 of file console.cpp.

43  {
44  char Bf[255];
45  sprintf(Bf, "%g", Flt);
46  PutBf((void *) Bf, int(strlen(Bf)));
47  return *this;
48 
49 }
void PutBf(const void *LBf, const int &LBfL)
Definition: console.cpp:17
TCon & TCon::operator<< ( const double &  Double)

Definition at line 51 of file console.cpp.

51  {
52  char Bf[255];
53  sprintf(Bf, "%g", Double);
54  PutBf((void *) Bf, int(strlen(Bf)));
55  return *this;
56 }
void PutBf(const void *LBf, const int &LBfL)
Definition: console.cpp:17
TCon & TCon::operator<< ( const long double &  LDouble)

Definition at line 58 of file console.cpp.

58  {
59  char Bf[255];
60  sprintf(Bf, "%Lg", LDouble);
61  PutBf((void *) Bf, int(strlen(Bf)));
62  return *this;
63 }
void PutBf(const void *LBf, const int &LBfL)
Definition: console.cpp:17
TCon& TCon::operator<< ( const char *  CStr)
inline

Definition at line 47 of file console.h.

47 { PutBf(CStr, int(strlen(CStr))); return *this; }
void PutBf(const void *LBf, const int &LBfL)
Definition: console.cpp:17
TCon& TCon::operator<< ( const TStr Str)
inline

Definition at line 48 of file console.h.

48 { PutBf(Str.CStr(), Str.Len()); return *this; }
int Len() const
Definition: dt.h:487
void PutBf(const void *LBf, const int &LBfL)
Definition: console.cpp:17
char * CStr()
Definition: dt.h:476
TCon& TCon::operator<< ( const TChA ChA)
inline

Definition at line 49 of file console.h.

49 { PutBf(ChA.CStr(), ChA.Len()); return *this; }
int Len() const
Definition: dt.h:259
char * CStr()
Definition: dt.h:255
void PutBf(const void *LBf, const int &LBfL)
Definition: console.cpp:17
TCon& TCon::operator<< ( const TConManip Mnp)
inline

Definition at line 50 of file console.h.

50 { return Mnp(*this); }
TCon& TCon::operator<< ( TCon &(*)(TCon &)  FuncPt)
inline

Definition at line 51 of file console.h.

51 { return FuncPt(*this); }
TCon& TCon::operator= ( const TCon )
private
void TCon::PutBf ( const void *  LBf,
const int &  LBfL 
)

Definition at line 17 of file console.cpp.

17  {
18 #if defined (GLib_Console)
19  #if defined (GLib_CreateConsole)
20  DWORD ChsWritten;
21  WriteConsole(HStdOut, LBf, LBfL, &ChsWritten, 0);
22  IAssert(ChsWritten == static_cast<DWORD>(LBfL));
23  #else
24  fwrite(LBf, sizeof(char), LBfL, stdout);
25  #endif
26 #endif
27 }
#define IAssert(Cond)
Definition: bd.h:262
int TCon::PutCh ( const int &  Ch)
inline

Definition at line 33 of file console.h.

33 { PutBf((void *) &Ch, 1); return Ch; }
void PutBf(const void *LBf, const int &LBfL)
Definition: console.cpp:17

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