another adjustments for string
This commit is contained in:
@@ -27,6 +27,7 @@ namespace OpenVulkano
|
|||||||
String(const std::string_view& str) : m_string(str) {}
|
String(const std::string_view& str) : m_string(str) {}
|
||||||
String(const String& other) : m_string(other.m_string) {}
|
String(const String& other) : m_string(other.m_string) {}
|
||||||
String(String&& other) noexcept : m_string(std::move(other.m_string)) {}
|
String(String&& other) noexcept : m_string(std::move(other.m_string)) {}
|
||||||
|
String(std::string&& other) noexcept : m_string(std::move(other)) {}
|
||||||
~String() = default;
|
~String() = default;
|
||||||
|
|
||||||
template<typename T> String& operator=(const T& other)
|
template<typename T> String& operator=(const T& other)
|
||||||
@@ -41,24 +42,32 @@ namespace OpenVulkano
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> String& operator=(const String& other)
|
String& operator=(const String& other)
|
||||||
{
|
{
|
||||||
m_string = other.m_string;
|
m_string = other.m_string;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String& operator=(String&& other)
|
||||||
|
{
|
||||||
|
m_string = std::move(other.m_string);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T> String& operator+=(const T& other)
|
template<typename T> String& operator+=(const T& other)
|
||||||
{
|
{
|
||||||
m_string += other;
|
m_string += other;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> String& operator+=(const String& other)
|
String& operator+=(const String& other)
|
||||||
{
|
{
|
||||||
m_string += other.m_string;
|
m_string += other.m_string;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename T> String operator+(const T& other) const { return m_string + other; }
|
template<typename T> String operator+(const T& other) const { return m_string + other; }
|
||||||
String operator+(const String& other) const { return m_string + other.m_string; }
|
String operator+(const String& other) const { return m_string + other.m_string; }
|
||||||
|
|
||||||
@@ -96,7 +105,7 @@ namespace OpenVulkano
|
|||||||
|
|
||||||
String& Trim() noexcept { return TrimBack().TrimFront(); }
|
String& Trim() noexcept { return TrimBack().TrimFront(); }
|
||||||
|
|
||||||
[[nodiscard]] String Trim() const { return Trim(); }
|
[[nodiscard]] String Trim() const { return Trim(); }
|
||||||
|
|
||||||
String& TrimFront() noexcept
|
String& TrimFront() noexcept
|
||||||
{
|
{
|
||||||
@@ -263,7 +272,7 @@ namespace OpenVulkano
|
|||||||
|
|
||||||
int64_t HexToInt() { return HexToInt(m_string); }
|
int64_t HexToInt() { return HexToInt(m_string); }
|
||||||
|
|
||||||
static bool IsUrl(const std::string_view& str)
|
static constexpr bool IsUrl(const std::string_view& str)
|
||||||
{
|
{
|
||||||
return str.find("http://") == 0 || str.find("https://") == 0 || str.find("ftp://") == 0;
|
return str.find("http://") == 0 || str.find("https://") == 0 || str.find("ftp://") == 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user