MCPcopy Create free account
hub / github.com/csyonghe/Spire / Write

Method Write

Source/CoreLib/TextIO.cpp:149–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147 }
148 }
149 void StreamWriter::Write(const String & str)
150 {
151 encodingBuffer.Clear();
152 StringBuilder sb;
153 String newLine;
154#ifdef _WIN32
155 newLine = "\r\n";
156#else
157 newLine = "\n";
158#endif
159 for (int i = 0; i < str.Length(); i++)
160 {
161 if (str[i] == '\r')
162 sb << newLine;
163 else if (str[i] == '\n')
164 {
165 if (i > 0 && str[i - 1] != '\r')
166 sb << newLine;
167 }
168 else
169 sb << str[i];
170 }
171 encoding->GetBytes(encodingBuffer, sb.ProduceString());
172 stream->Write(encodingBuffer.Buffer(), encodingBuffer.Count());
173 }
174 void StreamWriter::Write(const char * str)
175 {
176 Write(String(str));

Callers 4

SaveToFileMethod · 0.45
WriteAllTextMethod · 0.45
uiprintfFunction · 0.45
StreamWriterMethod · 0.45

Calls 7

StringClass · 0.85
ProduceStringMethod · 0.80
ClearMethod · 0.45
LengthMethod · 0.45
GetBytesMethod · 0.45
BufferMethod · 0.45
CountMethod · 0.45

Tested by

no test coverage detected