KSquare Utilities
HTMLReport.h
Go to the documentation of this file.
1 
2 #ifndef _HTMLREPORT_
3 #define _HTMLREPORT_
4 
5 #include "DateTime.h"
6 #include "KKStr.h"
7 
8 
9 #ifndef WIN32
10 #define __cdecl
11 #endif
12 
13 
14 
15 namespace KKB
16 {
17  class HTMLReport
18  {
19  public:
21  enum class AlignmentType {Left, Center, Right};
22 
23  HTMLReport (KKStr _fileName,
24  KKStr _title,
25  AlignmentType _alignment
26  );
27 
28  ~HTMLReport ();
29 
30 
31  void Append (const char* str);
32  void Close ();
33 
34  ostream& OStream () {return r;}
35 
36 
41  friend HTMLReport& operator<< (HTMLReport& htmlReport, double right);
42 
43  friend HTMLReport& operator<< (HTMLReport& htmlReport, char right);
44  friend HTMLReport& operator<< (HTMLReport& htmlReport, const char* right);
45  friend HTMLReport& operator<< (HTMLReport& htmlReport, const KKStr& right);
47 
49 
50  friend HTMLReport& endl (HTMLReport& _outs);
51 
52 
53  private:
54  KKStr CurStyleStr ();
55 
56  AlignmentType curAlignment;
57 
58  KKStr fileName;
59  bool opened;
60  ofstream r;
61  KKStr title;
62  };
63 
64  typedef HTMLReport::HTMLReportPtr HTMLReportPtr;
65 
66 
67  #ifdef WIN32
68  HTMLReport& __cdecl operator<< (HTMLReport& htmlReport,
69  HTMLReport& (__cdecl* mf)(HTMLReport &)
70  );
71 
72  HTMLReport& __cdecl endl (HTMLReport& htmlReport);
73  #else
74 
76  HTMLReport & (*)(HTMLReport &)
77  );
78 
79 
81 
82  #endif
83 
84 
85  HTMLReport& operator<< (HTMLReport& htmlReport,
86  kkint32 right
87  );
88 
89  HTMLReport& operator<< (HTMLReport& htmlReport,
90  kkuint32 right
91  );
92 
93  HTMLReport& operator<< (HTMLReport& htmlReport,
94  kkint64 right
95  );
96 
97  HTMLReport& operator<< (HTMLReport& htmlReport,
98  kkuint64 right
99  );
100 
101  HTMLReport& operator<< (HTMLReport& htmlReport,
102  double right
103  );
104 
105  HTMLReport& operator<< (HTMLReport& htmlReport,
106  char right
107  );
108 
109  HTMLReport& operator<< (HTMLReport& htmlReport,
110  const char* right
111  );
112 
113  HTMLReport& operator<< (HTMLReport& htmlReport,
114  const KKStr& right
115  );
116 
117  HTMLReport& operator<< (HTMLReport& htmlReport,
118  KKStrConstPtr right
119  );
120 
121  HTMLReport& operator<< (HTMLReport& htmlReport,
122  const DateTime& right
123  );
124 
125 } /* namespace KKB */
126 
127 #endif
HTMLReport &__cdecl endl(HTMLReport &htmlReport)
Definition: HTMLReport.cpp:240
__int32 kkint32
Definition: KKBaseTypes.h:88
HTMLReport(KKStr _fileName, KKStr _title, AlignmentType _alignment)
Definition: HTMLReport.cpp:35
void Append(const char *str)
Definition: HTMLReport.cpp:88
unsigned __int32 kkuint32
Definition: KKBaseTypes.h:89
__int64 kkint64
Definition: KKBaseTypes.h:90
KKTHread * KKTHreadPtr
HTMLReport * HTMLReportPtr
Definition: HTMLReport.h:20
static KKStr Concat(const std::vector< std::string > &values)
Concatenates the list of &#39;std::string&#39; strings.
Definition: KKStr.cpp:1082
unsigned __int64 kkuint64
Definition: KKBaseTypes.h:91
friend std::ostream & operator<<(std::ostream &os, const Matrix &matrix)
ostream & OStream()
Definition: HTMLReport.h:34
HTMLReport &__cdecl operator<<(HTMLReport &htmlReport, HTMLReport &(__cdecl *mf)(HTMLReport &))
Definition: HTMLReport.cpp:230