2#ifndef __StreamWriter_h__
3#define __StreamWriter_h__
5#include "system/io/text_writer.h"
6#include "system/text/encoding.h"
10namespace System {
namespace IO {
81 ASPOSECPP_SHARED_API
void Write(char_t value)
override;
84 ASPOSECPP_SHARED_API
void Write(
const String &value)
override;
99 ASPOSECPP_SHARED_API
void Write(
const char_t* buffer)
override;
124 template <
typename T>
127 Write(obj->ToString());
133 template <
typename T>
136 WriteLine(obj->ToString());
142 ASPOSECPP_SHARED_API
void Close()
override;
145 ASPOSECPP_SHARED_API
void Flush()
override;
150 ASPOSECPP_SHARED_API
void Dispose(
bool disposing)
override;
162 void CheckState()
const;
168 void LowLevelWrite (
const char_t* first,
const char_t* last);
169 void LowLevelWrite (std::vector<char_t>::const_iterator first, std::vector<char_t>::const_iterator last);
174 void Initialize(
const EncodingPtr& encoding,
int buffer_size);
180 bool m_preamble_done{};
193 SharedPtr<Stream> m_internal_stream;
198#ifdef ASPOSE_GET_SHARED_MEMBERS
201 ASPOSECPP_SHARED_API
void GetSharedMembers(System::Object::shared_members_type& result)
const override;
204#ifdef __DBG_FOR_EACH_MEMBER
206 ASPOSECPP_SHARED_API
void DBG_for_each_member(DBG::for_each_member_visitor &visitor)
const override;
207 const char* DBG_class_name()
const override {
return "StreamWriter"; }
Represents a writer that writes characters to a byte stream. Objects of this class should only be all...
Definition: stream_writer.h:18
void Close() override
Closes the stream and releases aquired resources.
StreamWriter(const SharedPtr< Stream > &stream, const EncodingPtr &encoding, int buffer_size, bool leave_open=false)
Constructs an instance of StreamWriter object that writes characters to the specified underlying stre...
void WriteLine(const ArrayPtr< char_t > &buffer) override
Writes all characetrs from the specified array followed by the line-terminating characters to the str...
void Write(const String &value) override
Writes the specified string to the stream.
void Dispose(bool disposing) override
Releases all resources used by the current object and closes the underlying stream.
void Write(char_t value) override
Writes the specified character to the stream.
void Flush() override
Flushes the content of the buffer to the underlying stream and then flushes the underlying stream.
bool get_AutoFlush() const
Returns a value that indicates whether the StreamWriter will flush the data to the underlying stream ...
SharedPtr< Stream > get_BaseStream() const
Returns a shared pointer to an object that represents the underlying stream.
void Write(const ArrayPtr< char_t > &buffer) override
Writes all characetrs from the specified array to the stream.
StreamWriter(const String &path)
Constructs an instance of StreamWriter object that writes characters to the specified file using UTF-...
EncodingPtr get_Encoding() override
Returns the currently used encoding.
void Write(const char_t *buffer) override
Writes the specified c-string to the stream.
void WriteLine(const SharedPtr< Object > &obj) override
Writes the string representation of the specified object followed by the line-terminating characters ...
StreamWriter(const String &path, bool append, const EncodingPtr &encoding=System::Text::Encoding::get_UTF8Unmarked())
Constructs an instance of StreamWriter object that writes characters to the specified file using the ...
void set_AutoFlush(bool value)
Returns a value that specifies whether the StreamWriter should flush the data to the underlying strea...
~StreamWriter()
Destructor.
StreamWriter(const SharedPtr< Stream > &stream)
Constructs an instance of StreamWriter object that writes characters to the specified underlying stre...
StreamWriter(const SharedPtr< Stream > &stream, const EncodingPtr &encoding)
Constructs an instance of StreamWriter object that writes characters to the specified underlying stre...
void WriteLine(const System::SharedPtr< T > &obj)
Writes the string representation of the specified object followed by the line-terminating characters ...
Definition: stream_writer.h:134
void WriteLine(const char_t *buffer) override
Writes the specified c-string followed by the line-terminating characters to the stream.
Definition: stream_writer.h:119
void Write(const SharedPtr< Object > &obj) override
Writes the string representation of the specified object to the stream.
void WriteLine(const String &value) override
Writes the specified string followed by the line-terminating characters to the stream.
void Write(const ArrayPtr< char_t > &buffer, int32_t index, int32_t count) override
Writes the specified subrange of UTF-16 characters from the specified character array to the stream.
StreamWriter(const String &path, bool append, const EncodingPtr &encoding, int buffer_size)
Constructs an instance of StreamWriter object that writes characters to the specified file using the ...
void Write(const System::SharedPtr< T > &obj)
Writes the string representation of the specified object to the stream.
Definition: stream_writer.h:125
void WriteLine() override
Writes line terminator characters to the stream.
void WriteLine(const ArrayPtr< char_t > &buffer, int32_t index, int32_t count) override
Writes the specified subrange of UTF-16 characters from the specified character array followed by the...
A base class for classes that represent writers that writes sequences of characters to different dest...
Definition: text_writer.h:21
virtual void Dispose() override
Releases all resources used by the current object and closes the undelying stream.
Definition: text_writer.h:43
virtual void WriteLine()
Writes line terminator characters to the stream.
virtual void Write(const SharedPtr< Object > &value)
Writes the string representation of the specified object to the stream.
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 EncodingPtr get_UTF8Unmarked()
Only internal, to be used by the class libraries: Unmarked and non-input-validating.
@ Stream
The type that supports reliable, two-way, connection-based byte streams without duplication of data a...
Definition: db_command.h:9
System::SmartPtr< System::Text::Encoding > EncodingPtr
An alias for a smart pointer that points to an instance of System::Text::Encoding class.
Definition: fwd.h:86