7#include "system/iformatprovider.h"
8#include "system/exceptions.h"
9#include "system/reflection.h"
10#include "system/globalization/culture_info.h"
11#include "system/io/text_writer.h"
12#include "system/text/string_builder.h"
13#include "system/text/unicode_encoding.h"
15namespace System {
namespace IO {
31 throw ArgumentNullException(u
"StringBuilder");
38 :
StringWriter(sb, Globalization::CultureInfo::get_CurrentCulture()) {}
52 if (m_Encoding ==
nullptr)
53 m_Encoding = MakeObject<Text::UnicodeEncoding>(
false,
false);
65 virtual void Write(char_t value)
override {
74 if (buffer ==
nullptr)
75 throw ArgumentNullException(u
"buffer");
80 if (buffer->get_Length() -
index < count)
83 _sb->Append(buffer,
index, count);
Template that represents wrapper of exceptions that are derived from Exception class.
Definition: exception.h:118
Implements a TextWriter that writes information to a string. Objects of this class should only be all...
Definition: string_writer.h:21
StringWriter(const IFormatProviderPtr &formatProvider)
Constructs a new instance of StringWriter using the specified IFormatProvider.
Definition: string_writer.h:42
virtual void Write(char_t value) override
Writes the specified character to the stream.
Definition: string_writer.h:65
StringWriter(const System::SharedPtr< Text::StringBuilder > &sb, const IFormatProviderPtr &formatProvider)
Constructs a new instance of StringWriter using the specified StringBuilder and IFormatProvider.
Definition: string_writer.h:28
virtual SharedPtr< Text::Encoding > get_Encoding() override
Returns the currently used encoding.
Definition: string_writer.h:50
virtual SharedPtr< Text::StringBuilder > GetStringBuilder()
Returns the currently used StringBuilder.
Definition: string_writer.h:58
virtual void Write(const String &value) override
Writes the specified string to the stream.
Definition: string_writer.h:88
StringWriter(const System::SharedPtr< Text::StringBuilder > &sb)
Constructs a new instance of StringWriter using the specified StringBuilder and IFormatProvider from ...
Definition: string_writer.h:37
StringWriter()
Constructs a new instance of StringWriter using IFormatProvider from the current culture.
Definition: string_writer.h:46
virtual String ToString() const override
Returns the underlying string.
Definition: string_writer.h:93
virtual void Write(const ArrayPtr< char_t > &buffer, int32_t index, int32_t count) override
Writes the specified subrange of characters from the specified character array to the stream.
Definition: string_writer.h:73
A base class for classes that represent writers that writes sequences of characters to different dest...
Definition: text_writer.h:21
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:126
String ToString() const
Wrapper for handling String class in contexts where ToString() is being called on value type objects.
Definition: string.h:511
Definition: db_command.h:9
std::enable_if<!IsSmartPtr< T >::value, SmartPtr< T > >::type MakeObject(Args &&... args)
Creates object on heap and returns shared pointer to it.
Definition: smart_ptr.h:1496
System::ExceptionWrapper< Details_ArgumentOutOfRangeException > ArgumentOutOfRangeException
Definition: throw_helper.h:24