CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
text_writer.h
1
2#ifndef _aspose_system_io_text_writer_h_
3#define _aspose_system_io_text_writer_h_
4
5#include "system/string.h"
6#include "system/object.h"
7#include "system/array.h"
8#include "system/idisposable.h"
9#include "system/exceptions.h"
10#include "system/iformatprovider.h"
11
12#include "fwd.h"
13
14namespace System { class TypeInfo; }
15namespace System { namespace IO {
20class ASPOSECPP_SHARED_CLASS TextWriter : public IDisposable
21{
22 RTTI_INFO(System::IO::TextWriter, ::System::BaseTypesInfo<System::IDisposable>)
23
24public:
28 virtual ASPOSECPP_SHARED_API SharedPtr<System::Text::Encoding> get_Encoding() = 0;
30 virtual ASPOSECPP_SHARED_API SharedPtr<IFormatProvider> get_FormatProvider() const;
32 virtual ASPOSECPP_SHARED_API System::String get_NewLine() const;
35 virtual ASPOSECPP_SHARED_API void set_NewLine(const System::String &value);
37 virtual ~TextWriter() {};
39 ASPOSECPP_SHARED_API String get_NewLine();
41 ASPOSECPP_SHARED_API IFormatProviderPtr get_FormatProvider();
43 virtual void Dispose() override { Dispose(true); }
45 virtual void Close() { Dispose(true); }
47 virtual void Flush() {}
48
51 virtual ASPOSECPP_SHARED_API void Write(const SharedPtr<Object>& value);
54 virtual ASPOSECPP_SHARED_API void Write(bool value);
57 virtual ASPOSECPP_SHARED_API void Write(char_t value);
60 virtual ASPOSECPP_SHARED_API void Write(Decimal value);
63 virtual ASPOSECPP_SHARED_API void Write(double value);
66 virtual ASPOSECPP_SHARED_API void Write(int value);
69 virtual ASPOSECPP_SHARED_API void Write(int64_t value);
72 virtual ASPOSECPP_SHARED_API void Write(float value);
75 virtual ASPOSECPP_SHARED_API void Write(const String &value);
78 virtual ASPOSECPP_SHARED_API void Write(uint32_t value);
81 virtual ASPOSECPP_SHARED_API void Write(uint64_t value);
84 virtual ASPOSECPP_SHARED_API void Write(const ArrayPtr<char_t>& buffer);
89 virtual ASPOSECPP_SHARED_API void Write(const ArrayPtr<char_t>& buffer, int32_t index, int32_t count);
90
92 virtual ASPOSECPP_SHARED_API void WriteLine();
95 virtual ASPOSECPP_SHARED_API void WriteLine(const SharedPtr<Object>& value);
98 virtual ASPOSECPP_SHARED_API void WriteLine(bool value);
101 virtual ASPOSECPP_SHARED_API void WriteLine(char_t value);
104 virtual ASPOSECPP_SHARED_API void WriteLine(Decimal value);
107 virtual ASPOSECPP_SHARED_API void WriteLine(double value);
110 virtual ASPOSECPP_SHARED_API void WriteLine(int value);
113 virtual ASPOSECPP_SHARED_API void WriteLine(int64_t value);
116 virtual ASPOSECPP_SHARED_API void WriteLine(float value);
119 virtual ASPOSECPP_SHARED_API void WriteLine(const String &value);
122 virtual ASPOSECPP_SHARED_API void WriteLine(uint32_t value);
125 virtual ASPOSECPP_SHARED_API void WriteLine(uint64_t value);
128 virtual ASPOSECPP_SHARED_API void WriteLine(const ArrayPtr<char_t>& buffer);
133 virtual ASPOSECPP_SHARED_API void WriteLine(const ArrayPtr<char_t>& buffer, int32_t index, int32_t count);
136 virtual ASPOSECPP_SHARED_API void Write(const char_t* value);
139 virtual ASPOSECPP_SHARED_API void WriteLine(const char_t* value);
142 virtual ASPOSECPP_SHARED_API void Write(const TypeInfo& value);
145 virtual ASPOSECPP_SHARED_API void WriteLine(const TypeInfo& value);
146
151 template<class... TArgs>
152 void Write(const String& format, const TArgs&... args)
153 {
154 Write(String::Format(format, args...));
155 }
156
161 template<class... TArgs>
162 void WriteLine(const String& format, const TArgs&... args)
163 {
164 WriteLine( String::Format(format, args...));
165 }
166
167protected:
171 virtual ASPOSECPP_SHARED_API void WriteImpl(const char_t* value, int32_t length);
172
175 virtual ASPOSECPP_SHARED_API void Dispose(bool disposing);
176
179 ASPOSECPP_SHARED_API TextWriter();
182 ASPOSECPP_SHARED_API TextWriter(const IFormatProviderPtr& formatProvider);
183
188};
189
190}} // namespace System::IO
191
192#endif // _aspose_system_io_text_writer_h_
Represents a decimal number. This type should be allocated on stack and passed to functions by value ...
Definition: decimal.h:107
Defines method that releases resources owned by the current object. Objects of this class should only...
Definition: idisposable.h:30
A base class for classes that represent writers that writes sequences of characters to different dest...
Definition: text_writer.h:21
virtual void WriteLine(int64_t value)
Writes the string representation of the specified 64-bit integer value followed by the line-terminati...
virtual void WriteLine(const ArrayPtr< char_t > &buffer, int32_t index, int32_t count)
Writes the specified subrange of UTF-16 characters from the specified character array followed by the...
virtual void WriteLine(const TypeInfo &value)
Writes the string representation of the specified TypeInfo object followed by the line-terminating ch...
virtual void Write(double value)
Writes the string representation of the specified double-precision floating point value to the stream...
IFormatProviderPtr internalFormatProvider
IFormatProvider used by the current object.
Definition: text_writer.h:187
virtual void Write(char_t value)
Writes the specified character to the stream.
TextWriter(const IFormatProviderPtr &formatProvider)
Constructs a new intstance of TextWriter class that uses the specified IFormatProvider object.
System::SharedPtr< TextWriter > Ptr
An alias for a shared pointer to this class.
Definition: text_writer.h:26
virtual System::String get_NewLine() const
Returns a line terminator string.
String get_NewLine()
Returns a line terminator string.
virtual SharedPtr< IFormatProvider > get_FormatProvider() const
Returns the currently used IFormatProvider object.
virtual void Write(uint64_t value)
Writes the string representation of the specified unsigned 64-bit integer value to the stream.
void Write(const String &format, const TArgs &... args)
Writes the specified values formatted according to the specified format to the stream.
Definition: text_writer.h:152
virtual void WriteLine(bool value)
Writes the string representation of the specified boolean value followed by the line-terminating char...
virtual void WriteLine(float value)
Writes the string representation of the specified single-precision floating point value followed by t...
virtual void Dispose(bool disposing)
Releases all resources used by the current object and closes the undelying stream.
virtual void WriteLine(Decimal value)
Writes the string representation of the specified Decimal object followed by the line-terminating cha...
virtual void WriteLine(int value)
Writes the string representation of the specified 32-bit integer value followed by the line-terminati...
virtual void Write(Decimal value)
Writes the string representation of the specified Decimal object to the stream.
virtual SharedPtr< System::Text::Encoding > get_Encoding()=0
Returns the currently used encoding.
virtual void WriteLine(const SharedPtr< Object > &value)
Writes the string representation of the specified object followed by the line-terminating characters ...
IFormatProviderPtr get_FormatProvider()
Returns the currently used IFormatProvider object.
virtual void WriteLine(double value)
Writes the string representation of the specified double-precision floating point value followed by t...
void WriteLine(const String &format, const TArgs &... args)
Writes the specified values formatted according to the specified format followed by the line-terminat...
Definition: text_writer.h:162
virtual void Write(const TypeInfo &value)
Writes the string representation of the specified TypeInfo object to the stream.
TextWriter()
Constructs a new intstance of TextWriter class that uses IFormatProvider object from the invariant cu...
virtual void WriteImpl(const char_t *value, int32_t length)
Writes the specified c-string to the stream.
virtual void set_NewLine(const System::String &value)
Sets a line terminator string.
virtual void WriteLine(const ArrayPtr< char_t > &buffer)
Writes all characetrs from the specified array followed by the line-terminating characters to the str...
virtual void Close()
Closes the stream and releases aquired resources.
Definition: text_writer.h:45
virtual void Write(const char_t *value)
Writes the specified c-string to the stream.
virtual void Write(const ArrayPtr< char_t > &buffer)
Writes all characetrs from the specified array to the stream.
virtual void Dispose() override
Releases all resources used by the current object and closes the undelying stream.
Definition: text_writer.h:43
virtual void Flush()
Flushes the content of the buffer to the underlying stream.
Definition: text_writer.h:47
virtual void Write(int value)
Writes the string representation of the specified 32-bit integer value to the stream.
virtual void WriteLine()
Writes line terminator characters to the stream.
virtual void Write(float value)
Writes the string representation of the specified single-precision floating point value to the stream...
virtual void WriteLine(const char_t *value)
Writes the specified c-string followed by the line-terminating characters to the stream.
virtual ~TextWriter()
Destructor.
Definition: text_writer.h:37
virtual void WriteLine(char_t value)
Writes the specified character followed by the line-terminating characters to the stream.
virtual void WriteLine(uint32_t value)
Writes the string representation of the specified unsigned 32-bit integer value followed by the line-...
virtual void Write(int64_t value)
Writes the string representation of the specified 64-bit integer value to the stream.
virtual void Write(bool value)
Writes the string representation of the specified boolean value to the stream.
virtual void Write(const String &value)
Writes the specified string to the stream.
virtual void Write(uint32_t value)
Writes the string representation of the specified unsigned 32-bit integer value to the stream.
virtual void WriteLine(const String &value)
Writes the specified string followed by the line-terminating characters to the stream.
virtual void WriteLine(uint64_t value)
Writes the string representation of the specified unsigned 64-bit integer value followed by the line-...
virtual void Write(const ArrayPtr< char_t > &buffer, int32_t index, int32_t count)
Writes the specified subrange of UTF-16 characters from the specified character array to the stream.
virtual void Write(const SharedPtr< Object > &value)
Writes the string representation of the specified object to the stream.
ArrayPtr< char_t > CoreNewLine
The line terminator string.
Definition: text_writer.h:185
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