Removed ACE_HAS_BSTRING, not used
[ACE_TAO.git] / ACE / ace / CE_Screen_Output.cpp
blob8711f1e57c48ff5277259f0133ad0ca4c12271ec
1 #include "ace/CE_Screen_Output.h"
2 #if defined (ACE_HAS_WINCE)
4 #include "ace/Log_Category.h"
6 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
8 ACE_CE_Screen_Output::ACE_CE_Screen_Output(HWND hEdit)
9 : handler_(hEdit)
10 , pFile_(0)
14 ACE_CE_Screen_Output::ACE_CE_Screen_Output()
15 : handler_(0)
16 , pFile_(0)
20 ACE_CE_Screen_Output::~ACE_CE_Screen_Output()
22 if (pFile_ != 0) {
23 fclose(pFile_);
27 void ACE_CE_Screen_Output::log(ACE_Log_Record &log_record)
29 ACE_TCHAR verbose_msg[ACE_Log_Record::MAXVERBOSELOGMSGLEN];
30 int result = log_record.format_msg (ACE_TEXT("WindozeCE"), // host name
31 0, // verbose flag
32 verbose_msg);
34 if (result == 0)
36 verbose_msg[ ACE_OS::strlen(verbose_msg) - 1 ] = 0; // CE does not like '\n' by itself.
37 *this << verbose_msg << endl;
41 void ACE_CE_Screen_Output::SetOutputWindow(HWND hEdit)
43 handler_ = hEdit;
46 void ACE_CE_Screen_Output::clear()
48 SetWindowText(handler_, 0);
51 ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (ACE_TCHAR* output)
53 int length = GetWindowTextLength(handler_);
54 SendMessage(handler_, EM_SETSEL, length, length);
55 SendMessage(handler_, EM_REPLACESEL, 0, (LPARAM)output);
57 if (pFile_ != 0)
59 fwprintf(pFile_, L"%s", output);
62 return *this;
65 ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (const ACE_TCHAR* output)
67 ACE_TCHAR* buffer = ACE_OS::strdup(output);
68 if (buffer != 0)
70 *this << buffer;
71 delete buffer;
73 return *this;
76 ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (ACE_ANTI_TCHAR* output)
78 *this << ACE_TEXT_CHAR_TO_TCHAR(output);
79 return *this;
82 ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (const ACE_ANTI_TCHAR* output)
84 *this << ACE_TEXT_CHAR_TO_TCHAR(output);
85 return *this;
88 ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (char output)
90 *this << (int)output;
91 return *this;
94 ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (unsigned char output)
96 *this << (int)output;
97 return *this;
100 ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (unsigned short output)
102 ACE_TCHAR buffer[20];
103 wsprintf(buffer, ACE_TEXT("%u"), output);
104 *this << buffer;
105 return *this;
108 ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (int output)
110 ACE_TCHAR buffer[20];
111 wsprintf(buffer, ACE_TEXT("%d"), output);
112 *this << buffer;
113 return *this;
116 ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (unsigned int output)
118 ACE_TCHAR buffer[20];
119 wsprintf(buffer, ACE_TEXT("%du"), output);
120 *this << buffer;
121 return *this;
124 ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (float output)
126 ACE_TCHAR buffer[20];
127 swprintf(buffer, ACE_TEXT("%f"), output);
128 *this << buffer;
129 return *this;
132 ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (long output)
134 ACE_TCHAR buffer[20];
135 wsprintf(buffer, ACE_TEXT("%l"), output);
136 *this << buffer;
137 return *this;
140 ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (unsigned long output)
142 ACE_TCHAR buffer[20];
143 wsprintf(buffer, ACE_TEXT("%lu"), output);
144 *this << buffer;
145 return *this;
148 ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (FILE* pFile)
150 pFile_ = pFile;
151 return *this;
154 ACE_END_VERSIONED_NAMESPACE_DECL
156 #endif // ACE_HAS_WINCE