diff --git a/include/etl/basic_format_spec.h b/include/etl/basic_format_spec.h new file mode 100644 index 00000000..38d48b48 --- /dev/null +++ b/include/etl/basic_format_spec.h @@ -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 + 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(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(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 diff --git a/include/etl/format_spec.h b/include/etl/format_spec.h index 238bc721..27cbcaa0 100644 --- a/include/etl/format_spec.h +++ b/include/etl/format_spec.h @@ -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 - 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(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(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 format_spec; } #endif diff --git a/include/etl/private/to_string_helper.h b/include/etl/private/to_string_helper.h index a384e1ec..ce4dfd50 100644 --- a/include/etl/private/to_string_helper.h +++ b/include/etl/private/to_string_helper.h @@ -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::value, TIString&>::type to_string_helper(T value, TIString& str, - const etl::format_spec& format, + const etl::basic_format_spec& format, const bool append) { typedef typename TIString::value_type type; diff --git a/include/etl/to_string.h b/include/etl/to_string.h index 51f1991b..058ac099 100644 --- a/include/etl/to_string.h +++ b/include/etl/to_string.h @@ -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::value, const etl::istring&>::type to_string(const T value, etl::istring& str, const bool append = false) { - etl::format_spec 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::value && etl::is_signed::value && !etl::is_same::value, const etl::istring&>::type - to_string(const T value, etl::istring& str, const etl::format_spec& 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::value, const etl::istring&>::type to_string(const T value, etl::istring& str, const bool append = false) { - etl::format_spec 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::value && etl::is_unsigned::value && !etl::is_same::value, const etl::istring&>::type - to_string(const T value, etl::istring& str, const etl::format_spec& 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::value, const etl::istring&>::type to_string(const T value, etl::istring& str, const bool append = false) { - etl::format_spec 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::value && etl::is_signed::value && etl::is_same::value, const etl::istring&>::type - to_string(const T value, etl::istring& str, const etl::format_spec& 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::value, const etl::istring&>::type to_string(const T value, etl::istring& str, const bool append = false) { - etl::format_spec 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::value && etl::is_unsigned::value && etl::is_same::value, const etl::istring&>::type - to_string(const T value, etl::istring& str, const etl::format_spec& 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); } diff --git a/include/etl/to_u16string.h b/include/etl/to_u16string.h index 09a5ce0f..46bfbb59 100644 --- a/include/etl/to_u16string.h +++ b/include/etl/to_u16string.h @@ -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::value, etl::iu16string&>::type to_u16string(const T value, etl::iu16string& str, const bool append = false) { - etl::format_spec 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::value && etl::is_signed::value && !etl::is_same::value, etl::iu16string&>::type - to_u16string(const T value, etl::iu16string& str, const etl::format_spec& 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::value, etl::iu16string&>::type to_u16string(const T value, etl::iu16string& str, const bool append = false) { - etl::format_spec 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::value && etl::is_unsigned::value && !etl::is_same::value, etl::iu16string&>::type - to_u16string(const T value, etl::iu16string& str, const etl::format_spec& 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::value, etl::iu16string&>::type to_u16string(const T value, etl::iu16string& str, const bool append = false) { - etl::format_spec 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::value && etl::is_signed::value && etl::is_same::value, etl::iu16string&>::type - to_u16string(const T value, etl::iu16string& str, const etl::format_spec& 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::value, etl::iu16string&>::type to_u16string(const T value, etl::iu16string& str, const bool append = false) { - etl::format_spec 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::value && etl::is_unsigned::value && etl::is_same::value, etl::iu16string&>::type - to_u16string(const T value, etl::iu16string& str, const etl::format_spec& 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); } diff --git a/include/etl/to_u32string.h b/include/etl/to_u32string.h index 9eaf6110..6caa403c 100644 --- a/include/etl/to_u32string.h +++ b/include/etl/to_u32string.h @@ -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::value, etl::iu32string&>::type to_u32string(const T value, etl::iu32string& str, const bool append = false) { - etl::format_spec 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::value && etl::is_signed::value && !etl::is_same::value, etl::iu32string&>::type - to_u32string(const T value, etl::iu32string& str, const etl::format_spec& 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::value, etl::iu32string&>::type to_u32string(const T value, etl::iu32string& str, const bool append = false) { - etl::format_spec 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::value && etl::is_unsigned::value && !etl::is_same::value, etl::iu32string&>::type - to_u32string(const T value, etl::iu32string& str, const etl::format_spec& 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::value, etl::iu32string&>::type to_u32string(const T value, etl::iu32string& str, const bool append = false) { - etl::format_spec 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::value && etl::is_signed::value && etl::is_same::value, etl::iu32string&>::type - to_u32string(const T value, etl::iu32string& str, const etl::format_spec& 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::value, etl::iu32string&>::type to_u32string(const T value, etl::iu32string& str, const bool append = false) { - etl::format_spec 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::value && etl::is_unsigned::value && etl::is_same::value, etl::iu32string&>::type - to_u32string(const T value, etl::iu32string& str, const etl::format_spec& 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); } diff --git a/include/etl/to_wstring.h b/include/etl/to_wstring.h index ff55b483..9bd39944 100644 --- a/include/etl/to_wstring.h +++ b/include/etl/to_wstring.h @@ -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::value, etl::iwstring&>::type to_wstring(const T value, etl::iwstring& str, const bool append = false) { - etl::format_spec 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::value && etl::is_signed::value && !etl::is_same::value, etl::iwstring&>::type - to_wstring(const T value, etl::iwstring& str, const etl::format_spec& 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::value, etl::iwstring&>::type to_wstring(const T value, etl::iwstring& str, const bool append = false) { - etl::format_spec 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::value && etl::is_unsigned::value && !etl::is_same::value, etl::iwstring&>::type - to_wstring(const T value, etl::iwstring& str, const etl::format_spec& 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::value, etl::iwstring&>::type to_wstring(const T value, etl::iwstring& str, const bool append = false) { - etl::format_spec 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::value && etl::is_signed::value && etl::is_same::value, etl::iwstring&>::type - to_wstring(const T value, etl::iwstring& str, const etl::format_spec& 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::value, etl::iwstring&>::type to_wstring(const T value, etl::iwstring& str, const bool append = false) { - etl::format_spec 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::value && etl::is_unsigned::value && etl::is_same::value, etl::iwstring&>::type - to_wstring(const T value, etl::iwstring& str, const etl::format_spec& 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); } diff --git a/include/etl/u16format_spec.h b/include/etl/u16format_spec.h new file mode 100644 index 00000000..39c523ca --- /dev/null +++ b/include/etl/u16format_spec.h @@ -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 u16format_spec; +} + +#endif diff --git a/include/etl/u32format_spec.h b/include/etl/u32format_spec.h new file mode 100644 index 00000000..2a9d34b8 --- /dev/null +++ b/include/etl/u32format_spec.h @@ -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 u32format_spec; +} + +#endif diff --git a/include/etl/version.h b/include/etl/version.h index 073313ad..c1d96ebd 100644 --- a/include/etl/version.h +++ b/include/etl/version.h @@ -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)) diff --git a/include/etl/wformat_spec.h b/include/etl/wformat_spec.h new file mode 100644 index 00000000..0ff2d57e --- /dev/null +++ b/include/etl/wformat_spec.h @@ -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 wformat_spec; +} + +#endif diff --git a/support/Release notes.txt b/support/Release notes.txt index 60355b97..e43c898e 100644 --- a/support/Release notes.txt +++ b/support/Release notes.txt @@ -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 diff --git a/test/codeblocks/ETL.cbp b/test/codeblocks/ETL.cbp index 8cd1b63a..a7041a42 100644 --- a/test/codeblocks/ETL.cbp +++ b/test/codeblocks/ETL.cbp @@ -154,6 +154,7 @@ + @@ -309,7 +310,9 @@ + + @@ -323,6 +326,7 @@ +