1 // =================================
  2 // Copyright (c) 2021 Seppo Laakko
  3 // Distributed under the MIT license
  4 // =================================
  5 
  6 using System.IO;
  7 
  8 namespace System
  9 {
 10     public static class Console
 11     {
 12         static Console() : 
 13             in(SharedPtr<ByteStream>(new FileByteStream(stdin)))
 14             out(SharedPtr<ByteStream>(new FileByteStream(stdout)))
 15             err(SharedPtr<ByteStream>(new FileByteStream(stderr)))
 16         {
 17         }
 18         public static void Write(const char* s)
 19         {
 20             out.Write(s);
 21         }
 22         public static void Write(const wchar* s)
 23         {
 24             out.Write(s);
 25         }
 26         public static void Write(const uchar* s)
 27         {
 28             out.Write(s);
 29         }
 30         public static void Write(const string& s)
 31         {
 32             out.Write(s);
 33         }
 34         public static void Write(const wstring& s)
 35         {
 36             out.Write(s);
 37         }
 38         public static void Write(const ustring& s)
 39         {
 40             out.Write(s);
 41         }
 42         public static void Write(bool b)
 43         {
 44             out.Write(b);
 45         }
 46         public static void Write(sbyte s)
 47         {
 48             out.Write(s);
 49         }
 50         public static void Write(byte b)
 51         {
 52             out.Write(b);
 53         }
 54         public static void Write(short s)
 55         {
 56             out.Write(s);
 57         }
 58         public static void Write(ushort u)
 59         {
 60             out.Write(u);
 61         }
 62         public static void Write(int i)
 63         {
 64             out.Write(i);
 65         }
 66         public static void Write(uint u)
 67         {
 68             out.Write(u);
 69         }
 70         public static void Write(long l)
 71         {
 72             out.Write(l);
 73         }
 74         public static void Write(ulong u)
 75         {
 76             out.Write(u);
 77         }
 78         public static void Write(float f)
 79         {
 80             out.Write(f);
 81         }
 82         public static void Write(double d)
 83         {
 84             out.Write(d);
 85         }
 86         public static void Write(char c)
 87         {
 88             out.Write(c);
 89         }
 90         public static void Write(wchar w)
 91         {
 92             out.Write(w);
 93         }
 94         public static void Write(uchar u)
 95         {
 96             out.Write(u);
 97         }
 98         public static void Write(const Date& date)
 99         {
100             out.Write(date);
101         }
102         public static void Write(const DateTime& dateTime)
103         {
104             out.Write(dateTime);
105         }
106         public static void WriteLine()
107         {
108             out.WriteLine();
109         }
110         public static void WriteLine(const char* s)
111         {
112             out.WriteLine(s);
113         }
114         public static void WriteLine(const wchar* s)
115         {
116             out.WriteLine(s);
117         }
118         public static void WriteLine(const uchar* s)
119         {
120             out.WriteLine(s);
121         }
122         public static void WriteLine(const string& s)
123         {
124             out.WriteLine(s);
125         }
126         public static void WriteLine(const wstring& s)
127         {
128             out.WriteLine(s);
129         }
130         public static void WriteLine(const ustring& s)
131         {
132             out.WriteLine(s);
133         }
134         public static void WriteLine(bool b)
135         {
136             out.WriteLine(b);
137         }
138         public static void WriteLine(sbyte s)
139         {
140             out.WriteLine(s);
141         }
142         public static void WriteLine(byte b)
143         {
144             out.WriteLine(b);
145         }
146         public static void WriteLine(short s)
147         {
148             out.WriteLine(s);
149         }
150         public static void WriteLine(ushort u)
151         {
152             out.WriteLine(u);
153         }
154         public static void WriteLine(int i)
155         {
156             out.WriteLine(i);
157         }
158         public static void WriteLine(uint u)
159         {
160             out.WriteLine(u);
161         }
162         public static void WriteLine(long l)
163         {
164             out.WriteLine(l);
165         }
166         public static void WriteLine(ulong u)
167         {
168             out.WriteLine(u);
169         }
170         public static void WriteLine(float f)
171         {
172             out.WriteLine(f);
173         }
174         public static void WriteLine(double d)
175         {
176             out.WriteLine(d);
177         }
178         public static void WriteLine(char c)
179         {
180             out.WriteLine(c);
181         }
182         public static void WriteLine(wchar w)
183         {
184             out.WriteLine(w);
185         }
186         public static void WriteLine(uchar u)
187         {
188             out.WriteLine(u);
189         }
190         public static void WriteLine(const Date& date)
191         {
192             out.WriteLine(date);
193         }
194         public static void WriteLine(const DateTime& dateTime)
195         {
196             out.WriteLine(dateTime);
197         }
198         public static int Read()
199         {
200             return in.Read();
201         }
202         public static string ReadLine()
203         {
204             return in.ReadLine();
205         }
206         public static string ReadToEnd()
207         {
208             return in.ReadToEnd();
209         }
210         public static nothrow StreamReader& In()
211         {
212             return in;
213         }
214         public static nothrow StreamWriter& Out()
215         {
216             return out;
217         }
218         public static nothrow StreamWriter& Error()
219         {
220             return err;
221         }
222         public static nothrow void SetIn(StreamReader&& in_)
223         {
224             in = in_;
225         }
226         public static nothrow void SetOut(StreamWriter&& out_)
227         {
228             out = out_;
229         }
230         public static nothrow void SetError(StreamWriter&& err_)
231         {
232             err = err_;
233         }
234         private static StreamReader in;
235         private static StreamWriter out;
236         private static StreamWriter err;
237     }
238 }