1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
// $Id$
#include "ace/CE_Screen_Output.h"
#if defined (ACE_HAS_WINCE)
#include "ace/Log_Msg.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_CE_Screen_Output::ACE_CE_Screen_Output(HWND hEdit)
: handler_(hEdit)
, pFile_(0)
{
}
ACE_CE_Screen_Output::ACE_CE_Screen_Output()
: handler_(0)
, pFile_(0)
{
}
ACE_CE_Screen_Output::~ACE_CE_Screen_Output()
{
if (pFile_ != 0) {
fclose(pFile_);
}
}
void ACE_CE_Screen_Output::log(ACE_Log_Record &log_record)
{
ACE_TCHAR verbose_msg[ACE_Log_Record::MAXVERBOSELOGMSGLEN];
int result = log_record.format_msg (ACE_LIB_TEXT("WindozeCE"), // host name
0, // verbose flag
verbose_msg);
if (result == 0)
{
verbose_msg[ ACE_OS::strlen(verbose_msg) - 1 ] = 0; // CE does not like '\n' by itself.
*this << verbose_msg << endl;
}
}
void ACE_CE_Screen_Output::SetOutputWindow(HWND hEdit)
{
handler_ = hEdit;
}
void ACE_CE_Screen_Output::clear()
{
SetWindowText(handler_, 0);
}
ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (ACE_TCHAR* output)
{
int length = GetWindowTextLength(handler_);
SendMessage(handler_, EM_SETSEL, length, length);
SendMessage(handler_, EM_REPLACESEL, 0, (LPARAM)output);
if (pFile_ != 0)
{
fwprintf(pFile_, L"%s", output);
}
return *this;
}
ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (const ACE_TCHAR* output)
{
ACE_TCHAR* buffer = ACE_OS::strdup(output);
if (buffer != 0)
{
*this << buffer;
delete buffer;
}
return *this;
}
ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (ACE_ANTI_TCHAR* output)
{
*this << ACE_TEXT_CHAR_TO_TCHAR(output);
return *this;
}
ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (const ACE_ANTI_TCHAR* output)
{
*this << ACE_TEXT_CHAR_TO_TCHAR(output);
return *this;
}
ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (char output)
{
*this << (int)output;
return *this;
}
ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (unsigned char output)
{
*this << (int)output;
return *this;
}
ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (unsigned short output)
{
ACE_TCHAR buffer[20];
wsprintf(buffer, ACE_LIB_TEXT("%u"), output);
*this << buffer;
return *this;
}
ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (int output)
{
ACE_TCHAR buffer[20];
wsprintf(buffer, ACE_LIB_TEXT("%d"), output);
*this << buffer;
return *this;
}
ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (unsigned int output)
{
ACE_TCHAR buffer[20];
wsprintf(buffer, ACE_LIB_TEXT("%du"), output);
*this << buffer;
return *this;
}
ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (float output)
{
ACE_TCHAR buffer[20];
swprintf(buffer, ACE_LIB_TEXT("%f"), output);
*this << buffer;
return *this;
}
ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (long output)
{
ACE_TCHAR buffer[20];
wsprintf(buffer, ACE_LIB_TEXT("%l"), output);
*this << buffer;
return *this;
}
ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (unsigned long output)
{
ACE_TCHAR buffer[20];
wsprintf(buffer, ACE_LIB_TEXT("%lu"), output);
*this << buffer;
return *this;
}
ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (FILE* pFile)
{
pFile_ = pFile;
return *this;
}
ACE_END_VERSIONED_NAMESPACE_DECL
#endif // ACE_HAS_WINCE
|