Core/String: Replace implicit operator std::string by ToStd::String
This commit is contained in:
parent
5aab9b248d
commit
fd8306f17f
|
|
@ -134,7 +134,7 @@ namespace Ndk
|
||||||
|
|
||||||
Nz::Vector3f textBox = m_textSprite->GetBoundingVolume().obb.localBox.GetLengths();
|
Nz::Vector3f textBox = m_textSprite->GetBoundingVolume().obb.localBox.GetLengths();
|
||||||
m_textEntity->GetComponent<NodeComponent>().SetPosition(origin.x + checkboxSize.x + (m_adaptativeMargin ? checkboxSize.x / 2.f : m_textMargin),
|
m_textEntity->GetComponent<NodeComponent>().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)
|
void CheckboxWidget::OnMouseButtonRelease(int x, int y, Nz::Mouse::Button button)
|
||||||
|
|
|
||||||
|
|
@ -168,6 +168,7 @@ namespace Nz
|
||||||
bool ToDouble(double* value) const;
|
bool ToDouble(double* value) const;
|
||||||
bool ToInteger(long long* value, UInt8 radix = 10) const;
|
bool ToInteger(long long* value, UInt8 radix = 10) const;
|
||||||
String ToLower(UInt32 flags = None) const;
|
String ToLower(UInt32 flags = None) const;
|
||||||
|
std::string ToStdString() const;
|
||||||
String ToUpper(UInt32 flags = None) const;
|
String ToUpper(UInt32 flags = None) const;
|
||||||
|
|
||||||
String& Trim(UInt32 flags = None);
|
String& Trim(UInt32 flags = None);
|
||||||
|
|
@ -193,8 +194,6 @@ namespace Nz
|
||||||
typedef char value_type;
|
typedef char value_type;
|
||||||
// Méthodes STD
|
// Méthodes STD
|
||||||
|
|
||||||
operator std::string() const;
|
|
||||||
|
|
||||||
char& operator[](std::size_t pos);
|
char& operator[](std::size_t pos);
|
||||||
char operator[](std::size_t pos) const;
|
char operator[](std::size_t pos) const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -238,7 +238,7 @@ namespace Nz
|
||||||
String error("Column out of range: (" + String::Number(column) + ") > 3");
|
String error("Column out of range: (" + String::Number(column) + ") > 3");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::out_of_range(error);
|
throw std::out_of_range(error.ToStdString());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -632,7 +632,7 @@ namespace Nz
|
||||||
String error("Row out of range: (" + String::Number(row) + ") > 3");
|
String error("Row out of range: (" + String::Number(row) + ") > 3");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::out_of_range(error);
|
throw std::out_of_range(error.ToStdString());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1347,7 +1347,7 @@ namespace Nz
|
||||||
String error("Index out of range: (" + String::Number(x) + ", " + String::Number(y) +") > (3, 3)");
|
String error("Index out of range: (" + String::Number(x) + ", " + String::Number(y) +") > (3, 3)");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::out_of_range(error);
|
throw std::out_of_range(error.ToStdString());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1371,7 +1371,7 @@ namespace Nz
|
||||||
String error("Index out of range: (" + String::Number(x) + ", " + String::Number(y) +") > (3, 3)");
|
String error("Index out of range: (" + String::Number(x) + ", " + String::Number(y) +") > (3, 3)");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::out_of_range(error);
|
throw std::out_of_range(error.ToStdString());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -304,7 +304,7 @@ namespace Nz
|
||||||
ss << "Index out of range: (" << i << " >= " << BoxCorner_Max << ")";
|
ss << "Index out of range: (" << i << " >= " << BoxCorner_Max << ")";
|
||||||
|
|
||||||
NazaraError(ss);
|
NazaraError(ss);
|
||||||
throw std::out_of_range(ss.ToString());
|
throw std::out_of_range(ss.ToString().ToStdString());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -579,7 +579,7 @@ namespace Nz
|
||||||
String error("Planes are parallel");
|
String error("Planes are parallel");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::domain_error(error);
|
throw std::domain_error(error.ToStdString());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -607,7 +607,7 @@ namespace Nz
|
||||||
String error("Division by zero");
|
String error("Division by zero");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::domain_error(error);
|
throw std::domain_error(error.ToStdString());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -633,7 +633,7 @@ namespace Nz
|
||||||
String error("Division by zero");
|
String error("Division by zero");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::domain_error(error);
|
throw std::domain_error(error.ToStdString());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -723,7 +723,7 @@ namespace Nz
|
||||||
String error("Division by zero");
|
String error("Division by zero");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::domain_error(error);
|
throw std::domain_error(error.ToStdString());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -752,7 +752,7 @@ namespace Nz
|
||||||
String error("Division by zero");
|
String error("Division by zero");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::domain_error(error);
|
throw std::domain_error(error.ToStdString());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1050,7 +1050,7 @@ Nz::Vector2<T> operator/(T scale, const Nz::Vector2<T>& vec)
|
||||||
Nz::String error("Division by zero");
|
Nz::String error("Division by zero");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::domain_error(error);
|
throw std::domain_error(error.ToStdString());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ namespace Nz
|
||||||
String error("Division by zero");
|
String error("Division by zero");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::domain_error(error);
|
throw std::domain_error(error.ToStdString());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -726,7 +726,7 @@ namespace Nz
|
||||||
String error("Division by zero");
|
String error("Division by zero");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::domain_error(error);
|
throw std::domain_error(error.ToStdString());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -751,7 +751,7 @@ namespace Nz
|
||||||
String error("Division by zero");
|
String error("Division by zero");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::domain_error(error);
|
throw std::domain_error(error.ToStdString());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -839,7 +839,7 @@ namespace Nz
|
||||||
String error("Division by zero");
|
String error("Division by zero");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::domain_error(error);
|
throw std::domain_error(error.ToStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
x /= vec.x;
|
x /= vec.x;
|
||||||
|
|
@ -866,7 +866,7 @@ namespace Nz
|
||||||
String error("Division by zero");
|
String error("Division by zero");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::domain_error(error);
|
throw std::domain_error(error.ToStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
x /= scale;
|
x /= scale;
|
||||||
|
|
@ -1340,7 +1340,7 @@ Nz::Vector3<T> operator/(T scale, const Nz::Vector3<T>& vec)
|
||||||
Nz::String error("Division by zero");
|
Nz::String error("Division by zero");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::domain_error(error);
|
throw std::domain_error(error.ToStdString());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -637,7 +637,7 @@ namespace Nz
|
||||||
String error("Division by zero");
|
String error("Division by zero");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::domain_error(error);
|
throw std::domain_error(error.ToStdString());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -663,7 +663,7 @@ namespace Nz
|
||||||
String error("Division by zero");
|
String error("Division by zero");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::domain_error(error);
|
throw std::domain_error(error.ToStdString());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -761,7 +761,7 @@ namespace Nz
|
||||||
String error("Division by zero");
|
String error("Division by zero");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::domain_error(error);
|
throw std::domain_error(error.ToStdString());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -792,7 +792,7 @@ namespace Nz
|
||||||
String error("Division by zero");
|
String error("Division by zero");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::domain_error(error);
|
throw std::domain_error(error.ToStdString());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1113,7 +1113,7 @@ Nz::Vector4<T> operator/(T scale, const Nz::Vector4<T>& vec)
|
||||||
Nz::String error("Division by zero");
|
Nz::String error("Division by zero");
|
||||||
|
|
||||||
NazaraError(error);
|
NazaraError(error);
|
||||||
throw std::domain_error(error);
|
throw std::domain_error(error.ToStdString());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ namespace Nz
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
//FIXME: MinGW seems to dislike thread_local shared_ptr.. (using a std::string is a working hackfix)
|
//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);
|
String path = File::AbsolutePath(dirPath);
|
||||||
if (DirectoryImpl::Exists(path))
|
if (DirectoryImpl::Exists(path))
|
||||||
{
|
{
|
||||||
currentPath = path;
|
currentPath = path.ToStdString();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ namespace Nz
|
||||||
|
|
||||||
if (type == ErrorType_AssertFailed || (type != ErrorType_Warning &&
|
if (type == ErrorType_AssertFailed || (type != ErrorType_Warning &&
|
||||||
(s_flags & ErrorFlag_ThrowException) != 0 && (s_flags & ErrorFlag_ThrowExceptionDisabled) == 0))
|
(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 &&
|
if (type == ErrorType_AssertFailed || (type != ErrorType_Warning &&
|
||||||
(s_flags & ErrorFlag_ThrowException) != 0 && (s_flags & ErrorFlag_ThrowExceptionDisabled) == 0))
|
(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;
|
UInt32 Error::s_flags = ErrorFlag_None;
|
||||||
|
|
|
||||||
|
|
@ -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
|
* \brief Converts the string to upper
|
||||||
* \return Upper string
|
* \return Upper string
|
||||||
*
|
*
|
||||||
* \param flags Flag for the look up
|
* \param flags Flag for the look up
|
||||||
*/
|
*/
|
||||||
|
|
||||||
String String::ToUpper(UInt32 flags) const
|
String String::ToUpper(UInt32 flags) const
|
||||||
{
|
{
|
||||||
if (m_sharedString->size == 0)
|
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
|
* \brief Gets the ith character in the string
|
||||||
* \return A reference to the character
|
* \return A reference to the character
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ namespace Nz
|
||||||
{
|
{
|
||||||
String lastError(lua_tostring(internalState, -1));
|
String lastError(lua_tostring(internalState, -1));
|
||||||
|
|
||||||
throw std::runtime_error("Lua panic: " + lastError);
|
throw std::runtime_error("Lua panic: " + lastError.ToStdString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ namespace Nz
|
||||||
if (varPtr->type != type)
|
if (varPtr->type != type)
|
||||||
{
|
{
|
||||||
//TODO: AstParseError
|
//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;
|
break;
|
||||||
|
|
@ -98,7 +98,7 @@ namespace Nz
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
//TODO: AstParseError
|
//TODO: AstParseError
|
||||||
throw std::runtime_error("Function has no parameter \"" + name + "\"");
|
throw std::runtime_error("Function has no parameter \"" + name.ToStdString() + "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue