Replace core::string implementation with std::basic_string

This commit is contained in:
sfan5 2022-12-22 23:55:35 +01:00
parent 735af8eec6
commit 07fd32da50
6 changed files with 249 additions and 764 deletions

View File

@ -37,8 +37,10 @@ void run_unit_tests() {
test_irr_array();
test_irr_string();
} catch (const std::exception &e) {
std::cerr << e.what() << std::endl;
test_fail++;
}
std::cout << std::endl;
}
int main(int argc, char *argv[])

View File

@ -36,11 +36,6 @@ static void test_basics()
// operator=
s = stringw(L"abcdef");
UASSERTSTR(s, "abcdef");
s = stringc("test");
s = s.c_str();
UASSERTSTR(s, "test");
s = s.c_str() + 1;
UASSERTSTR(s, "est");
s = L"abcdef";
UASSERTSTR(s, "abcdef");
s = static_cast<const char*>(nullptr);

File diff suppressed because it is too large Load Diff

View File

@ -813,8 +813,8 @@ public:
//! Constructor from other string types
template <class B, class A>
ustring16(const string<B, A>& other)
template <class B>
ustring16(const string<B>& other)
: array(0), allocated(0), used(0)
{
#if __BYTE_ORDER == __BIG_ENDIAN
@ -1054,8 +1054,8 @@ public:
}
//! Assignment operator for other string types
template <class B, class A>
ustring16<TAlloc>& operator=(const string<B, A>& other)
template <class B>
ustring16<TAlloc>& operator=(const string<B>& other)
{
*this = other.c_str();
return *this;
@ -3139,8 +3139,8 @@ inline ustring16<TAlloc> operator+(const B* const left, const ustring16<TAlloc>&
//! Appends a ustring16 and an Irrlicht string.
template <typename TAlloc, typename B, typename BAlloc>
inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const string<B, BAlloc>& right)
template <typename TAlloc, typename B>
inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const string<B>& right)
{
ustring16<TAlloc> ret(left);
ret += right;
@ -3149,8 +3149,8 @@ inline ustring16<TAlloc> operator+(const ustring16<TAlloc>& left, const string<B
//! Appends a ustring16 and an Irrlicht string.
template <typename TAlloc, typename B, typename BAlloc>
inline ustring16<TAlloc> operator+(const string<B, BAlloc>& left, const ustring16<TAlloc>& right)
template <typename TAlloc, typename B>
inline ustring16<TAlloc> operator+(const string<B>& left, const ustring16<TAlloc>& right)
{
ustring16<TAlloc> ret(left);
ret += right;
@ -3438,8 +3438,8 @@ inline ustring16<TAlloc>&& operator+(const B* const left, ustring16<TAlloc>&& ri
//! Appends a ustring16 and an Irrlicht string.
template <typename TAlloc, typename B, typename BAlloc>
inline ustring16<TAlloc>&& operator+(const string<B, BAlloc>& left, ustring16<TAlloc>&& right)
template <typename TAlloc, typename B>
inline ustring16<TAlloc>&& operator+(const string<B>& left, ustring16<TAlloc>&& right)
{
//std::cout << "MOVE operator+(&, &&)" << std::endl;
right.insert(left, 0);
@ -3448,8 +3448,8 @@ inline ustring16<TAlloc>&& operator+(const string<B, BAlloc>& left, ustring16<TA
//! Appends a ustring16 and an Irrlicht string.
template <typename TAlloc, typename B, typename BAlloc>
inline ustring16<TAlloc>&& operator+(ustring16<TAlloc>&& left, const string<B, BAlloc>& right)
template <typename TAlloc, typename B>
inline ustring16<TAlloc>&& operator+(ustring16<TAlloc>&& left, const string<B>& right)
{
//std::cout << "MOVE operator+(&&, &)" << std::endl;
left.append(right);

View File

@ -3,6 +3,7 @@
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "CLimitReadFile.h"
#include "irrMath.h"
#include "irrString.h"
namespace irr

View File

@ -11,6 +11,7 @@
// (this is also the reason why this file is header-only as correct OGL ES headers have to be included first)
#if defined(_IRR_COMPILE_WITH_OGLES2_) || defined(_IRR_COMPILE_WITH_OGLES1_)
#include "irrMath.h"
#include "COpenGLCoreFeature.h"
namespace irr