DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
TextWriter.cpp
Go to the documentation of this file.
1#include "pch.h"
3#include "System/Convert.h"
4#include "System/Char.h"
5
6namespace DotNetDupe {
7 namespace System {
8 namespace IO {
10 Dispose();
11 }
12
14 // Base implementation does nothing
15 }
16
18 // Base implementation does nothing
19 }
20
21 void TextWriter::Write(bool bValue) {
22 Write(Convert::ToString(bValue));
23 }
24
25 void TextWriter::Write(char chValue) {
26 // Base class does not know how to write, should be overridden
27 }
28
29 void TextWriter::Write(const char* pValue) {
31 if (pValue == nullptr) return;
32
33 Write(String(pValue));
34 }
35
36 void TextWriter::Write(const String& sValue) {
38 for (int iIdx = 0; iIdx < sValue.GetLength(); iIdx++) {
39 Write((char)sValue[iIdx]);
40 }
41 }
42
43 void TextWriter::Write(int iValue) {
44 Write(Convert::ToString(iValue));
45 }
46
47 void TextWriter::Write(long long llValue) {
48 Write(Convert::ToString(llValue));
49 }
50
51 void TextWriter::Write(float fValue) {
52 Write(Convert::ToString(fValue));
53 }
54
55 void TextWriter::Write(double dValue) {
56 Write(Convert::ToString(dValue));
57 }
58
62
63 void TextWriter::WriteLine(bool bValue) {
64 Write(bValue);
65 WriteLine();
66 }
67
68 void TextWriter::WriteLine(char chValue) {
69 Write(chValue);
70 WriteLine();
71 }
72
73 void TextWriter::WriteLine(const char* pValue) {
74 Write(pValue);
75 WriteLine();
76 }
77
78 void TextWriter::WriteLine(const String& sValue) {
79 Write(sValue);
80 WriteLine();
81 }
82
83 void TextWriter::WriteLine(int iValue) {
84 Write(iValue);
85 WriteLine();
86 }
87
88 void TextWriter::WriteLine(long long llValue) {
89 Write(llValue);
90 WriteLine();
91 }
92
93 void TextWriter::WriteLine(float fValue) {
94 Write(fValue);
95 WriteLine();
96 }
97
98 void TextWriter::WriteLine(double dValue) {
99 Write(dValue);
100 WriteLine();
101 }
102
104 static String sNewLine("\r\n");
105 return sNewLine;
106 }
107 }
108 }
109}
Represents a Unicode character code point mirroring .NET System.Char.
Converts a base data type to another base data type, and encodes/decodes Base64 data.
static String ToString(bool value)
Definition Convert.cpp:253
virtual void Write(bool bValue)=0
Writes the text representation of a Boolean value to the text string or stream.
virtual void Flush()=0
Clears all buffers for the current writer and causes any buffered data to be written to the underlyin...
static const String & GetNewLine()
Gets the default line terminator string.
virtual void Dispose() override=0
Releases all resources used by the TextWriter object.
virtual void Close()=0
Closes the current writer and releases any system resources associated with the writer.
Definition TextWriter.cpp:9
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
String()
Initializes a new instance of the String class to an empty string.
Definition String.cpp:64