1 #ifndef __CRTRACE
2 #define __CRTRACE 1
3 
4 #include "lvstring.h"
5 
6 struct endtrace {
endtraceendtrace7     endtrace() {}
8 };
9 
10 class crtrace {
11     lString8 buffer_;
12 public:
crtrace()13     crtrace() : buffer_()  {}
crtrace(const char * c)14     crtrace(const char *c) : buffer_(c) {}
~crtrace()15     virtual ~crtrace() { flush(); }
flush()16     void flush() {
17         CRLog::info(buffer_.c_str());
18         buffer_.clear();
19     }
20 
21     crtrace& operator << (const char *s) {
22         buffer_.append(s);
23         return *this;
24     }
25 
26     crtrace& operator << (const lString8& ls8) {
27         buffer_.append(ls8);
28         return *this;
29     }
30 
31     crtrace& operator << (const lString32& ls32) {
32         buffer_.append(UnicodeToUtf8(ls32));
33         return *this;
34     }
35 
36     crtrace& operator << (int i) {
37         buffer_.append(lString8::itoa(i));
38         return *this;
39     }
40 
41     void operator << (const endtrace&) {
42         flush();
43     }
44 
45 };
46 
47 #endif
48