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
159
160
161
162
163
|
//=============================================================================
/**
* @file CE_fostream.cpp
*
* $Id$
*
* @author Si Mong Park <spark@ociweb.com>
*
* This is a helper class to simulate basic functions of fostream for
* Windows CE since WinCE does not have IO stream.
*
* Note that the numeric base conversion does not work and will be displayed
* as received.
*/
// ============================================================================
#include "CE_fostream.h"
// This is CE only, prior to availability of iostreams (VC 8).
#if defined (ACE_HAS_WINCE) && defined (ACE_LACKS_IOSTREAM_TOTALLY)
ACE_CE_fostream* ACE_CE_fostream::instance_ = 0;
ACE_CE_fostream* ACE_CE_fostream::instance (void)
{
if (instance_ == 0) {
instance_ = new ACE_CE_fostream();
}
return instance_;
}
ACE_CE_fostream::ACE_CE_fostream()
: ostream_(0)
, displayMode_(dec)
{
}
ACE_CE_fostream::~ACE_CE_fostream()
{
ACE_OS::fclose(ostream_);
}
FILE* ACE_CE_fostream::open(const ACE_TCHAR *prog_name)
{
ostream_ = ACE_OS::fopen(prog_name, ACE_TEXT("a+"));
return ostream_;
}
ACE_CE_fostream& ACE_CE_fostream::operator << (NUM_TYPE num_type)
{
displayMode_ = num_type;
return *this;
}
ACE_CE_fostream& ACE_CE_fostream::operator << (const ACE_ANTI_TCHAR* c)
{
ACE_OS::fprintf(ostream_, "%s", c);
return *this;
}
ACE_CE_fostream& ACE_CE_fostream::operator << (ACE_ANTI_TCHAR c)
{
ACE_OS::fprintf(ostream_, "%c", c);
return *this;
}
ACE_CE_fostream& ACE_CE_fostream::operator << (const ACE_TCHAR* c)
{
fwprintf(ostream_, ACE_TEXT("%s"), c);
return *this;
}
ACE_CE_fostream& ACE_CE_fostream::operator << (ACE_TCHAR c)
{
fwprintf(ostream_, ACE_TEXT("%c"), c);
return *this;
}
ACE_CE_fostream& ACE_CE_fostream::operator << (short s)
{
if (displayMode_ == oct) {
const NUM_BITS = ACE_SIZEOF_SHORT * 8;
short currentMax = 16384;
for (int i = 0; i < NUM_BITS; ++i) {
}
}
else if (displayMode_ == hex) {
}
fwprintf(ostream_, ACE_TEXT("%d"), s);
return *this;
}
ACE_CE_fostream& ACE_CE_fostream::operator << (int i)
{
fwprintf(ostream_, ACE_TEXT("%d"), i);
return *this;
}
ACE_CE_fostream& ACE_CE_fostream::operator << (unsigned int i)
{
fwprintf(ostream_, ACE_TEXT("%d"), i);
return *this;
}
ACE_CE_fostream& ACE_CE_fostream::operator << (long l)
{
fwprintf(ostream_, ACE_TEXT("%f"), l);
return *this;
}
ACE_CE_fostream& ACE_CE_fostream::operator << (unsigned long l)
{
fwprintf(ostream_, ACE_TEXT("%f"), l);
return *this;
}
ACE_CE_fostream& ACE_CE_fostream::operator << (float f)
{
fwprintf(ostream_, ACE_TEXT("%f"), f);
return *this;
}
ACE_CE_fostream& ACE_CE_fostream::operator << (double d)
{
fwprintf(ostream_, ACE_TEXT("%f"), d);
return *this;
}
ACE_CE_fostream& ACE_CE_fostream::operator << (long double d)
{
fwprintf(ostream_, ACE_TEXT("%f"), d);
return *this;
}
ACE_CE_fostream& ACE_CE_fostream::operator << (const void* v)
{
fwprintf(ostream_, ACE_TEXT("%d"), v);
return *this;
}
#endif /* ACE_HAS_WINCE && ACE_LACKS_IOSTREAMS_TOTALLY */
|