Browse Source

Update contrib/restricted/boost/locale to 1.83.0

robot-contrib 1 year ago
parent
commit
b4f93a19b7

+ 39 - 0
contrib/restricted/boost/io/include/boost/io/detail/buffer_fill.hpp

@@ -0,0 +1,39 @@
+/*
+Copyright 2019-2020 Glen Joseph Fernandes
+(glenjofe@gmail.com)
+
+Distributed under the Boost Software License, Version 1.0.
+(http://www.boost.org/LICENSE_1_0.txt)
+*/
+#ifndef BOOST_IO_DETAIL_BUFFER_FILL_HPP
+#define BOOST_IO_DETAIL_BUFFER_FILL_HPP
+
+#include <iosfwd>
+#include <cstddef>
+
+namespace boost {
+namespace io {
+namespace detail {
+
+template<class charT, class traits>
+inline bool
+buffer_fill(std::basic_streambuf<charT, traits>& buf, charT ch,
+    std::size_t size)
+{
+    charT fill[] = { ch, ch, ch, ch, ch, ch, ch, ch };
+    enum {
+        chunk = sizeof fill / sizeof(charT)
+    };
+    for (; size > chunk; size -= chunk) {
+        if (static_cast<std::size_t>(buf.sputn(fill, chunk)) != chunk) {
+            return false;
+        }
+    }
+    return static_cast<std::size_t>(buf.sputn(fill, size)) == size;
+}
+
+} /* detail */
+} /* io */
+} /* boost */
+
+#endif

+ 45 - 0
contrib/restricted/boost/io/include/boost/io/detail/ostream_guard.hpp

@@ -0,0 +1,45 @@
+/*
+Copyright 2019-2020 Glen Joseph Fernandes
+(glenjofe@gmail.com)
+
+Distributed under the Boost Software License, Version 1.0.
+(http://www.boost.org/LICENSE_1_0.txt)
+*/
+#ifndef BOOST_IO_DETAIL_OSTREAM_GUARD_HPP
+#define BOOST_IO_DETAIL_OSTREAM_GUARD_HPP
+
+#include <boost/config.hpp>
+#include <iosfwd>
+
+namespace boost {
+namespace io {
+namespace detail {
+
+template<class Char, class Traits>
+class ostream_guard {
+public:
+    explicit ostream_guard(std::basic_ostream<Char, Traits>& os) BOOST_NOEXCEPT
+        : os_(&os) { }
+
+    ~ostream_guard() BOOST_NOEXCEPT_IF(false) {
+        if (os_) {
+            os_->setstate(std::basic_ostream<Char, Traits>::badbit);
+        }
+    }
+
+    void release() BOOST_NOEXCEPT {
+        os_ = 0;
+    }
+
+private:
+    ostream_guard(const ostream_guard&);
+    ostream_guard& operator=(const ostream_guard&);
+
+    std::basic_ostream<Char, Traits>* os_;
+};
+
+} /* detail */
+} /* io */
+} /* boost */
+
+#endif

+ 50 - 0
contrib/restricted/boost/io/include/boost/io/ostream_put.hpp

@@ -0,0 +1,50 @@
+/*
+Copyright 2019 Glen Joseph Fernandes
+(glenjofe@gmail.com)
+
+Distributed under the Boost Software License, Version 1.0.
+(http://www.boost.org/LICENSE_1_0.txt)
+*/
+#ifndef BOOST_IO_OSTREAM_PUT_HPP
+#define BOOST_IO_OSTREAM_PUT_HPP
+
+#include <boost/io/detail/buffer_fill.hpp>
+#include <boost/io/detail/ostream_guard.hpp>
+
+namespace boost {
+namespace io {
+
+template<class charT, class traits>
+inline std::basic_ostream<charT, traits>&
+ostream_put(std::basic_ostream<charT, traits>& os, const charT* data,
+    std::size_t size)
+{
+    typedef std::basic_ostream<charT, traits> stream;
+    detail::ostream_guard<charT, traits> guard(os);
+    typename stream::sentry entry(os);
+    if (entry) {
+        std::basic_streambuf<charT, traits>& buf = *os.rdbuf();
+        std::size_t width = static_cast<std::size_t>(os.width());
+        if (width <= size) {
+            if (static_cast<std::size_t>(buf.sputn(data, size)) != size) {
+                return os;
+            }
+        } else if ((os.flags() & stream::adjustfield) == stream::left) {
+            if (static_cast<std::size_t>(buf.sputn(data, size)) != size ||
+                !detail::buffer_fill(buf, os.fill(), width - size)) {
+                return os;
+            }
+        } else if (!detail::buffer_fill(buf, os.fill(), width - size) ||
+            static_cast<std::size_t>(buf.sputn(data, size)) != size) {
+            return os;
+        }
+        os.width(0);
+    }
+    guard.release();
+    return os;
+}
+
+} /* io */
+} /* boost */
+
+#endif

+ 1 - 0
contrib/restricted/boost/locale/CMakeLists.darwin-x86_64.txt

@@ -28,6 +28,7 @@ target_link_libraries(restricted-boost-locale PUBLIC
   restricted-boost-iterator
   restricted-boost-predef
   restricted-boost-thread
+  restricted-boost-utility
 )
 target_sources(restricted-boost-locale PRIVATE
   ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/posix/codecvt.cpp

+ 1 - 0
contrib/restricted/boost/locale/CMakeLists.linux-aarch64.txt

@@ -29,6 +29,7 @@ target_link_libraries(restricted-boost-locale PUBLIC
   restricted-boost-iterator
   restricted-boost-predef
   restricted-boost-thread
+  restricted-boost-utility
 )
 target_sources(restricted-boost-locale PRIVATE
   ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/posix/codecvt.cpp

+ 1 - 0
contrib/restricted/boost/locale/CMakeLists.linux-x86_64.txt

@@ -29,6 +29,7 @@ target_link_libraries(restricted-boost-locale PUBLIC
   restricted-boost-iterator
   restricted-boost-predef
   restricted-boost-thread
+  restricted-boost-utility
 )
 target_sources(restricted-boost-locale PRIVATE
   ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/posix/codecvt.cpp

+ 1 - 0
contrib/restricted/boost/locale/CMakeLists.windows-x86_64.txt

@@ -28,6 +28,7 @@ target_link_libraries(restricted-boost-locale PUBLIC
   restricted-boost-iterator
   restricted-boost-predef
   restricted-boost-thread
+  restricted-boost-utility
 )
 target_sources(restricted-boost-locale PRIVATE
   ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/win32/collate.cpp

+ 3 - 3
contrib/restricted/boost/locale/README.md

@@ -5,7 +5,7 @@ Part of the [Boost C++ Libraries](http://github.com/boostorg).
 Boost.Locale is a library that provides high quality localization facilities in a C++ way.
 It was originally designed a part of [CppCMS](http://cppcms.sourceforge.net/) - a C++ Web Framework project and then contributed to Boost.
 
-Boost.Locale gives powerful tools for development of cross platform localized software - the software that talks to users in their language.
+Boost.Locale gives powerful tools for development of cross-platform localized software - the software that talks to users in their language.
 
 Provided Features:
 
@@ -21,7 +21,7 @@ Provided Features:
 - Support for `char` and `wchar_t`
 - Experimental support for C++11 `char16_t` and `char32_t` strings and streams.
 
-Boost.Locale enhances and unifies the standard library's API the way it becomes useful and convenient for development of cross platform and "cross-culture" software.
+Boost.Locale enhances and unifies the standard library's API the way it becomes useful and convenient for development of cross-platform and "cross-culture" software.
 
 In order to achieve this goal Boost.Locale uses the-state-of-the-art Unicode and Localization library: ICU - International Components for Unicode.
 
@@ -38,7 +38,7 @@ Distributed under the [Boost Software License, Version 1.0](https://www.boost.or
 ### Properties
 
 * C++11
-* Formatted with clang-format, see [`tools/format_source.sh`](https://github.com/boostorg/locale/blob/develop/tools/format_source.sh)
+* Formatted with clang-format, see [`tools/format_sources.sh`](https://github.com/boostorg/locale/blob/develop/tools/format_sources.sh)
 
 ### Build Status
 

+ 1 - 0
contrib/restricted/boost/locale/include/boost/locale.hpp

@@ -21,5 +21,6 @@
 #include <boost/locale/localization_backend.hpp>
 #include <boost/locale/message.hpp>
 #include <boost/locale/util.hpp>
+#include <boost/locale/util/locale_data.hpp>
 
 #endif

+ 8 - 56
contrib/restricted/boost/locale/include/boost/locale/boundary/facets.hpp

@@ -8,6 +8,8 @@
 #define BOOST_LOCALE_BOUNDARY_FACETS_HPP_INCLUDED
 
 #include <boost/locale/boundary/types.hpp>
+#include <boost/locale/detail/facet_id.hpp>
+#include <boost/locale/detail/is_supported_char.hpp>
 #include <locale>
 #include <vector>
 
@@ -49,16 +51,14 @@ namespace boost { namespace locale {
         /// with marks
         typedef std::vector<break_info> index_type;
 
-        template<typename CharType>
-        class boundary_indexing;
-
-#ifdef BOOST_LOCALE_DOXYGEN
-        /// \brief This facet generates an index for boundary analysis
-        /// for a given text.
+        /// \brief This facet generates an index for boundary analysis of a given text.
         ///
-        /// It is specialized for 4 types of characters \c char_t, \c wchar_t, \c char16_t and \c char32_t
+        /// It is implemented for supported character types, at least \c char, \c wchar_t
         template<typename Char>
-        class BOOST_LOCALE_DECL boundary_indexing : public std::locale::facet {
+        class BOOST_SYMBOL_VISIBLE boundary_indexing : public std::locale::facet,
+                                                       public boost::locale::detail::facet_id<boundary_indexing<Char>> {
+            BOOST_LOCALE_ASSERT_IS_SUPPORTED(Char);
+
         public:
             /// Default constructor typical for facets
             boundary_indexing(size_t refs = 0) : std::locale::facet(refs) {}
@@ -69,56 +69,8 @@ namespace boost { namespace locale {
             /// index is never empty, even if the range [begin,end) is empty it consists
             /// of at least one boundary point with the offset 0.
             virtual index_type map(boundary_type t, const Char* begin, const Char* end) const = 0;
-
-            /// Identification of this facet
-            static std::locale::id id;
-        };
-
-#else
-
-        template<>
-        class BOOST_LOCALE_DECL boundary_indexing<char> : public std::locale::facet {
-        public:
-            boundary_indexing(size_t refs = 0) : std::locale::facet(refs) {}
-            ~boundary_indexing();
-            virtual index_type map(boundary_type t, const char* begin, const char* end) const = 0;
-            static std::locale::id id;
         };
 
-        template<>
-        class BOOST_LOCALE_DECL boundary_indexing<wchar_t> : public std::locale::facet {
-        public:
-            boundary_indexing(size_t refs = 0) : std::locale::facet(refs) {}
-            ~boundary_indexing();
-            virtual index_type map(boundary_type t, const wchar_t* begin, const wchar_t* end) const = 0;
-
-            static std::locale::id id;
-        };
-
-#    ifdef BOOST_LOCALE_ENABLE_CHAR16_T
-        template<>
-        class BOOST_LOCALE_DECL boundary_indexing<char16_t> : public std::locale::facet {
-        public:
-            boundary_indexing(size_t refs = 0) : std::locale::facet(refs) {}
-            ~boundary_indexing();
-            virtual index_type map(boundary_type t, const char16_t* begin, const char16_t* end) const = 0;
-            static std::locale::id id;
-        };
-#    endif
-
-#    ifdef BOOST_LOCALE_ENABLE_CHAR32_T
-        template<>
-        class BOOST_LOCALE_DECL boundary_indexing<char32_t> : public std::locale::facet {
-        public:
-            boundary_indexing(size_t refs = 0) : std::locale::facet(refs) {}
-            ~boundary_indexing();
-            virtual index_type map(boundary_type t, const char32_t* begin, const char32_t* end) const = 0;
-            static std::locale::id id;
-        };
-#    endif
-
-#endif
-
         /// @}
     } // namespace boundary
 

Some files were not shown because too many files changed in this diff