Remove Nz::String and Nz::StringStream

This commit is contained in:
Jérôme Leclercq
2020-09-25 19:31:01 +02:00
parent d665af1f9d
commit 2b6a463a45
212 changed files with 1877 additions and 8721 deletions

View File

@@ -5,7 +5,7 @@
#include <Nazara/Core/Stream.hpp>
#include <Nazara/Core/ByteArray.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/String.hpp>
#include <Nazara/Core/StringExt.hpp>
#include <cstring>
#include <Nazara/Core/Debug.hpp>
@@ -147,22 +147,24 @@ namespace Nz
* \param string String to write
*/
bool Stream::Write(const String& string)
bool Stream::Write(const std::string_view& string)
{
String temp(string);
if (m_streamOptions & StreamOption_Text)
{
#if defined(NAZARA_PLATFORM_WINDOWS)
temp.Replace("\n", "\r\n");
#elif defined(NAZARA_PLATFORM_LINUX)
#if defined(NAZARA_PLATFORM_WINDOWS)
std::string temp(string);
ReplaceStr(temp, "\n", "\r\n");
#elif defined(NAZARA_PLATFORM_LINUX)
std::string_view temp(string);
// Nothing to do
#elif defined(NAZARA_PLATFORM_MACOS)
temp.Replace('\n', '\r');
#endif
}
#elif defined(NAZARA_PLATFORM_MACOS)
std::string temp(string);
ReplaceStr(temp, "\n", "\r");
#endif
std::size_t size = temp.GetSize();
return Write(temp.GetConstBuffer(), size) == size;
return Write(temp.data(), temp.size()) == temp.size();
}
else
return Write(string.data(), string.size()) == string.size();
}
}