CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
console.h
1
3#pragma once
4
5#include <fwd.h>
6#include <system/decimal.h>
7#include <system/string.h>
8#include <system/object.h>
9#include <system/io/text_writer.h>
10#include <system/io/text_reader.h>
11
12namespace System {
13
14 class ConsoleOutput;
15 class TypeInfo;
16
49 class Console
50 {
51 public:
55 template <class T>
56 static void Write(const SharedPtr<T>& object)
57 {
58 if (object)
60 }
61
64 static ASPOSECPP_SHARED_API void Write(bool value);
67 static ASPOSECPP_SHARED_API void Write(char_t value);
70 static ASPOSECPP_SHARED_API void Write(const ArrayPtr<char_t>& buffer);
73 static ASPOSECPP_SHARED_API void Write(const Decimal& value);
76 static ASPOSECPP_SHARED_API void Write(double value);
79 static ASPOSECPP_SHARED_API void Write(float value);
82 static ASPOSECPP_SHARED_API void Write(int32_t value);
85 static ASPOSECPP_SHARED_API void Write(int64_t value);
88 static ASPOSECPP_SHARED_API void Write(const String& value);
91 static ASPOSECPP_SHARED_API void Write(const char_t* value);
94 static ASPOSECPP_SHARED_API void Write(const TypeInfo& value);
97 static ASPOSECPP_SHARED_API void Write(uint32_t value);
100 static ASPOSECPP_SHARED_API void Write(uint64_t value);
105 static ASPOSECPP_SHARED_API void Write(const ArrayPtr<char_t>& buffer, int32_t index, int32_t count);
106
111 template<class... Args>
112 static void Write(const String& format, Args&&... args)
113 {
114 Write(String::Format(format, std::forward<Args>(args)...));
115 }
116
118 static ASPOSECPP_SHARED_API void WriteLine();
119
123 template <class T>
124 static void WriteLine(const SharedPtr<T>& object)
125 {
126 Write(object);
127 WriteLine();
128 }
131 static ASPOSECPP_SHARED_API void WriteLine(bool value);
134 static ASPOSECPP_SHARED_API void WriteLine(char_t value);
137 static ASPOSECPP_SHARED_API void WriteLine(const ArrayPtr<char_t>& buffer);
140 static ASPOSECPP_SHARED_API void WriteLine(const Decimal& value);
143 static ASPOSECPP_SHARED_API void WriteLine(double value);
146 static ASPOSECPP_SHARED_API void WriteLine(float value);
149 static ASPOSECPP_SHARED_API void WriteLine(int32_t value);
152 static ASPOSECPP_SHARED_API void WriteLine(int64_t value);
155 static ASPOSECPP_SHARED_API void WriteLine(const String& value);
158 static ASPOSECPP_SHARED_API void WriteLine(const char_t* value);
161 static ASPOSECPP_SHARED_API void WriteLine(const TypeInfo& value);
164 static ASPOSECPP_SHARED_API void WriteLine(uint32_t value);
167 static ASPOSECPP_SHARED_API void WriteLine(uint64_t value);
172 static ASPOSECPP_SHARED_API void WriteLine(const ArrayPtr<char_t>& buffer, int index, int count);
175 static ASPOSECPP_SHARED_API void WriteLine(const Exception& e);
176
181 template<class... Args>
182 static void WriteLine(const String& format, Args&&... args)
183 {
184 WriteLine(String::Format(format, std::forward<Args>(args)...));
185 }
186
187 static void Write(const char*) = delete;
188 static void WriteLine(const char*) = delete;
189
192 static void Beep()
193 {
194 throw NotImplementedException(ASPOSE_CURRENT_FUNCTION);
195 }
196
198 static ASPOSECPP_SHARED_API SharedPtr<System::IO::TextWriter>& get_Out();
200 static ASPOSECPP_SHARED_API SharedPtr<System::IO::TextWriter>& get_Error();
202 static ASPOSECPP_SHARED_API SharedPtr<System::IO::TextReader>& get_In();
203
206 static ASPOSECPP_SHARED_API void SetOut(const SharedPtr<System::IO::TextWriter>& value);
207
210 static ASPOSECPP_SHARED_API void SetError(const SharedPtr<System::IO::TextWriter>& value);
211
214 static ASPOSECPP_SHARED_API void SetIn(const SharedPtr<System::IO::TextReader>& value);
215
218 static ASPOSECPP_SHARED_API void Mute(bool muted);
219
221 static ASPOSECPP_SHARED_API void ReadKey();
222
223 private:
225 static bool muted;
226 }; // class Console
227
232 class ASPOSECPP_SHARED_CLASS ConsoleOutput : public System::IO::TextWriter
233 {
234 public:
236 ASPOSECPP_SHARED_API SharedPtr<System::Text::Encoding> get_Encoding() override;
239 ASPOSECPP_SHARED_API void Write(bool value) override;
242 ASPOSECPP_SHARED_API void Write(const SharedPtr<Object>& value) override;
245 ASPOSECPP_SHARED_API void Write(char_t value) override;
248 ASPOSECPP_SHARED_API void Write(Decimal value) override;
251 ASPOSECPP_SHARED_API void Write(double value) override;
254 ASPOSECPP_SHARED_API void Write(int32_t value) override;
257 ASPOSECPP_SHARED_API void Write(int64_t value) override;
260 ASPOSECPP_SHARED_API void Write(float value) override;
263 ASPOSECPP_SHARED_API void Write(const String& value) override;
266 ASPOSECPP_SHARED_API void Write(uint32_t value) override;
269 ASPOSECPP_SHARED_API void Write(uint64_t value) override;
272 ASPOSECPP_SHARED_API void Write(const ArrayPtr<char_t>& buffer) override;
277 ASPOSECPP_SHARED_API void Write(const ArrayPtr<char_t>& buffer, int32_t index, int32_t count) override;
278
280 ASPOSECPP_SHARED_API void WriteLine() override;
283 ASPOSECPP_SHARED_API void WriteLine(const SharedPtr<Object>& value) override;
286 ASPOSECPP_SHARED_API void WriteLine(bool value) override;
289 ASPOSECPP_SHARED_API void WriteLine(char_t value) override;
292 ASPOSECPP_SHARED_API void WriteLine(Decimal value) override;
295 ASPOSECPP_SHARED_API void WriteLine(double value) override;
298 ASPOSECPP_SHARED_API void WriteLine(int value) override;
301 ASPOSECPP_SHARED_API void WriteLine(int64_t value) override;
304 ASPOSECPP_SHARED_API void WriteLine(float value) override;
307 ASPOSECPP_SHARED_API void WriteLine(const String& value) override;
310 ASPOSECPP_SHARED_API void WriteLine(uint32_t value) override;
313 ASPOSECPP_SHARED_API void WriteLine(uint64_t value) override;
316 ASPOSECPP_SHARED_API void WriteLine(const ArrayPtr<char_t>& buffer) override;
321 ASPOSECPP_SHARED_API void WriteLine(const ArrayPtr<char_t>& buffer, int32_t index, int32_t count) override;
322
325 ASPOSECPP_SHARED_API void Write(const char_t* value) override;
328 ASPOSECPP_SHARED_API void WriteLine(const char_t* value) override;
331 ASPOSECPP_SHARED_API void Write(const TypeInfo& value) override;
334 ASPOSECPP_SHARED_API void WriteLine(const TypeInfo& value) override;
335
336 void Write(const char*) = delete;
337 void WriteLine(const char*) = delete;
338 };
339
340} // namespace System
Provides methods for outputting data to the standard output stream. This is a static type with no ins...
Definition: console.h:50
static void WriteLine(uint32_t value)
Outputs the string representation of unsigned 32-bit integer value followed by the current line termi...
static void WriteLine(float value)
Outputs the string representation of single-precision floating-point value followed by the current li...
static void Write(const Decimal &value)
Outputs the string representation of Decimal value to the standard output stream.
static void WriteLine(bool value)
Outputs the string representation of bool value followed by the current line terminator to the standa...
static void WriteLine(const Decimal &value)
Outputs the string representation of Decimal value followed by the current line terminator to the sta...
static void WriteLine(uint64_t value)
Outputs the string representation of unsigned 64-bit integer value followed by the current line termi...
static void Write(double value)
Outputs the string representation of double-precision floating-point value to the standard output str...
static void Write(const String &format, Args &&... args)
Outputs the string representation of the specified arguments formatted according to the specified for...
Definition: console.h:112
static void WriteLine(const char *)=delete
static void WriteLine(const ArrayPtr< char_t > &buffer)
Outputs the string representation of the specified character array followed by the current line termi...
static void Write(const ArrayPtr< char_t > &buffer)
Outputs the string representation of the specified character array to the standard output stream.
static void WriteLine(int32_t value)
Outputs the string representation of 32-bit integer value followed by the current line terminator to ...
static void Write(const char *)=delete
static void SetError(const SharedPtr< System::IO::TextWriter > &value)
Assigns the specified object to the class' Error property.
static void ReadKey()
NOT IMPLEMENTED.
static void Write(float value)
Outputs the string representation of single-precision floating-point value to the standard output str...
static void Beep()
NOT IMPLEMENTED.
Definition: console.h:192
static void WriteLine(const SharedPtr< T > &object)
Outputs the string representation of the specified object followed by the current line terminator to ...
Definition: console.h:124
static void WriteLine(const Exception &e)
Outputs the string representation of the specified Exception object followed by the current line term...
static void WriteLine(const char_t *value)
Outputs the specified c-string followed by the current line terminator to the standard output stream.
static void WriteLine(const ArrayPtr< char_t > &buffer, int index, int count)
Outputs the string representation of the specified range of the specified character array followed by...
static void Write(int32_t value)
Outputs the string representation of 32-bit integer value to the standard output stream.
static SharedPtr< System::IO::TextWriter > & get_Out()
Returns a shared pointer pointing to the object that represents the standard output stream.
static void Write(int64_t value)
Outputs the string representation of 64-bit integer value to the standard output stream.
static void Write(uint64_t value)
Outputs the string representation of unsigned 64-bit integer value to the standard output stream.
static void Write(const char_t *value)
Outputs the specified c-string to the standard output stream.
static void WriteLine()
Outputs the current line terminator to the standard output stream.
static void SetIn(const SharedPtr< System::IO::TextReader > &value)
Sets the In property to the specified TextReader object.
static void WriteLine(int64_t value)
Outputs the string representation of 64-bit integer value followed by the current line terminator to ...
static void WriteLine(const String &format, Args &&... args)
Outputs the string representation of the specified arguments formatted according to the specified for...
Definition: console.h:182
static void Write(const SharedPtr< T > &object)
Outputs the string representation of the specified object to the standard output stream.
Definition: console.h:56
static void WriteLine(const TypeInfo &value)
Outputs the string representation of TypeInfo value followed by the current line terminator to the st...
static void Write(const String &value)
Outputs the specified string object to the standard output stream.
static void Write(uint32_t value)
Outputs the string representation of unsigned 32-bit integer value to the standard output stream.
static void Write(const ArrayPtr< char_t > &buffer, int32_t index, int32_t count)
Outputs the string representation of the specified range of the specified character array to the stan...
static void Write(const TypeInfo &value)
Outputs the string representation of TypeInfo value to the standard output stream.
static void Write(bool value)
Outputs the string representation of bool value to the standard output stream.
static void WriteLine(double value)
Outputs the string representation of double-precision floating-point value followed by the current li...
static SharedPtr< System::IO::TextWriter > & get_Error()
Returns a shared pointer pointing to the object that represents the standard error stream.
static void WriteLine(char_t value)
Outputs the specified character value followed by the current line terminator to the standard output ...
static void SetOut(const SharedPtr< System::IO::TextWriter > &value)
Assigns the specified object to the class' Out property.
static SharedPtr< System::IO::TextReader > & get_In()
Returns a shared pointer pointing to the object that represents the standard input stream.
static void Write(char_t value)
Outputs the specified character value to the standard output stream.
static void Mute(bool muted)
Mutes or unmutes the standard output stream.
static void WriteLine(const String &value)
Outputs the specified string object followed by the current line terminator to the standard output st...
Represents the standard output stream. Objects of this class should only be allocated using System::M...
Definition: console.h:233
void WriteLine(const char_t *value) override
Outputs the specified c-string followed by the current line terminator to the output stream represent...
void Write(const String &value) override
Outputs the specified string object to the output stream represented by the current object.
void WriteLine(int value) override
Outputs the string representation of 32-bit integer value followed by the current line terminator to ...
void Write(const TypeInfo &value) override
Outputs the string representation of the specified TypeInfo object to the output stream represented b...
void Write(float value) override
Outputs the string representation of single-precision floating-point value to the output stream repre...
void WriteLine(float value) override
Outputs the string representation of single-precision floating-point value followed by the current li...
void Write(const SharedPtr< Object > &value) override
Outputs the string representation of the specified object to the output stream represented by the cur...
void WriteLine(const ArrayPtr< char_t > &buffer, int32_t index, int32_t count) override
Outputs the string representation of a range of values of the specified character array followed by t...
void WriteLine(Decimal value) override
Outputs the string representation of Decimal value followed by the current line terminator to the out...
void Write(char_t value) override
Outputs the specified character value to the output stream represented by the current object.
void WriteLine(const TypeInfo &value) override
Outputs the string representation of the specified TypeInfo object followed by the current line termi...
SharedPtr< System::Text::Encoding > get_Encoding() override
Always returns ASCII encoding.
void Write(int32_t value) override
Outputs the string representation of 32-bit integer value to the output stream represented by the cur...
void WriteLine(char_t value) override
Outputs the specified character value followed by the current line terminator to the output stream re...
void WriteLine(uint32_t value) override
Outputs the string representation of unsigned 32-bit integer value followed by the current line termi...
void WriteLine(bool value) override
Outputs the string representation of the specified bool value followed by the current line terminator...
void Write(const ArrayPtr< char_t > &buffer) override
Outputs the string representation of the specified character array to the output stream represented b...
void Write(bool value) override
Outputs the string representation of the specified bool value to the output stream represented by the...
void WriteLine(uint64_t value) override
Outputs the string representation of unsigned 64-bit integer value followed by the current line termi...
void Write(double value) override
Outputs the string representation of double-precision floating-point value to the output stream repre...
void WriteLine(const ArrayPtr< char_t > &buffer) override
Outputs the string representation of the specified character array followed by the current line termi...
void WriteLine(const String &value) override
Outputs the specified string object followed by the current line terminator to the output stream repr...
void Write(const ArrayPtr< char_t > &buffer, int32_t index, int32_t count) override
Outputs the string representation of a range of values of the specified character array to the output...
void Write(Decimal value) override
Outputs the string representation of Decimal value to the output stream represented by the current ob...
void WriteLine() override
Outputs the current line terminator to the output stream represented by the current object.
void WriteLine(const SharedPtr< Object > &value) override
Outputs the string representation of the specified object followed by the current line terminator to ...
void WriteLine(double value) override
Outputs the string representation of double-precision floating-point value followed by the current li...
void Write(uint32_t value) override
Outputs the string representation of unsigned 32-bit integer value to the output stream represented b...
void Write(int64_t value) override
Outputs the string representation of 64-bit integer value to the output stream represented by the cur...
void Write(const char *)=delete
void WriteLine(int64_t value) override
Outputs the string representation of 64-bit integer value followed by the current line terminator to ...
void WriteLine(const char *)=delete
void Write(const char_t *value) override
Outputs the specified c-string to the output stream represented by the current object.
void Write(uint64_t value) override
Outputs the string representation of unsigned 64-bit integer value to the output stream represented b...
Represents a decimal number. This type should be allocated on stack and passed to functions by value ...
Definition: decimal.h:107
Template that represents wrapper of exceptions that are derived from Exception class.
Definition: exception.h:113
A base class for classes that represent writers that writes sequences of characters to different dest...
Definition: text_writer.h:21
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:62
virtual String ToString() const
Analog of C# Object.ToString() method. Enables converting custom objects to string.
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
static String Format(const SharedPtr< IFormatProvider > &fp, const String &format, const Args &... args)
Formats string in C# style.
Definition: string.h:1405
Represents a particular type and provides information about it.
Definition: type_info.h:109
@ TypeInfo
Specifies that the member is a type.
Definition: db_command.h:9