SNAP Library , Developer Reference
2013-01-07 14:03:36
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
00001 // #define GLib_Console if you want Con output 00002 00003 class TCon; 00004 00006 // Console-Manipulator 00007 class TConManip { 00008 protected: 00009 TConManip() { } 00010 TConManip(const TConManip&); 00011 TConManip& operator = (const TConManip&); 00012 virtual ~TConManip(); 00013 public: 00014 virtual TCon& operator () (TCon& Con) const = 0; 00015 }; 00016 00018 // Console 00019 class TCon { 00020 private: 00021 #if defined (GLib_CreateConsole) 00022 bool Ok; 00023 HANDLE HStdOut; 00024 #endif 00025 00026 private: 00027 TCon(const TCon&); 00028 TCon& operator = (const TCon&); 00029 public: 00030 TCon(); 00031 ~TCon(); 00032 00033 int PutCh(const int& Ch) { PutBf((void *) &Ch, 1); return Ch; } 00034 void PutBf(const void *LBf, const int& LBfL); 00035 void Flush() { } 00036 00037 TCon& operator << (const bool& Bool) { PutCh(Bool ? 'T' : 'F'); return *this; } 00038 TCon& operator << (const uchar& UCh) { PutBf(&UCh, sizeof(UCh)); return *this; } 00039 TCon& operator << (const char& Ch) { PutBf(&Ch, sizeof(Ch)); return *this; } 00040 TCon& operator << (const int& Int); 00041 TCon& operator << (const uint& Int); 00042 TCon& operator << (const short& Sh) { operator<<((int) Sh); return *this; } 00043 TCon& operator << (const ushort& USh) { operator<<((uint) USh); return *this; } 00044 TCon& operator << (const float& Flt); 00045 TCon& operator << (const double& Double); 00046 TCon& operator << (const long double& LDouble); 00047 TCon& operator << (const char *CStr) { PutBf(CStr, int(strlen(CStr))); return *this; } 00048 TCon& operator << (const TStr& Str) { PutBf(Str.CStr(), Str.Len()); return *this; } 00049 TCon& operator << (const TChA& ChA) { PutBf(ChA.CStr(), ChA.Len()); return *this; } 00050 TCon& operator << (const TConManip& Mnp) { return Mnp(*this); } 00051 TCon& operator << (TCon& (*FuncPt)(TCon&)) { return FuncPt(*this); } 00052 00053 void operator () (const char * FmtStr, ...); 00054 }; 00055 00056 TCon& Eol(TCon& Con); 00057 TCon& Tab(TCon& Con); 00058 TCon& Spc(TCon& Con); 00059 00060 #if defined (GLib_Console) 00061 extern TCon Con; 00062 #endif 00063