diff --git a/SDK/src/NDK/Widgets/CheckboxWidget.cpp b/SDK/src/NDK/Widgets/CheckboxWidget.cpp index ab513c7f8..3dcdb682c 100644 --- a/SDK/src/NDK/Widgets/CheckboxWidget.cpp +++ b/SDK/src/NDK/Widgets/CheckboxWidget.cpp @@ -134,7 +134,7 @@ namespace Ndk Nz::Vector3f textBox = m_textSprite->GetBoundingVolume().obb.localBox.GetLengths(); m_textEntity->GetComponent().SetPosition(origin.x + checkboxSize.x + (m_adaptativeMargin ? checkboxSize.x / 2.f : m_textMargin), - origin.y + checkboxSize.y / 2.f - textBox.y / 2.f); + origin.y + checkboxSize.y / 2.f - textBox.y / 2.f); } void CheckboxWidget::OnMouseButtonRelease(int x, int y, Nz::Mouse::Button button) diff --git a/include/Nazara/Core/String.hpp b/include/Nazara/Core/String.hpp index 918230d29..293dcfa8f 100644 --- a/include/Nazara/Core/String.hpp +++ b/include/Nazara/Core/String.hpp @@ -168,6 +168,7 @@ namespace Nz bool ToDouble(double* value) const; bool ToInteger(long long* value, UInt8 radix = 10) const; String ToLower(UInt32 flags = None) const; + std::string ToStdString() const; String ToUpper(UInt32 flags = None) const; String& Trim(UInt32 flags = None); @@ -193,8 +194,6 @@ namespace Nz typedef char value_type; // Méthodes STD - operator std::string() const; - char& operator[](std::size_t pos); char operator[](std::size_t pos) const; diff --git a/include/Nazara/Math/Matrix4.inl b/include/Nazara/Math/Matrix4.inl index 27b7d3183..f259607a6 100644 --- a/include/Nazara/Math/Matrix4.inl +++ b/include/Nazara/Math/Matrix4.inl @@ -238,7 +238,7 @@ namespace Nz String error("Column out of range: (" + String::Number(column) + ") > 3"); NazaraError(error); - throw std::out_of_range(error); + throw std::out_of_range(error.ToStdString()); } #endif @@ -632,7 +632,7 @@ namespace Nz String error("Row out of range: (" + String::Number(row) + ") > 3"); NazaraError(error); - throw std::out_of_range(error); + throw std::out_of_range(error.ToStdString()); } #endif @@ -1347,7 +1347,7 @@ namespace Nz String error("Index out of range: (" + String::Number(x) + ", " + String::Number(y) +") > (3, 3)"); NazaraError(error); - throw std::out_of_range(error); + throw std::out_of_range(error.ToStdString()); } #endif @@ -1371,7 +1371,7 @@ namespace Nz String error("Index out of range: (" + String::Number(x) + ", " + String::Number(y) +") > (3, 3)"); NazaraError(error); - throw std::out_of_range(error); + throw std::out_of_range(error.ToStdString()); } #endif diff --git a/include/Nazara/Math/OrientedBox.inl b/include/Nazara/Math/OrientedBox.inl index 674e8bdb0..fb335f992 100644 --- a/include/Nazara/Math/OrientedBox.inl +++ b/include/Nazara/Math/OrientedBox.inl @@ -304,7 +304,7 @@ namespace Nz ss << "Index out of range: (" << i << " >= " << BoxCorner_Max << ")"; NazaraError(ss); - throw std::out_of_range(ss.ToString()); + throw std::out_of_range(ss.ToString().ToStdString()); } #endif diff --git a/include/Nazara/Math/Ray.inl b/include/Nazara/Math/Ray.inl index 2149af8b7..813226bb1 100644 --- a/include/Nazara/Math/Ray.inl +++ b/include/Nazara/Math/Ray.inl @@ -579,7 +579,7 @@ namespace Nz String error("Planes are parallel"); NazaraError(error); - throw std::domain_error(error); + throw std::domain_error(error.ToStdString()); } #endif diff --git a/include/Nazara/Math/Vector2.inl b/include/Nazara/Math/Vector2.inl index 2c9d87978..f3e6609bd 100644 --- a/include/Nazara/Math/Vector2.inl +++ b/include/Nazara/Math/Vector2.inl @@ -607,7 +607,7 @@ namespace Nz String error("Division by zero"); NazaraError(error); - throw std::domain_error(error); + throw std::domain_error(error.ToStdString()); } #endif @@ -633,7 +633,7 @@ namespace Nz String error("Division by zero"); NazaraError(error); - throw std::domain_error(error); + throw std::domain_error(error.ToStdString()); } #endif @@ -723,7 +723,7 @@ namespace Nz String error("Division by zero"); NazaraError(error); - throw std::domain_error(error); + throw std::domain_error(error.ToStdString()); } #endif @@ -752,7 +752,7 @@ namespace Nz String error("Division by zero"); NazaraError(error); - throw std::domain_error(error); + throw std::domain_error(error.ToStdString()); } #endif @@ -1050,7 +1050,7 @@ Nz::Vector2 operator/(T scale, const Nz::Vector2& vec) Nz::String error("Division by zero"); NazaraError(error); - throw std::domain_error(error); + throw std::domain_error(error.ToStdString()); } #endif diff --git a/include/Nazara/Math/Vector3.inl b/include/Nazara/Math/Vector3.inl index 9a74717ff..b7a884749 100644 --- a/include/Nazara/Math/Vector3.inl +++ b/include/Nazara/Math/Vector3.inl @@ -142,7 +142,7 @@ namespace Nz String error("Division by zero"); NazaraError(error); - throw std::domain_error(error); + throw std::domain_error(error.ToStdString()); } #endif @@ -726,7 +726,7 @@ namespace Nz String error("Division by zero"); NazaraError(error); - throw std::domain_error(error); + throw std::domain_error(error.ToStdString()); } #endif @@ -751,7 +751,7 @@ namespace Nz String error("Division by zero"); NazaraError(error); - throw std::domain_error(error); + throw std::domain_error(error.ToStdString()); } #endif @@ -839,7 +839,7 @@ namespace Nz String error("Division by zero"); NazaraError(error); - throw std::domain_error(error); + throw std::domain_error(error.ToStdString()); } x /= vec.x; @@ -866,7 +866,7 @@ namespace Nz String error("Division by zero"); NazaraError(error); - throw std::domain_error(error); + throw std::domain_error(error.ToStdString()); } x /= scale; @@ -1340,7 +1340,7 @@ Nz::Vector3 operator/(T scale, const Nz::Vector3& vec) Nz::String error("Division by zero"); NazaraError(error); - throw std::domain_error(error); + throw std::domain_error(error.ToStdString()); } #endif diff --git a/include/Nazara/Math/Vector4.inl b/include/Nazara/Math/Vector4.inl index 2263eb66a..873cea235 100644 --- a/include/Nazara/Math/Vector4.inl +++ b/include/Nazara/Math/Vector4.inl @@ -637,7 +637,7 @@ namespace Nz String error("Division by zero"); NazaraError(error); - throw std::domain_error(error); + throw std::domain_error(error.ToStdString()); } #endif @@ -663,7 +663,7 @@ namespace Nz String error("Division by zero"); NazaraError(error); - throw std::domain_error(error); + throw std::domain_error(error.ToStdString()); } #endif @@ -761,7 +761,7 @@ namespace Nz String error("Division by zero"); NazaraError(error); - throw std::domain_error(error); + throw std::domain_error(error.ToStdString()); } #endif @@ -792,7 +792,7 @@ namespace Nz String error("Division by zero"); NazaraError(error); - throw std::domain_error(error); + throw std::domain_error(error.ToStdString()); } #endif @@ -1113,7 +1113,7 @@ Nz::Vector4 operator/(T scale, const Nz::Vector4& vec) Nz::String error("Division by zero"); NazaraError(error); - throw std::domain_error(error); + throw std::domain_error(error.ToStdString()); } #endif diff --git a/src/Nazara/Core/Directory.cpp b/src/Nazara/Core/Directory.cpp index d5076a09a..04a2eeb94 100644 --- a/src/Nazara/Core/Directory.cpp +++ b/src/Nazara/Core/Directory.cpp @@ -31,7 +31,7 @@ namespace Nz namespace { //FIXME: MinGW seems to dislike thread_local shared_ptr.. (using a std::string is a working hackfix) - thread_local std::string currentPath(DirectoryImpl::GetCurrent()); + thread_local std::string currentPath(DirectoryImpl::GetCurrent().ToStdString()); } /*! @@ -526,7 +526,7 @@ namespace Nz String path = File::AbsolutePath(dirPath); if (DirectoryImpl::Exists(path)) { - currentPath = path; + currentPath = path.ToStdString(); return true; } else diff --git a/src/Nazara/Core/Error.cpp b/src/Nazara/Core/Error.cpp index 1e50d87fb..b5c689971 100644 --- a/src/Nazara/Core/Error.cpp +++ b/src/Nazara/Core/Error.cpp @@ -148,7 +148,7 @@ namespace Nz if (type == ErrorType_AssertFailed || (type != ErrorType_Warning && (s_flags & ErrorFlag_ThrowException) != 0 && (s_flags & ErrorFlag_ThrowExceptionDisabled) == 0)) - throw std::runtime_error(error); + throw std::runtime_error(error.ToStdString()); } /*! @@ -183,7 +183,7 @@ namespace Nz if (type == ErrorType_AssertFailed || (type != ErrorType_Warning && (s_flags & ErrorFlag_ThrowException) != 0 && (s_flags & ErrorFlag_ThrowExceptionDisabled) == 0)) - throw std::runtime_error(error); + throw std::runtime_error(error.ToStdString()); } UInt32 Error::s_flags = ErrorFlag_None; diff --git a/src/Nazara/Core/String.cpp b/src/Nazara/Core/String.cpp index ba29d0916..7a5b01d19 100644 --- a/src/Nazara/Core/String.cpp +++ b/src/Nazara/Core/String.cpp @@ -4197,13 +4197,21 @@ namespace Nz } } + /*! + * \brief Converts the string to std::string + * \return std::string representation + */ + std::string String::ToStdString() const + { + return std::string(m_sharedString->string.get(), m_sharedString->size); + } + /*! * \brief Converts the string to upper * \return Upper string * * \param flags Flag for the look up */ - String String::ToUpper(UInt32 flags) const { if (m_sharedString->size == 0) @@ -4481,16 +4489,6 @@ namespace Nz } */ - /*! - * \brief Converts the string to std::string - * \return std::string representation - */ - - String::operator std::string() const - { - return std::string(m_sharedString->string.get(), m_sharedString->size); - } - /*! * \brief Gets the ith character in the string * \return A reference to the character diff --git a/src/Nazara/Lua/LuaInstance.cpp b/src/Nazara/Lua/LuaInstance.cpp index 366ccab27..6b06aaacc 100644 --- a/src/Nazara/Lua/LuaInstance.cpp +++ b/src/Nazara/Lua/LuaInstance.cpp @@ -21,7 +21,7 @@ namespace Nz { String lastError(lua_tostring(internalState, -1)); - throw std::runtime_error("Lua panic: " + lastError); + throw std::runtime_error("Lua panic: " + lastError.ToStdString()); } } diff --git a/src/Nazara/Renderer/GlslWriter.cpp b/src/Nazara/Renderer/GlslWriter.cpp index 074082165..06ebc251d 100644 --- a/src/Nazara/Renderer/GlslWriter.cpp +++ b/src/Nazara/Renderer/GlslWriter.cpp @@ -89,7 +89,7 @@ namespace Nz if (varPtr->type != type) { //TODO: AstParseError - throw std::runtime_error("Function uses parameter \"" + name + "\" with a different type than specified in the function arguments"); + throw std::runtime_error("Function uses parameter \"" + name.ToStdString() + "\" with a different type than specified in the function arguments"); } break; @@ -98,7 +98,7 @@ namespace Nz if (!found) //TODO: AstParseError - throw std::runtime_error("Function has no parameter \"" + name + "\""); + throw std::runtime_error("Function has no parameter \"" + name.ToStdString() + "\""); } break;