Merge remote-tracking branch 'origin/develop'

# Conflicts:
#	include/etl/format_spec.h
#	include/etl/private/to_string_helper.h
#	include/etl/to_string.h
#	include/etl/to_u16string.h
#	include/etl/to_u32string.h
#	include/etl/to_wstring.h
#	include/etl/version.h
#	support/Release notes.txt
#	test/test_to_string.cpp
#	test/test_to_u16string.cpp
#	test/test_to_u32string.cpp
#	test/test_to_wstring.cpp
#	test/vs2017/etl.vcxproj.filters
This commit is contained in:
John Wellbelove 2019-04-09 08:21:28 +01:00
parent 7844142c19
commit 8d46963bb0
19 changed files with 411 additions and 206 deletions

View File

@ -0,0 +1,204 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2019 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_BASIC_FORMAT_SPEC_INCLUDED
#define ETL_BASIC_FORMAT_SPEC_INCLUDED
///\ingroup string
#include "platform.h"
#include "type_traits.h"
#include "static_assert.h"
namespace etl
{
template <typename TString>
class basic_format_spec
{
public:
//***************************************************************************
/// Default constructor.
/// Sets:-
/// Base = 10
/// Width = 0
/// Upper case (for hex) = true
/// Left Justified = false
//***************************************************************************
basic_format_spec()
: base_(10)
, width_(0)
, upper_case_(true)
, left_justified_(false)
, fill_(typename TString::value_type(' '))
{
}
//***************************************************************************
/// Sets the base.
/// \return A reference to the basic_format_spec.
//***************************************************************************
basic_format_spec& base(const uint32_t b)
{
base_ = static_cast<uint_least8_t>(b);
return *this;
}
//***************************************************************************
/// Sets the base to binary.
/// \return A reference to the basic_format_spec.
//***************************************************************************
basic_format_spec& binary()
{
base(2);
return *this;
}
//***************************************************************************
/// Sets the base to octal.
/// \return A reference to the basic_format_spec.
//***************************************************************************
basic_format_spec& octal()
{
base(8);
return *this;
}
//***************************************************************************
/// Sets the base to decimal.
/// \return A reference to the basic_format_spec.
//***************************************************************************
basic_format_spec& decimal()
{
base(10);
return *this;
}
//***************************************************************************
/// Sets the base to hex.
/// \return A reference to the basic_format_spec.
//***************************************************************************
basic_format_spec& hex()
{
base(16);
return *this;
}
//***************************************************************************
/// Gets the base.
//***************************************************************************
uint32_t base() const
{
return base_;
}
//***************************************************************************
/// Sets the width.
/// \return A reference to the basic_format_spec.
//***************************************************************************
basic_format_spec& width(const uint32_t w)
{
width_ = static_cast<uint_least8_t>(w);
return *this;
}
//***************************************************************************
/// Gets the width.
//***************************************************************************
uint32_t width() const
{
return width_;
}
//***************************************************************************
/// Sets the upper case flag.
/// \return A reference to the basic_format_spec.
//***************************************************************************
basic_format_spec& upper_case(const bool u)
{
upper_case_ = u;
return *this;
}
//***************************************************************************
/// Gets the upper case flag.
//***************************************************************************
bool upper_case() const
{
return upper_case_;
}
//***************************************************************************
/// Sets the fill character.
/// \return A reference to the basic_format_spec.
//***************************************************************************
basic_format_spec& fill(const typename TString::value_type c)
{
fill_ = c;
return *this;
}
//***************************************************************************
/// Gets the fill character.
//***************************************************************************
typename TString::value_type fill() const
{
return fill_;
}
//***************************************************************************
/// Sets the left justify flag.
/// \return A reference to the basic_format_spec.
//***************************************************************************
basic_format_spec& left_justified(const bool l)
{
left_justified_ = l;
return *this;
}
//***************************************************************************
/// Gets the left justify flag.
//***************************************************************************
bool left_justified() const
{
return left_justified_;
}
private:
uint_least8_t base_;
uint_least8_t width_;
bool upper_case_;
bool left_justified_;
typename TString::value_type fill_;
};
}
#endif

View File

@ -34,171 +34,12 @@ SOFTWARE.
///\ingroup string
#include "platform.h"
#include "type_traits.h"
#include "static_assert.h"
#include "basic_format_spec.h"
#include "cstring.h"
namespace etl
{
template <typename TString>
class format_spec
{
public:
//***************************************************************************
/// Default constructor.
/// Sets:-
/// Base = 10
/// Width = 0
/// Upper case (for hex) = true
/// Left Justified = false
//***************************************************************************
format_spec()
: base_(10)
, width_(0)
, upper_case_(true)
, left_justified_(false)
, fill_(typename TString::value_type(' '))
{
}
//***************************************************************************
/// Sets the base.
/// \return A reference to the format_spec.
//***************************************************************************
format_spec& base(const uint32_t b)
{
base_ = static_cast<uint_least8_t>(b);
return *this;
}
//***************************************************************************
/// Sets the base to binary.
/// \return A reference to the format_spec.
//***************************************************************************
format_spec& binary()
{
base(2);
return *this;
}
//***************************************************************************
/// Sets the base to octal.
/// \return A reference to the format_spec.
//***************************************************************************
format_spec& octal()
{
base(8);
return *this;
}
//***************************************************************************
/// Sets the base to decimal.
/// \return A reference to the format_spec.
//***************************************************************************
format_spec& decimal()
{
base(10);
return *this;
}
//***************************************************************************
/// Sets the base to hex.
/// \return A reference to the format_spec.
//***************************************************************************
format_spec& hex()
{
base(16);
return *this;
}
//***************************************************************************
/// Gets the base.
//***************************************************************************
uint32_t base() const
{
return base_;
}
//***************************************************************************
/// Sets the width.
/// \return A reference to the format_spec.
//***************************************************************************
format_spec& width(const uint32_t w)
{
width_ = static_cast<uint_least8_t>(w);
return *this;
}
//***************************************************************************
/// Gets the width.
//***************************************************************************
uint32_t width() const
{
return width_;
}
//***************************************************************************
/// Sets the upper case flag.
/// \return A reference to the format_spec.
//***************************************************************************
format_spec& upper_case(const bool u)
{
upper_case_ = u;
return *this;
}
//***************************************************************************
/// Gets the upper case flag.
//***************************************************************************
bool upper_case() const
{
return upper_case_;
}
//***************************************************************************
/// Sets the fill character.
/// \return A reference to the format_spec.
//***************************************************************************
format_spec& fill(const typename TString::value_type c)
{
fill_ = c;
return *this;
}
//***************************************************************************
/// Gets the fill character.
//***************************************************************************
typename TString::value_type fill() const
{
return fill_;
}
//***************************************************************************
/// Sets the left justify flag.
/// \return A reference to the format_spec.
//***************************************************************************
format_spec& left_justified(const bool l)
{
left_justified_ = l;
return *this;
}
//***************************************************************************
/// Gets the left justify flag.
//***************************************************************************
bool left_justified() const
{
return left_justified_;
}
private:
uint_least8_t base_;
uint_least8_t width_;
bool upper_case_;
bool left_justified_;
typename TString::value_type fill_;
};
typedef etl::basic_format_spec<etl::istring> format_spec;
}
#endif

View File

@ -36,7 +36,7 @@ SOFTWARE.
#include "../platform.h"
#include "../absolute.h"
#include "../negative.h"
#include "../format_spec.h"
#include "../basic_format_spec.h"
#include "../type_traits.h"
#include "../stl/algorithm.h"
@ -51,7 +51,7 @@ namespace etl
typename etl::enable_if<etl::is_integral<T>::value, TIString&>::type
to_string_helper(T value,
TIString& str,
const etl::format_spec<TIString>& format,
const etl::basic_format_spec<TIString>& format,
const bool append)
{
typedef typename TIString::value_type type;

View File

@ -28,8 +28,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_TO_U32STRING_INCLUDED
#define ETL_TO_U32STRING_INCLUDED
#ifndef ETL_TO_STRING_INCLUDED
#define ETL_TO_STRING_INCLUDED
///\ingroup string
@ -50,7 +50,7 @@ namespace etl
!etl::is_same<T, int64_t>::value, const etl::istring&>::type
to_string(const T value, etl::istring& str, const bool append = false)
{
etl::format_spec<etl::istring> format;
etl::format_spec format;
return to_string_helper(int32_t(value), str, format, append);
}
@ -62,7 +62,7 @@ namespace etl
typename etl::enable_if<etl::is_integral<T>::value &&
etl::is_signed<T>::value &&
!etl::is_same<T, int64_t>::value, const etl::istring&>::type
to_string(const T value, etl::istring& str, const etl::format_spec<etl::istring>& format, const bool append = false)
to_string(const T value, etl::istring& str, const etl::format_spec& format, const bool append = false)
{
return to_string_helper(int32_t(value), str, format, append);
}
@ -76,7 +76,7 @@ namespace etl
!etl::is_same<T, uint64_t>::value, const etl::istring&>::type
to_string(const T value, etl::istring& str, const bool append = false)
{
etl::format_spec<etl::istring> format;
etl::format_spec format;
return to_string_helper(uint32_t(value), str, format, append);
}
@ -88,7 +88,7 @@ namespace etl
typename etl::enable_if<etl::is_integral<T>::value &&
etl::is_unsigned<T>::value &&
!etl::is_same<T, uint64_t>::value, const etl::istring&>::type
to_string(const T value, etl::istring& str, const etl::format_spec<etl::istring>& format, const bool append = false)
to_string(const T value, etl::istring& str, const etl::format_spec& format, const bool append = false)
{
return to_string_helper(uint32_t(value), str, format, append);
}
@ -102,7 +102,7 @@ namespace etl
etl::is_same<T, int64_t>::value, const etl::istring&>::type
to_string(const T value, etl::istring& str, const bool append = false)
{
etl::format_spec<etl::istring> format;
etl::format_spec format;
return to_string_helper(int64_t(value), str, format, append);
}
@ -114,7 +114,7 @@ namespace etl
typename etl::enable_if<etl::is_integral<T>::value &&
etl::is_signed<T>::value &&
etl::is_same<T, int64_t>::value, const etl::istring&>::type
to_string(const T value, etl::istring& str, const etl::format_spec<etl::istring>& format, const bool append = false)
to_string(const T value, etl::istring& str, const etl::format_spec& format, const bool append = false)
{
return to_string_helper(int64_t(value), str, format, append);
}
@ -128,7 +128,7 @@ namespace etl
etl::is_same<T, uint64_t>::value, const etl::istring&>::type
to_string(const T value, etl::istring& str, const bool append = false)
{
etl::format_spec<etl::istring> format;
etl::format_spec format;
return to_string_helper(uint64_t(value), str, format, append);
}
@ -140,7 +140,7 @@ namespace etl
typename etl::enable_if<etl::is_integral<T>::value &&
etl::is_unsigned<T>::value &&
etl::is_same<T, uint64_t>::value, const etl::istring&>::type
to_string(const T value, etl::istring& str, const etl::format_spec<etl::istring>& format, const bool append = false)
to_string(const T value, etl::istring& str, const etl::format_spec& format, const bool append = false)
{
return to_string_helper(uint64_t(value), str, format, append);
}

View File

@ -36,7 +36,7 @@ SOFTWARE.
#include "platform.h"
#include "type_traits.h"
#include "u16string.h"
#include "format_spec.h"
#include "u16format_spec.h"
#include "private/to_string_helper.h"
namespace etl
@ -50,7 +50,7 @@ namespace etl
!etl::is_same<T, int64_t>::value, etl::iu16string&>::type
to_u16string(const T value, etl::iu16string& str, const bool append = false)
{
etl::format_spec<etl::iu16string> format;
etl::u16format_spec format;
return to_string_helper(int32_t(value), str, format, append);
}
@ -62,7 +62,7 @@ namespace etl
typename etl::enable_if<etl::is_integral<T>::value &&
etl::is_signed<T>::value &&
!etl::is_same<T, int64_t>::value, etl::iu16string&>::type
to_u16string(const T value, etl::iu16string& str, const etl::format_spec<etl::iu16string>& format, const bool append = false)
to_u16string(const T value, etl::iu16string& str, const etl::u16format_spec& format, const bool append = false)
{
return to_string_helper(int32_t(value), str, format, append);
}
@ -76,7 +76,7 @@ namespace etl
!etl::is_same<T, uint64_t>::value, etl::iu16string&>::type
to_u16string(const T value, etl::iu16string& str, const bool append = false)
{
etl::format_spec<etl::iu16string> format;
etl::u16format_spec format;
return to_string_helper(uint32_t(value), str, format, append);
}
@ -88,7 +88,7 @@ namespace etl
typename etl::enable_if<etl::is_integral<T>::value &&
etl::is_unsigned<T>::value &&
!etl::is_same<T, uint64_t>::value, etl::iu16string&>::type
to_u16string(const T value, etl::iu16string& str, const etl::format_spec<etl::iu16string>& format, const bool append = false)
to_u16string(const T value, etl::iu16string& str, const etl::u16format_spec& format, const bool append = false)
{
return to_string_helper(uint32_t(value), str, format, append);
}
@ -102,7 +102,7 @@ namespace etl
etl::is_same<T, int64_t>::value, etl::iu16string&>::type
to_u16string(const T value, etl::iu16string& str, const bool append = false)
{
etl::format_spec<etl::iu16string> format;
etl::u16format_spec format;
return to_string_helper(int64_t(value), str, format, append);
}
@ -114,7 +114,7 @@ namespace etl
typename etl::enable_if<etl::is_integral<T>::value &&
etl::is_signed<T>::value &&
etl::is_same<T, int64_t>::value, etl::iu16string&>::type
to_u16string(const T value, etl::iu16string& str, const etl::format_spec<etl::iu16string>& format, const bool append = false)
to_u16string(const T value, etl::iu16string& str, const etl::u16format_spec& format, const bool append = false)
{
return to_string_helper(int64_t(value), str, format, append);
}
@ -128,7 +128,7 @@ namespace etl
etl::is_same<T, uint64_t>::value, etl::iu16string&>::type
to_u16string(const T value, etl::iu16string& str, const bool append = false)
{
etl::format_spec<etl::iu16string> format;
etl::u16format_spec format;
return to_string_helper(uint64_t(value), str, format, append);
}
@ -140,7 +140,7 @@ namespace etl
typename etl::enable_if<etl::is_integral<T>::value &&
etl::is_unsigned<T>::value &&
etl::is_same<T, uint64_t>::value, etl::iu16string&>::type
to_u16string(const T value, etl::iu16string& str, const etl::format_spec<etl::iu16string>& format, const bool append = false)
to_u16string(const T value, etl::iu16string& str, const etl::u16format_spec& format, const bool append = false)
{
return to_string_helper(uint64_t(value), str, format, append);
}

View File

@ -36,7 +36,7 @@ SOFTWARE.
#include "platform.h"
#include "type_traits.h"
#include "u32string.h"
#include "format_spec.h"
#include "u32format_spec.h"
#include "private/to_string_helper.h"
namespace etl
@ -50,7 +50,7 @@ namespace etl
!etl::is_same<T, int64_t>::value, etl::iu32string&>::type
to_u32string(const T value, etl::iu32string& str, const bool append = false)
{
etl::format_spec<etl::iu32string> format;
etl::u32format_spec format;
return to_string_helper(int32_t(value), str, format, append);
}
@ -62,7 +62,7 @@ namespace etl
typename etl::enable_if<etl::is_integral<T>::value &&
etl::is_signed<T>::value &&
!etl::is_same<T, int64_t>::value, etl::iu32string&>::type
to_u32string(const T value, etl::iu32string& str, const etl::format_spec<etl::iu32string>& format, const bool append = false)
to_u32string(const T value, etl::iu32string& str, const etl::u32format_spec& format, const bool append = false)
{
return to_string_helper(int32_t(value), str, format, append);
}
@ -76,7 +76,7 @@ namespace etl
!etl::is_same<T, uint64_t>::value, etl::iu32string&>::type
to_u32string(const T value, etl::iu32string& str, const bool append = false)
{
etl::format_spec<etl::iu32string> format;
etl::u32format_spec format;
return to_string_helper(uint32_t(value), str, format, append);
}
@ -88,7 +88,7 @@ namespace etl
typename etl::enable_if<etl::is_integral<T>::value &&
etl::is_unsigned<T>::value &&
!etl::is_same<T, uint64_t>::value, etl::iu32string&>::type
to_u32string(const T value, etl::iu32string& str, const etl::format_spec<etl::iu32string>& format, const bool append = false)
to_u32string(const T value, etl::iu32string& str, const etl::u32format_spec& format, const bool append = false)
{
return to_string_helper(uint32_t(value), str, format, append);
}
@ -102,7 +102,7 @@ namespace etl
etl::is_same<T, int64_t>::value, etl::iu32string&>::type
to_u32string(const T value, etl::iu32string& str, const bool append = false)
{
etl::format_spec<etl::iu32string> format;
etl::u32format_spec format;
return to_string_helper(int64_t(value), str, format, append);
}
@ -114,7 +114,7 @@ namespace etl
typename etl::enable_if<etl::is_integral<T>::value &&
etl::is_signed<T>::value &&
etl::is_same<T, int64_t>::value, etl::iu32string&>::type
to_u32string(const T value, etl::iu32string& str, const etl::format_spec<etl::iu32string>& format, const bool append = false)
to_u32string(const T value, etl::iu32string& str, const etl::u32format_spec& format, const bool append = false)
{
return to_string_helper(int64_t(value), str, format, append);
}
@ -128,7 +128,7 @@ namespace etl
etl::is_same<T, uint64_t>::value, etl::iu32string&>::type
to_u32string(const T value, etl::iu32string& str, const bool append = false)
{
etl::format_spec<etl::iu32string> format;
etl::u32format_spec format;
return to_string_helper(uint64_t(value), str, format, append);
}
@ -140,7 +140,7 @@ namespace etl
typename etl::enable_if<etl::is_integral<T>::value &&
etl::is_unsigned<T>::value &&
etl::is_same<T, uint64_t>::value, etl::iu32string&>::type
to_u32string(const T value, etl::iu32string& str, const etl::format_spec<etl::iu32string>& format, const bool append = false)
to_u32string(const T value, etl::iu32string& str, const etl::u32format_spec& format, const bool append = false)
{
return to_string_helper(uint64_t(value), str, format, append);
}

View File

@ -36,7 +36,7 @@ SOFTWARE.
#include "platform.h"
#include "type_traits.h"
#include "wstring.h"
#include "format_spec.h"
#include "wformat_spec.h"
#include "private/to_string_helper.h"
namespace etl
@ -50,7 +50,7 @@ namespace etl
!etl::is_same<T, int64_t>::value, etl::iwstring&>::type
to_wstring(const T value, etl::iwstring& str, const bool append = false)
{
etl::format_spec<etl::iwstring> format;
etl::wformat_spec format;
return to_string_helper(int32_t(value), str, format, append);
}
@ -62,7 +62,7 @@ namespace etl
typename etl::enable_if<etl::is_integral<T>::value &&
etl::is_signed<T>::value &&
!etl::is_same<T, int64_t>::value, etl::iwstring&>::type
to_wstring(const T value, etl::iwstring& str, const etl::format_spec<etl::iwstring>& format, const bool append = false)
to_wstring(const T value, etl::iwstring& str, const etl::wformat_spec& format, const bool append = false)
{
return to_string_helper(int32_t(value), str, format, append);
}
@ -76,7 +76,7 @@ namespace etl
!etl::is_same<T, uint64_t>::value, etl::iwstring&>::type
to_wstring(const T value, etl::iwstring& str, const bool append = false)
{
etl::format_spec<etl::iwstring> format;
etl::wformat_spec format;
return to_string_helper(uint32_t(value), str, format, append);
}
@ -88,7 +88,7 @@ namespace etl
typename etl::enable_if<etl::is_integral<T>::value &&
etl::is_unsigned<T>::value &&
!etl::is_same<T, uint64_t>::value, etl::iwstring&>::type
to_wstring(const T value, etl::iwstring& str, const etl::format_spec<etl::iwstring>& format, const bool append = false)
to_wstring(const T value, etl::iwstring& str, const etl::wformat_spec& format, const bool append = false)
{
return to_string_helper(uint32_t(value), str, format, append);
}
@ -102,7 +102,7 @@ namespace etl
etl::is_same<T, int64_t>::value, etl::iwstring&>::type
to_wstring(const T value, etl::iwstring& str, const bool append = false)
{
etl::format_spec<etl::iwstring> format;
etl::wformat_spec format;
return to_string_helper(int64_t(value), str, format, append);
}
@ -114,7 +114,7 @@ namespace etl
typename etl::enable_if<etl::is_integral<T>::value &&
etl::is_signed<T>::value &&
etl::is_same<T, int64_t>::value, etl::iwstring&>::type
to_wstring(const T value, etl::iwstring& str, const etl::format_spec<etl::iwstring>& format, const bool append = false)
to_wstring(const T value, etl::iwstring& str, const etl::wformat_spec& format, const bool append = false)
{
return to_string_helper(int64_t(value), str, format, append);
}
@ -128,7 +128,7 @@ namespace etl
etl::is_same<T, uint64_t>::value, etl::iwstring&>::type
to_wstring(const T value, etl::iwstring& str, const bool append = false)
{
etl::format_spec<etl::iwstring> format;
etl::wformat_spec format;
return to_string_helper(uint64_t(value), str, format, append);
}
@ -140,7 +140,7 @@ namespace etl
typename etl::enable_if<etl::is_integral<T>::value &&
etl::is_unsigned<T>::value &&
etl::is_same<T, uint64_t>::value, etl::iwstring&>::type
to_wstring(const T value, etl::iwstring& str, const etl::format_spec<etl::iwstring>& format, const bool append = false)
to_wstring(const T value, etl::iwstring& str, const etl::wformat_spec& format, const bool append = false)
{
return to_string_helper(uint64_t(value), str, format, append);
}

View File

@ -0,0 +1,45 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2019 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_U16FORMAT_SPEC_INCLUDED
#define ETL_U16FORMAT_SPEC_INCLUDED
///\ingroup string
#include "platform.h"
#include "basic_format_spec.h"
#include "u16string.h"
namespace etl
{
typedef etl::basic_format_spec<etl::iu16string> u16format_spec;
}
#endif

View File

@ -0,0 +1,45 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2019 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_U32FORMAT_SPEC_INCLUDED
#define ETL_U32FORMAT_SPEC_INCLUDED
///\ingroup string
#include "platform.h"
#include "basic_format_spec.h"
#include "u32string.h"
namespace etl
{
typedef etl::basic_format_spec<etl::iu32string> u32format_spec;
}
#endif

View File

@ -39,7 +39,7 @@ SOFTWARE.
#define ETL_VERSION_MAJOR 14
#define ETL_VERSION_MINOR 18
#define ETL_VERSION_PATCH 0
#define ETL_VERSION_PATCH 1
#define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) ETL_STRINGIFY(ETL_VERSION_MINOR) ETL_STRINGIFY(ETL_VERSION_PATCH)
#define ETL_VERSION_W ETL_WIDE_STRING(ETL_CONCAT(ETL_CONCAT(ETL_VERSION_MAJOR, ETL_VERSION_MINOR), ETL_VERSION_PATCH))

View File

@ -0,0 +1,45 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2019 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_WFORMAT_SPEC_INCLUDED
#define ETL_WFORMAT_SPEC_INCLUDED
///\ingroup string
#include "platform.h"
#include "basic_format_spec.h"
#include "wstring.h"
namespace etl
{
typedef etl::basic_format_spec<etl::iwstring> wformat_spec;
}
#endif

View File

@ -1,3 +1,8 @@
===============================================================================
14.18.1
Changed etl::format_sepc template to etl::basic_firmat_spec.
Created individual format_spec typedefs for each string type.
===============================================================================
14.18.0
Added etl::to_string, etl::to_wstring, etl::to_u16string and etl::to_u32string

View File

@ -154,6 +154,7 @@
<Unit filename="../../include/etl/atomic/atomic_arm.h" />
<Unit filename="../../include/etl/atomic/atomic_gcc_sync.h" />
<Unit filename="../../include/etl/atomic/atomic_std.h" />
<Unit filename="../../include/etl/basic_format_spec.h" />
<Unit filename="../../include/etl/basic_string.h" />
<Unit filename="../../include/etl/binary.h" />
<Unit filename="../../include/etl/bit_stream.h" />
@ -309,7 +310,9 @@
<Unit filename="../../include/etl/type_select.h" />
<Unit filename="../../include/etl/type_traits.h" />
<Unit filename="../../include/etl/type_traits_generator.h" />
<Unit filename="../../include/etl/u16format_spec.h" />
<Unit filename="../../include/etl/u16string.h" />
<Unit filename="../../include/etl/u32format_spec.h" />
<Unit filename="../../include/etl/u32string.h" />
<Unit filename="../../include/etl/unordered_map.h" />
<Unit filename="../../include/etl/unordered_multimap.h" />
@ -323,6 +326,7 @@
<Unit filename="../../include/etl/vector.h" />
<Unit filename="../../include/etl/version.h" />
<Unit filename="../../include/etl/visitor.h" />
<Unit filename="../../include/etl/wformat_spec.h" />
<Unit filename="../../include/etl/wstring.h" />
<Unit filename="../../src/c/ecl_timer.c">
<Option compilerVar="CC" />

View File

@ -39,7 +39,7 @@ SOFTWARE.
namespace
{
typedef etl::format_spec<etl::istring> Format;
typedef etl::format_spec Format;
std::ostream& operator << (std::ostream& os, const etl::istring& str)
{

View File

@ -39,7 +39,7 @@ SOFTWARE.
namespace
{
typedef etl::format_spec<etl::iu16string> Format;
typedef etl::u16format_spec Format;
std::ostream& operator << (std::ostream& os, const etl::iu16string& str)
{

View File

@ -39,7 +39,7 @@ SOFTWARE.
namespace
{
typedef etl::format_spec<etl::iu32string> Format;
typedef etl::u32format_spec Format;
std::ostream& operator << (std::ostream& os, const etl::iu32string& str)
{

View File

@ -39,7 +39,7 @@ SOFTWARE.
namespace
{
typedef etl::format_spec<etl::iwstring> Format;
typedef etl::wformat_spec Format;
std::ostream& operator << (std::ostream& os, const etl::iwstring& str)
{

View File

@ -362,6 +362,7 @@
<ClInclude Include="..\..\include\etl\atomic\atomic_gcc_sync.h" />
<ClInclude Include="..\..\include\etl\atomic\atomic_llvm_sync.h" />
<ClInclude Include="..\..\include\etl\atomic\atomic_std.h" />
<ClInclude Include="..\..\include\etl\basic_format_spec.h" />
<ClInclude Include="..\..\include\etl\bit_stream.h" />
<ClInclude Include="..\..\include\etl\callback_timer.h" />
<ClInclude Include="..\..\include\etl\combinations.h" />
@ -446,6 +447,8 @@
<ClInclude Include="..\..\include\etl\type_select.h" />
<ClInclude Include="..\..\include\etl\type_select_generator.h" />
<ClInclude Include="..\..\include\etl\type_traits_generator.h" />
<ClInclude Include="..\..\include\etl\u16format_spec.h" />
<ClInclude Include="..\..\include\etl\u32format_spec.h" />
<ClInclude Include="..\..\include\etl\variant_pool.h" />
<ClInclude Include="..\..\include\etl\variant_pool_generator.h" />
<ClInclude Include="..\..\include\etl\version.h" />
@ -541,6 +544,7 @@
<ClInclude Include="..\..\include\etl\variant.h" />
<ClInclude Include="..\..\include\etl\vector.h" />
<ClInclude Include="..\..\include\etl\visitor.h" />
<ClInclude Include="..\..\include\etl\wformat_spec.h" />
<ClInclude Include="..\..\include\etl\wstring.h" />
<ClInclude Include="..\data.h" />
<ClInclude Include="..\ecl_user.h" />

View File

@ -753,6 +753,18 @@
<ClInclude Include="..\..\include\etl\private\to_string_helper.h">
<Filter>ETL\Private</Filter>
</ClInclude>
<ClInclude Include="..\..\include\etl\basic_format_spec.h">
<Filter>ETL\Utilities</Filter>
</ClInclude>
<ClInclude Include="..\..\include\etl\u16format_spec.h">
<Filter>ETL\Utilities</Filter>
</ClInclude>
<ClInclude Include="..\..\include\etl\u32format_spec.h">
<Filter>ETL\Utilities</Filter>
</ClInclude>
<ClInclude Include="..\..\include\etl\wformat_spec.h">
<Filter>ETL\Utilities</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\main.cpp">