DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
StringWriter.cpp
Go to the documentation of this file.
1#include "pch.h"
3
4namespace DotNetDupe {
5 namespace System {
6 namespace IO {
8 : m_pSb(new Text::StringBuilder()), m_bIsOpen(true) {
10 }
11
13 : m_pSb(&sbOutput), m_bIsOpen(true) {
15 }
16
19 m_bIsOpen = false;
20 }
21
24 m_bIsOpen = false;
25 }
26
29 }
30
35
38 return m_pSb->ToString();
39 }
40
41 void StringWriter::Write(bool bValue) {
43 TextWriter::Write(bValue);
44 }
45
46 void StringWriter::Write(char chValue) {
48 if (!m_bIsOpen) return;
50 m_pSb->Append(chValue);
51 }
52
53 void StringWriter::Write(const String& sValue) {
55 if (!m_bIsOpen) return;
57 m_pSb->Append(sValue);
58 }
59
60 void StringWriter::Write(const char* pValue) {
62 if (!m_bIsOpen) return;
64 m_pSb->Append(pValue);
65 }
66
67 void StringWriter::Write(int iValue) {
69 TextWriter::Write(iValue);
70 }
71
72 void StringWriter::Write(long long llValue) {
74 TextWriter::Write(llValue);
75 }
76
77 void StringWriter::Write(float fValue) {
79 TextWriter::Write(fValue);
80 }
81
82 void StringWriter::Write(double dValue) {
84 TextWriter::Write(dValue);
85 }
86
91
92 void StringWriter::WriteLine(bool bValue) {
95 }
96
97 void StringWriter::WriteLine(char chValue) {
99 TextWriter::WriteLine(chValue);
100 }
101
102 void StringWriter::WriteLine(const char* pValue) {
104 TextWriter::WriteLine(pValue);
105 }
106
107 void StringWriter::WriteLine(const String& sValue) {
109 TextWriter::WriteLine(sValue);
110 }
111
112 void StringWriter::WriteLine(int iValue) {
114 TextWriter::WriteLine(iValue);
115 }
116
117 void StringWriter::WriteLine(long long llValue) {
119 TextWriter::WriteLine(llValue);
120 }
121
122 void StringWriter::WriteLine(float fValue) {
124 TextWriter::WriteLine(fValue);
125 }
126
127 void StringWriter::WriteLine(double dValue) {
129 TextWriter::WriteLine(dValue);
130 }
131 }
132 }
133}
virtual String ToString() const
Returns a string containing the characters written to the current StringWriter so far.
void Close() override
Closes the current StringWriter.
void Dispose() override
Releases all resources used by the StringWriter.
void WriteLine() override
Writes a line terminator to the text string.
void Flush() override
Clears all buffers for the current writer.
void Write(bool bValue) override
Writes the text representation of a Boolean value to the text string.
StringWriter()
Initializes a new instance of the StringWriter class.
virtual Text::EncodingPtr GetEncoding() const override
Gets the Encoding in which the output is written.
virtual void Write(bool bValue)=0
Writes the text representation of a Boolean value to the text string or stream.
virtual void WriteLine()=0
Writes a line terminator to the text stream.
Represents text as a sequence of UTF-8 code units with culture-invariant operations.
Definition String.h:74
static String ToString(int iValue)
Definition String.cpp:643
Represents a mutable string of characters.
static EncodingPtr UTF8()
Gets an encoding for the UTF-8 format.
SmartPointer< Encoding > EncodingPtr
SmartPointer alias for Encoding instances.