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

@@ -35,7 +35,7 @@ namespace Nz
{
Int32 parent;
Quaternionf bindOrient;
String name;
std::string name;
Vector3f bindPos;
UInt32 flags;
UInt32 index;
@@ -57,12 +57,12 @@ namespace Nz
private:
bool Advance(bool required = true);
void Error(const String& message);
void Error(const std::string& message);
bool ParseBaseframe();
bool ParseBounds();
bool ParseFrame();
bool ParseHierarchy();
void Warning(const String& message);
void Warning(const std::string& message);
void UnrecognizedLine(bool error = false);
std::vector<float> m_animatedComponents;
@@ -70,7 +70,7 @@ namespace Nz
std::vector<Joint> m_joints;
Stream& m_stream;
StreamOptionFlags m_streamFlags;
String m_currentLine;
std::string m_currentLine;
bool m_keepLastLine;
unsigned int m_frameIndex;
unsigned int m_frameRate;

View File

@@ -8,11 +8,11 @@
#define NAZARA_FORMATS_MD5MESHPARSER_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Core/String.hpp>
#include <Nazara/Math/Quaternion.hpp>
#include <Nazara/Math/Vector2.hpp>
#include <Nazara/Math/Vector3.hpp>
#include <Nazara/Utility/Config.hpp>
#include <string>
#include <vector>
namespace Nz
@@ -22,9 +22,9 @@ namespace Nz
public:
struct Joint
{
std::string name;
Int32 parent;
Quaternionf bindOrient;
String name;
Vector3f bindPos;
};

View File

@@ -68,7 +68,7 @@ namespace Nz
std::unordered_map<std::string, Material> m_materials;
mutable Stream* m_currentStream;
std::string m_currentLine;
mutable StringStream m_outputStream;
mutable std::ostringstream m_outputStream;
bool m_keepLastLine;
unsigned int m_lineCount;
};

View File

@@ -35,7 +35,7 @@ namespace Nz
void MTLParser::Emit(const T& text) const
{
m_outputStream << text;
if (m_outputStream.GetBufferSize() > 1024 * 1024)
if (m_outputStream.rdbuf()->str().size() > 1024 * 1024)
Flush();
}
@@ -58,8 +58,8 @@ namespace Nz
inline void MTLParser::Flush() const
{
m_currentStream->Write(m_outputStream);
m_outputStream.Clear();
m_currentStream->Write(std::move(m_outputStream).str());
m_outputStream.str({});
}
inline void MTLParser::Warning(const std::string& message)

View File

@@ -94,7 +94,7 @@ namespace Nz
mutable Stream* m_currentStream;
std::string m_currentLine;
std::filesystem::path m_mtlLib;
mutable StringStream m_outputStream;
mutable std::ostringstream m_outputStream;
bool m_keepLastLine;
unsigned int m_lineCount;
unsigned int m_errorCount;

View File

@@ -2,6 +2,7 @@
// This file is part of the "Nazara Engine - Utility module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/Formats/OBJParser.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Utility/Debug.hpp>
@@ -135,7 +136,7 @@ namespace Nz
void OBJParser::Emit(const T& text) const
{
m_outputStream << text;
if (m_outputStream.GetBufferSize() > 1024 * 1024)
if (m_outputStream.rdbuf()->str().size() > 1024 * 1024)
Flush();
}
@@ -158,8 +159,8 @@ namespace Nz
inline void OBJParser::Flush() const
{
m_currentStream->Write(m_outputStream);
m_outputStream.Clear();
m_currentStream->Write(std::move(m_outputStream).str());
m_outputStream.str({});
}
inline void OBJParser::Warning(const std::string& message)