diff --git a/CMakeLists.txt b/CMakeLists.txt index 500d794..c0b4e69 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright 2020, 2021 Peter Dimov -# Copyright 2022-2024 Alexander Grund +# Copyright 2022-2025 Alexander Grund # Distributed under the Boost Software License, Version 1.0. # https://www.boost.org/LICENSE_1_0.txt @@ -51,7 +51,6 @@ target_link_libraries(boost_locale Boost::config Boost::core Boost::iterator - Boost::utility PRIVATE Boost::charconv Boost::predef diff --git a/build.jam b/build.jam index 573ca20..a9b6ec7 100644 --- a/build.jam +++ b/build.jam @@ -1,4 +1,5 @@ # Copyright René Ferdinand Rivera Morell 2023-2024 +# Copyright(c) 2025 Alexander Grund # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) @@ -20,7 +21,7 @@ constant boost_dependencies : /boost/config//boost_config /boost/core//boost_core /boost/iterator//boost_iterator - /boost/utility//boost_utility ; + ; project /boost/locale : common-requirements diff --git a/include/boost/locale/detail/any_string.hpp b/include/boost/locale/detail/any_string.hpp index c0cc7ff..473d07e 100644 --- a/include/boost/locale/detail/any_string.hpp +++ b/include/boost/locale/detail/any_string.hpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2023 Alexander Grund +// Copyright (c) 2023-2025 Alexander Grund // // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include #include @@ -31,7 +31,7 @@ namespace boost { namespace locale { namespace detail { }; template struct BOOST_SYMBOL_VISIBLE impl : base { - explicit impl(const boost::basic_string_view value) : s(value) {} + explicit impl(const core::basic_string_view value) : s(value) {} impl* clone() const override { return new impl(*this); } std::basic_string s; }; @@ -49,7 +49,7 @@ namespace boost { namespace locale { namespace detail { } template - void set(const boost::basic_string_view s) + void set(const core::basic_string_view s) { BOOST_ASSERT(!s.empty()); s_.reset(new impl(s)); diff --git a/include/boost/locale/detail/encoding.hpp b/include/boost/locale/detail/encoding.hpp index 390c4bb..2e37c30 100644 --- a/include/boost/locale/detail/encoding.hpp +++ b/include/boost/locale/detail/encoding.hpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2022-2023 Alexander Grund +// Copyright (c) 2022-2025 Alexander Grund // // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include @@ -24,7 +24,7 @@ namespace boost { namespace locale { namespace conv { namespace detail { virtual ~charset_converter() = default; virtual string_type convert(const CharIn* begin, const CharIn* end) = 0; - string_type convert(const boost::basic_string_view text) + string_type convert(const core::basic_string_view text) { return convert(text.data(), text.data() + text.length()); } diff --git a/include/boost/locale/encoding.hpp b/include/boost/locale/encoding.hpp index 52c8bc4..abc68ba 100644 --- a/include/boost/locale/encoding.hpp +++ b/include/boost/locale/encoding.hpp @@ -1,5 +1,6 @@ // // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) +// Copyright (c) 2025 Alexander Grund // // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt @@ -240,11 +241,11 @@ namespace boost { namespace locale { /// Convert \a text to UTF /// /// \throws conversion_error: Conversion failed - string_type convert(const boost::string_view text) const { return impl_->convert(text); } + string_type convert(const core::string_view text) const { return impl_->convert(text); } /// Convert \a text to UTF /// /// \throws conversion_error: Conversion failed - string_type operator()(const boost::string_view text) const { return convert(text); } + string_type operator()(const core::string_view text) const { return convert(text); } }; /// Converter class to decode an UTF string and encode it using a local encoding @@ -254,7 +255,7 @@ namespace boost { namespace locale { public: using char_type = CharType; - using stringview_type = boost::basic_string_view; + using stringview_type = core::basic_string_view; /// Create an instance to convert UTF text to text encoded with \a charset according to policy \a how /// @@ -298,11 +299,11 @@ namespace boost { namespace locale { /// Convert \a text /// /// \throws conversion_error: Conversion failed - std::string convert(const boost::string_view text) const { return impl_->convert(text); } + std::string convert(const core::string_view text) const { return impl_->convert(text); } /// Convert \a text /// /// \throws conversion_error: Conversion failed - std::string operator()(const boost::string_view text) const { return convert(text); } + std::string operator()(const core::string_view text) const { return convert(text); } }; } // namespace conv }} // namespace boost::locale diff --git a/src/shared/message.cpp b/src/shared/message.cpp index 27aaa67..88cee09 100644 --- a/src/shared/message.cpp +++ b/src/shared/message.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2009-2015 Artyom Beilis (Tonkikh) -// Copyright (c) 2021-2023 Alexander Grund +// Copyright (c) 2021-2025 Alexander Grund // // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt @@ -26,7 +26,7 @@ #include "mo_hash.hpp" #include "mo_lambda.hpp" #include -#include +#include #include #include #include @@ -141,7 +141,7 @@ namespace boost { namespace locale { namespace gnu_gettext { hash_offset_ = get(24); } - string_view find(const char* context_in, const char* key_in) const + core::string_view find(const char* context_in, const char* key_in) const { if(!has_hash()) return {}; @@ -192,13 +192,13 @@ namespace boost { namespace locale { namespace gnu_gettext { return data_.data() + off; } - string_view value(unsigned id) const + core::string_view value(unsigned id) const { const uint32_t len = get(translations_offset_ + id * 8); const uint32_t off = get(translations_offset_ + id * 8 + 4); if(len > data_.size() || off > data_.size() - len) throw std::runtime_error("Bad mo-file format"); - return string_view(&data_[off], len); + return core::string_view(&data_[off], len); } bool has_hash() const { return hash_size_ != 0; } @@ -233,7 +233,7 @@ namespace boost { namespace locale { namespace gnu_gettext { template struct mo_file_use_traits { static constexpr bool in_use = false; - using string_view_type = basic_string_view; + using string_view_type = core::basic_string_view; static string_view_type use(const mo_file&, const CharType*, const CharType*) { throw std::logic_error("Unexpected call"); // LCOV_EXCL_LINE @@ -243,7 +243,7 @@ namespace boost { namespace locale { namespace gnu_gettext { template<> struct mo_file_use_traits { static constexpr bool in_use = true; - using string_view_type = basic_string_view; + using string_view_type = core::basic_string_view; static string_view_type use(const mo_file& mo, const char* context, const char* key) { return mo.find(context, key); @@ -254,10 +254,10 @@ namespace boost { namespace locale { namespace gnu_gettext { template<> struct mo_file_use_traits { static constexpr bool in_use = true; - using string_view_type = basic_string_view; + using string_view_type = core::basic_string_view; static string_view_type use(const mo_file& mo, const char8_t* context, const char8_t* key) { - string_view res = mo.find(reinterpret_cast(context), reinterpret_cast(key)); + core::string_view res = mo.find(reinterpret_cast(context), reinterpret_cast(key)); return {reinterpret_cast(res.data()), res.size()}; } }; @@ -551,10 +551,10 @@ namespace boost { namespace locale { namespace gnu_gettext { return true; } - static std::string extract(boost::string_view meta, const std::string& key, const boost::string_view separators) + static std::string extract(core::string_view meta, const std::string& key, const core::string_view separators) { const size_t pos = meta.find(key); - if(pos == boost::string_view::npos) + if(pos == core::string_view::npos) return ""; meta.remove_prefix(pos + key.size()); const size_t end_pos = meta.find_first_of(separators); diff --git a/src/util/encoding.cpp b/src/util/encoding.cpp index 18b658f..8b893f1 100644 --- a/src/util/encoding.cpp +++ b/src/util/encoding.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// Copyright (c) 2022-2023 Alexander Grund +// Copyright (c) 2022-2025 Alexander Grund // // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt @@ -18,7 +18,7 @@ #include namespace boost { namespace locale { namespace util { - std::string normalize_encoding(const string_view encoding) + std::string normalize_encoding(const core::string_view encoding) { std::string result; result.reserve(encoding.length()); @@ -51,7 +51,7 @@ namespace boost { namespace locale { namespace util { return -1; } - int encoding_to_windows_codepage(const string_view encoding) + int encoding_to_windows_codepage(const core::string_view encoding) { return normalized_encoding_to_windows_codepage(normalize_encoding(encoding)); } diff --git a/src/util/encoding.hpp b/src/util/encoding.hpp index 0f4c3b5..2f73d49 100644 --- a/src/util/encoding.hpp +++ b/src/util/encoding.hpp @@ -1,6 +1,6 @@ // // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// Copyright (c) 2022-2023 Alexander Grund +// Copyright (c) 2022-2025 Alexander Grund // // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt @@ -9,7 +9,7 @@ #define BOOST_LOCALE_UTIL_ENCODING_HPP #include -#include +#include #include #include #include @@ -48,7 +48,7 @@ namespace boost { namespace locale { namespace util { #endif /// Make encoding lowercase and remove all non-alphanumeric characters - BOOST_LOCALE_DECL std::string normalize_encoding(string_view encoding); + BOOST_LOCALE_DECL std::string normalize_encoding(core::string_view encoding); /// True if the normalized encodings are equal inline bool are_encodings_equal(const std::string& l, const std::string& r) { @@ -58,10 +58,10 @@ namespace boost { namespace locale { namespace util { BOOST_LOCALE_DECL std::vector get_simple_encodings(); #if BOOST_LOCALE_USE_WIN32_API - int encoding_to_windows_codepage(string_view encoding); + int encoding_to_windows_codepage(core::string_view encoding); #else // Requires WinAPI -> Dummy returning invalid - inline int encoding_to_windows_codepage(string_view) // LCOV_EXCL_LINE + inline int encoding_to_windows_codepage(core::string_view) // LCOV_EXCL_LINE { return -1; // LCOV_EXCL_LINE } diff --git a/src/util/numeric_conversion.hpp b/src/util/numeric_conversion.hpp index f4de06c..3efc50f 100644 --- a/src/util/numeric_conversion.hpp +++ b/src/util/numeric_conversion.hpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2024 Alexander Grund +// Copyright (c) 2024-2025 Alexander Grund // // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt @@ -9,12 +9,12 @@ #include #include -#include +#include namespace boost { namespace locale { namespace util { template - bool try_to_int(string_view s, Integer& value) + bool try_to_int(core::string_view s, Integer& value) { if(s.size() >= 2 && s[0] == '+') { if(s[1] == '-') // "+-" is not allowed, invalid "+" is detected by parser