Strings may use external buffers if the 'max size' template parameter is zero.

This commit is contained in:
John Wellbelove 2020-05-09 12:47:55 +01:00
parent 5f969f07fe
commit d55695e3d4
18 changed files with 17356 additions and 31 deletions

View File

@ -243,10 +243,10 @@ namespace etl
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
#ifdef ETL_ISTRING_REPAIR_ENABLE
virtual
#endif
void repair()
#ifdef ETL_ISTRING_REPAIR_ENABLE
ETL_OVERRIDE
#endif
{
etl::istring::repair_buffer(buffer);
}
@ -256,6 +256,188 @@ namespace etl
value_type buffer[MAX_SIZE + 1];
};
//***************************************************************************
/// A string implementation that uses a fixed size buffer.
/// A specilisation that requires an external buffer to be specified.
///\ingroup string
//***************************************************************************
template <>
class string<0U> : public istring
{
public:
typedef istring base_type;
typedef istring interface_type;
typedef istring::value_type value_type;
//*************************************************************************
/// Constructor.
//*************************************************************************
string(value_type* buffer, size_t max_size)
: istring(buffer, max_size - 1)
{
this->initialise();
}
//*************************************************************************
/// Copy constructor.
///\param other The other string.
//*************************************************************************
string(const etl::string<0U>& other, value_type* buffer, size_t max_size)
: istring(buffer, max_size - 1)
{
this->assign(other);
}
//*************************************************************************
/// From other istring.
///\param other The other istring.
//*************************************************************************
string(const etl::istring& other, value_type* buffer, size_t max_size)
: istring(buffer, max_size - 1)
{
this->assign(other);
}
//*************************************************************************
/// From other string, position, length.
///\param other The other string.
///\param position The position of the first character.
///\param length The number of characters. Default = npos.
//*************************************************************************
string(const etl::istring& other, value_type* buffer, size_t max_size, size_t position, size_t length_ = npos)
: istring(buffer, max_size - 1)
{
ETL_ASSERT(position < other.size(), ETL_ERROR(string_out_of_bounds));
this->assign(other.begin() + position, other.begin() + position + length_);
if (other.truncated())
{
this->is_truncated = true;
#if defined(ETL_STRING_TRUNCATION_IS_ERROR)
ETL_ALWAYS_ASSERT(ETL_ERROR(string_truncation));
#endif
}
}
//*************************************************************************
/// Constructor, from null terminated text.
///\param text The initial text of the string.
//*************************************************************************
ETL_EXPLICIT_STRING_FROM_CHAR string(const value_type* text, value_type* buffer, size_t max_size)
: istring(buffer, max_size - 1)
{
this->assign(text, text + etl::char_traits<value_type>::length(text));
}
//*************************************************************************
/// Constructor, from null terminated text and count.
///\param text The initial text of the string.
///\param count The number of characters to copy.
//*************************************************************************
string(const value_type* text, size_t count, value_type* buffer, size_t max_size)
: istring(buffer, max_size - 1)
{
this->assign(text, text + count);
}
//*************************************************************************
/// Constructor, from initial size and value.
///\param initialSize The initial size of the string.
///\param value The value to fill the string with.
//*************************************************************************
string(size_t count, value_type c, value_type* buffer, size_t max_size)
: istring(buffer, max_size - 1)
{
this->initialise();
this->resize(count, c);
}
//*************************************************************************
/// Constructor, from an iterator range.
///\tparam TIterator The iterator type.
///\param first The iterator to the first element.
///\param last The iterator to the last element + 1.
//*************************************************************************
template <typename TIterator>
string(TIterator first, TIterator last, value_type* buffer, size_t max_size)
: istring(buffer, max_size - 1)
{
this->assign(first, last);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Construct from initializer_list.
//*************************************************************************
string(std::initializer_list<value_type> init, value_type* buffer, size_t max_size)
: istring(buffer, max_size - 1)
{
this->assign(init.begin(), init.end());
}
#endif
//*************************************************************************
/// From string_view.
///\param view The string_view.
//*************************************************************************
explicit string(const etl::string_view& view, value_type* buffer, size_t max_size)
: istring(buffer, max_size - 1)
{
this->assign(view.begin(), view.end());
}
//*************************************************************************
/// Assignment operator.
//*************************************************************************
string& operator = (const string& rhs)
{
if (&rhs != this)
{
this->assign(rhs);
}
return *this;
}
//*************************************************************************
/// Assignment operator.
//*************************************************************************
string& operator = (const istring& rhs)
{
if (&rhs != this)
{
this->assign(rhs);
}
return *this;
}
//*************************************************************************
/// Assignment operator.
//*************************************************************************
string& operator = (const value_type* text)
{
this->assign(text);
return *this;
}
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
#ifdef ETL_ISTRING_REPAIR_ENABLE
ETL_OVERRIDE
#endif
{
}
};
//*************************************************************************
/// Hash function.
//*************************************************************************

View File

@ -2372,10 +2372,10 @@ namespace etl
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
#ifdef ETL_IDEQUE_REPAIR_ENABLE
virtual
#endif
void repair()
#ifdef ETL_ISTRING_REPAIR_ENABLE
ETL_OVERRIDE
#endif
{
#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
ETL_ASSERT(etl::is_trivially_copyable<T>::value, ETL_ERROR(etl::deque_incompatible_type));

View File

@ -38,10 +38,8 @@ SOFTWARE.
#define ETL_8BIT_SUPPORT (CHAR_BIT == 8)
// Define a debug macro
#if !defined(ETL_DEBUG)
#if defined(_DEBUG) || defined(DEBUG)
#define ETL_DEBUG
#endif
#if defined(_DEBUG) || defined(DEBUG)
#define ETL_DEBUG
#endif
// Determine the bit width of the platform.
@ -52,6 +50,11 @@ SOFTWARE.
// Include the user's profile definition.
#include "etl_profile.h"
// Helper macro, so we don't have to use double negatives.
// The ETL will use the STL, unless ETL_NO_STL is defined.
// With this macro we can use '#if ETL_USING_STL' instead of '#if !defined(ETL_NO_STL)' in the code.
#define ETL_USING_STL (!defined(ETL_NO_STL))
// Figure out things about the compiler, if haven't already done so in etl_profile.h
#include "profiles/determine_compiler_version.h"
#include "profiles/determine_compiler_language_support.h"
@ -59,6 +62,7 @@ SOFTWARE.
// See if we can determine the OS we're compiling on, if haven't already done so in etl_profile.h
#include "profiles/determine_development_os.h"
// Option to force string construction from a character pointer to be explicit.
#if defined(ETL_FORCE_EXPLICIT_STRING_CONVERSION_FROM_CHAR)
#define ETL_EXPLICIT_STRING_FROM_CHAR explicit
#else
@ -76,12 +80,12 @@ SOFTWARE.
#define ETL_FINAL final
#define ETL_NORETURN [[noreturn]]
#if defined(ETL_EXCEPTIONS_DISABLED)
#define ETL_NOEXCEPT
#define ETL_NOEXCEPT_EXPR(expression)
#else
#if defined(ETL_THROW_EXCEPTIONS)
#define ETL_NOEXCEPT noexcept
#define ETL_NOEXCEPT_EXPR(expression) noexcept(expression)
#else
#define ETL_NOEXCEPT
#define ETL_NOEXCEPT_EXPR(expression)
#endif
#else
#define ETL_CONSTEXPR

View File

@ -426,6 +426,13 @@ namespace etl
return *this;
}
#ifdef ETL_IVECTOR_REPAIR_ENABLE
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
virtual void repair() = 0;
#endif
protected:
//*********************************************************************
@ -837,6 +844,13 @@ namespace etl
return *this;
}
#ifdef ETL_IVECTOR_REPAIR_ENABLE
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
virtual void repair() = 0;
#endif
protected:
//*********************************************************************

View File

@ -229,10 +229,10 @@ namespace etl
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
#ifdef ETL_ISTRING_REPAIR_ENABLE
virtual
#endif
void repair()
#ifdef ETL_ISTRING_REPAIR_ENABLE
ETL_OVERRIDE
#endif
{
etl::iu16string::repair_buffer(buffer);
}
@ -242,6 +242,188 @@ namespace etl
value_type buffer[MAX_SIZE + 1];
};
//***************************************************************************
/// A u16string implementation that uses a fixed size buffer.
/// A specilisation that requires an external buffer to be specified.
///\ingroup u16string
//***************************************************************************
template <>
class u16string<0U> : public iu16string
{
public:
typedef iu16string base_type;
typedef iu16string interface_type;
typedef iu16string::value_type value_type;
//*************************************************************************
/// Constructor.
//*************************************************************************
u16string(value_type* buffer, size_t max_size)
: iu16string(buffer, max_size - 1)
{
this->initialise();
}
//*************************************************************************
/// Copy constructor.
///\param other The other u16string.
//*************************************************************************
u16string(const etl::u16string<0U>& other, value_type* buffer, size_t max_size)
: iu16string(buffer, max_size - 1)
{
this->assign(other);
}
//*************************************************************************
/// From other iu16string.
///\param other The other iu16string.
//*************************************************************************
u16string(const etl::iu16string& other, value_type* buffer, size_t max_size)
: iu16string(buffer, max_size - 1)
{
this->assign(other);
}
//*************************************************************************
/// From other u16string, position, length.
///\param other The other u16string.
///\param position The position of the first character.
///\param length The number of characters. Default = npos.
//*************************************************************************
u16string(const etl::iu16string& other, value_type* buffer, size_t max_size, size_t position, size_t length_ = npos)
: iu16string(buffer, max_size - 1)
{
ETL_ASSERT(position < other.size(), ETL_ERROR(string_out_of_bounds));
this->assign(other.begin() + position, other.begin() + position + length_);
if (other.truncated())
{
this->is_truncated = true;
#if defined(ETL_STRING_TRUNCATION_IS_ERROR)
ETL_ALWAYS_ASSERT(ETL_ERROR(u16string_truncation));
#endif
}
}
//*************************************************************************
/// Constructor, from null terminated text.
///\param text The initial text of the u16string.
//*************************************************************************
ETL_EXPLICIT_STRING_FROM_CHAR u16string(const value_type* text, value_type* buffer, size_t max_size)
: iu16string(buffer, max_size - 1)
{
this->assign(text, text + etl::char_traits<value_type>::length(text));
}
//*************************************************************************
/// Constructor, from null terminated text and count.
///\param text The initial text of the u16string.
///\param count The number of characters to copy.
//*************************************************************************
u16string(const value_type* text, size_t count, value_type* buffer, size_t max_size)
: iu16string(buffer, max_size - 1)
{
this->assign(text, text + count);
}
//*************************************************************************
/// Constructor, from initial size and value.
///\param initialSize The initial size of the u16string.
///\param value The value to fill the u16string with.
//*************************************************************************
u16string(size_t count, value_type c, value_type* buffer, size_t max_size)
: iu16string(buffer, max_size - 1)
{
this->initialise();
this->resize(count, c);
}
//*************************************************************************
/// Constructor, from an iterator range.
///\tparam TIterator The iterator type.
///\param first The iterator to the first element.
///\param last The iterator to the last element + 1.
//*************************************************************************
template <typename TIterator>
u16string(TIterator first, TIterator last, value_type* buffer, size_t max_size)
: iu16string(buffer, max_size - 1)
{
this->assign(first, last);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Construct from initializer_list.
//*************************************************************************
u16string(std::initializer_list<value_type> init, value_type* buffer, size_t max_size)
: iu16string(buffer, max_size - 1)
{
this->assign(init.begin(), init.end());
}
#endif
//*************************************************************************
/// From u16string_view.
///\param view The u16string_view.
//*************************************************************************
explicit u16string(const etl::u16string_view& view, value_type* buffer, size_t max_size)
: iu16string(buffer, max_size - 1)
{
this->assign(view.begin(), view.end());
}
//*************************************************************************
/// Assignment operator.
//*************************************************************************
u16string& operator = (const u16string& rhs)
{
if (&rhs != this)
{
this->assign(rhs);
}
return *this;
}
//*************************************************************************
/// Assignment operator.
//*************************************************************************
u16string& operator = (const iu16string& rhs)
{
if (&rhs != this)
{
this->assign(rhs);
}
return *this;
}
//*************************************************************************
/// Assignment operator.
//*************************************************************************
u16string& operator = (const value_type* text)
{
this->assign(text);
return *this;
}
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
#ifdef ETL_ISTRING_REPAIR_ENABLE
ETL_OVERRIDE
#endif
{
}
};
//*************************************************************************
/// Hash function.
//*************************************************************************

View File

@ -229,10 +229,10 @@ namespace etl
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
#ifdef ETL_ISTRING_REPAIR_ENABLE
virtual
#endif
void repair()
#ifdef ETL_ISTRING_REPAIR_ENABLE
ETL_OVERRIDE
#endif
{
etl::iu32string::repair_buffer(buffer);
}
@ -242,6 +242,188 @@ namespace etl
value_type buffer[MAX_SIZE + 1];
};
//***************************************************************************
/// A u32string implementation that uses a fixed size buffer.
/// A specilisation that requires an external buffer to be specified.
///\ingroup u32string
//***************************************************************************
template <>
class u32string<0U> : public iu32string
{
public:
typedef iu32string base_type;
typedef iu32string interface_type;
typedef iu32string::value_type value_type;
//*************************************************************************
/// Constructor.
//*************************************************************************
u32string(value_type* buffer, size_t max_size)
: iu32string(buffer, max_size - 1)
{
this->initialise();
}
//*************************************************************************
/// Copy constructor.
///\param other The other u32string.
//*************************************************************************
u32string(const etl::u32string<0U>& other, value_type* buffer, size_t max_size)
: iu32string(buffer, max_size - 1)
{
this->assign(other);
}
//*************************************************************************
/// From other iu32string.
///\param other The other iu32string.
//*************************************************************************
u32string(const etl::iu32string& other, value_type* buffer, size_t max_size)
: iu32string(buffer, max_size - 1)
{
this->assign(other);
}
//*************************************************************************
/// From other u32string, position, length.
///\param other The other u32string.
///\param position The position of the first character.
///\param length The number of characters. Default = npos.
//*************************************************************************
u32string(const etl::iu32string& other, value_type* buffer, size_t max_size, size_t position, size_t length_ = npos)
: iu32string(buffer, max_size - 1)
{
ETL_ASSERT(position < other.size(), ETL_ERROR(string_out_of_bounds));
this->assign(other.begin() + position, other.begin() + position + length_);
if (other.truncated())
{
this->is_truncated = true;
#if defined(ETL_STRING_TRUNCATION_IS_ERROR)
ETL_ALWAYS_ASSERT(ETL_ERROR(u32string_truncation));
#endif
}
}
//*************************************************************************
/// Constructor, from null terminated text.
///\param text The initial text of the u32string.
//*************************************************************************
ETL_EXPLICIT_STRING_FROM_CHAR u32string(const value_type* text, value_type* buffer, size_t max_size)
: iu32string(buffer, max_size - 1)
{
this->assign(text, text + etl::char_traits<value_type>::length(text));
}
//*************************************************************************
/// Constructor, from null terminated text and count.
///\param text The initial text of the u32string.
///\param count The number of characters to copy.
//*************************************************************************
u32string(const value_type* text, size_t count, value_type* buffer, size_t max_size)
: iu32string(buffer, max_size - 1)
{
this->assign(text, text + count);
}
//*************************************************************************
/// Constructor, from initial size and value.
///\param initialSize The initial size of the u32string.
///\param value The value to fill the u32string with.
//*************************************************************************
u32string(size_t count, value_type c, value_type* buffer, size_t max_size)
: iu32string(buffer, max_size - 1)
{
this->initialise();
this->resize(count, c);
}
//*************************************************************************
/// Constructor, from an iterator range.
///\tparam TIterator The iterator type.
///\param first The iterator to the first element.
///\param last The iterator to the last element + 1.
//*************************************************************************
template <typename TIterator>
u32string(TIterator first, TIterator last, value_type* buffer, size_t max_size)
: iu32string(buffer, max_size - 1)
{
this->assign(first, last);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Construct from initializer_list.
//*************************************************************************
u32string(std::initializer_list<value_type> init, value_type* buffer, size_t max_size)
: iu32string(buffer, max_size - 1)
{
this->assign(init.begin(), init.end());
}
#endif
//*************************************************************************
/// From u32string_view.
///\param view The u32string_view.
//*************************************************************************
explicit u32string(const etl::u32string_view& view, value_type* buffer, size_t max_size)
: iu32string(buffer, max_size - 1)
{
this->assign(view.begin(), view.end());
}
//*************************************************************************
/// Assignment operator.
//*************************************************************************
u32string& operator = (const u32string& rhs)
{
if (&rhs != this)
{
this->assign(rhs);
}
return *this;
}
//*************************************************************************
/// Assignment operator.
//*************************************************************************
u32string& operator = (const iu32string& rhs)
{
if (&rhs != this)
{
this->assign(rhs);
}
return *this;
}
//*************************************************************************
/// Assignment operator.
//*************************************************************************
u32string& operator = (const value_type* text)
{
this->assign(text);
return *this;
}
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
#ifdef ETL_ISTRING_REPAIR_ENABLE
ETL_OVERRIDE
#endif
{
}
};
//*************************************************************************
/// Hash function.
//*************************************************************************

View File

@ -1284,10 +1284,10 @@ namespace etl
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
#ifdef ETL_IVECTOR_REPAIR_ENABLE
virtual
#endif
void repair()
#ifdef ETL_IVECTOR_REPAIR_ENABLE
ETL_OVERRIDE
#endif
{
#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
ETL_ASSERT(etl::is_trivially_copyable<T>::value, ETL_ERROR(etl::vector_incompatible_type));
@ -1439,10 +1439,10 @@ namespace etl
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
#ifdef ETL_IVECTOR_REPAIR_ENABLE
virtual
ETL_OVERRIDE
#endif
void repair()
{
#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
ETL_ASSERT(etl::is_trivially_copyable<T>::value, ETL_ERROR(etl::vector_incompatible_type));
@ -1594,6 +1594,9 @@ namespace etl
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
#ifdef ETL_IVECTOR_REPAIR_ENABLE
ETL_OVERRIDE
#endif
{
etl::ivector<T*>::repair_buffer(buffer);
}
@ -1739,10 +1742,10 @@ namespace etl
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
#ifdef ETL_IVECTOR_REPAIR_ENABLE
virtual
ETL_OVERRIDE
#endif
void repair()
{
etl::ivector<T*>::repair_buffer(this->p_buffer);
}

View File

@ -38,8 +38,8 @@ SOFTWARE.
///\ingroup utilities
#define ETL_VERSION_MAJOR 18
#define ETL_VERSION_MINOR 0
#define ETL_VERSION_PATCH 1
#define ETL_VERSION_MINOR 1
#define ETL_VERSION_PATCH 0
#define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) "." ETL_STRINGIFY(ETL_VERSION_MINOR) "." ETL_STRINGIFY(ETL_VERSION_PATCH)
#define ETL_VERSION_W ETL_STRINGIFY(ETL_VERSION_MAJOR) L"." ETL_STRINGIFY(ETL_VERSION_MINOR) L"." ETL_STRINGIFY(ETL_VERSION_PATCH)
#define ETL_VERSION_U16 ETL_STRINGIFY(ETL_VERSION_MAJOR) u"." ETL_STRINGIFY(ETL_VERSION_MINOR) u"." ETL_STRINGIFY(ETL_VERSION_PATCH)

View File

@ -243,6 +243,188 @@ namespace etl
value_type buffer[MAX_SIZE + 1];
};
//***************************************************************************
/// A wstring implementation that uses a fixed size buffer.
/// A specilisation that requires an external buffer to be specified.
///\ingroup wstring
//***************************************************************************
template <>
class wstring<0U> : public iwstring
{
public:
typedef iwstring base_type;
typedef iwstring interface_type;
typedef iwstring::value_type value_type;
//*************************************************************************
/// Constructor.
//*************************************************************************
wstring(value_type* buffer, size_t max_size)
: iwstring(buffer, max_size - 1)
{
this->initialise();
}
//*************************************************************************
/// Copy constructor.
///\param other The other wstring.
//*************************************************************************
wstring(const etl::wstring<0U>& other, value_type* buffer, size_t max_size)
: iwstring(buffer, max_size - 1)
{
this->assign(other);
}
//*************************************************************************
/// From other iwstring.
///\param other The other iwstring.
//*************************************************************************
wstring(const etl::iwstring& other, value_type* buffer, size_t max_size)
: iwstring(buffer, max_size - 1)
{
this->assign(other);
}
//*************************************************************************
/// From other wstring, position, length.
///\param other The other wstring.
///\param position The position of the first character.
///\param length The number of characters. Default = npos.
//*************************************************************************
wstring(const etl::iwstring& other, value_type* buffer, size_t max_size, size_t position, size_t length_ = npos)
: iwstring(buffer, max_size - 1)
{
ETL_ASSERT(position < other.size(), ETL_ERROR(string_out_of_bounds));
this->assign(other.begin() + position, other.begin() + position + length_);
if (other.truncated())
{
this->is_truncated = true;
#if defined(ETL_STRING_TRUNCATION_IS_ERROR)
ETL_ALWAYS_ASSERT(ETL_ERROR(wstring_truncation));
#endif
}
}
//*************************************************************************
/// Constructor, from null terminated text.
///\param text The initial text of the wstring.
//*************************************************************************
ETL_EXPLICIT_STRING_FROM_CHAR wstring(const value_type* text, value_type* buffer, size_t max_size)
: iwstring(buffer, max_size - 1)
{
this->assign(text, text + etl::char_traits<value_type>::length(text));
}
//*************************************************************************
/// Constructor, from null terminated text and count.
///\param text The initial text of the wstring.
///\param count The number of characters to copy.
//*************************************************************************
wstring(const value_type* text, size_t count, value_type* buffer, size_t max_size)
: iwstring(buffer, max_size - 1)
{
this->assign(text, text + count);
}
//*************************************************************************
/// Constructor, from initial size and value.
///\param initialSize The initial size of the wstring.
///\param value The value to fill the wstring with.
//*************************************************************************
wstring(size_t count, value_type c, value_type* buffer, size_t max_size)
: iwstring(buffer, max_size - 1)
{
this->initialise();
this->resize(count, c);
}
//*************************************************************************
/// Constructor, from an iterator range.
///\tparam TIterator The iterator type.
///\param first The iterator to the first element.
///\param last The iterator to the last element + 1.
//*************************************************************************
template <typename TIterator>
wstring(TIterator first, TIterator last, value_type* buffer, size_t max_size)
: iwstring(buffer, max_size - 1)
{
this->assign(first, last);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Construct from initializer_list.
//*************************************************************************
wstring(std::initializer_list<value_type> init, value_type* buffer, size_t max_size)
: iwstring(buffer, max_size - 1)
{
this->assign(init.begin(), init.end());
}
#endif
//*************************************************************************
/// From wstring_view.
///\param view The wstring_view.
//*************************************************************************
explicit wstring(const etl::wstring_view& view, value_type* buffer, size_t max_size)
: iwstring(buffer, max_size - 1)
{
this->assign(view.begin(), view.end());
}
//*************************************************************************
/// Assignment operator.
//*************************************************************************
wstring& operator = (const wstring& rhs)
{
if (&rhs != this)
{
this->assign(rhs);
}
return *this;
}
//*************************************************************************
/// Assignment operator.
//*************************************************************************
wstring& operator = (const iwstring& rhs)
{
if (&rhs != this)
{
this->assign(rhs);
}
return *this;
}
//*************************************************************************
/// Assignment operator.
//*************************************************************************
wstring& operator = (const value_type* text)
{
this->assign(text);
return *this;
}
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
#ifdef ETL_ISTRING_REPAIR_ENABLE
ETL_OVERRIDE
#endif
{
}
};
//*************************************************************************
/// Hash function.
//*************************************************************************

View File

@ -1,6 +1,6 @@
{
"name": "Embedded Template Library",
"version": "18.0.1",
"version": "18.1.0",
"authors": {
"name": "John Wellbelove",
"email": "john.wellbelove@etlcpp.com"

View File

@ -1,5 +1,5 @@
name=Embedded Template Library
version=18.0.1
version=18.1.0
author= John Wellbelove <john.wellbelove@etlcpp.com>
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
license=MIT

View File

@ -1,3 +1,7 @@
===============================================================================
18.1.0
Strings may use external buffers if the 'max size' template parameter is zero.
===============================================================================
18.0.1
Fixed 'insert to empty container' bug in etl::deque.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1615,10 +1615,14 @@
<ClCompile Include="..\test_smallest.cpp" />
<ClCompile Include="..\test_stack.cpp" />
<ClCompile Include="..\test_string_char.cpp" />
<ClCompile Include="..\test_string_char_external_buffer.cpp" />
<ClCompile Include="..\test_string_u16.cpp" />
<ClCompile Include="..\test_string_u16_external_buffer.cpp" />
<ClCompile Include="..\test_string_u32.cpp" />
<ClCompile Include="..\test_string_u32_external_buffer.cpp" />
<ClCompile Include="..\test_string_view.cpp" />
<ClCompile Include="..\test_string_wchar_t.cpp" />
<ClCompile Include="..\test_string_wchar_t_external_buffer.cpp" />
<ClCompile Include="..\test_task_scheduler.cpp" />
<ClCompile Include="..\test_to_string.cpp" />
<ClCompile Include="..\test_to_u16string.cpp" />

View File

@ -1313,6 +1313,18 @@
<ClCompile Include="..\test_span.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\test_string_char_external_buffer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\test_string_wchar_t_external_buffer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\test_string_u16_external_buffer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\test_string_u32_external_buffer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\..\library.properties">