1
2
3
4
5
6 using System;
7
8 namespace System.IO
9 {
10 public class StringWriter : TextWriter
11 {
12 public nothrow StringWriter() : str()
13 {
14 }
15 public nothrow string GetString()
16 {
17 return Rvalue(str);
18 }
19 public nothrow const string& Str() const
20 {
21 return str;
22 }
23 public override void Write(const string& x)
24 {
25 str.Append(x);
26 }
27 public override void Write(const wstring& x)
28 {
29 Write(ToUtf8(x));
30 }
31 public override void Write(const ustring& x)
32 {
33 Write(ToUtf8(x));
34 }
35 public override void Write(bool x)
36 {
37 Write(ToString(x));
38 }
39 public override void Write(char x)
40 {
41 Write(ToString(x));
42 }
43 public override void Write(wchar x)
44 {
45 Write(ToString(x));
46 }
47 public override void Write(uchar x)
48 {
49 Write(ToString(x));
50 }
51 public override void Write(sbyte x)
52 {
53 Write(ToString(x));
54 }
55 public override void Write(byte x)
56 {
57 Write(ToString(x));
58 }
59 public override void Write(short x)
60 {
61 Write(ToString(x));
62 }
63 public override void Write(ushort x)
64 {
65 Write(ToString(x));
66 }
67 public override void Write(int x)
68 {
69 Write(ToString(x));
70 }
71 public override void Write(uint x)
72 {
73 Write(ToString(x));
74 }
75 public override void Write(long x)
76 {
77 Write(ToString(x));
78 }
79 public override void Write(ulong x)
80 {
81 Write(ToString(x));
82 }
83 public override void Write(float x)
84 {
85 Write(ToString(x));
86 }
87 public override void Write(double x)
88 {
89 Write(ToString(x));
90 }
91 public override void Write(const Date& date)
92 {
93 Write(date.ToString());
94 }
95 public override void Write(const DateTime& dateTime)
96 {
97 Write(dateTime.ToString());
98 }
99 public override void WriteLine()
100 {
101 str.Append('\n');
102 }
103 public override void WriteLine(const string& x)
104 {
105 Write(x);
106 WriteLine();
107 }
108 public override void WriteLine(const wstring& x)
109 {
110 Write(x);
111 WriteLine();
112 }
113 public override void WriteLine(const ustring& x)
114 {
115 Write(x);
116 WriteLine();
117 }
118 public override void WriteLine(bool x)
119 {
120 Write(x);
121 WriteLine();
122 }
123 public override void WriteLine(sbyte x)
124 {
125 Write(x);
126 WriteLine();
127 }
128 public override void WriteLine(byte x)
129 {
130 Write(x);
131 WriteLine();
132 }
133 public override void WriteLine(short x)
134 {
135 Write(x);
136 WriteLine();
137 }
138 public override void WriteLine(ushort x)
139 {
140 Write(x);
141 WriteLine();
142 }
143 public override void WriteLine(int x)
144 {
145 Write(x);
146 WriteLine();
147 }
148 public override void WriteLine(uint x)
149 {
150 Write(x);
151 WriteLine();
152 }
153 public override void WriteLine(long x)
154 {
155 Write(x);
156 WriteLine();
157 }
158 public override void WriteLine(ulong x)
159 {
160 Write(x);
161 WriteLine();
162 }
163 public override void WriteLine(float x)
164 {
165 Write(x);
166 WriteLine();
167 }
168 public override void WriteLine(double x)
169 {
170 Write(x);
171 WriteLine();
172 }
173 public override void WriteLine(const Date& date)
174 {
175 Write(date);
176 WriteLine();
177 }
178 public override void WriteLine(const DateTime& dateTime)
179 {
180 Write(dateTime);
181 WriteLine();
182 }
183 private string str;
184 }
185 }