Remove Nz::String and Nz::StringStream
This commit is contained in:
@@ -16,7 +16,7 @@ namespace Nz
|
||||
{
|
||||
struct AnimationImpl
|
||||
{
|
||||
std::unordered_map<String, std::size_t> sequenceMap;
|
||||
std::unordered_map<std::string, std::size_t> sequenceMap;
|
||||
std::vector<Sequence> sequences;
|
||||
std::vector<SequenceJoint> sequenceJoints; // Uniquement pour les animations squelettiques
|
||||
AnimationType type;
|
||||
@@ -58,7 +58,7 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
if (!sequence.name.IsEmpty())
|
||||
if (!sequence.name.empty())
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
auto it = m_impl->sequenceMap.find(sequence.name);
|
||||
@@ -147,7 +147,7 @@ namespace Nz
|
||||
return m_impl->jointCount;
|
||||
}
|
||||
|
||||
Sequence* Animation::GetSequence(const String& sequenceName)
|
||||
Sequence* Animation::GetSequence(const std::string& sequenceName)
|
||||
{
|
||||
NazaraAssert(m_impl, "Animation not created");
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace Nz
|
||||
return &m_impl->sequences[index];
|
||||
}
|
||||
|
||||
const Sequence* Animation::GetSequence(const String& sequenceName) const
|
||||
const Sequence* Animation::GetSequence(const std::string& sequenceName) const
|
||||
{
|
||||
NazaraAssert(m_impl, "Animation not created");
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace Nz
|
||||
return static_cast<std::size_t>(m_impl->sequences.size());
|
||||
}
|
||||
|
||||
std::size_t Animation::GetSequenceIndex(const String& sequenceName) const
|
||||
std::size_t Animation::GetSequenceIndex(const std::string& sequenceName) const
|
||||
{
|
||||
NazaraAssert(m_impl, "Animation not created");
|
||||
|
||||
@@ -235,7 +235,7 @@ namespace Nz
|
||||
return m_impl->type;
|
||||
}
|
||||
|
||||
bool Animation::HasSequence(const String& sequenceName) const
|
||||
bool Animation::HasSequence(const std::string& sequenceName) const
|
||||
{
|
||||
NazaraAssert(m_impl, "Animation not created");
|
||||
|
||||
@@ -261,7 +261,7 @@ namespace Nz
|
||||
return m_impl != nullptr;
|
||||
}
|
||||
|
||||
void Animation::RemoveSequence(const String& identifier)
|
||||
void Animation::RemoveSequence(const std::string& identifier)
|
||||
{
|
||||
NazaraAssert(m_impl, "Animation not created");
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Utility/Font.hpp>
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#include <Nazara/Utility/FontData.hpp>
|
||||
#include <Nazara/Utility/FontGlyph.hpp>
|
||||
@@ -146,13 +147,13 @@ namespace Nz
|
||||
return count;
|
||||
}
|
||||
|
||||
String Font::GetFamilyName() const
|
||||
std::string Font::GetFamilyName() const
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!IsValid())
|
||||
{
|
||||
NazaraError("Invalid font");
|
||||
return String("Invalid font");
|
||||
return std::string("Invalid font");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -237,13 +238,13 @@ namespace Nz
|
||||
return it->second;
|
||||
}
|
||||
|
||||
String Font::GetStyleName() const
|
||||
std::string Font::GetStyleName() const
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!IsValid())
|
||||
{
|
||||
NazaraError("Invalid font");
|
||||
return String("Invalid font");
|
||||
return std::string("Invalid font");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -261,10 +262,10 @@ namespace Nz
|
||||
return PrecacheGlyph(m_glyphes[key], characterSize, style, outlineThickness, character).valid;
|
||||
}
|
||||
|
||||
bool Font::Precache(unsigned int characterSize, TextStyleFlags style, float outlineThickness, const String& characterSet) const
|
||||
bool Font::Precache(unsigned int characterSize, TextStyleFlags style, float outlineThickness, const std::string& characterSet) const
|
||||
{
|
||||
///TODO: Itération UTF-8 => UTF-32 sans allocation de buffer (Exposer utf8cpp ?)
|
||||
std::u32string set = characterSet.GetUtf32String();
|
||||
std::u32string set = ToUtf32String(characterSet);
|
||||
if (set.empty())
|
||||
{
|
||||
NazaraError("Invalid character set");
|
||||
@@ -548,7 +549,7 @@ namespace Nz
|
||||
glyph.valid = true;
|
||||
}
|
||||
else
|
||||
NazaraWarning("Failed to extract glyph \"" + String::Unicode(character) + "\"");
|
||||
NazaraWarning("Failed to extract glyph \"" + FromUtf32String(std::u32string_view(&character, 1)) + "\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace Nz
|
||||
|
||||
if (byteStream.Read(ptr, byteCount) != byteCount)
|
||||
{
|
||||
NazaraError("Failed to read level #" + String::Number(i));
|
||||
NazaraError("Failed to read level #" + NumberToString(i));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ namespace Nz
|
||||
buf[3] = (header.format.fourCC >> 24) & 255;
|
||||
buf[4] = '\0';
|
||||
|
||||
NazaraError("Unhandled format \"" + String(buf) + "\"");
|
||||
NazaraError("Unhandled format \"" + std::string(buf) + "\"");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <Nazara/Utility/FontGlyph.hpp>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -243,12 +244,12 @@ namespace Nz
|
||||
return true;
|
||||
}
|
||||
|
||||
String GetFamilyName() const override
|
||||
std::string GetFamilyName() const override
|
||||
{
|
||||
return m_face->family_name;
|
||||
}
|
||||
|
||||
String GetStyleName() const override
|
||||
std::string GetStyleName() const override
|
||||
{
|
||||
return m_face->style_name;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <Nazara/Utility/Formats/MD5AnimParser.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#include <cstdio>
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
@@ -81,13 +82,13 @@ namespace Nz
|
||||
{
|
||||
#if NAZARA_UTILITY_STRICT_RESOURCE_PARSING
|
||||
case 'M': // MD5Version
|
||||
if (m_currentLine.GetWord(0) != "MD5Version")
|
||||
if (GetWord(m_currentLine, 0) != "MD5Version")
|
||||
UnrecognizedLine();
|
||||
break;
|
||||
#endif
|
||||
|
||||
case 'b': // baseframe/bounds
|
||||
if (m_currentLine.StartsWith("baseframe {"))
|
||||
if (StartsWith(m_currentLine, "baseframe {"))
|
||||
{
|
||||
if (!ParseBaseframe())
|
||||
{
|
||||
@@ -95,7 +96,7 @@ namespace Nz
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (m_currentLine.StartsWith("bounds {"))
|
||||
else if (StartsWith(m_currentLine, "bounds {"))
|
||||
{
|
||||
if (!ParseBounds())
|
||||
{
|
||||
@@ -111,7 +112,7 @@ namespace Nz
|
||||
|
||||
#if NAZARA_UTILITY_STRICT_RESOURCE_PARSING
|
||||
case 'c': // commandline
|
||||
if (m_currentLine.GetWord(0) != "commandline")
|
||||
if (GetWord(m_currentLine, 0) != "commandline")
|
||||
UnrecognizedLine();
|
||||
break;
|
||||
#endif
|
||||
@@ -123,7 +124,7 @@ namespace Nz
|
||||
{
|
||||
if (m_frameIndex != index)
|
||||
{
|
||||
Error("Unexpected frame index (expected " + String::Number(m_frameIndex) + ", got " + String::Number(index) + ')');
|
||||
Error("Unexpected frame index (expected " + NumberToString(m_frameIndex) + ", got " + NumberToString(index) + ')');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -145,7 +146,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
case 'h': // hierarchy
|
||||
if (m_currentLine.StartsWith("hierarchy {"))
|
||||
if (StartsWith(m_currentLine, "hierarchy {"))
|
||||
{
|
||||
if (!ParseHierarchy())
|
||||
{
|
||||
@@ -220,7 +221,7 @@ namespace Nz
|
||||
|
||||
if (m_frameIndex != frameCount)
|
||||
{
|
||||
NazaraError("Missing frame infos: [" + String::Number(m_frameIndex) + ',' + String::Number(frameCount) + ']');
|
||||
NazaraError("Missing frame infos: [" + NumberToString(m_frameIndex) + ',' + NumberToString(frameCount) + ']');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -250,13 +251,10 @@ namespace Nz
|
||||
m_lineCount++;
|
||||
|
||||
m_currentLine = m_stream.ReadLine();
|
||||
if (m_currentLine.IsEmpty())
|
||||
continue;
|
||||
|
||||
m_currentLine = m_currentLine.SubStringTo("//"); // On ignore les commentaires
|
||||
m_currentLine.Simplify(); // Pour un traitement plus simple
|
||||
if (std::size_t pos = m_currentLine.find("//"); pos != std::string::npos)
|
||||
m_currentLine.resize(pos);
|
||||
}
|
||||
while (m_currentLine.IsEmpty());
|
||||
while (m_currentLine.empty());
|
||||
}
|
||||
else
|
||||
m_keepLastLine = false;
|
||||
@@ -264,9 +262,9 @@ namespace Nz
|
||||
return true;
|
||||
}
|
||||
|
||||
void MD5AnimParser::Error(const String& message)
|
||||
void MD5AnimParser::Error(const std::string& message)
|
||||
{
|
||||
NazaraError(message + " at line #" + String::Number(m_lineCount));
|
||||
NazaraError(message + " at line #" + NumberToString(m_lineCount));
|
||||
}
|
||||
|
||||
bool MD5AnimParser::ParseBaseframe()
|
||||
@@ -295,7 +293,7 @@ namespace Nz
|
||||
if (!Advance())
|
||||
return false;
|
||||
|
||||
if (m_currentLine != '}')
|
||||
if (m_currentLine != "}")
|
||||
{
|
||||
#if NAZARA_UTILITY_STRICT_RESOURCE_PARSING
|
||||
Warning("Bounds braces closing not found");
|
||||
@@ -336,7 +334,7 @@ namespace Nz
|
||||
if (!Advance())
|
||||
return false;
|
||||
|
||||
if (m_currentLine != '}')
|
||||
if (m_currentLine != "}")
|
||||
{
|
||||
#if NAZARA_UTILITY_STRICT_RESOURCE_PARSING
|
||||
Warning("Bounds braces closing not found");
|
||||
@@ -365,7 +363,7 @@ namespace Nz
|
||||
return false;
|
||||
}
|
||||
|
||||
String line;
|
||||
std::string line;
|
||||
|
||||
std::size_t count = 0;
|
||||
do
|
||||
@@ -374,7 +372,7 @@ namespace Nz
|
||||
return false;
|
||||
|
||||
std::size_t index = 0;
|
||||
std::size_t size = m_currentLine.GetSize();
|
||||
std::size_t size = m_currentLine.size();
|
||||
do
|
||||
{
|
||||
float f;
|
||||
@@ -430,7 +428,7 @@ namespace Nz
|
||||
if (!Advance(false))
|
||||
return true;
|
||||
|
||||
if (m_currentLine != '}')
|
||||
if (m_currentLine != "}")
|
||||
{
|
||||
#if NAZARA_UTILITY_STRICT_RESOURCE_PARSING
|
||||
Warning("Hierarchy braces closing not found");
|
||||
@@ -457,8 +455,8 @@ namespace Nz
|
||||
if (!Advance())
|
||||
return false;
|
||||
|
||||
std::size_t pos = m_currentLine.Find(' ');
|
||||
if (pos == String::npos)
|
||||
std::size_t pos = m_currentLine.find(' ');
|
||||
if (pos == std::string::npos)
|
||||
{
|
||||
UnrecognizedLine(true);
|
||||
return false;
|
||||
@@ -477,15 +475,14 @@ namespace Nz
|
||||
return false;
|
||||
}
|
||||
|
||||
m_joints[i].name = name;
|
||||
m_joints[i].name.Trim('"');
|
||||
m_joints[i].name = Trim(name, '"');
|
||||
|
||||
Int32 parent = m_joints[i].parent;
|
||||
if (parent >= 0)
|
||||
{
|
||||
if (static_cast<UInt32>(parent) >= jointCount)
|
||||
{
|
||||
Error("Joint's parent is out of bounds (" + String::Number(parent) + " >= " + String::Number(jointCount) + ')');
|
||||
Error("Joint's parent is out of bounds (" + NumberToString(parent) + " >= " + NumberToString(jointCount) + ')');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -494,7 +491,7 @@ namespace Nz
|
||||
if (!Advance())
|
||||
return false;
|
||||
|
||||
if (m_currentLine != '}')
|
||||
if (m_currentLine != "}")
|
||||
{
|
||||
#if NAZARA_UTILITY_STRICT_RESOURCE_PARSING
|
||||
Warning("Hierarchy braces closing not found");
|
||||
@@ -507,14 +504,14 @@ namespace Nz
|
||||
return true;
|
||||
}
|
||||
|
||||
void MD5AnimParser::Warning(const String& message)
|
||||
void MD5AnimParser::Warning(const std::string& message)
|
||||
{
|
||||
NazaraWarning(message + " at line #" + String::Number(m_lineCount));
|
||||
NazaraWarning(message + " at line #" + NumberToString(m_lineCount));
|
||||
}
|
||||
|
||||
void MD5AnimParser::UnrecognizedLine(bool error)
|
||||
{
|
||||
String message = "Unrecognized \"" + m_currentLine + '"';
|
||||
std::string message = "Unrecognized \"" + m_currentLine + '"';
|
||||
|
||||
if (error)
|
||||
Error(message);
|
||||
|
||||
@@ -229,7 +229,7 @@ namespace Nz
|
||||
return false;
|
||||
|
||||
std::size_t pos = m_currentLine.find(' ');
|
||||
if (pos == String::npos)
|
||||
if (pos == std::string::npos)
|
||||
{
|
||||
UnrecognizedLine(true);
|
||||
return false;
|
||||
@@ -250,8 +250,7 @@ namespace Nz
|
||||
return false;
|
||||
}
|
||||
|
||||
m_joints[i].name = name;
|
||||
m_joints[i].name.Trim('"');
|
||||
m_joints[i].name = Trim(name, '"');
|
||||
|
||||
Int32 parent = m_joints[i].parent;
|
||||
if (parent >= 0)
|
||||
|
||||
@@ -499,7 +499,7 @@ namespace Nz
|
||||
});
|
||||
}
|
||||
|
||||
m_outputStream.Clear();
|
||||
m_outputStream.str({});
|
||||
|
||||
EmitLine("# Exported by Nazara Engine");
|
||||
EmitLine();
|
||||
@@ -510,7 +510,7 @@ namespace Nz
|
||||
|
||||
for (auto& pair : m_materials)
|
||||
{
|
||||
const String& matName = pair.first;
|
||||
const std::string& matName = pair.first;
|
||||
const Material& mat = pair.second;
|
||||
|
||||
Emit("newmtl ");
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Nz
|
||||
return false;
|
||||
}
|
||||
|
||||
std::unordered_map<String, ParameterList> materialCache;
|
||||
std::unordered_map<std::string, ParameterList> materialCache;
|
||||
std::filesystem::path baseDir = file.GetDirectory();
|
||||
for (std::size_t i = 0; i < meshCount; ++i)
|
||||
{
|
||||
|
||||
@@ -503,7 +503,7 @@ namespace Nz
|
||||
});
|
||||
}
|
||||
|
||||
m_outputStream.Clear();
|
||||
m_outputStream.str({});
|
||||
|
||||
EmitLine("# Exported by Nazara Engine");
|
||||
EmitLine();
|
||||
|
||||
@@ -101,11 +101,8 @@ namespace Nz
|
||||
{
|
||||
const ParameterList& matData = mesh.GetMaterialData(i);
|
||||
|
||||
String nzname;
|
||||
std::string name;
|
||||
if (matData.GetStringParameter(MaterialData::Name, &nzname))
|
||||
name = nzname.ToStdString();
|
||||
else
|
||||
if (!matData.GetStringParameter(MaterialData::Name, &name))
|
||||
name = "material_" + std::to_string(i);
|
||||
|
||||
// Makes sure we only have one material of that name
|
||||
@@ -117,10 +114,7 @@ namespace Nz
|
||||
|
||||
MTLParser::Material* material = mtlFormat.AddMaterial(name);
|
||||
|
||||
String strVal;
|
||||
if (matData.GetStringParameter(MaterialData::FilePath, &strVal))
|
||||
material->diffuseMap = strVal.ToStdString();
|
||||
else
|
||||
if (!matData.GetStringParameter(MaterialData::FilePath, &material->diffuseMap))
|
||||
{
|
||||
Color colorVal;
|
||||
double dValue;
|
||||
@@ -137,14 +131,9 @@ namespace Nz
|
||||
if (matData.GetDoubleParameter(MaterialData::Shininess, &dValue))
|
||||
material->shininess = float(dValue);
|
||||
|
||||
if (matData.GetStringParameter(MaterialData::AlphaTexturePath, &strVal))
|
||||
material->alphaMap = strVal.ToStdString();
|
||||
|
||||
if (matData.GetStringParameter(MaterialData::DiffuseTexturePath, &strVal))
|
||||
material->diffuseMap = strVal.ToStdString();
|
||||
|
||||
if (matData.GetStringParameter(MaterialData::SpecularTexturePath, &strVal))
|
||||
material->specularMap = strVal.ToStdString();
|
||||
matData.GetStringParameter(MaterialData::AlphaTexturePath, &material->alphaMap);
|
||||
matData.GetStringParameter(MaterialData::DiffuseTexturePath, &material->diffuseMap);
|
||||
matData.GetStringParameter(MaterialData::SpecularTexturePath, &material->specularMap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace Nz
|
||||
{
|
||||
if (!stream.Read(&rle_value, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + String::Number(stream.GetCursorPos()) + ')');
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace Nz
|
||||
rle_count = rle_value - 0xc0;
|
||||
if (!stream.Read(&rle_value, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + String::Number(stream.GetCursorPos()) + ')');
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -174,7 +174,7 @@ namespace Nz
|
||||
{
|
||||
if (!stream.Read(&rle_value, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + String::Number(stream.GetCursorPos()) + ')');
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace Nz
|
||||
rle_count = rle_value - 0xc0;
|
||||
if (!stream.Read(&rle_value, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + String::Number(stream.GetCursorPos()) + ')');
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -225,14 +225,14 @@ namespace Nz
|
||||
UInt8 magic;
|
||||
if (!stream.Read(&magic, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + String::Number(stream.GetCursorPos()) + ')');
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* first byte must be equal to 0x0c (12) */
|
||||
if (magic != 0x0c)
|
||||
{
|
||||
NazaraError("Colormap's first byte must be 0x0c (0x" + String::Number(magic, 16) + ')');
|
||||
NazaraError("Colormap's first byte must be 0x0c (0x" + NumberToString(magic, 16) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ namespace Nz
|
||||
{
|
||||
if (!stream.Read(&rle_value, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + String::Number(stream.GetCursorPos()) + ')');
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ namespace Nz
|
||||
rle_count = rle_value - 0xc0;
|
||||
if (!stream.Read(&rle_value, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + String::Number(stream.GetCursorPos()) + ')');
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -302,7 +302,7 @@ namespace Nz
|
||||
{
|
||||
if (!stream.Read(&rle_value, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + String::Number(stream.GetCursorPos()) + ')');
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ namespace Nz
|
||||
rle_count = rle_value - 0xc0;
|
||||
if (!stream.Read(&rle_value, 1))
|
||||
{
|
||||
NazaraError("Failed to read stream (byte " + String::Number(stream.GetCursorPos()) + ')');
|
||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -329,7 +329,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
default:
|
||||
NazaraError("Unsupported " + String::Number(bitCount) + " bitcount for pcx files");
|
||||
NazaraError("Unsupported " + NumberToString(bitCount) + " bitcount for pcx files");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/Stream.hpp>
|
||||
#include <Nazara/Utility/Image.hpp>
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -38,7 +38,7 @@ namespace Nz
|
||||
|
||||
bool IsSupported(const std::string& extension)
|
||||
{
|
||||
static std::set<String> supportedExtensions = {"bmp", "gif", "hdr", "jpg", "jpeg", "pic", "png", "ppm", "pgm", "psd", "tga"};
|
||||
static std::unordered_set<std::string> supportedExtensions = {"bmp", "gif", "hdr", "jpg", "jpeg", "pic", "png", "ppm", "pgm", "psd", "tga"};
|
||||
return supportedExtensions.find(extension) != supportedExtensions.end();
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Nz
|
||||
UInt8* ptr = stbi_load_from_callbacks(&callbacks, &stream, &width, &height, &bpp, STBI_rgb_alpha);
|
||||
if (!ptr)
|
||||
{
|
||||
NazaraError("Failed to load image: " + String(stbi_failure_reason()));
|
||||
NazaraError("Failed to load image: " + std::string(stbi_failure_reason()));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace Nz
|
||||
ImageType type = image.GetType();
|
||||
if (type != ImageType_1D && type != ImageType_2D)
|
||||
{
|
||||
NazaraError("Image type 0x" + String::Number(type, 16) + " is not in a supported format");
|
||||
NazaraError("Image type 0x" + NumberToString(type, 16) + " is not in a supported format");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace Nz
|
||||
{
|
||||
if (imageQuality <= 0 || imageQuality > 100)
|
||||
{
|
||||
NazaraError("NativeJPEGSaver_Quality value (" + Nz::String::Number(imageQuality) + ") does not fit in bounds ]0, 100], clamping...");
|
||||
NazaraError("NativeJPEGSaver_Quality value (" + Nz::NumberToString(imageQuality) + ") does not fit in bounds ]0, 100], clamping...");
|
||||
imageQuality = Nz::Clamp(imageQuality, 1LL, 100LL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Nz
|
||||
#ifdef NAZARA_DEBUG
|
||||
if (layers[i] >= m_layers.size())
|
||||
{
|
||||
NazaraWarning("Rectangle #" + String::Number(i) + " belong to an out-of-bounds layer (" + String::Number(i) + " >= " + String::Number(m_layers.size()) + ")");
|
||||
NazaraWarning("Rectangle #" + NumberToString(i) + " belong to an out-of-bounds layer (" + NumberToString(i) + " >= " + NumberToString(m_layers.size()) + ")");
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
@@ -57,7 +57,7 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (layerIndex >= m_layers.size())
|
||||
{
|
||||
NazaraError("Layer index out of range (" + String::Number(layerIndex) + " >= " + String::Number(m_layers.size()) + ')');
|
||||
NazaraError("Layer index out of range (" + NumberToString(layerIndex) + " >= " + NumberToString(m_layers.size()) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <Nazara/Utility/Image.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/ErrorFlags.hpp>
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#include <Nazara/Utility/PixelFormat.hpp>
|
||||
#include <memory>
|
||||
@@ -268,7 +269,7 @@ namespace Nz
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraError("Failed to allocate image's level " + String::Number(i) + " (" + String(e.what()) + ')');
|
||||
NazaraError("Failed to allocate image's level " + NumberToString(i) + " (" + std::string(e.what()) + ')');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -448,7 +449,7 @@ namespace Nz
|
||||
unsigned int depth = (m_sharedImage->type == ImageType_Cubemap) ? 6 : m_sharedImage->depth;
|
||||
if (z >= depth)
|
||||
{
|
||||
NazaraError("Z value exceeds depth (" + String::Number(z) + " >= " + String::Number(depth) + ')');
|
||||
NazaraError("Z value exceeds depth (" + NumberToString(z) + " >= " + NumberToString(depth) + ')');
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -574,7 +575,7 @@ namespace Nz
|
||||
|
||||
if (level >= m_sharedImage->levels.size())
|
||||
{
|
||||
NazaraError("Level out of bounds (" + String::Number(level) + " >= " + String::Number(m_sharedImage->levels.size()) + ')');
|
||||
NazaraError("Level out of bounds (" + NumberToString(level) + " >= " + NumberToString(m_sharedImage->levels.size()) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@@ -583,7 +584,7 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (x >= width)
|
||||
{
|
||||
NazaraError("X value exceeds width (" + String::Number(x) + " >= " + String::Number(width) + ')');
|
||||
NazaraError("X value exceeds width (" + NumberToString(x) + " >= " + NumberToString(width) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@@ -592,14 +593,14 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (y >= height)
|
||||
{
|
||||
NazaraError("Y value exceeds height (" + String::Number(y) + " >= " + String::Number(height) + ')');
|
||||
NazaraError("Y value exceeds height (" + NumberToString(y) + " >= " + NumberToString(height) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
unsigned int depth = (m_sharedImage->type == ImageType_Cubemap) ? 6 : GetLevelSize(m_sharedImage->depth, level);
|
||||
if (z >= depth)
|
||||
{
|
||||
NazaraError("Z value exceeds depth (" + String::Number(z) + " >= " + String::Number(depth) + ')');
|
||||
NazaraError("Z value exceeds depth (" + NumberToString(z) + " >= " + NumberToString(depth) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@@ -612,7 +613,7 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (level >= m_sharedImage->levels.size())
|
||||
{
|
||||
NazaraError("Level out of bounds (" + String::Number(level) + " >= " + String::Number(m_sharedImage->levels.size()) + ')');
|
||||
NazaraError("Level out of bounds (" + NumberToString(level) + " >= " + NumberToString(m_sharedImage->levels.size()) + ')');
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -630,7 +631,7 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (level >= m_sharedImage->levels.size())
|
||||
{
|
||||
NazaraError("Level out of bounds (" + String::Number(level) + " >= " + String::Number(m_sharedImage->levels.size()) + ')');
|
||||
NazaraError("Level out of bounds (" + NumberToString(level) + " >= " + NumberToString(m_sharedImage->levels.size()) + ')');
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -697,20 +698,20 @@ namespace Nz
|
||||
|
||||
if (x >= m_sharedImage->width)
|
||||
{
|
||||
NazaraError("X value exceeds width (" + String::Number(x) + " >= " + String::Number(m_sharedImage->width) + ')');
|
||||
NazaraError("X value exceeds width (" + NumberToString(x) + " >= " + NumberToString(m_sharedImage->width) + ')');
|
||||
return Color();
|
||||
}
|
||||
|
||||
if (y >= m_sharedImage->height)
|
||||
{
|
||||
NazaraError("Y value exceeds height (" + String::Number(y) + " >= " + String::Number(m_sharedImage->height) + ')');
|
||||
NazaraError("Y value exceeds height (" + NumberToString(y) + " >= " + NumberToString(m_sharedImage->height) + ')');
|
||||
return Color();
|
||||
}
|
||||
|
||||
unsigned int depth = (m_sharedImage->type == ImageType_Cubemap) ? 6 : m_sharedImage->depth;
|
||||
if (z >= depth)
|
||||
{
|
||||
NazaraError("Z value exceeds depth (" + String::Number(z) + " >= " + String::Number(depth) + ')');
|
||||
NazaraError("Z value exceeds depth (" + NumberToString(z) + " >= " + NumberToString(depth) + ')');
|
||||
return Color();
|
||||
}
|
||||
#endif
|
||||
@@ -735,7 +736,7 @@ namespace Nz
|
||||
|
||||
if (level >= m_sharedImage->levels.size())
|
||||
{
|
||||
NazaraError("Level out of bounds (" + String::Number(level) + " >= " + String::Number(m_sharedImage->levels.size()) + ')');
|
||||
NazaraError("Level out of bounds (" + NumberToString(level) + " >= " + NumberToString(m_sharedImage->levels.size()) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@@ -744,7 +745,7 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (x >= width)
|
||||
{
|
||||
NazaraError("X value exceeds width (" + String::Number(x) + " >= " + String::Number(width) + ')');
|
||||
NazaraError("X value exceeds width (" + NumberToString(x) + " >= " + NumberToString(width) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@@ -753,20 +754,20 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (y >= height)
|
||||
{
|
||||
NazaraError("Y value exceeds height (" + String::Number(y) + " >= " + String::Number(height) + ')');
|
||||
NazaraError("Y value exceeds height (" + NumberToString(y) + " >= " + NumberToString(height) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
unsigned int depth = (m_sharedImage->type == ImageType_Cubemap) ? 6 : GetLevelSize(m_sharedImage->depth, level);
|
||||
if (z >= depth)
|
||||
{
|
||||
NazaraError("Z value exceeds depth (" + String::Number(z) + " >= " + String::Number(depth) + ')');
|
||||
NazaraError("Z value exceeds depth (" + NumberToString(z) + " >= " + NumberToString(depth) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (level >= m_sharedImage->levels.size())
|
||||
{
|
||||
NazaraError("Level out of bounds (" + String::Number(level) + " >= " + String::Number(m_sharedImage->levels.size()) + ')');
|
||||
NazaraError("Level out of bounds (" + NumberToString(level) + " >= " + NumberToString(m_sharedImage->levels.size()) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@@ -781,7 +782,7 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (level >= m_sharedImage->levels.size())
|
||||
{
|
||||
NazaraError("Level out of bounds (" + String::Number(level) + " >= " + String::Number(m_sharedImage->levels.size()) + ')');
|
||||
NazaraError("Level out of bounds (" + NumberToString(level) + " >= " + NumberToString(m_sharedImage->levels.size()) + ')');
|
||||
return Vector3ui::Zero();
|
||||
}
|
||||
#endif
|
||||
@@ -799,7 +800,7 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (level >= m_sharedImage->levels.size())
|
||||
{
|
||||
NazaraError("Level out of bounds (" + String::Number(level) + " >= " + String::Number(m_sharedImage->levels.size()) + ')');
|
||||
NazaraError("Level out of bounds (" + NumberToString(level) + " >= " + NumberToString(m_sharedImage->levels.size()) + ')');
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -885,7 +886,7 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (type != ImageType_1D && type != ImageType_2D)
|
||||
{
|
||||
NazaraError("Image type not handled (0x" + String::Number(type, 16) + ')');
|
||||
NazaraError("Image type not handled (0x" + NumberToString(type, 16) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@@ -894,12 +895,12 @@ namespace Nz
|
||||
|
||||
if (imageSize.x % atlasSize.x != 0)
|
||||
{
|
||||
NazaraWarning("Image width is not divisible by atlas width (" + String::Number(imageSize.x) + " mod " + String::Number(atlasSize.x) + " != 0)");
|
||||
NazaraWarning("Image width is not divisible by atlas width (" + NumberToString(imageSize.x) + " mod " + NumberToString(atlasSize.x) + " != 0)");
|
||||
}
|
||||
|
||||
if (imageSize.y % atlasSize.y != 0)
|
||||
{
|
||||
NazaraWarning("Image height is not divisible by atlas height (" + String::Number(imageSize.y) + " mod " + String::Number(atlasSize.y) + " != 0)");
|
||||
NazaraWarning("Image height is not divisible by atlas height (" + NumberToString(imageSize.y) + " mod " + NumberToString(atlasSize.y) + " != 0)");
|
||||
}
|
||||
|
||||
Vector2ui faceSize = imageSize/atlasSize;
|
||||
@@ -971,7 +972,7 @@ namespace Nz
|
||||
ImageType type = image->GetType();
|
||||
if (type != ImageType_2D)
|
||||
{
|
||||
NazaraError("Image type not handled (0x" + String::Number(type, 16) + ')');
|
||||
NazaraError("Image type not handled (0x" + NumberToString(type, 16) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@@ -1216,20 +1217,20 @@ namespace Nz
|
||||
|
||||
if (x >= m_sharedImage->width)
|
||||
{
|
||||
NazaraError("X value exceeds width (" + String::Number(x) + " >= " + String::Number(m_sharedImage->width) + ')');
|
||||
NazaraError("X value exceeds width (" + NumberToString(x) + " >= " + NumberToString(m_sharedImage->width) + ')');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (y >= m_sharedImage->height)
|
||||
{
|
||||
NazaraError("Y value exceeds height (" + String::Number(y) + " >= " + String::Number(m_sharedImage->height) + ')');
|
||||
NazaraError("Y value exceeds height (" + NumberToString(y) + " >= " + NumberToString(m_sharedImage->height) + ')');
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned int depth = (m_sharedImage->type == ImageType_Cubemap) ? 6 : m_sharedImage->depth;
|
||||
if (z >= depth)
|
||||
{
|
||||
NazaraError("Z value exceeds depth (" + String::Number(z) + " >= " + String::Number(depth) + ')');
|
||||
NazaraError("Z value exceeds depth (" + NumberToString(z) + " >= " + NumberToString(depth) + ')');
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -1262,7 +1263,7 @@ namespace Nz
|
||||
|
||||
if (level >= m_sharedImage->levels.size())
|
||||
{
|
||||
NazaraError("Level out of bounds (" + String::Number(level) + " >= " + String::Number(m_sharedImage->levels.size()) + ')');
|
||||
NazaraError("Level out of bounds (" + NumberToString(level) + " >= " + NumberToString(m_sharedImage->levels.size()) + ')');
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -1296,7 +1297,7 @@ namespace Nz
|
||||
|
||||
if (level >= m_sharedImage->levels.size())
|
||||
{
|
||||
NazaraError("Level out of bounds (" + String::Number(level) + " >= " + String::Number(m_sharedImage->levels.size()) + ')');
|
||||
NazaraError("Level out of bounds (" + NumberToString(level) + " >= " + NumberToString(m_sharedImage->levels.size()) + ')');
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -1425,7 +1426,7 @@ namespace Nz
|
||||
return GetMaxLevel(width, height, depth);
|
||||
}
|
||||
|
||||
NazaraError("Image type not handled (0x" + String::Number(type, 16) + ')');
|
||||
NazaraError("Image type not handled (0x" + NumberToString(type, 16) + ')');
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Nz
|
||||
return m_inverseBindMatrix;
|
||||
}
|
||||
|
||||
String Joint::GetName() const
|
||||
const std::string& Joint::GetName() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
@@ -63,9 +63,9 @@ namespace Nz
|
||||
m_skinningMatrixUpdated = false;
|
||||
}
|
||||
|
||||
void Joint::SetName(const String& name)
|
||||
void Joint::SetName(std::string name)
|
||||
{
|
||||
m_name = name;
|
||||
m_name = std::move(name);
|
||||
|
||||
m_skeleton->InvalidateJointMap();
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <Nazara/Core/Enums.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/PrimitiveList.hpp>
|
||||
#include <Nazara/Core/StringExt.hpp>
|
||||
#include <Nazara/Utility/Algorithm.hpp>
|
||||
#include <Nazara/Utility/Buffer.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
@@ -613,7 +614,7 @@ namespace Nz
|
||||
if (matIndex >= matCount)
|
||||
{
|
||||
data.subMesh->SetMaterialIndex(0); // To prevent a crash
|
||||
NazaraWarning("SubMesh " + String::Pointer(data.subMesh) + " material index is over mesh new material count (" + String::Number(matIndex) + " >= " + String::Number(matCount) + "), setting it to first material");
|
||||
NazaraWarning("SubMesh " + PointerToString(data.subMesh) + " material index is over mesh new material count (" + NumberToString(matIndex) + " >= " + NumberToString(matCount) + "), setting it to first material");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace Nz
|
||||
return m_position;
|
||||
}
|
||||
|
||||
NazaraError("Coordinate system out of enum (0x" + String::Number(coordSys, 16) + ')');
|
||||
NazaraError("Coordinate system out of enum (0x" + NumberToString(coordSys, 16) + ')');
|
||||
return Vector3f();
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ namespace Nz
|
||||
return m_rotation;
|
||||
}
|
||||
|
||||
NazaraError("Coordinate system out of enum (0x" + String::Number(coordSys, 16) + ')');
|
||||
NazaraError("Coordinate system out of enum (0x" + NumberToString(coordSys, 16) + ')');
|
||||
return Quaternionf();
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ namespace Nz
|
||||
return m_scale;
|
||||
}
|
||||
|
||||
NazaraError("Coordinate system out of enum (0x" + String::Number(coordSys, 16) + ')');
|
||||
NazaraError("Coordinate system out of enum (0x" + NumberToString(coordSys, 16) + ')');
|
||||
return Vector3f();
|
||||
}
|
||||
|
||||
|
||||
@@ -1440,7 +1440,7 @@ namespace Nz
|
||||
for (unsigned int i = 0; i <= PixelFormat_Max; ++i)
|
||||
{
|
||||
if (!s_pixelFormatInfos[i].Validate())
|
||||
NazaraWarning("Pixel format 0x" + String::Number(i, 16) + " (" + GetName(static_cast<Nz::PixelFormat>(i)) + ") failed validation tests");
|
||||
NazaraWarning("Pixel format 0x" + NumberToString(i, 16) + " (" + GetName(static_cast<Nz::PixelFormat>(i)) + ") failed validation tests");
|
||||
}
|
||||
|
||||
// Reset functions
|
||||
|
||||
@@ -55,9 +55,9 @@ namespace Nz
|
||||
|
||||
RichTextDrawer::~RichTextDrawer() = default;
|
||||
|
||||
auto RichTextDrawer::AppendText(const String& str, bool forceNewBlock) -> BlockRef
|
||||
auto RichTextDrawer::AppendText(const std::string& str, bool forceNewBlock) -> BlockRef
|
||||
{
|
||||
NazaraAssert(!str.IsEmpty(), "String cannot be empty");
|
||||
NazaraAssert(!str.empty(), "String cannot be empty");
|
||||
|
||||
std::size_t defaultFontIndex = HandleFontAddition(m_defaultFont);
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace Nz
|
||||
if (!m_blocks.empty())
|
||||
{
|
||||
Block& lastBlock = m_blocks.back();
|
||||
glyphIndex = lastBlock.glyphIndex + lastBlock.text.GetLength();
|
||||
glyphIndex = lastBlock.glyphIndex + lastBlock.text.size();
|
||||
}
|
||||
else
|
||||
glyphIndex = 0;
|
||||
@@ -209,7 +209,7 @@ namespace Nz
|
||||
{
|
||||
NazaraAssert(index < m_blocks.size(), "Invalid block index");
|
||||
|
||||
std::size_t textLength = m_blocks[index].text.GetLength();
|
||||
std::size_t textLength = m_blocks[index].text.size();
|
||||
|
||||
ReleaseFont(m_blocks[index].fontIndex);
|
||||
m_blocks.erase(m_blocks.begin() + index);
|
||||
@@ -376,13 +376,13 @@ namespace Nz
|
||||
return false;
|
||||
};
|
||||
|
||||
void RichTextDrawer::GenerateGlyphs(const Font* font, const Color& color, TextStyleFlags style, unsigned int characterSize, const Color& outlineColor, float characterSpacingOffset, float lineSpacingOffset, float outlineThickness, const String& text) const
|
||||
void RichTextDrawer::GenerateGlyphs(const Font* font, const Color& color, TextStyleFlags style, unsigned int characterSize, const Color& outlineColor, float characterSpacingOffset, float lineSpacingOffset, float outlineThickness, const std::string& text) const
|
||||
{
|
||||
if (text.IsEmpty())
|
||||
if (text.empty())
|
||||
return;
|
||||
|
||||
///TODO: Allow iteration on Unicode characters without allocating any buffer
|
||||
std::u32string characters = text.GetUtf32String();
|
||||
std::u32string characters = ToUtf32String(text);
|
||||
if (characters.empty())
|
||||
{
|
||||
NazaraError("Invalid character set");
|
||||
@@ -503,7 +503,7 @@ namespace Nz
|
||||
auto it = std::find_if(m_fonts.begin(), m_fonts.end(), [font](const auto& fontData) { return fontData.font == font; });
|
||||
if (it == m_fonts.end())
|
||||
{
|
||||
NazaraInternalError("Not listening to " + String::Pointer(font));
|
||||
NazaraInternalError("Not listening to " + PointerToString(font));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -525,7 +525,7 @@ namespace Nz
|
||||
auto it = std::find_if(m_fonts.begin(), m_fonts.end(), [font](const auto& fontData) { return fontData.font == font; });
|
||||
if (it == m_fonts.end())
|
||||
{
|
||||
NazaraInternalError("Not listening to " + String::Pointer(font));
|
||||
NazaraInternalError("Not listening to " + PointerToString(font));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -542,7 +542,7 @@ namespace Nz
|
||||
auto it = std::find_if(m_fonts.begin(), m_fonts.end(), [font](const auto& fontData) { return fontData.font == font; });
|
||||
if (it == m_fonts.end())
|
||||
{
|
||||
NazaraInternalError("Not listening to " + String::Pointer(font));
|
||||
NazaraInternalError("Not listening to " + PointerToString(font));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Nz
|
||||
{
|
||||
void SimpleTextDrawer::Clear()
|
||||
{
|
||||
m_text.Clear(true);
|
||||
m_text.clear();
|
||||
ClearGlyphs();
|
||||
}
|
||||
|
||||
@@ -182,13 +182,13 @@ namespace Nz
|
||||
return false;
|
||||
};
|
||||
|
||||
void SimpleTextDrawer::GenerateGlyphs(const String& text) const
|
||||
void SimpleTextDrawer::GenerateGlyphs(const std::string_view& text) const
|
||||
{
|
||||
if (text.IsEmpty())
|
||||
if (text.empty())
|
||||
return;
|
||||
|
||||
///TODO: Allow iteration on Unicode characters without allocating any buffer
|
||||
std::u32string characters = text.GetUtf32String();
|
||||
std::u32string characters = ToUtf32String(text);
|
||||
if (characters.empty())
|
||||
{
|
||||
NazaraError("Invalid character set");
|
||||
@@ -290,7 +290,7 @@ namespace Nz
|
||||
#ifdef NAZARA_DEBUG
|
||||
if (m_font != font)
|
||||
{
|
||||
NazaraInternalError("Not listening to " + String::Pointer(font));
|
||||
NazaraInternalError("Not listening to " + PointerToString(font));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -311,7 +311,7 @@ namespace Nz
|
||||
#ifdef NAZARA_DEBUG
|
||||
if (m_font != font)
|
||||
{
|
||||
NazaraInternalError("Not listening to " + String::Pointer(font));
|
||||
NazaraInternalError("Not listening to " + PointerToString(font));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -327,7 +327,7 @@ namespace Nz
|
||||
#ifdef NAZARA_DEBUG
|
||||
if (m_font != font)
|
||||
{
|
||||
NazaraInternalError("Not listening to " + String::Pointer(font));
|
||||
NazaraInternalError("Not listening to " + PointerToString(font));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Nz
|
||||
{
|
||||
struct SkeletonImpl
|
||||
{
|
||||
std::unordered_map<String, std::size_t> jointMap;
|
||||
std::unordered_map<std::string, std::size_t> jointMap;
|
||||
std::vector<Joint> joints;
|
||||
Boxf aabb;
|
||||
bool aabbUpdated = false;
|
||||
@@ -90,7 +90,7 @@ namespace Nz
|
||||
return m_impl->aabb;
|
||||
}
|
||||
|
||||
Joint* Skeleton::GetJoint(const String& jointName)
|
||||
Joint* Skeleton::GetJoint(const std::string& jointName)
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!m_impl)
|
||||
@@ -129,7 +129,7 @@ namespace Nz
|
||||
|
||||
if (index >= m_impl->joints.size())
|
||||
{
|
||||
NazaraError("Joint index out of range (" + String::Number(index) + " >= " + String::Number(m_impl->joints.size()) + ')');
|
||||
NazaraError("Joint index out of range (" + NumberToString(index) + " >= " + NumberToString(m_impl->joints.size()) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@@ -139,7 +139,7 @@ namespace Nz
|
||||
return &m_impl->joints[index];
|
||||
}
|
||||
|
||||
const Joint* Skeleton::GetJoint(const String& jointName) const
|
||||
const Joint* Skeleton::GetJoint(const std::string& jointName) const
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!m_impl)
|
||||
@@ -176,7 +176,7 @@ namespace Nz
|
||||
|
||||
if (index >= m_impl->joints.size())
|
||||
{
|
||||
NazaraError("Joint index out of range (" + String::Number(index) + " >= " + String::Number(m_impl->joints.size()) + ')');
|
||||
NazaraError("Joint index out of range (" + NumberToString(index) + " >= " + NumberToString(m_impl->joints.size()) + ')');
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@@ -223,7 +223,7 @@ namespace Nz
|
||||
return static_cast<std::size_t>(m_impl->joints.size());
|
||||
}
|
||||
|
||||
int Skeleton::GetJointIndex(const String& jointName) const
|
||||
int Skeleton::GetJointIndex(const std::string& jointName) const
|
||||
{
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (!m_impl)
|
||||
@@ -322,7 +322,7 @@ namespace Nz
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (index >= m_impl->joints.size())
|
||||
{
|
||||
NazaraError("Index #" + String::Number(i) + " out of range (" + String::Number(index) + " >= " + String::Number(m_impl->joints.size()) + ')');
|
||||
NazaraError("Index #" + NumberToString(i) + " out of range (" + NumberToString(index) + " >= " + NumberToString(m_impl->joints.size()) + ')');
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -409,8 +409,8 @@ namespace Nz
|
||||
m_impl->jointMap.clear();
|
||||
for (std::size_t i = 0; i < m_impl->joints.size(); ++i)
|
||||
{
|
||||
String name = m_impl->joints[i].GetName();
|
||||
if (!name.IsEmpty())
|
||||
const std::string& name = m_impl->joints[i].GetName();
|
||||
if (!name.empty())
|
||||
{
|
||||
NazaraAssert(m_impl->jointMap.find(name) == m_impl->jointMap.end(), "Joint name \"" + name + "\" is already present in joint map");
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Nz
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraError("Failed to allocate software buffer (" + String(e.what()) + ')');
|
||||
NazaraError("Failed to allocate software buffer (" + std::string(e.what()) + ')');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include <Nazara/Utility/SubMesh.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#include <Nazara/Utility/TriangleIterator.hpp>
|
||||
#include <Nazara/Utility/VertexMapper.hpp>
|
||||
@@ -195,7 +194,7 @@ namespace Nz
|
||||
return indexCount - 2;
|
||||
}
|
||||
|
||||
NazaraError("Primitive mode not handled (0x" + String::Number(m_primitiveMode, 16) + ')');
|
||||
NazaraError("Primitive mode not handled (0x" + NumberToString(m_primitiveMode, 16) + ')');
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Nz
|
||||
m_components.reserve(components.size());
|
||||
for (const ComponentEntry& entry : components)
|
||||
{
|
||||
NazaraAssert(IsTypeSupported(entry.type), "Component type 0x" + String::Number(entry.type, 16) + " is not supported by vertex declarations");
|
||||
NazaraAssert(IsTypeSupported(entry.type), "Component type 0x" + NumberToString(entry.type, 16) + " is not supported by vertex declarations");
|
||||
NazaraAssert(entry.componentIndex == 0 || entry.component == VertexComponent_Userdata, "Only userdata components can have non-zero component indexes");
|
||||
|
||||
if (entry.component != VertexComponent_Unused)
|
||||
@@ -91,7 +91,7 @@ namespace Nz
|
||||
return false;
|
||||
}
|
||||
|
||||
NazaraError("Component type not handled (0x" + String::Number(type, 16) + ')');
|
||||
NazaraError("Component type not handled (0x" + NumberToString(type, 16) + ')');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ namespace Nz
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
NazaraError("Failed to initialize vertex declaration: " + String(e.what()));
|
||||
NazaraError("Failed to initialize vertex declaration: " + std::string(e.what()));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Nz
|
||||
|
||||
if (!buffer)
|
||||
{
|
||||
NazaraInternalError("Animation type not handled (0x" + String::Number(subMesh->GetAnimationType(), 16) + ')');
|
||||
NazaraInternalError("Animation type not handled (0x" + NumberToString(subMesh->GetAnimationType(), 16) + ')');
|
||||
}
|
||||
|
||||
m_mapper.Map(buffer, access);
|
||||
@@ -72,7 +72,7 @@ namespace Nz
|
||||
|
||||
if (!buffer)
|
||||
{
|
||||
NazaraInternalError("Animation type not handled (0x" + String::Number(subMesh->GetAnimationType(), 16) + ')');
|
||||
NazaraInternalError("Animation type not handled (0x" + NumberToString(subMesh->GetAnimationType(), 16) + ')');
|
||||
}
|
||||
|
||||
m_mapper.Map(buffer, access);
|
||||
|
||||
Reference in New Issue
Block a user