diff options
author | thegeorg <thegeorg@yandex-team.com> | 2022-09-14 00:50:10 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2022-09-14 00:50:10 +0300 |
commit | 0a2f138bbe6e773a6f3b4f083989e68309254d19 (patch) | |
tree | da5fcb35f465ff68237d675d9e500069db24cd5c | |
parent | 2ac0967dd34bc7d5d1d8127c91b92da7e7f44dc5 (diff) | |
download | ydb-0a2f138bbe6e773a6f3b4f083989e68309254d19.tar.gz |
Update contrib/restricted/boost/locale to 1.80.0
98 files changed, 2548 insertions, 2613 deletions
diff --git a/contrib/restricted/boost/locale/CMakeLists.txt b/contrib/restricted/boost/locale/CMakeLists.txt index 383dde4989..dd9fea7203 100644 --- a/contrib/restricted/boost/locale/CMakeLists.txt +++ b/contrib/restricted/boost/locale/CMakeLists.txt @@ -16,6 +16,9 @@ target_compile_options(restricted-boost-locale PRIVATE target_include_directories(restricted-boost-locale PUBLIC ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/include ) +target_include_directories(restricted-boost-locale PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src +) target_link_libraries(restricted-boost-locale PUBLIC contrib-libs-cxxsupp contrib-libs-icu @@ -29,37 +32,37 @@ target_link_libraries(restricted-boost-locale PUBLIC restricted-boost-type_traits ) target_sources(restricted-boost-locale PRIVATE - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/posix/codecvt.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/posix/collate.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/posix/converter.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/posix/numeric.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/posix/posix_backend.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/encoding/codepage.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/icu/boundary.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/icu/codecvt.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/icu/collator.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/icu/conversion.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/icu/date_time.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/icu/formatter.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/icu/icu_backend.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/icu/numeric.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/icu/time_zone.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/shared/date_time.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/shared/format.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/shared/formatting.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/shared/generator.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/shared/ids.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/shared/localization_backend.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/shared/message.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/shared/mo_lambda.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/std/codecvt.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/std/collate.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/std/converter.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/std/numeric.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/std/std_backend.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/util/codecvt_converter.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/util/default_locale.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/util/gregorian.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/util/info.cpp - ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/util/locale_data.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/posix/codecvt.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/posix/collate.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/posix/converter.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/posix/numeric.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/posix/posix_backend.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/encoding/codepage.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/icu/boundary.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/icu/codecvt.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/icu/collator.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/icu/conversion.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/icu/date_time.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/icu/formatter.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/icu/icu_backend.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/icu/numeric.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/icu/time_zone.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/shared/date_time.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/shared/format.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/shared/formatting.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/shared/generator.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/shared/ids.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/shared/localization_backend.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/shared/message.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/shared/mo_lambda.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/std/codecvt.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/std/collate.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/std/converter.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/std/numeric.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/std/std_backend.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/util/codecvt_converter.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/util/default_locale.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/util/gregorian.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/util/info.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/locale/src/boost/locale/util/locale_data.cpp ) diff --git a/contrib/restricted/boost/locale/LICENSE b/contrib/restricted/boost/locale/LICENSE new file mode 100644 index 0000000000..36b7cd93cd --- /dev/null +++ b/contrib/restricted/boost/locale/LICENSE @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +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, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/contrib/restricted/boost/locale/README.md b/contrib/restricted/boost/locale/README.md new file mode 100644 index 0000000000..b73b3dd82a --- /dev/null +++ b/contrib/restricted/boost/locale/README.md @@ -0,0 +1,64 @@ +# Boost.CI + +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. + +Provided Features: + +- Correct case conversion, case folding and normalization. +- Collation (sorting), including support for 4 Unicode collation levels. +- Date, time, timezone and calendar manipulations, formatting and parsing, including transparent support for calendars other than Gregorian. +- Boundary analysis for characters, words, sentences and line-breaks. +- Number formatting, spelling and parsing. +- Monetary formatting and parsing. +- Powerful message formatting (string translation) including support for plural forms, using GNU catalogs. +- Character set conversion. +- Transparent support for 8-bit character sets like Latin1 +- Support for `char` and `wchar_t` +- Experimental support for C++0x `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. + +In order to achieve this goal Boost.Locale uses the-state-of-the-art Unicode and Localization library: ICU - International Components for Unicode. + +Boost.Locale creates the natural glue between the C++ locales framework, iostreams, and the powerful ICU library. + +Boost.Locale provides non-ICU based localization support as well. +It is based on the operating system native API or on the standard C++ library support. +Sacrificing some less important features, Boost.Locale becomes less powerful but lighter and easier to deploy and use library. + +### License + +Distributed under the [Boost Software License, Version 1.0](https://www.boost.org/LICENSE_1_0.txt). + +### Properties + +* C++03 + +### Build Status + +Branch | GH Actions | Appveyor | codecov.io | Deps | Docs | Tests | +:-------------: | ---------- | -------- | ---------- | ---- | ---- | ----- | +[`master`](https://github.com/boostorg/locale/tree/master) | [![CI](https://github.com/boostorg/locale/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/locale/actions/workflows/ci.yml) | [![Build status](https://ci.appveyor.com/api/projects/status/github/boostorg/locale?branch=master&svg=true)](https://ci.appveyor.com/project/Flamefire/locale/branch/master) | [![codecov](https://codecov.io/gh/boostorg/locale/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/locale/branch/master) | [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/locale.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](https://www.boost.org/doc/libs/master/libs/locale/doc/html/index.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/locale.html) +[`develop`](https://github.com/boostorg/locale/tree/develop) | [![CI](https://github.com/boostorg/locale/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/locale/actions/workflows/ci.yml) | [![Build status](https://ci.appveyor.com/api/projects/status/github/boostorg/locale?branch=develop&svg=true)](https://ci.appveyor.com/project/Flamefire/locale/branch/develop) | [![codecov](https://codecov.io/gh/boostorg/locale/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/locale/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/locale.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](https://www.boost.org/doc/libs/develop/libs/locale/doc/html/index.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/locale.html) + +### Directories + +| Name | Purpose | +| ----------- | ------------------------------ | +| `doc` | Documentation | +| `examples` | Examples | +| `include` | Headers | +| `src` | Source files | +| `test` | Unit tests | + +### More information + +* [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-locale) +* [Report bugs](https://github.com/boostorg/locale/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well. +* Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](https://www.boost.org/LICENSE_1_0.txt). +* Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[locale]` tag at the beginning of the subject line. diff --git a/contrib/restricted/boost/locale/include/boost/locale.hpp b/contrib/restricted/boost/locale/include/boost/locale.hpp index 989bba6c8a..1840bf5163 100644 --- a/contrib/restricted/boost/locale/include/boost/locale.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale.hpp @@ -1,10 +1,9 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_HPP_INCLUDED #define BOOST_LOCALE_HPP_INCLUDED @@ -24,4 +23,3 @@ #include <boost/locale/util.hpp> #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/boundary.hpp b/contrib/restricted/boost/locale/include/boost/locale/boundary.hpp index 57af2651e3..d767d173d4 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/boundary.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/boundary.hpp @@ -1,10 +1,9 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_BOUNDARY_HPP_INCLUDED #define BOOST_LOCALE_BOUNDARY_HPP_INCLUDED @@ -15,4 +14,3 @@ #include <boost/locale/boundary/index.hpp> #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/boundary/boundary_point.hpp b/contrib/restricted/boost/locale/include/boost/locale/boundary/boundary_point.hpp index 3c72dba662..306a8f6e3b 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/boundary/boundary_point.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/boundary/boundary_point.hpp @@ -1,10 +1,9 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_BOUNDARY_BOUNDARY_POINT_HPP_INCLUDED #define BOOST_LOCALE_BOUNDARY_BOUNDARY_POINT_HPP_INCLUDED @@ -19,13 +18,13 @@ namespace boundary { /// @{ /// - /// \brief This class represents a boundary point in the text. + /// \brief This class represents a boundary point in the text. /// - /// It represents a pair - an iterator and a rule that defines this + /// It represents a pair - an iterator and a rule that defines this /// point. /// /// This type of object is dereference by the iterators of boundary_point_index. Using a rule() - /// member function you can get the reason why this specific boundary point was selected. + /// member function you can get the reason why this specific boundary point was selected. /// /// For example, When you use a sentence boundary analysis, the (rule() & \ref sentence_term) != 0 means /// that this boundary point was selected because a sentence terminator (like .?!) was spotted @@ -56,7 +55,7 @@ namespace boundary { /// Empty default constructor /// boundary_point() : rule_(0) {} - + /// /// Create a new boundary_point using iterator \p and a rule \a r /// @@ -82,7 +81,7 @@ namespace boundary { /// /// Fetch an iterator /// - iterator_type iterator() const + iterator_type iterator() const { return iterator_; } @@ -133,7 +132,7 @@ namespace boundary { private: iterator_type iterator_; rule_type rule_; - + }; /// /// Check if the boundary point \a r points to same location as an iterator \a l @@ -153,7 +152,7 @@ namespace boundary { } /// @} - + typedef boundary_point<std::string::const_iterator> sboundary_point; ///< convenience typedef typedef boundary_point<std::wstring::const_iterator> wsboundary_point; ///< convenience typedef #ifdef BOOST_LOCALE_ENABLE_CHAR16_T @@ -162,7 +161,7 @@ namespace boundary { #ifdef BOOST_LOCALE_ENABLE_CHAR32_T typedef boundary_point<std::u32string::const_iterator> u32sboundary_point;///< convenience typedef #endif - + typedef boundary_point<char const *> cboundary_point; ///< convenience typedef typedef boundary_point<wchar_t const *> wcboundary_point; ///< convenience typedef #ifdef BOOST_LOCALE_ENABLE_CHAR16_T @@ -171,7 +170,7 @@ namespace boundary { #ifdef BOOST_LOCALE_ENABLE_CHAR32_T typedef boundary_point<char32_t const *> u32cboundary_point; ///< convenience typedef #endif - + } // boundary } // locale @@ -180,4 +179,3 @@ namespace boundary { #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/boundary/facets.hpp b/contrib/restricted/boost/locale/include/boost/locale/boundary/facets.hpp index 26c01e7d0d..1c9c891276 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/boundary/facets.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/boundary/facets.hpp @@ -1,31 +1,27 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_BOUNDARY_FACETS_HPP_INCLUDED #define BOOST_LOCALE_BOUNDARY_FACETS_HPP_INCLUDED -#include <boost/locale/config.hpp> #include <boost/locale/boundary/types.hpp> +#include <locale> +#include <vector> + #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4275 4251 4231 4660) #endif -#include <locale> -#include <vector> - - - namespace boost { namespace locale { - + /// - /// \brief This namespae contains all operations required for boundary analysis of text + /// \brief This namespace contains all operations required for boundary analysis of text /// namespace boundary { /// @@ -34,7 +30,7 @@ namespace boost { /// @{ /// - + /// /// \brief This structure is used for representing boundary point /// that follows the offset. @@ -44,7 +40,7 @@ namespace boost { /// /// Create empty break point at beginning /// - break_info() : + break_info() : offset(0), rule(0) { @@ -60,15 +56,15 @@ namespace boost { } /// - /// Offset from the beggining of the text where a break occurs. + /// Offset from the beginning of the text where a break occurs. /// size_t offset; /// - /// The identification of this break point according to + /// The identification of this break point according to /// various break types /// rule_type rule; - + /// /// Compare two break points' offset. Allows to search with /// standard algorithms over the index. @@ -78,7 +74,7 @@ namespace boost { return offset < other.offset; } }; - + /// /// This type holds the analysis of the text - all its break points /// with marks @@ -117,7 +113,7 @@ namespace boost { /// Identification of this facet /// static std::locale::id id; - + #if defined (__SUNPRO_CC) && defined (_RWSTD_VER) std::locale::id& __get_id (void) const { return id; } #endif @@ -131,19 +127,21 @@ namespace boost { boundary_indexing(size_t refs=0) : std::locale::facet(refs) { } + ~boundary_indexing(); virtual index_type map(boundary_type t,char const *begin,char const *end) const = 0; static std::locale::id id; #if defined (__SUNPRO_CC) && defined (_RWSTD_VER) std::locale::id& __get_id (void) const { return id; } #endif }; - + 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,wchar_t const *begin,wchar_t const *end) const = 0; static std::locale::id id; @@ -151,7 +149,7 @@ namespace boost { std::locale::id& __get_id (void) const { return id; } #endif }; - + #ifdef BOOST_LOCALE_ENABLE_CHAR16_T template<> class BOOST_LOCALE_DECL boundary_indexing<char16_t> : public std::locale::facet { @@ -159,6 +157,7 @@ namespace boost { boundary_indexing(size_t refs=0) : std::locale::facet(refs) { } + ~boundary_indexing(); virtual index_type map(boundary_type t,char16_t const *begin,char16_t const *end) const = 0; static std::locale::id id; #if defined (__SUNPRO_CC) && defined (_RWSTD_VER) @@ -166,7 +165,7 @@ namespace boost { #endif }; #endif - + #ifdef BOOST_LOCALE_ENABLE_CHAR32_T template<> class BOOST_LOCALE_DECL boundary_indexing<char32_t> : public std::locale::facet { @@ -174,6 +173,7 @@ namespace boost { boundary_indexing(size_t refs=0) : std::locale::facet(refs) { } + ~boundary_indexing(); virtual index_type map(boundary_type t,char32_t const *begin,char32_t const *end) const = 0; static std::locale::id id; #if defined (__SUNPRO_CC) && defined (_RWSTD_VER) @@ -200,4 +200,3 @@ namespace boost { #endif #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/boundary/index.hpp b/contrib/restricted/boost/locale/include/boost/locale/boundary/index.hpp index 8870c9bcfc..dab4673d57 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/boundary/index.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/boundary/index.hpp @@ -1,40 +1,38 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_BOUNDARY_INDEX_HPP_INCLUDED #define BOOST_LOCALE_BOUNDARY_INDEX_HPP_INCLUDED -#include <boost/locale/config.hpp> #include <boost/locale/boundary/types.hpp> #include <boost/locale/boundary/facets.hpp> #include <boost/locale/boundary/segment.hpp> #include <boost/locale/boundary/boundary_point.hpp> +#include <boost/assert.hpp> +#include <boost/cstdint.hpp> #include <boost/iterator/iterator_facade.hpp> -#include <boost/type_traits/is_same.hpp> #include <boost/shared_ptr.hpp> -#include <boost/cstdint.hpp> -#include <boost/assert.hpp> +#include <boost/type_traits/is_same.hpp> +#include <algorithm> +#include <iostream> +#include <iterator> +#include <locale> +#include <stdexcept> +#include <string> +#include <vector> + #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4275 4251 4231 4660) #endif -#include <string> -#include <locale> -#include <vector> -#include <iterator> -#include <algorithm> -#include <stdexcept> - -#include <iostream> namespace boost { namespace locale { - + namespace boundary { /// /// \defgroup boundary Boundary Analysis @@ -88,7 +86,7 @@ namespace boost { // // C++0x requires that string is continious in memory and all known // string implementations - // do this because of c_str() support. + // do this because of c_str() support. // if(linear_iterator_traits<char_type,IteratorType>::is_linear && b!=e) @@ -117,8 +115,8 @@ namespace boost { mapping(boundary_type type, base_iterator begin, base_iterator end, - std::locale const &loc) - : + std::locale const &loc) + : index_(new index_type()), begin_(begin), end_(end) @@ -152,7 +150,7 @@ namespace boost { }; template<typename BaseIterator> - class segment_index_iterator : + class segment_index_iterator : public boost::iterator_facade< segment_index_iterator<BaseIterator>, segment<BaseIterator>, @@ -164,7 +162,7 @@ namespace boost { typedef BaseIterator base_iterator; typedef mapping<base_iterator> mapping_type; typedef segment<base_iterator> segment_type; - + segment_index_iterator() : current_(0,0),map_(0) { } @@ -267,13 +265,13 @@ namespace boost { { size_t dist=std::distance(map_->begin(),p); index_type::const_iterator b=map_->index().begin(),e=map_->index().end(); - index_type::const_iterator + index_type::const_iterator boundary_point=std::upper_bound(b,e,break_info(dist)); while(boundary_point != e && (boundary_point->rule & mask_)==0) boundary_point++; current_.first = current_.second = boundary_point - b; - + if(full_select_) { while(current_.first > 0) { current_.first --; @@ -318,31 +316,31 @@ namespace boost { bool valid_offset(size_t offset) const { - return offset == 0 + return offset == 0 || offset == size() // make sure we not acess index[size] || (index()[offset].rule & mask_)!=0; } - + size_t size() const { return index().size(); } - + index_type const &index() const { return map_->index(); } - - + + segment_type value_; std::pair<size_t,size_t> current_; mapping_type const *map_; rule_type mask_; bool full_select_; }; - + template<typename BaseIterator> - class boundary_point_index_iterator : + class boundary_point_index_iterator : public boost::iterator_facade< boundary_point_index_iterator<BaseIterator>, boundary_point<BaseIterator>, @@ -354,7 +352,7 @@ namespace boost { typedef BaseIterator base_iterator; typedef mapping<base_iterator> mapping_type; typedef boundary_point<base_iterator> boundary_point_type; - + boundary_point_index_iterator() : current_(0),map_(0) { } @@ -466,22 +464,22 @@ namespace boost { bool valid_offset(size_t offset) const { - return offset == 0 + return offset == 0 || offset + 1 >= size() // last and first are always valid regardless of mark || (index()[offset].rule & mask_)!=0; } - + size_t size() const { return index().size(); } - + index_type const &index() const { return map_->index(); } - - + + boundary_point_type value_; size_t current_; mapping_type const *map_; @@ -498,10 +496,10 @@ namespace boost { template<typename BaseIterator> class boundary_point_index; - + /// - /// \brief This class holds an index of segments in the text range and allows to iterate over them + /// \brief This class holds an index of segments in the text range and allows to iterate over them /// /// This class is provides \ref begin() and \ref end() member functions that return bidirectional iterators /// to the \ref segment objects. @@ -512,7 +510,7 @@ namespace boost { /// various masks %as \ref word_any. /// \n /// The default is to select any types of boundaries. - /// \n + /// \n /// For example: using word %boundary analysis, when the provided mask is \ref word_kana then the iterators /// would iterate only over the words containing Kana letters and \ref word_any would select all types of /// words excluding ranges that consist of white space and punctuation marks. So iterating over the text @@ -533,7 +531,7 @@ namespace boost { /// terminator "!" or "?". But changing \ref full_select() to true, the selected segment would include /// all the text up to previous valid %boundary point and would return two expected sentences: /// "Hello!" and "How\nare you?". - /// + /// /// This class allows to find a segment according to the given iterator in range using \ref find() member /// function. /// @@ -555,7 +553,7 @@ namespace boost { template<typename BaseIterator> class segment_index { public: - + /// /// The type of the iterator used to iterate over the original text /// @@ -572,7 +570,7 @@ namespace boost { /// segment_index<some_iterator>::iterator p=index.begin(); /// segment<some_iterator> &t = *p; /// ++p; - /// cout << t.str() << endl; + /// std::cout << t.str() << std::endl; /// \endcode /// typedef unspecified_iterator_type iterator; @@ -591,7 +589,7 @@ namespace boost { typedef segment<base_iterator> value_type; /// - /// Default constructor. + /// Default constructor. /// /// \note /// @@ -610,7 +608,7 @@ namespace boost { base_iterator begin, base_iterator end, rule_type mask, - std::locale const &loc=std::locale()) + std::locale const &loc=std::locale()) : map_(type,begin,end,loc), mask_(mask), @@ -624,7 +622,7 @@ namespace boost { segment_index(boundary_type type, base_iterator begin, base_iterator end, - std::locale const &loc=std::locale()) + std::locale const &loc=std::locale()) : map_(type,begin,end,loc), mask_(0xFFFFFFFFu), @@ -655,7 +653,7 @@ namespace boost { /// segment_index const &operator = (boundary_point_index<base_iterator> const &); - + /// /// Create a new index for %boundary analysis \ref boundary_type "type" of the text /// in range [begin,end) for locale \a loc. @@ -694,7 +692,7 @@ namespace boost { } /// - /// Find a first valid segment following a position \a p. + /// Find a first valid segment following a position \a p. /// /// If \a p is inside a valid segment this segment is selected: /// @@ -704,7 +702,7 @@ namespace boost { /// - "t|o be or ", would point to "to", /// - "to be or| ", would point to end. /// - /// + /// /// Preconditions: the segment_index should have a mapping and \a p should be valid iterator /// to the text in the mapped range. /// @@ -714,17 +712,17 @@ namespace boost { { return iterator(p,&map_,mask_,full_select_); } - + /// /// Get the mask of rules that are used - /// + /// rule_type rule() const { return mask_; } /// /// Set the mask of rules that are used - /// + /// void rule(rule_type v) { mask_ = v; @@ -743,7 +741,7 @@ namespace boost { /// following part "are you?" /// - bool full_select() const + bool full_select() const { return full_select_; } @@ -761,11 +759,11 @@ namespace boost { /// following part "are you?" /// - void full_select(bool v) + void full_select(bool v) { full_select_ = v; } - + private: friend class boundary_point_index<base_iterator>; typedef details::mapping<base_iterator> mapping_type; @@ -793,14 +791,14 @@ namespace boost { /// - "Hello! How\n|are you?" /// - "Hello! How\nare you?|" /// - /// However if \ref rule() is set to \ref sentence_term then the selected %boundary points would be: + /// However if \ref rule() is set to \ref sentence_term then the selected %boundary points would be: /// /// - "|Hello! How\nare you?" /// - "Hello! |How\nare you?" /// - "Hello! How\nare you?|" - /// + /// /// Such that a %boundary point defined by a line feed character would be ignored. - /// + /// /// This class allows to find a boundary_point according to the given iterator in range using \ref find() member /// function. /// @@ -858,9 +856,9 @@ namespace boost { /// an object that represents the selected \ref boundary_point "boundary point". /// typedef boundary_point<base_iterator> value_type; - + /// - /// Default constructor. + /// Default constructor. /// /// \note /// @@ -871,7 +869,7 @@ namespace boost { boundary_point_index() : mask_(0xFFFFFFFFu) { } - + /// /// Create a segment_index for %boundary analysis \ref boundary_type "type" of the text /// in range [begin,end) using a rule \a mask for locale \a loc. @@ -880,7 +878,7 @@ namespace boost { base_iterator begin, base_iterator end, rule_type mask, - std::locale const &loc=std::locale()) + std::locale const &loc=std::locale()) : map_(type,begin,end,loc), mask_(mask) @@ -893,7 +891,7 @@ namespace boost { boundary_point_index(boundary_type type, base_iterator begin, base_iterator end, - std::locale const &loc=std::locale()) + std::locale const &loc=std::locale()) : map_(type,begin,end,loc), mask_(0xFFFFFFFFu) @@ -969,7 +967,7 @@ namespace boost { /// /// - "|to be", would return %boundary point at "|to be", /// - "t|o be", would point to "to| be" - /// + /// /// Preconditions: the boundary_point_index should have a mapping and \a p should be valid iterator /// to the text in the mapped range. /// @@ -979,17 +977,17 @@ namespace boost { { return iterator(p,&map_,mask_); } - + /// /// Get the mask of rules that are used - /// + /// rule_type rule() const { return mask_; } /// /// Set the mask of rules that are used - /// + /// void rule(rule_type v) { mask_ = v; @@ -1002,8 +1000,8 @@ namespace boost { mapping_type map_; rule_type mask_; }; - - /// \cond INTERNAL + + /// \cond INTERNAL template<typename BaseIterator> segment_index<BaseIterator>::segment_index(boundary_point_index<BaseIterator> const &other) : map_(other.map_), @@ -1011,7 +1009,7 @@ namespace boost { full_select_(false) { } - + template<typename BaseIterator> boundary_point_index<BaseIterator>::boundary_point_index(segment_index<BaseIterator> const &other) : map_(other.map_), @@ -1025,7 +1023,7 @@ namespace boost { map_ = other.map_; return *this; } - + template<typename BaseIterator> boundary_point_index<BaseIterator> const &boundary_point_index<BaseIterator>::operator=(segment_index<BaseIterator> const &other) { @@ -1033,7 +1031,7 @@ namespace boost { return *this; } /// \endcond - + typedef segment_index<std::string::const_iterator> ssegment_index; ///< convenience typedef typedef segment_index<std::wstring::const_iterator> wssegment_index; ///< convenience typedef #ifdef BOOST_LOCALE_ENABLE_CHAR16_T @@ -1042,7 +1040,7 @@ namespace boost { #ifdef BOOST_LOCALE_ENABLE_CHAR32_T typedef segment_index<std::u32string::const_iterator> u32ssegment_index;///< convenience typedef #endif - + typedef segment_index<char const *> csegment_index; ///< convenience typedef typedef segment_index<wchar_t const *> wcsegment_index; ///< convenience typedef #ifdef BOOST_LOCALE_ENABLE_CHAR16_T @@ -1060,7 +1058,7 @@ namespace boost { #ifdef BOOST_LOCALE_ENABLE_CHAR32_T typedef boundary_point_index<std::u32string::const_iterator> u32sboundary_point_index;///< convenience typedef #endif - + typedef boundary_point_index<char const *> cboundary_point_index; ///< convenience typedef typedef boundary_point_index<wchar_t const *> wcboundary_point_index; ///< convenience typedef #ifdef BOOST_LOCALE_ENABLE_CHAR16_T @@ -1089,4 +1087,3 @@ namespace boost { #endif #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/boundary/segment.hpp b/contrib/restricted/boost/locale/include/boost/locale/boundary/segment.hpp index 516d883d54..6260f59faa 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/boundary/segment.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/boundary/segment.hpp @@ -1,22 +1,22 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_BOUNDARY_SEGMENT_HPP_INCLUDED #define BOOST_LOCALE_BOUNDARY_SEGMENT_HPP_INCLUDED + #include <boost/locale/config.hpp> +#include <iosfwd> +#include <iterator> +#include <locale> +#include <string> + #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4275 4251 4231 4660) #endif -#include <locale> -#include <string> -#include <iosfwd> -#include <iterator> - namespace boost { namespace locale { @@ -53,7 +53,7 @@ namespace boundary { { return compare_text(l.begin(),l.end(),r.begin(),r.end()); } - + template<typename Left,typename Char> int compare_string(Left const &l,Char const *begin) { @@ -95,14 +95,14 @@ namespace boundary { /// \see /// /// - \ref segment_index - /// - \ref boundary_point - /// - \ref boundary_point_index + /// - \ref boundary_point + /// - \ref boundary_point_index /// template<typename IteratorType> class segment : public std::pair<IteratorType,IteratorType> { public: /// - /// The type of the underlying character + /// The type of the underlying character /// typedef typename std::iterator_traits<IteratorType>::value_type char_type; /// @@ -156,7 +156,7 @@ namespace boundary { /// /// Get the start of the range /// - IteratorType begin() const + IteratorType begin() const { return this->first; } @@ -176,7 +176,7 @@ namespace boundary { { return std::basic_string<char_type, T, A>(this->first, this->second); } - + /// /// Create a string from the range explicitly /// @@ -220,135 +220,135 @@ namespace boundary { // make sure we override std::pair's operator== /// Compare two segments - bool operator==(segment const &other) + bool operator==(segment const &other) const { return details::compare_text(*this,other) == 0; } /// Compare two segments - bool operator!=(segment const &other) + bool operator!=(segment const &other) const { return details::compare_text(*this,other) != 0; } private: rule_type rule_; - + }; - + /// Compare two segments template<typename IteratorL,typename IteratorR> bool operator==(segment<IteratorL> const &l,segment<IteratorR> const &r) { - return details::compare_text(l,r) == 0; + return details::compare_text(l,r) == 0; } /// Compare two segments template<typename IteratorL,typename IteratorR> bool operator!=(segment<IteratorL> const &l,segment<IteratorR> const &r) { - return details::compare_text(l,r) != 0; + return details::compare_text(l,r) != 0; } /// Compare two segments template<typename IteratorL,typename IteratorR> bool operator<(segment<IteratorL> const &l,segment<IteratorR> const &r) { - return details::compare_text(l,r) < 0; + return details::compare_text(l,r) < 0; } /// Compare two segments template<typename IteratorL,typename IteratorR> bool operator<=(segment<IteratorL> const &l,segment<IteratorR> const &r) { - return details::compare_text(l,r) <= 0; + return details::compare_text(l,r) <= 0; } /// Compare two segments template<typename IteratorL,typename IteratorR> bool operator>(segment<IteratorL> const &l,segment<IteratorR> const &r) { - return details::compare_text(l,r) > 0; + return details::compare_text(l,r) > 0; } /// Compare two segments template<typename IteratorL,typename IteratorR> bool operator>=(segment<IteratorL> const &l,segment<IteratorR> const &r) { - return details::compare_text(l,r) >= 0; + return details::compare_text(l,r) >= 0; } /// Compare string and segment template<typename CharType,typename Traits,typename Alloc,typename IteratorR> bool operator==(std::basic_string<CharType,Traits,Alloc> const &l,segment<IteratorR> const &r) { - return details::compare_text(l,r) == 0; + return details::compare_text(l,r) == 0; } /// Compare string and segment template<typename CharType,typename Traits,typename Alloc,typename IteratorR> bool operator!=(std::basic_string<CharType,Traits,Alloc> const &l,segment<IteratorR> const &r) { - return details::compare_text(l,r) != 0; + return details::compare_text(l,r) != 0; } /// Compare string and segment template<typename CharType,typename Traits,typename Alloc,typename IteratorR> bool operator<(std::basic_string<CharType,Traits,Alloc> const &l,segment<IteratorR> const &r) { - return details::compare_text(l,r) < 0; + return details::compare_text(l,r) < 0; } /// Compare string and segment template<typename CharType,typename Traits,typename Alloc,typename IteratorR> bool operator<=(std::basic_string<CharType,Traits,Alloc> const &l,segment<IteratorR> const &r) { - return details::compare_text(l,r) <= 0; + return details::compare_text(l,r) <= 0; } /// Compare string and segment template<typename CharType,typename Traits,typename Alloc,typename IteratorR> bool operator>(std::basic_string<CharType,Traits,Alloc> const &l,segment<IteratorR> const &r) { - return details::compare_text(l,r) > 0; + return details::compare_text(l,r) > 0; } /// Compare string and segment template<typename CharType,typename Traits,typename Alloc,typename IteratorR> bool operator>=(std::basic_string<CharType,Traits,Alloc> const &l,segment<IteratorR> const &r) { - return details::compare_text(l,r) >= 0; + return details::compare_text(l,r) >= 0; } /// Compare string and segment template<typename Iterator,typename CharType,typename Traits,typename Alloc> bool operator==(segment<Iterator> const &l,std::basic_string<CharType,Traits,Alloc> const &r) { - return details::compare_text(l,r) == 0; + return details::compare_text(l,r) == 0; } /// Compare string and segment template<typename Iterator,typename CharType,typename Traits,typename Alloc> bool operator!=(segment<Iterator> const &l,std::basic_string<CharType,Traits,Alloc> const &r) { - return details::compare_text(l,r) != 0; + return details::compare_text(l,r) != 0; } /// Compare string and segment template<typename Iterator,typename CharType,typename Traits,typename Alloc> bool operator<(segment<Iterator> const &l,std::basic_string<CharType,Traits,Alloc> const &r) { - return details::compare_text(l,r) < 0; + return details::compare_text(l,r) < 0; } /// Compare string and segment template<typename Iterator,typename CharType,typename Traits,typename Alloc> bool operator<=(segment<Iterator> const &l,std::basic_string<CharType,Traits,Alloc> const &r) { - return details::compare_text(l,r) <= 0; + return details::compare_text(l,r) <= 0; } /// Compare string and segment template<typename Iterator,typename CharType,typename Traits,typename Alloc> bool operator>(segment<Iterator> const &l,std::basic_string<CharType,Traits,Alloc> const &r) { - return details::compare_text(l,r) > 0; + return details::compare_text(l,r) > 0; } /// Compare string and segment template<typename Iterator,typename CharType,typename Traits,typename Alloc> bool operator>=(segment<Iterator> const &l,std::basic_string<CharType,Traits,Alloc> const &r) { - return details::compare_text(l,r) >= 0; + return details::compare_text(l,r) >= 0; } @@ -356,76 +356,76 @@ namespace boundary { template<typename CharType,typename IteratorR> bool operator==(CharType const *l,segment<IteratorR> const &r) { - return details::compare_string(l,r) == 0; + return details::compare_string(l,r) == 0; } /// Compare C string and segment template<typename CharType,typename IteratorR> bool operator!=(CharType const *l,segment<IteratorR> const &r) { - return details::compare_string(l,r) != 0; + return details::compare_string(l,r) != 0; } /// Compare C string and segment template<typename CharType,typename IteratorR> bool operator<(CharType const *l,segment<IteratorR> const &r) { - return details::compare_string(l,r) < 0; + return details::compare_string(l,r) < 0; } /// Compare C string and segment template<typename CharType,typename IteratorR> bool operator<=(CharType const *l,segment<IteratorR> const &r) { - return details::compare_string(l,r) <= 0; + return details::compare_string(l,r) <= 0; } /// Compare C string and segment template<typename CharType,typename IteratorR> bool operator>(CharType const *l,segment<IteratorR> const &r) { - return details::compare_string(l,r) > 0; + return details::compare_string(l,r) > 0; } /// Compare C string and segment template<typename CharType,typename IteratorR> bool operator>=(CharType const *l,segment<IteratorR> const &r) { - return details::compare_string(l,r) >= 0; + return details::compare_string(l,r) >= 0; } /// Compare C string and segment template<typename Iterator,typename CharType> bool operator==(segment<Iterator> const &l,CharType const *r) { - return details::compare_string(l,r) == 0; + return details::compare_string(l,r) == 0; } /// Compare C string and segment template<typename Iterator,typename CharType> bool operator!=(segment<Iterator> const &l,CharType const *r) { - return details::compare_string(l,r) != 0; + return details::compare_string(l,r) != 0; } /// Compare C string and segment template<typename Iterator,typename CharType> bool operator<(segment<Iterator> const &l,CharType const *r) { - return details::compare_string(l,r) < 0; + return details::compare_string(l,r) < 0; } /// Compare C string and segment template<typename Iterator,typename CharType> bool operator<=(segment<Iterator> const &l,CharType const *r) { - return details::compare_string(l,r) <= 0; + return details::compare_string(l,r) <= 0; } /// Compare C string and segment template<typename Iterator,typename CharType> bool operator>(segment<Iterator> const &l,CharType const *r) { - return details::compare_string(l,r) > 0; + return details::compare_string(l,r) > 0; } /// Compare C string and segment template<typename Iterator,typename CharType> bool operator>=(segment<Iterator> const &l,CharType const *r) { - return details::compare_string(l,r) >= 0; + return details::compare_string(l,r) >= 0; } @@ -441,7 +441,7 @@ namespace boundary { #ifdef BOOST_LOCALE_ENABLE_CHAR32_T typedef segment<std::u32string::const_iterator> u32ssegment;///< convenience typedef #endif - + typedef segment<char const *> csegment; ///< convenience typedef typedef segment<wchar_t const *> wcsegment; ///< convenience typedef #ifdef BOOST_LOCALE_ENABLE_CHAR16_T @@ -453,8 +453,8 @@ namespace boundary { - - + + /// /// Write the segment to the stream character by character /// @@ -480,4 +480,3 @@ namespace boundary { #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/boundary/types.hpp b/contrib/restricted/boost/locale/include/boost/locale/boundary/types.hpp index 5ce1eb2c9a..8eeb254769 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/boundary/types.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/boundary/types.hpp @@ -1,26 +1,25 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_BOUNDARY_TYPES_HPP_INCLUDED #define BOOST_LOCALE_BOUNDARY_TYPES_HPP_INCLUDED #include <boost/locale/config.hpp> -#include <boost/cstdint.hpp> #include <boost/assert.hpp> +#include <boost/cstdint.hpp> + #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4275 4251 4231 4660) #endif - namespace boost { namespace locale { - + /// /// \brief This namespase contains all operations required for boundary analysis of text /// @@ -51,13 +50,13 @@ namespace boost { typedef uint32_t rule_type; /// - /// \anchor bl_boundary_word_rules + /// \anchor bl_boundary_word_rules /// \name Flags that describe a type of word selected /// @{ static const rule_type word_none = 0x0000F, ///< Not a word, like white space or punctuation mark word_number = 0x000F0, ///< Word that appear to be a number - word_letter = 0x00F00, ///< Word that contains letters, excluding kana and ideographic characters + word_letter = 0x00F00, ///< Word that contains letters, excluding kana and ideographic characters word_kana = 0x0F000, ///< Word that contains kana characters word_ideo = 0xF0000, ///< Word that contains ideographic characters word_any = 0xFFFF0, ///< Any word including numbers, 0 is special flag, equivalent to 15 @@ -67,24 +66,24 @@ namespace boost { /// @} /// - /// \anchor bl_boundary_line_rules + /// \anchor bl_boundary_line_rules /// \name Flags that describe a type of line break /// @{ - static const rule_type + static const rule_type line_soft = 0x0F, ///< Soft line break: optional but not required line_hard = 0xF0, ///< Hard line break: like break is required (as per CR/LF) line_any = 0xFF, ///< Soft or Hard line break line_mask = 0xFF; ///< Select all types of line breaks - + /// @} - + /// - /// \anchor bl_boundary_sentence_rules + /// \anchor bl_boundary_sentence_rules /// \name Flags that describe a type of sentence break /// /// @{ static const rule_type - sentence_term = 0x0F, ///< \brief The sentence was terminated with a sentence terminator + sentence_term = 0x0F, ///< \brief The sentence was terminated with a sentence terminator /// like ".", "!" possible followed by hard separator like CR, LF, PS sentence_sep = 0xF0, ///< \brief The sentence does not contain terminator like ".", "!" but ended with hard separator /// like CR, LF, PS or end of input. @@ -126,11 +125,10 @@ namespace boost { } // boundary } // locale } // boost - + #ifdef BOOST_MSVC #pragma warning(pop) #endif #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/collator.hpp b/contrib/restricted/boost/locale/include/boost/locale/collator.hpp index 9ac98b9abd..67e6da8c29 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/collator.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/collator.hpp @@ -1,20 +1,19 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_COLLATOR_HPP_INCLUDED #define BOOST_LOCALE_COLLATOR_HPP_INCLUDED #include <boost/locale/config.hpp> +#include <locale> + #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4275 4251 4231 4660) #endif -#include <locale> - namespace boost { namespace locale { @@ -22,7 +21,7 @@ namespace locale { class info; /// - /// \defgroup collation Collation + /// \defgroup collation Collation /// /// This module introduces collation related classes /// @@ -45,15 +44,15 @@ namespace locale { identical = 4 ///< identical collation level: include code-point comparison } level_type; }; - + /// - /// \brief Collation facet. + /// \brief Collation facet. /// /// It reimplements standard C++ std::collate, /// allowing usage of std::locale for direct string comparison /// template<typename CharType> - class collator : + class collator : public std::collate<CharType>, public collator_base { @@ -66,7 +65,7 @@ namespace locale { /// Type of string used with this facet /// typedef std::basic_string<CharType> string_type; - + /// /// Compare two strings in rage [b1,e1), [b2,e2) according using a collation level \a level. Calls do_compare @@ -143,26 +142,22 @@ namespace locale { { return do_transform(level,s.data(),s.data()+s.size()); } - + protected: /// /// constructor of the collator object /// - collator(size_t refs = 0) : std::collate<CharType>(refs) + collator(size_t refs = 0) : std::collate<CharType>(refs) { } - virtual ~collator() - { - } - /// /// This function is used to override default collation function that does not take in account collation level. /// Uses primary level /// - virtual int do_compare( char_type const *b1,char_type const *e1, - char_type const *b2,char_type const *e2) const + int do_compare( char_type const *b1,char_type const *e1, + char_type const *b2,char_type const *e2) const BOOST_OVERRIDE { return do_compare(identical,b1,e1,b2,e2); } @@ -170,7 +165,7 @@ namespace locale { /// This function is used to override default collation function that does not take in account collation level. /// Uses primary level /// - virtual string_type do_transform(char_type const *b,char_type const *e) const + string_type do_transform(char_type const *b,char_type const *e) const BOOST_OVERRIDE { return do_transform(identical,b,e); } @@ -178,23 +173,23 @@ namespace locale { /// This function is used to override default collation function that does not take in account collation level. /// Uses primary level /// - virtual long do_hash(char_type const *b,char_type const *e) const + long do_hash(char_type const *b,char_type const *e) const BOOST_OVERRIDE { return do_hash(identical,b,e); } /// - /// Actual function that performs comparison between the strings. For details see compare member function. Can be overridden. + /// Actual function that performs comparison between the strings. For details see compare member function. Can be overridden. /// virtual int do_compare( level_type level, char_type const *b1,char_type const *e1, char_type const *b2,char_type const *e2) const = 0; /// - /// Actual function that performs transformation. For details see transform member function. Can be overridden. + /// Actual function that performs transformation. For details see transform member function. Can be overridden. /// virtual string_type do_transform(level_type level,char_type const *b,char_type const *e) const = 0; /// - /// Actual function that calculates hash. For details see hash member function. Can be overridden. + /// Actual function that calculates hash. For details see hash member function. Can be overridden. /// virtual long do_hash(level_type level,char_type const *b,char_type const *e) const = 0; @@ -210,7 +205,7 @@ namespace locale { /// \code /// std::map<std::string,std::string,comparator<char,collator_base::secondary> > data; /// \endcode - /// + /// /// Would create a map the keys of which are sorted using secondary collation level /// template<typename CharType,collator_base::level_type default_level = collator_base::identical> @@ -221,8 +216,8 @@ namespace locale { /// Create a comparator class for locale \a l and with collation leval \a level /// /// \note throws std::bad_cast if l does not have \ref collator facet installed - /// - comparator(std::locale const &l=std::locale(),collator_base::level_type level=default_level) : + /// + comparator(std::locale const &l=std::locale(),collator_base::level_type level=default_level) : locale_(l), level_(level) { @@ -258,4 +253,3 @@ namespace locale { /// \example collate.cpp /// Example of using collation functions /// -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/config.hpp b/contrib/restricted/boost/locale/include/boost/locale/config.hpp index ab102b4efe..518b601c84 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/config.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/config.hpp @@ -1,18 +1,27 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_CONFIG_HPP_INCLUDED #define BOOST_LOCALE_CONFIG_HPP_INCLUDED -#include <boost/locale/definitions.hpp> +#include <boost/config.hpp> +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_LOCALE_DYN_LINK) +# ifdef BOOST_LOCALE_SOURCE +# define BOOST_LOCALE_DECL BOOST_SYMBOL_EXPORT +# else +# define BOOST_LOCALE_DECL BOOST_SYMBOL_IMPORT +# endif // BOOST_LOCALE_SOURCE +#else +# define BOOST_LOCALE_DECL +#endif // BOOST_LOCALE_DYN_LINK + +// +// Automatically link to the correct build variant where possible. // -// Automatically link to the correct build variant where possible. -// #if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_LOCALE_NO_LIB) && !defined(BOOST_LOCALE_SOURCE) // // Set the name of our library, this will get undef'ed by auto_link.hpp @@ -31,7 +40,41 @@ #include <boost/config/auto_link.hpp> #endif // auto-linking disabled +#if defined(BOOST_LOCALE_HIDE_AUTO_PTR) || defined(BOOST_NO_AUTO_PTR) +#define BOOST_LOCALE_USE_AUTO_PTR 0 +#else +#define BOOST_LOCALE_USE_AUTO_PTR 1 +#endif + +// Check for C++11 features that will be used in Boost 1.81 +// If you are using Boost.Locale and REALLY require it to keep +// supporting C++03/C++98 please comment with a detailed description +// of your use case and reasoning why using C++11 is not possible in +// https://github.com/boostorg/locale/issues/90 +#if !defined(BOOST_LOCALE_DISABLE_DEPRECATED_03_WARNING) && ( \ + defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || \ + defined(BOOST_NO_CXX11_DEFAULTED_MOVES) || \ + defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) || \ + defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) || \ + defined(BOOST_NO_CXX11_NOEXCEPT) || \ + defined(BOOST_NO_CXX11_OVERRIDE) || \ + defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \ + defined(BOOST_NO_CXX11_SMART_PTR) || \ + defined(BOOST_NO_CXX11_STATIC_ASSERT) \ + ) + #include <boost/config/pragma_message.hpp> + BOOST_PRAGMA_MESSAGE("CAUTION: Boost.Locale support for C++03 is deprecated. C++11 will be required from Boost 1.81 onwards.") + BOOST_PRAGMA_MESSAGE("CAUTION: Define BOOST_LOCALE_DISABLE_DEPRECATED_03_WARNING to suppress this message.") +#endif + +#ifdef _MSC_VER +// Denote a constant condition, e.g. for if(sizeof(... +#define BOOST_LOCALE_START_CONST_CONDITION __pragma(warning(push)) __pragma(warning(disable : 4127)) +#define BOOST_LOCALE_END_CONST_CONDITION __pragma(warning(pop)) +#else +#define BOOST_LOCALE_START_CONST_CONDITION +#define BOOST_LOCALE_END_CONST_CONDITION +#endif #endif // boost/locale/config.hpp -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/conversion.hpp b/contrib/restricted/boost/locale/include/boost/locale/conversion.hpp index 36f3a4fd64..ef5c6e6766 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/conversion.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/conversion.hpp @@ -1,32 +1,31 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_CONVERTER_HPP_INCLUDED #define BOOST_LOCALE_CONVERTER_HPP_INCLUDED #include <boost/locale/config.hpp> +#include <locale> + #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4275 4251 4231 4660) #endif -#include <locale> - namespace boost { namespace locale { - + /// - /// \defgroup convert Text Conversions + /// \defgroup convert Text Conversions /// /// This module provides various function for string manipulation like Unicode normalization, case conversion etc. /// @{ /// - + /// /// \brief This class provides base flags for text manipulation. It is used as base for converter facet. /// @@ -83,6 +82,7 @@ namespace boost { converter(size_t refs = 0) : std::locale::facet(refs) { } + ~converter(); virtual std::string convert(conversion_type how,char const *begin,char const *end,int flags = 0) const = 0; #if defined (__SUNPRO_CC) && defined (_RWSTD_VER) std::locale::id& __get_id (void) const { return id; } @@ -96,6 +96,7 @@ namespace boost { converter(size_t refs = 0) : std::locale::facet(refs) { } + ~converter(); virtual std::wstring convert(conversion_type how,wchar_t const *begin,wchar_t const *end,int flags = 0) const = 0; #if defined (__SUNPRO_CC) && defined (_RWSTD_VER) std::locale::id& __get_id (void) const { return id; } @@ -110,7 +111,8 @@ namespace boost { converter(size_t refs = 0) : std::locale::facet(refs) { } - virtual std::u16string convert(conversion_type how,char16_t const *begin,char16_t const *end,int flags = 0) const = 0; + ~converter(); + virtual std::u16string convert(conversion_type how,char16_t const *begin,char16_t const *end,int flags = 0) const = 0; #if defined (__SUNPRO_CC) && defined (_RWSTD_VER) std::locale::id& __get_id (void) const { return id; } #endif @@ -125,6 +127,7 @@ namespace boost { converter(size_t refs = 0) : std::locale::facet(refs) { } + ~converter(); virtual std::u32string convert(conversion_type how,char32_t const *begin,char32_t const *end,int flags = 0) const = 0; #if defined (__SUNPRO_CC) && defined (_RWSTD_VER) std::locale::id& __get_id (void) const { return id; } @@ -145,16 +148,16 @@ namespace boost { norm_nfkc, ///< Compatibility decomposition followed by canonical composition. norm_default = norm_nfc, ///< Default normalization - canonical decomposition followed by canonical composition } norm_type; - + /// /// Normalize Unicode string \a str according to \ref norm_type "normalization form" \a n /// /// Note: This function receives only Unicode strings, i.e.: UTF-8, UTF-16 or UTF-32. It does not take - /// in account the locale encoding, because Unicode decomposition and composition are meaningless outside + /// in account the locale encoding, because Unicode decomposition and composition are meaningless outside /// of a Unicode character set. /// /// \note throws std::bad_cast if loc does not have \ref converter facet installed - /// + /// template<typename CharType> std::basic_string<CharType> normalize(std::basic_string<CharType> const &str,norm_type n=norm_default,std::locale const &loc=std::locale()) { @@ -165,11 +168,11 @@ namespace boost { /// Normalize NUL terminated Unicode string \a str according to \ref norm_type "normalization form" \a n /// /// Note: This function receives only Unicode strings, i.e.: UTF-8, UTF-16 or UTF-32. It does not take - /// in account the locale encoding, because Unicode decomposition and composition are meaningless outside + /// in account the locale encoding, because Unicode decomposition and composition are meaningless outside /// of a Unicode character set. - /// + /// /// \note throws std::bad_cast if loc does not have \ref converter facet installed - /// + /// template<typename CharType> std::basic_string<CharType> normalize(CharType const *str,norm_type n=norm_default,std::locale const &loc=std::locale()) { @@ -178,16 +181,16 @@ namespace boost { end++; return std::use_facet<converter<CharType> >(loc).convert(converter_base::normalization,str,end,n); } - + /// /// Normalize Unicode string in range [begin,end) according to \ref norm_type "normalization form" \a n /// /// Note: This function receives only Unicode strings, i.e.: UTF-8, UTF-16 or UTF-32. It does not take - /// in account the locale encoding, because Unicode decomposition and composition are meaningless outside + /// in account the locale encoding, because Unicode decomposition and composition are meaningless outside /// of a Unicode character set. - /// + /// /// \note throws std::bad_cast if loc does not have \ref converter facet installed - /// + /// template<typename CharType> std::basic_string<CharType> normalize( CharType const *begin, CharType const *end, @@ -198,24 +201,24 @@ namespace boost { } /////////////////////////////////////////////////// - + /// /// Convert a string \a str to upper case according to locale \a loc /// /// \note throws std::bad_cast if loc does not have \ref converter facet installed - /// + /// template<typename CharType> std::basic_string<CharType> to_upper(std::basic_string<CharType> const &str,std::locale const &loc=std::locale()) { return std::use_facet<converter<CharType> >(loc).convert(converter_base::upper_case,str.data(),str.data()+str.size()); } - + /// /// Convert a NUL terminated string \a str to upper case according to locale \a loc /// /// \note throws std::bad_cast if loc does not have \ref converter facet installed - /// + /// template<typename CharType> std::basic_string<CharType> to_upper(CharType const *str,std::locale const &loc=std::locale()) { @@ -224,12 +227,12 @@ namespace boost { end++; return std::use_facet<converter<CharType> >(loc).convert(converter_base::upper_case,str,end); } - + /// /// Convert a string in range [begin,end) to upper case according to locale \a loc /// /// \note throws std::bad_cast if loc does not have \ref converter facet installed - /// + /// template<typename CharType> std::basic_string<CharType> to_upper(CharType const *begin,CharType const *end,std::locale const &loc=std::locale()) { @@ -237,24 +240,24 @@ namespace boost { } /////////////////////////////////////////////////// - + /// /// Convert a string \a str to lower case according to locale \a loc /// /// \note throws std::bad_cast if loc does not have \ref converter facet installed - /// + /// template<typename CharType> std::basic_string<CharType> to_lower(std::basic_string<CharType> const &str,std::locale const &loc=std::locale()) { return std::use_facet<converter<CharType> >(loc).convert(converter_base::lower_case,str.data(),str.data()+str.size()); } - + /// /// Convert a NUL terminated string \a str to lower case according to locale \a loc /// /// \note throws std::bad_cast if loc does not have \ref converter facet installed - /// + /// template<typename CharType> std::basic_string<CharType> to_lower(CharType const *str,std::locale const &loc=std::locale()) { @@ -263,36 +266,36 @@ namespace boost { end++; return std::use_facet<converter<CharType> >(loc).convert(converter_base::lower_case,str,end); } - + /// /// Convert a string in range [begin,end) to lower case according to locale \a loc /// /// \note throws std::bad_cast if loc does not have \ref converter facet installed - /// + /// template<typename CharType> std::basic_string<CharType> to_lower(CharType const *begin,CharType const *end,std::locale const &loc=std::locale()) { return std::use_facet<converter<CharType> >(loc).convert(converter_base::lower_case,begin,end); } /////////////////////////////////////////////////// - + /// /// Convert a string \a str to title case according to locale \a loc /// /// \note throws std::bad_cast if loc does not have \ref converter facet installed - /// + /// template<typename CharType> std::basic_string<CharType> to_title(std::basic_string<CharType> const &str,std::locale const &loc=std::locale()) { return std::use_facet<converter<CharType> >(loc).convert(converter_base::title_case,str.data(),str.data()+str.size()); } - + /// /// Convert a NUL terminated string \a str to title case according to locale \a loc /// /// \note throws std::bad_cast if loc does not have \ref converter facet installed - /// + /// template<typename CharType> std::basic_string<CharType> to_title(CharType const *str,std::locale const &loc=std::locale()) { @@ -301,12 +304,12 @@ namespace boost { end++; return std::use_facet<converter<CharType> >(loc).convert(converter_base::title_case,str,end); } - + /// /// Convert a string in range [begin,end) to title case according to locale \a loc /// /// \note throws std::bad_cast if loc does not have \ref converter facet installed - /// + /// template<typename CharType> std::basic_string<CharType> to_title(CharType const *begin,CharType const *end,std::locale const &loc=std::locale()) { @@ -314,24 +317,24 @@ namespace boost { } /////////////////////////////////////////////////// - + /// /// Fold case of a string \a str according to locale \a loc /// /// \note throws std::bad_cast if loc does not have \ref converter facet installed - /// + /// template<typename CharType> std::basic_string<CharType> fold_case(std::basic_string<CharType> const &str,std::locale const &loc=std::locale()) { return std::use_facet<converter<CharType> >(loc).convert(converter_base::case_folding,str.data(),str.data()+str.size()); } - + /// /// Fold case of a NUL terminated string \a str according to locale \a loc /// /// \note throws std::bad_cast if loc does not have \ref converter facet installed - /// + /// template<typename CharType> std::basic_string<CharType> fold_case(CharType const *str,std::locale const &loc=std::locale()) { @@ -340,12 +343,12 @@ namespace boost { end++; return std::use_facet<converter<CharType> >(loc).convert(converter_base::case_folding,str,end); } - + /// /// Fold case of a string in range [begin,end) according to locale \a loc /// /// \note throws std::bad_cast if loc does not have \ref converter facet installed - /// + /// template<typename CharType> std::basic_string<CharType> fold_case(CharType const *begin,CharType const *end,std::locale const &loc=std::locale()) { @@ -376,5 +379,4 @@ namespace boost { /// Example of using various text conversion functions with wide strings. /// -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/date_time.hpp b/contrib/restricted/boost/locale/include/boost/locale/date_time.hpp index 71a92690a1..0ce2e55d2f 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/date_time.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/date_time.hpp @@ -1,32 +1,29 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_DATE_TIME_HPP_INCLUDED #define BOOST_LOCALE_DATE_TIME_HPP_INCLUDED -#include <boost/locale/config.hpp> -#ifdef BOOST_MSVC -# pragma warning(push) -# pragma warning(disable : 4275 4251 4231 4660) -#endif - -#include <boost/locale/hold_ptr.hpp> #include <boost/locale/date_time_facet.hpp> #include <boost/locale/formatting.hpp> +#include <boost/locale/hold_ptr.hpp> #include <boost/locale/time_zone.hpp> #include <locale> -#include <vector> #include <stdexcept> +#include <vector> +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4275 4251 4231 4660) +#endif namespace boost { namespace locale { /// - /// \defgroup date_time Date, Time, Timezone and Calendar manipulations + /// \defgroup date_time Date, Time, Timezone and Calendar manipulations /// /// This module provides various calendar, timezone and date time services /// @@ -40,7 +37,7 @@ namespace boost { public: /// /// Constructor of date_time_error class - /// + /// date_time_error(std::string const &e) : std::runtime_error(e) {} }; @@ -52,8 +49,8 @@ namespace boost { /// Usually obtained as product of period_type and integer or /// my calling a representative functions /// For example day()*3 == date_time_period(day(),3) == day(3) - /// - struct date_time_period + /// + struct date_time_period { period::period_type type; ///< The type of period, i.e. era, year, day etc. int value; ///< The value the actual number of \a periods @@ -65,7 +62,7 @@ namespace boost { /// Operator -, switches the sign of period /// date_time_period operator-() const { return date_time_period(type,-value); } - + /// /// Constructor that creates date_time_period from period_type \a f and a value \a v -- default 1. /// @@ -111,7 +108,7 @@ namespace boost { /// inline period_type day_of_week(){ return period_type(marks::day_of_week); } /// - /// Get period_type for: Original number of the day of the week in month. For example 1st Sunday, + /// Get period_type for: Original number of the day of the week in month. For example 1st Sunday, /// 2nd Sunday, etc. in Gregorian [1..5] /// inline period_type day_of_week_in_month(){ return period_type(marks::day_of_week_in_month); } @@ -155,27 +152,27 @@ namespace boost { /// /// Get date_time_period for: Era i.e. AC, BC in Gregorian and Julian calendar, range [0,1] /// - inline date_time_period era(int v) { return date_time_period(era(),v); } + inline date_time_period era(int v) { return date_time_period(era(),v); } /// /// Get date_time_period for: Year, it is calendar specific, for example 2011 in Gregorian calendar. /// - inline date_time_period year(int v) { return date_time_period(year(),v); } + inline date_time_period year(int v) { return date_time_period(year(),v); } /// /// Get date_time_period for: Extended year for Gregorian/Julian calendars, where 1 BC == 0, 2 BC == -1. /// - inline date_time_period extended_year(int v) { return date_time_period(extended_year(),v); } + inline date_time_period extended_year(int v) { return date_time_period(extended_year(),v); } /// /// Get date_time_period for: The month of year, calendar specific, in Gregorian [0..11] /// - inline date_time_period month(int v) { return date_time_period(month(),v); } + inline date_time_period month(int v) { return date_time_period(month(),v); } /// /// Get date_time_period for: The day of month, calendar specific, in Gregorian [1..31] /// - inline date_time_period day(int v) { return date_time_period(day(),v); } + inline date_time_period day(int v) { return date_time_period(day(),v); } /// /// Get date_time_period for: The number of day in year, starting from 1, in Gregorian [1..366] /// - inline date_time_period day_of_year(int v) { return date_time_period(day_of_year(),v); } + inline date_time_period day_of_year(int v) { return date_time_period(day_of_year(),v); } /// /// Get date_time_period for: Day of week, Sunday=1, Monday=2,..., Saturday=7. /// @@ -184,48 +181,48 @@ namespace boost { /// the value to Sunday (1) would forward the date by 5 days forward and not backward /// by two days as it could be expected if the numbers were taken as is. /// - inline date_time_period day_of_week(int v) { return date_time_period(day_of_week(),v); } + inline date_time_period day_of_week(int v) { return date_time_period(day_of_week(),v); } /// - /// Get date_time_period for: Original number of the day of the week in month. For example 1st Sunday, + /// Get date_time_period for: Original number of the day of the week in month. For example 1st Sunday, /// 2nd Sunday, etc. in Gregorian [1..5] /// - inline date_time_period day_of_week_in_month(int v) { return date_time_period(day_of_week_in_month(),v); } + inline date_time_period day_of_week_in_month(int v) { return date_time_period(day_of_week_in_month(),v); } /// /// Get date_time_period for: Local day of week, for example in France Monday is 1, in US Sunday is 1, [1..7] /// - inline date_time_period day_of_week_local(int v) { return date_time_period(day_of_week_local(),v); } + inline date_time_period day_of_week_local(int v) { return date_time_period(day_of_week_local(),v); } /// /// Get date_time_period for: 24 clock hour [0..23] /// - inline date_time_period hour(int v) { return date_time_period(hour(),v); } + inline date_time_period hour(int v) { return date_time_period(hour(),v); } /// /// Get date_time_period for: 12 clock hour [0..11] /// - inline date_time_period hour_12(int v) { return date_time_period(hour_12(),v); } + inline date_time_period hour_12(int v) { return date_time_period(hour_12(),v); } /// /// Get date_time_period for: am or pm marker [0..1] /// - inline date_time_period am_pm(int v) { return date_time_period(am_pm(),v); } + inline date_time_period am_pm(int v) { return date_time_period(am_pm(),v); } /// /// Get date_time_period for: minute [0..59] /// - inline date_time_period minute(int v) { return date_time_period(minute(),v); } + inline date_time_period minute(int v) { return date_time_period(minute(),v); } /// /// Get date_time_period for: second [0..59] /// - inline date_time_period second(int v) { return date_time_period(second(),v); } + inline date_time_period second(int v) { return date_time_period(second(),v); } /// /// Get date_time_period for: The week number in the year /// - inline date_time_period week_of_year(int v) { return date_time_period(week_of_year(),v); } + inline date_time_period week_of_year(int v) { return date_time_period(week_of_year(),v); } /// /// Get date_time_period for: The week number within current month /// - inline date_time_period week_of_month(int v) { return date_time_period(week_of_month(),v); } + inline date_time_period week_of_month(int v) { return date_time_period(week_of_month(),v); } /// /// Get date_time_period for: First day of week, constant, for example Sunday in US = 1, Monday in France = 2 /// - inline date_time_period first_day_of_week(int v) { return date_time_period(first_day_of_week(),v); } + inline date_time_period first_day_of_week(int v) { return date_time_period(first_day_of_week(),v); } /// /// Get predefined constant for January @@ -264,7 +261,7 @@ namespace boost { /// inline date_time_period september() { return date_time_period(month(),8); } /// - /// Get predefined constant for October + /// Get predefined constant for October /// inline date_time_period october() { return date_time_period(month(),9); } /// @@ -281,7 +278,7 @@ namespace boost { /// inline date_time_period sunday() { return date_time_period(day_of_week(),1); } /// - /// Get predefined constant for Monday + /// Get predefined constant for Monday /// inline date_time_period monday() { return date_time_period(day_of_week(),2); } /// @@ -316,7 +313,7 @@ namespace boost { /// /// convert period_type to date_time_period(f,1) /// - inline date_time_period operator+(period::period_type f) + inline date_time_period operator+(period::period_type f) { return date_time_period(f); } @@ -329,7 +326,7 @@ namespace boost { } /// - /// Create date_time_period of type \a f with value \a v. + /// Create date_time_period of type \a f with value \a v. /// template<typename T> date_time_period operator*(period::period_type f,T v) @@ -338,7 +335,7 @@ namespace boost { } /// - /// Create date_time_period of type \a f with value \a v. + /// Create date_time_period of type \a f with value \a v. /// template<typename T> date_time_period operator*(T v,period::period_type f) @@ -346,7 +343,7 @@ namespace boost { return date_time_period(f,v); } /// - /// Create date_time_period of type \a f with value \a v. + /// Create date_time_period of type \a f with value \a v. /// template<typename T> date_time_period operator*(T v,date_time_period f) @@ -355,7 +352,7 @@ namespace boost { } /// - /// Create date_time_period of type \a f with value \a v. + /// Create date_time_period of type \a f with value \a v. /// template<typename T> date_time_period operator*(date_time_period f,T v) @@ -368,14 +365,14 @@ namespace boost { /// - /// \brief this class that represents a set of periods, + /// \brief this class that represents a set of periods, /// /// It is generally created by operations on periods: /// 1995*year + 3*month + 1*day. Note: operations are not commutative. /// class date_time_period_set { public: - + /// /// Default constructor - empty set /// @@ -425,7 +422,7 @@ namespace boost { /// /// Get item at position \a n the set, n should be in range [0,size) /// - date_time_period const &operator[](size_t n) const + date_time_period const &operator[](size_t n) const { if(n >= size()) throw std::out_of_range("Invalid index to date_time_period"); @@ -439,9 +436,9 @@ namespace boost { std::vector<date_time_period> periods_; }; - + /// - /// Append two periods sets. Note this operator is not commutative + /// Append two periods sets. Note this operator is not commutative /// inline date_time_period_set operator+(date_time_period_set const &a,date_time_period_set const &b) { @@ -450,7 +447,7 @@ namespace boost { s.add(b[i]); return s; } - + /// /// Append two period sets when all periods of set \b change their sign /// @@ -464,7 +461,7 @@ namespace boost { /// - /// \brief this class provides an access to general calendar information. + /// \brief this class provides an access to general calendar information. /// /// This information is not connected to specific date but generic to locale, and timezone. /// It is used in obtaining general information about calendar and is essential for creation of @@ -475,34 +472,34 @@ namespace boost { /// /// Create calendar taking locale and timezone information from ios_base instance. - /// + /// /// \note throws std::bad_cast if ios does not have a locale with installed \ref calendar_facet /// facet installed - /// + /// calendar(std::ios_base &ios); /// /// Create calendar with locale \a l and time_zone \a zone /// /// \note throws std::bad_cast if loc does not have \ref calendar_facet facet installed - /// + /// calendar(std::locale const &l,std::string const &zone); /// /// Create calendar with locale \a l and default timezone /// /// \note throws std::bad_cast if loc does not have \ref calendar_facet facet installed - /// + /// calendar(std::locale const &l); /// /// Create calendar with default locale and timezone \a zone /// /// \note throws std::bad_cast if global locale does not have \ref calendar_facet facet installed - /// + /// calendar(std::string const &zone); /// - /// Create calendar with default locale and timezone + /// Create calendar with default locale and timezone /// /// \note throws std::bad_cast if global locale does not have \ref calendar_facet facet installed - /// + /// calendar(); ~calendar(); @@ -586,7 +583,7 @@ namespace boost { /// some_time = year * 1995 that sets the year to 1995. /// /// - + class BOOST_LOCALE_DECL date_time { public: @@ -594,7 +591,7 @@ namespace boost { /// Dafault constructor, uses default calendar initialized date_time object to current time. /// /// \note throws std::bad_cast if the global locale does not have \ref calendar_facet facet installed - /// + /// date_time(); /// /// copy date_time @@ -614,7 +611,7 @@ namespace boost { /// Create a date_time object using POSIX time \a time and default calendar /// /// \note throws std::bad_cast if the global locale does not have \ref calendar_facet facet installed - /// + /// date_time(double time); /// /// Create a date_time object using POSIX time \a time and calendar \a cal @@ -624,21 +621,21 @@ namespace boost { /// Create a date_time object using calendar \a cal and initializes it to current time. /// date_time(calendar const &cal); - + /// /// Create a date_time object using default calendar and define values given in \a set /// /// \note throws std::bad_cast if the global locale does not have \ref calendar_facet facet installed - /// + /// date_time(date_time_period_set const &set); /// /// Create a date_time object using calendar \a cal and define values given in \a set /// date_time(date_time_period_set const &set,calendar const &cal); - + /// - /// assign values to various periods in set \a f + /// assign values to various periods in set \a f /// date_time const &operator=(date_time_period_set const &f); @@ -695,7 +692,7 @@ namespace boost { /// date_time operator<<(period::period_type f) const { - return *this<<date_time_period(f); + return *this << date_time_period(f); } /// @@ -711,14 +708,14 @@ namespace boost { /// date_time const &operator<<=(period::period_type f) { - return *this<<=date_time_period(f); + return *this <<= date_time_period(f); } /// /// roll backward a date by single period f. /// date_time const &operator>>=(period::period_type f) { - return *this>>=date_time_period(f); + return *this >>= date_time_period(f); } /// @@ -849,7 +846,7 @@ namespace boost { int maximum(period::period_type f) const; /// - /// Check if *this time point is in daylight saving time + /// Check if *this time point is in daylight saving time /// bool is_in_daylight_saving_time() const; @@ -865,22 +862,22 @@ namespace boost { /// For example: /// \code /// date_time now(time(0),hebrew_calendar) - /// cout << "Year: " << period::year(now) <<" Full Date:"<< now; + /// std::cout << "Year: " << period::year(now) << " Full Date:" << now; /// \endcode /// /// The output may be Year:5770 Full Date:Jan 1, 2010 - /// + /// template<typename CharType> std::basic_ostream<CharType> &operator<<(std::basic_ostream<CharType> &out,date_time const &t) { double time_point = t.time(); uint64_t display_flags = ios_info::get(out).display_flags(); if ( - display_flags == flags::date - || display_flags == flags::time - || display_flags == flags::datetime + display_flags == flags::date + || display_flags == flags::time + || display_flags == flags::datetime || display_flags == flags::strftime - ) + ) { out << time_point; } @@ -903,11 +900,11 @@ namespace boost { double v; uint64_t display_flags = ios_info::get(in).display_flags(); if ( - display_flags == flags::date - || display_flags == flags::time - || display_flags == flags::datetime + display_flags == flags::date + || display_flags == flags::time + || display_flags == flags::datetime || display_flags == flags::strftime - ) + ) { in >> v; } @@ -921,9 +918,13 @@ namespace boost { return in; } +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4512) //assignment operator could not be generated +#endif /// /// \brief This class represents a period: a pair of two date_time objects. - /// + /// /// It is generally used as syntactic sugar to calculate difference between two dates. /// /// Note: it stores references to the original objects, so it is not recommended to be used @@ -935,13 +936,13 @@ namespace boost { /// /// Create an object were \a first represents earlier point on time line and \a second is later /// point. - /// + /// date_time_duration(date_time const &first,date_time const &second) : s_(first), e_(second) { } - + /// /// find a difference in terms of period_type \a f /// @@ -970,6 +971,9 @@ namespace boost { date_time const &s_; date_time const &e_; }; +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif /// /// Calculates the difference between two dates, the left operand is a later point on time line. @@ -980,32 +984,32 @@ namespace boost { return date_time_duration(earlier,later); } - + namespace period { /// /// Extract from date_time numerical value of Era i.e. AC, BC in Gregorian and Julian calendar, range [0,1] /// - inline int era(date_time const &dt) { return dt.get(era()); } + inline int era(date_time const &dt) { return dt.get(era()); } /// /// Extract from date_time numerical value of Year, it is calendar specific, for example 2011 in Gregorian calendar. /// - inline int year(date_time const &dt) { return dt.get(year()); } + inline int year(date_time const &dt) { return dt.get(year()); } /// /// Extract from date_time numerical value of Extended year for Gregorian/Julian calendars, where 1 BC == 0, 2 BC == -1. /// - inline int extended_year(date_time const &dt) { return dt.get(extended_year()); } + inline int extended_year(date_time const &dt) { return dt.get(extended_year()); } /// /// Extract from date_time numerical value of The month of year, calendar specific, in Gregorian [0..11] /// - inline int month(date_time const &dt) { return dt.get(month()); } + inline int month(date_time const &dt) { return dt.get(month()); } /// /// Extract from date_time numerical value of The day of month, calendar specific, in Gregorian [1..31] /// - inline int day(date_time const &dt) { return dt.get(day()); } + inline int day(date_time const &dt) { return dt.get(day()); } /// /// Extract from date_time numerical value of The number of day in year, starting from 1, in Gregorian [1..366] /// - inline int day_of_year(date_time const &dt) { return dt.get(day_of_year()); } + inline int day_of_year(date_time const &dt) { return dt.get(day_of_year()); } /// /// Extract from date_time numerical value of Day of week, Sunday=1, Monday=2,..., Saturday=7. /// @@ -1014,121 +1018,121 @@ namespace boost { /// the value to Sunday (1) would forward the date by 5 days forward and not backward /// by two days as it could be expected if the numbers were taken as is. /// - inline int day_of_week(date_time const &dt) { return dt.get(day_of_week()); } + inline int day_of_week(date_time const &dt) { return dt.get(day_of_week()); } /// - /// Extract from date_time numerical value of Original number of the day of the week in month. For example 1st Sunday, + /// Extract from date_time numerical value of Original number of the day of the week in month. For example 1st Sunday, /// 2nd Sunday, etc. in Gregorian [1..5] /// - inline int day_of_week_in_month(date_time const &dt) { return dt.get(day_of_week_in_month()); } + inline int day_of_week_in_month(date_time const &dt) { return dt.get(day_of_week_in_month()); } /// /// Extract from date_time numerical value of Local day of week, for example in France Monday is 1, in US Sunday is 1, [1..7] /// - inline int day_of_week_local(date_time const &dt) { return dt.get(day_of_week_local()); } + inline int day_of_week_local(date_time const &dt) { return dt.get(day_of_week_local()); } /// /// Extract from date_time numerical value of 24 clock hour [0..23] /// - inline int hour(date_time const &dt) { return dt.get(hour()); } + inline int hour(date_time const &dt) { return dt.get(hour()); } /// /// Extract from date_time numerical value of 12 clock hour [0..11] /// - inline int hour_12(date_time const &dt) { return dt.get(hour_12()); } + inline int hour_12(date_time const &dt) { return dt.get(hour_12()); } /// /// Extract from date_time numerical value of am or pm marker [0..1] /// - inline int am_pm(date_time const &dt) { return dt.get(am_pm()); } + inline int am_pm(date_time const &dt) { return dt.get(am_pm()); } /// /// Extract from date_time numerical value of minute [0..59] /// - inline int minute(date_time const &dt) { return dt.get(minute()); } + inline int minute(date_time const &dt) { return dt.get(minute()); } /// /// Extract from date_time numerical value of second [0..59] /// - inline int second(date_time const &dt) { return dt.get(second()); } + inline int second(date_time const &dt) { return dt.get(second()); } /// /// Extract from date_time numerical value of The week number in the year /// - inline int week_of_year(date_time const &dt) { return dt.get(week_of_year()); } + inline int week_of_year(date_time const &dt) { return dt.get(week_of_year()); } /// /// Extract from date_time numerical value of The week number within current month /// - inline int week_of_month(date_time const &dt) { return dt.get(week_of_month()); } + inline int week_of_month(date_time const &dt) { return dt.get(week_of_month()); } /// /// Extract from date_time numerical value of First day of week, constant, for example Sunday in US = 1, Monday in France = 2 /// - inline int first_day_of_week(date_time const &dt) { return dt.get(first_day_of_week()); } - + inline int first_day_of_week(date_time const &dt) { return dt.get(first_day_of_week()); } + /// /// Extract from date_time_duration numerical value of duration in Era i.e. AC, BC in Gregorian and Julian calendar, range [0,1] /// - inline int era(date_time_duration const &dt) { return dt.get(era()); } + inline int era(date_time_duration const &dt) { return dt.get(era()); } /// /// Extract from date_time_duration numerical value of duration in years /// - inline int year(date_time_duration const &dt) { return dt.get(year()); } + inline int year(date_time_duration const &dt) { return dt.get(year()); } /// /// Extract from date_time_duration numerical value of duration in extended years (for Gregorian/Julian calendars, where 1 BC == 0, 2 BC == -1). /// - inline int extended_year(date_time_duration const &dt) { return dt.get(extended_year()); } + inline int extended_year(date_time_duration const &dt) { return dt.get(extended_year()); } /// /// Extract from date_time_duration numerical value of duration in months /// - inline int month(date_time_duration const &dt) { return dt.get(month()); } + inline int month(date_time_duration const &dt) { return dt.get(month()); } /// /// Extract from date_time_duration numerical value of duration in days of month /// - inline int day(date_time_duration const &dt) { return dt.get(day()); } + inline int day(date_time_duration const &dt) { return dt.get(day()); } /// /// Extract from date_time_duration numerical value of duration in days of year /// - inline int day_of_year(date_time_duration const &dt) { return dt.get(day_of_year()); } + inline int day_of_year(date_time_duration const &dt) { return dt.get(day_of_year()); } /// /// Extract from date_time_duration numerical value of duration in days of week /// - inline int day_of_week(date_time_duration const &dt) { return dt.get(day_of_week()); } + inline int day_of_week(date_time_duration const &dt) { return dt.get(day_of_week()); } /// /// Extract from date_time_duration numerical value of duration in original number of the day of the week in month /// - inline int day_of_week_in_month(date_time_duration const &dt) { return dt.get(day_of_week_in_month()); } + inline int day_of_week_in_month(date_time_duration const &dt) { return dt.get(day_of_week_in_month()); } /// /// Extract from date_time_duration numerical value of duration in local day of week /// - inline int day_of_week_local(date_time_duration const &dt) { return dt.get(day_of_week_local()); } + inline int day_of_week_local(date_time_duration const &dt) { return dt.get(day_of_week_local()); } /// /// Extract from date_time_duration numerical value of duration in hours /// - inline int hour(date_time_duration const &dt) { return dt.get(hour()); } + inline int hour(date_time_duration const &dt) { return dt.get(hour()); } /// /// Extract from date_time_duration numerical value of duration in 12 clock hours /// - inline int hour_12(date_time_duration const &dt) { return dt.get(hour_12()); } + inline int hour_12(date_time_duration const &dt) { return dt.get(hour_12()); } /// /// Extract from date_time_duration numerical value of duration in am or pm markers /// - inline int am_pm(date_time_duration const &dt) { return dt.get(am_pm()); } + inline int am_pm(date_time_duration const &dt) { return dt.get(am_pm()); } /// /// Extract from date_time_duration numerical value of duration in minutes /// - inline int minute(date_time_duration const &dt) { return dt.get(minute()); } + inline int minute(date_time_duration const &dt) { return dt.get(minute()); } /// /// Extract from date_time_duration numerical value of duration in seconds /// - inline int second(date_time_duration const &dt) { return dt.get(second()); } + inline int second(date_time_duration const &dt) { return dt.get(second()); } /// /// Extract from date_time_duration numerical value of duration in the week number in the year /// - inline int week_of_year(date_time_duration const &dt) { return dt.get(week_of_year()); } + inline int week_of_year(date_time_duration const &dt) { return dt.get(week_of_year()); } /// /// Extract from date_time_duration numerical value of duration in The week number within current month /// - inline int week_of_month(date_time_duration const &dt) { return dt.get(week_of_month()); } + inline int week_of_month(date_time_duration const &dt) { return dt.get(week_of_month()); } /// /// Extract from date_time_duration numerical value of duration in the first day of week /// - inline int first_day_of_week(date_time_duration const &dt) { return dt.get(first_day_of_week()); } + inline int first_day_of_week(date_time_duration const &dt) { return dt.get(first_day_of_week()); } } - + /// @} @@ -1147,4 +1151,3 @@ namespace boost { /// Example of using date_time functions for generating calendar for current year. /// -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/date_time_facet.hpp b/contrib/restricted/boost/locale/include/boost/locale/date_time_facet.hpp index 6ccca9bddc..ef0ff3ca72 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/date_time_facet.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/date_time_facet.hpp @@ -1,22 +1,21 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_DATE_TIME_FACET_HPP_INCLUDED #define BOOST_LOCALE_DATE_TIME_FACET_HPP_INCLUDED #include <boost/locale/config.hpp> +#include <boost/cstdint.hpp> +#include <locale> + #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4275 4251 4231 4660) #endif -#include <boost/cstdint.hpp> -#include <locale> - namespace boost { namespace locale { /// @@ -41,7 +40,7 @@ namespace boost { ///< If first day of week is Monday and the current day is Tuesday then setting ///< the value to Sunday (1) would forward the date by 5 days forward and not backward ///< by two days as it could be expected if the numbers were taken as is. - day_of_week_in_month, ///< Original number of the day of the week in month. For example 1st Sunday, + day_of_week_in_month, ///< Original number of the day of the week in month. For example 1st Sunday, ///< 2nd Sunday, etc. in Gregorian [1..5] day_of_week_local, ///< Local day of week, for example in France Monday is 1, in US Sunday is 1, [1..7] hour, ///< 24 clock hour [0..23] @@ -72,13 +71,13 @@ namespace boost { /// /// Create a period of specific type, default is invalid. /// - period_type(marks::period_mark m = marks::invalid) : mark_(m) + period_type(marks::period_mark m = marks::invalid) : mark_(m) { } - + /// /// Get the value of marks::period_mark it was created with. - /// + /// marks::period_mark mark() const { return mark_; @@ -167,7 +166,7 @@ namespace boost { /// /// If normalize() is not called after set_value, the behavior is undefined /// - virtual void set_value(period::marks::period_mark p,int value) = 0; + virtual void set_value(period::marks::period_mark m,int value) = 0; /// /// Recalculate all periods after setting them, should be called after use of set_value() function. @@ -177,7 +176,7 @@ namespace boost { /// /// Get specific value for period \a p according to a value_type \a v /// - virtual int get_value(period::marks::period_mark p,value_type v) const = 0; + virtual int get_value(period::marks::period_mark m,value_type v) const = 0; /// /// Set current time point @@ -201,12 +200,12 @@ namespace boost { /// Adjust period's \a p value by \a difference items using a update_type \a u. /// Note: not all values are adjustable /// - virtual void adjust_value(period::marks::period_mark p,update_type u,int difference) = 0; + virtual void adjust_value(period::marks::period_mark m,update_type u,int difference) = 0; /// /// Calculate the difference between this calendar and \a other in \a p units /// - virtual int difference(abstract_calendar const *other,period::marks::period_mark p) const = 0; + virtual int difference(abstract_calendar const *other,period::marks::period_mark m) const = 0; /// /// Set time zone, empty - use system @@ -222,10 +221,7 @@ namespace boost { /// virtual bool same(abstract_calendar const *other) const = 0; - virtual ~abstract_calendar() - { - } - + virtual ~abstract_calendar() {} }; /// @@ -236,7 +232,7 @@ namespace boost { /// /// Basic constructor /// - calendar_facet(size_t refs = 0) : std::locale::facet(refs) + calendar_facet(size_t refs = 0) : std::locale::facet(refs) { } /// @@ -259,5 +255,4 @@ namespace boost { #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/definitions.hpp b/contrib/restricted/boost/locale/include/boost/locale/definitions.hpp deleted file mode 100644 index b305ff730b..0000000000 --- a/contrib/restricted/boost/locale/include/boost/locale/definitions.hpp +++ /dev/null @@ -1,34 +0,0 @@ -// -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) -// -#ifndef BOOST_LOCALE_DEFINITIONS_HPP_INCLUDED -#define BOOST_LOCALE_DEFINITIONS_HPP_INCLUDED - -#include <boost/config.hpp> - -// Support older ICU versions -#ifndef BOOST_SYMBOL_VISIBLE -# define BOOST_SYMBOL_VISIBLE -#endif - -#ifdef BOOST_HAS_DECLSPEC -# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_LOCALE_DYN_LINK) -# ifdef BOOST_LOCALE_SOURCE -# define BOOST_LOCALE_DECL BOOST_SYMBOL_EXPORT -# else -# define BOOST_LOCALE_DECL BOOST_SYMBOL_IMPORT -# endif // BOOST_LOCALE_SOURCE -# endif // DYN_LINK -#endif // BOOST_HAS_DECLSPEC - -#ifndef BOOST_LOCALE_DECL -# define BOOST_LOCALE_DECL -#endif - -#endif // boost/locale/config.hpp -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 - diff --git a/contrib/restricted/boost/locale/include/boost/locale/encoding.hpp b/contrib/restricted/boost/locale/include/boost/locale/encoding.hpp index 5fd9cb745c..8ecec46f09 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/encoding.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/encoding.hpp @@ -1,23 +1,21 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_ENCODING_HPP_INCLUDED #define BOOST_LOCALE_ENCODING_HPP_INCLUDED #include <boost/locale/config.hpp> -#ifdef BOOST_MSVC -# pragma warning(push) -# pragma warning(disable : 4275 4251 4231 4660) -#endif #include <boost/locale/info.hpp> #include <boost/locale/encoding_errors.hpp> #include <boost/locale/encoding_utf.hpp> - +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4275 4251 4231 4660) +#endif namespace boost { namespace locale { @@ -47,7 +45,7 @@ namespace boost { /// convert string to UTF string from text in range [begin,end) encoded according to locale \a loc according to policy \a how /// /// \note throws std::bad_cast if the loc does not have \ref info facet installed - /// + /// template<typename CharType> std::basic_string<CharType> to_utf(char const *begin,char const *end,std::locale const &loc,method_type how=default_method) { @@ -58,7 +56,7 @@ namespace boost { /// convert UTF text in range [begin,end) to a text encoded according to locale \a loc according to policy \a how /// /// \note throws std::bad_cast if the loc does not have \ref info facet installed - /// + /// template<typename CharType> std::string from_utf(CharType const *begin,CharType const *end,std::locale const &loc,method_type how=default_method) { @@ -68,7 +66,7 @@ namespace boost { /// /// convert a string \a text encoded with \a charset to UTF string /// - + template<typename CharType> std::basic_string<CharType> to_utf(std::string const &text,std::string const &charset,method_type how=default_method) { @@ -91,7 +89,7 @@ namespace boost { std::basic_string<CharType> to_utf(char const *text,std::string const &charset,method_type how=default_method) { char const *text_end = text; - while(*text_end) + while(*text_end) text_end++; return to_utf<CharType>(text,text_end,charset,how); } @@ -103,7 +101,7 @@ namespace boost { std::string from_utf(CharType const *text,std::string const &charset,method_type how=default_method) { CharType const *text_end = text; - while(*text_end) + while(*text_end) text_end++; return from_utf(text,text_end,charset,how); } @@ -112,7 +110,7 @@ namespace boost { /// Convert a \a text in locale encoding given by \a loc to UTF /// /// \note throws std::bad_cast if the loc does not have \ref info facet installed - /// + /// template<typename CharType> std::basic_string<CharType> to_utf(std::string const &text,std::locale const &loc,method_type how=default_method) { @@ -123,7 +121,7 @@ namespace boost { /// Convert a \a text in UTF to locale encoding given by \a loc /// /// \note throws std::bad_cast if the loc does not have \ref info facet installed - /// + /// template<typename CharType> std::string from_utf(std::basic_string<CharType> const &text,std::locale const &loc,method_type how=default_method) { @@ -134,12 +132,12 @@ namespace boost { /// Convert a \a text in locale encoding given by \a loc to UTF /// /// \note throws std::bad_cast if the loc does not have \ref info facet installed - /// + /// template<typename CharType> std::basic_string<CharType> to_utf(char const *text,std::locale const &loc,method_type how=default_method) { char const *text_end = text; - while(*text_end) + while(*text_end) text_end++; return to_utf<CharType>(text,text_end,loc,how); } @@ -148,12 +146,12 @@ namespace boost { /// Convert a \a text in UTF to locale encoding given by \a loc /// /// \note throws std::bad_cast if the loc does not have \ref info facet installed - /// + /// template<typename CharType> std::string from_utf(CharType const *text,std::locale const &loc,method_type how=default_method) { CharType const *text_end = text; - while(*text_end) + while(*text_end) text_end++; return from_utf(text,text_end,loc,how); } @@ -162,7 +160,7 @@ namespace boost { /// /// Convert a text in range [begin,end) to \a to_encoding from \a from_encoding /// - + BOOST_LOCALE_DECL std::string between(char const *begin, char const *end, @@ -173,7 +171,7 @@ namespace boost { /// /// Convert a \a text to \a to_encoding from \a from_encoding /// - + inline std::string between(char const *text, std::string const &to_encoding, @@ -197,7 +195,7 @@ namespace boost { { return boost::locale::conv::between(text.c_str(),text.c_str()+text.size(),to_encoding,from_encoding,how); } - + /// \cond INTERNAL template<> @@ -244,5 +242,4 @@ namespace boost { #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/encoding_errors.hpp b/contrib/restricted/boost/locale/include/boost/locale/encoding_errors.hpp index 42b4bdf4b6..27964121de 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/encoding_errors.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/encoding_errors.hpp @@ -1,27 +1,25 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_ENCODING_ERRORS_HPP_INCLUDED #define BOOST_LOCALE_ENCODING_ERRORS_HPP_INCLUDED -#include <boost/locale/definitions.hpp> +#include <boost/locale/config.hpp> +#include <stdexcept> + #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4275 4251 4231 4660) #endif -#include <stdexcept> - - namespace boost { namespace locale { namespace conv { /// - /// \addtogroup codepage + /// \addtogroup codepage /// /// @{ @@ -32,7 +30,7 @@ namespace boost { public: conversion_error() : std::runtime_error("Conversion failed") {} }; - + /// /// \brief This exception is thrown in case of use of unsupported /// or invalid character set @@ -41,12 +39,12 @@ namespace boost { public: /// Create an error for charset \a charset - invalid_charset_error(std::string charset) : + invalid_charset_error(std::string charset) : std::runtime_error("Invalid or unsupported charset:" + charset) { } }; - + /// /// enum that defines conversion policy @@ -71,5 +69,4 @@ namespace boost { #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/encoding_utf.hpp b/contrib/restricted/boost/locale/include/boost/locale/encoding_utf.hpp index 9620a2f4b9..558e7248cc 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/encoding_utf.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/encoding_utf.hpp @@ -1,23 +1,21 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_ENCODING_UTF_HPP_INCLUDED #define BOOST_LOCALE_ENCODING_UTF_HPP_INCLUDED #include <boost/locale/utf.hpp> #include <boost/locale/encoding_errors.hpp> #include <iterator> + #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4275 4251 4231 4660) #endif - - namespace boost { namespace locale { namespace conv { @@ -89,5 +87,4 @@ namespace boost { #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/format.hpp b/contrib/restricted/boost/locale/include/boost/locale/format.hpp index 7615c406ee..cffbc94664 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/format.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/format.hpp @@ -1,28 +1,27 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_FORMAT_HPP_INCLUDED #define BOOST_LOCALE_FORMAT_HPP_INCLUDED #include <boost/locale/config.hpp> -#ifdef BOOST_MSVC -# pragma warning(push) -# pragma warning(disable : 4275 4251 4231 4660) -#endif -#include <boost/locale/message.hpp> #include <boost/locale/formatting.hpp> #include <boost/locale/hold_ptr.hpp> - +#include <boost/locale/message.hpp> #include <sstream> +#include <vector> +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4275 4251 4231 4660) +#endif namespace boost { namespace locale { - + /// /// \defgroup format Format /// @@ -44,7 +43,7 @@ namespace boost { writer_(&formattible::void_write) { } - + formattible(formattible const &other) : pointer_(other.pointer_), writer_(other.writer_) @@ -59,7 +58,7 @@ namespace boost { } return *this; } - + template<typename Type> formattible(Type const &value) { @@ -84,7 +83,7 @@ namespace boost { static void void_write(stream_type &output,void const * /*ptr*/) { CharType empty_string[1]={0}; - output<<empty_string; + output << empty_string; } template<typename Type> @@ -92,18 +91,18 @@ namespace boost { { output << *static_cast<Type const *>(ptr); } - + void const *pointer_; writer_type writer_; }; // formattible - + class BOOST_LOCALE_DECL format_parser { public: format_parser(std::ios_base &ios,void *,void (*imbuer)(void *,std::locale const &)); ~format_parser(); - + unsigned get_position(); - + void set_one_flag(std::string const &key,std::string const &value); template<typename CharType> @@ -137,7 +136,7 @@ namespace boost { /// /// For example /// \code - /// cout << format("Hello {1}, you are {2} years old") % name % age << endl; + /// std::cout << format("Hello {1}, you are {2} years old") % name % age << std::endl; /// \endcode /// /// Formatting is enclosed between curly brackets \c { \c } and defined by a comma separated list of flags in the format key[=value] @@ -149,8 +148,8 @@ namespace boost { /// /// For example: /// - /// \code - /// cout << format("The height of water at {1,time} is {2,num=fixed,precision=3}") % time % height; + /// \code + /// std::cout << format("The height of water at {1,time} is {2,num=fixed,precision=3}") % time % height; /// \endcode /// /// The special key -- a number without a value defines the position of an input parameter. @@ -161,10 +160,10 @@ namespace boost { /// - \c oct -- display in octal format /// - \c sci or \c scientific -- display in scientific format /// - \c fix or \c fixed -- display in fixed format - /// . + /// . /// For example \c number=sci /// - \c cur or \c currency -- format currency. Optional values are: - /// + /// /// - \c iso -- display using ISO currency symbol. /// - \c nat or \c national -- display using national currency symbol. /// . @@ -185,39 +184,39 @@ namespace boost { /// - \c locale -- with parameter -- switch locale for current operation. This command generates locale /// with formatting facets giving more fine grained control of formatting. For example: /// \code - /// cout << format("Today {1,date} ({1,date,locale=he_IL.UTF-8@calendar=hebrew,date} Hebrew Date)") % date; + /// std::cout << format("Today {1,date} ({1,date,locale=he_IL.UTF-8@calendar=hebrew,date} Hebrew Date)") % date; /// \endcode /// - \c timezone or \c tz -- the name of the timezone to display the time in. For example:\n /// \code - /// cout << format("Time is: Local {1,time}, ({1,time,tz=EET} Eastern European Time)") % date; + /// std::cout << format("Time is: Local {1,time}, ({1,time,tz=EET} Eastern European Time)") % date; /// \endcode /// - \c local - display the time in local time /// - \c gmt - display the time in UTC time scale /// \code - /// cout << format("Local time is: {1,time,local}, universal time is {1,time,gmt}") % time; + /// std::cout << format("Local time is: {1,time,local}, universal time is {1,time,gmt}") % time; /// \endcode - /// - /// + /// + /// /// Invalid formatting strings are slightly ignored. This would prevent from translator /// to crash the program in unexpected location. - /// + /// template<typename CharType> class basic_format { public: typedef CharType char_type; ///< Underlying character type typedef basic_message<char_type> message_type; ///< The translation message type /// \cond INTERNAL - typedef details::formattible<CharType> formattible_type; - /// \endcond + typedef details::formattible<CharType> formattible_type; + /// \endcond typedef std::basic_string<CharType> string_type; ///< string type for this type of character typedef std::basic_ostream<CharType> stream_type; ///< output stream type for this type of character - + /// /// Create a format class for \a format_string /// - basic_format(string_type format_string) : + basic_format(string_type format_string) : format_(format_string), translate_(false), parameters_count_(0) @@ -227,7 +226,7 @@ namespace boost { /// Create a format class using message \a trans. The message if translated first according /// to the rules of target locale and then interpreted as format string /// - basic_format(message_type const &trans) : + basic_format(message_type const &trans) : message_(trans), translate_(true), parameters_count_(0) @@ -266,17 +265,17 @@ namespace boost { format = message_.str(out.getloc(),ios_info::get(out).domain_id()); else format = format_; - + format_output(out,format); } - - + + private: class format_guard { public: - format_guard(details::format_parser &fmt) : + format_guard(details::format_parser &fmt) : fmt_(&fmt), restored_(false) { @@ -300,7 +299,7 @@ namespace boost { details::format_parser *fmt_; bool restored_; }; - + void format_output(stream_type &out,string_type const &sformat) const { char_type obrk='{'; @@ -319,7 +318,7 @@ namespace boost { pos+=2; } else { - out<<format[pos]; + out << format[pos]; pos++; } continue; @@ -331,12 +330,12 @@ namespace boost { continue; } pos++; - + details::format_parser fmt(out,static_cast<void *>(&out),&basic_format::imbue_locale); format_guard guard(fmt); - while(pos < size) { + while(pos < size) { std::string key; std::string svalue; string_type value; @@ -384,9 +383,9 @@ namespace boost { if(use_svalue) { fmt.set_one_flag(key,svalue); } - else + else fmt.set_flag_with_str(key,value); - + if(format[pos]==comma) { pos++; continue; @@ -398,7 +397,7 @@ namespace boost { pos++; break; } - else { + else { guard.restore(); break; } @@ -406,9 +405,9 @@ namespace boost { } } - + // - // Non-copyable + // Non-copyable // basic_format(basic_format const &other); void operator=(basic_format const &other); @@ -417,7 +416,7 @@ namespace boost { { if(parameters_count_ >= base_params_) ext_params_.push_back(param); - else + else parameters_[parameters_count_] = param; parameters_count_++; } @@ -440,7 +439,7 @@ namespace boost { static unsigned const base_params_ = 8; - + message_type message_; string_type format_; bool translate_; @@ -512,5 +511,4 @@ namespace boost { /// /// -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/formatting.hpp b/contrib/restricted/boost/locale/include/boost/locale/formatting.hpp index c16b509231..d7111ebbb6 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/formatting.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/formatting.hpp @@ -1,26 +1,26 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_FORMATTING_HPP_INCLUDED #define BOOST_LOCALE_FORMATTING_HPP_INCLUDED #include <boost/locale/config.hpp> -#ifdef BOOST_MSVC -# pragma warning(push) -# pragma warning(disable : 4275 4251 4231 4660) -#endif -#include <boost/cstdint.hpp> #include <boost/locale/time_zone.hpp> -#include <ostream> +#include <boost/cstdint.hpp> +#include <cstring> #include <istream> +#include <ostream> #include <string> -#include <string.h> #include <typeinfo> +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4275 4251 4231 4660) +#endif + namespace boost { namespace locale { /// @@ -86,7 +86,7 @@ namespace boost { domain_id ///< Domain code - for message formatting } value_type; - + } // flags /// @@ -116,37 +116,37 @@ namespace boost { /// Set a flags that define a way for format data like number, spell, currency etc. /// void display_flags(uint64_t flags); - + /// /// Set a flags that define how to format currency /// void currency_flags(uint64_t flags); - + /// /// Set a flags that define how to format date /// void date_flags(uint64_t flags); - + /// /// Set a flags that define how to format time /// void time_flags(uint64_t flags); - + /// /// Set a flags that define how to format both date and time /// void datetime_flags(uint64_t flags); - + /// /// Set special message domain identification /// void domain_id(int); - + /// /// Set time zone for formatting dates and time /// void time_zone(std::string const &); - + /// /// Set date/time pattern (strftime like) @@ -163,18 +163,18 @@ namespace boost { /// Get a flags that define a way for format data like number, spell, currency etc. /// uint64_t display_flags() const; - + /// /// Get a flags that define how to format currency /// uint64_t currency_flags() const; - + /// /// Get a flags that define how to format date /// uint64_t date_flags() const; - + /// /// Get a flags that define how to format time /// @@ -184,17 +184,17 @@ namespace boost { /// Get a flags that define how to format both date and time /// uint64_t datetime_flags() const; - + /// /// Get special message domain identification /// int domain_id() const; - + /// /// Get time zone for formatting dates and time /// std::string time_zone() const; - + /// /// Get date/time pattern (strftime like) /// @@ -204,26 +204,26 @@ namespace boost { string_set const &s = date_time_pattern_set(); return s.get<CharType>(); } - + /// \cond INTERNAL void on_imbue(); /// \endcond - + private: class string_set; string_set const &date_time_pattern_set() const; string_set &date_time_pattern_set(); - + class BOOST_LOCALE_DECL string_set { public: - string_set(); + string_set(); ~string_set(); string_set(string_set const &other); string_set const &operator=(string_set const &other); void swap(string_set &other); - + template<typename Char> void set(Char const *s) { @@ -278,7 +278,7 @@ namespace boost { /// Format values with "POSIX" or "C" locale. Note, if locale was created with additional non-classic locale then /// These numbers may be localized /// - + inline std::ios_base & posix(std::ios_base & ios) { ios_info::get(ios).display_flags(flags::posix); @@ -294,7 +294,7 @@ namespace boost { ios_info::get(ios).display_flags(flags::number); return ios; } - + /// /// Format currency, number is treated like amount of money /// @@ -303,7 +303,7 @@ namespace boost { ios_info::get(ios).display_flags(flags::currency); return ios; } - + /// /// Format percent, value 0.3 is treated as 30%. /// @@ -312,7 +312,7 @@ namespace boost { ios_info::get(ios).display_flags(flags::percent); return ios; } - + /// /// Format a date, number is treated as POSIX time /// @@ -349,7 +349,7 @@ namespace boost { ios_info::get(ios).display_flags(flags::strftime); return ios; } - + /// /// Spell the number, like "one hundred and ten" /// @@ -358,7 +358,7 @@ namespace boost { ios_info::get(ios).display_flags(flags::spellout); return ios; } - + /// /// Write an order of the number like 4th. /// @@ -483,10 +483,10 @@ namespace boost { { ios_info::get(ios).date_flags(flags::date_full); return ios; - } - - - /// \cond INTERNAL + } + + + /// \cond INTERNAL namespace details { template<typename CharType> struct add_ftime { @@ -507,7 +507,7 @@ namespace boost { fmt.apply(out); return out; } - + template<typename CharType> std::basic_istream<CharType> &operator>>(std::basic_istream<CharType> &in,add_ftime<CharType> const &fmt) { @@ -516,7 +516,7 @@ namespace boost { } } - /// \endcond + /// \endcond /// /// Set strftime like formatting string @@ -558,7 +558,7 @@ namespace boost { #ifdef BOOST_LOCALE_DOXYGEN unspecified_type #else - details::add_ftime<CharType> + details::add_ftime<CharType> #endif ftime(std::basic_string<CharType> const &format) { @@ -574,7 +574,7 @@ namespace boost { #ifdef BOOST_LOCALE_DOXYGEN unspecified_type #else - details::add_ftime<CharType> + details::add_ftime<CharType> #endif ftime(CharType const *format) { @@ -594,7 +594,7 @@ namespace boost { ios_info::get(out).time_zone(fmt.id); return out; } - + template<typename CharType> std::basic_istream<CharType> &operator>>(std::basic_istream<CharType> &in,set_timezone const &fmt) { @@ -603,10 +603,10 @@ namespace boost { } } /// \endcond - + /// /// Set GMT time zone to stream - /// + /// inline std::ios_base &gmt(std::ios_base &ios) { ios_info::get(ios).time_zone("GMT"); @@ -625,13 +625,13 @@ namespace boost { /// /// Set time zone using \a id /// - inline + inline #ifdef BOOST_LOCALE_DOXYGEN unspecified_type #else - details::set_timezone + details::set_timezone #endif - time_zone(char const *id) + time_zone(char const *id) { details::set_timezone tz; tz.id=id; @@ -641,13 +641,13 @@ namespace boost { /// /// Set time zone using \a id /// - inline + inline #ifdef BOOST_LOCALE_DOXYGEN unspecified_type #else - details::set_timezone - #endif - time_zone(std::string const &id) + details::set_timezone + #endif + time_zone(std::string const &id) { details::set_timezone tz; tz.id=id; @@ -660,7 +660,7 @@ namespace boost { /// } // as manipulators - + } // locale } // boost @@ -670,4 +670,3 @@ namespace boost { #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/generator.hpp b/contrib/restricted/boost/locale/include/boost/locale/generator.hpp index 97a6fb53ff..75e9389b05 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/generator.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/generator.hpp @@ -1,30 +1,27 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_GENERATOR_HPP #define BOOST_LOCALE_GENERATOR_HPP #include <boost/locale/config.hpp> +#include <boost/locale/hold_ptr.hpp> #include <boost/cstdint.hpp> +#include <string> +#include <locale> +#include <memory> + #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4275 4251 4231 4660) #endif -#include <string> -#include <locale> -#include <memory> -#include <boost/locale/hold_ptr.hpp> namespace boost { - template<typename Type> - class shared_ptr; - /// - /// \brief This is the main namespace that encloses all localization classes + /// \brief This is the main namespace that encloses all localization classes /// namespace locale { @@ -40,7 +37,7 @@ namespace boost { static const uint32_t character_first_facet = char_facet; ///< First facet specific for character type static const uint32_t character_last_facet = char32_t_facet; ///< Last facet specific for character type static const uint32_t all_characters = 0xFFFF; ///< Special mask -- generate all - + typedef uint32_t character_facet_type; ///<type that specifies the character type that locales can be generated for static const uint32_t convert_facet = 1 << 0; ///< Generate conversion facets @@ -50,19 +47,19 @@ namespace boost { static const uint32_t message_facet = 1 << 4; ///< Generate message facets static const uint32_t codepage_facet = 1 << 5; ///< Generate character set conversion facets (derived from std::codecvt) static const uint32_t boundary_facet = 1 << 6; ///< Generate boundary analysis facet - + static const uint32_t per_character_facet_first = convert_facet; ///< First facet specific for character static const uint32_t per_character_facet_last = boundary_facet; ///< Last facet specific for character static const uint32_t calendar_facet = 1 << 16; ///< Generate boundary analysis facet static const uint32_t information_facet = 1 << 17; ///< Generate general locale information facet - static const uint32_t non_character_facet_first = calendar_facet; ///< First character independent facet - static const uint32_t non_character_facet_last = information_facet;///< Last character independent facet + static const uint32_t non_character_facet_first = calendar_facet; ///< First character independent facet + static const uint32_t non_character_facet_last = information_facet;///< Last character independent facet + - static const uint32_t all_categories = 0xFFFFFFFFu; ///< Generate all of them - + typedef uint32_t locale_category_type; ///< a type used for more fine grained generation of facets /// @@ -76,11 +73,11 @@ namespace boost { public: /// - /// Create new generator using global localization_backend_manager + /// Create new generator using global localization_backend_manager /// generator(); /// - /// Create new generator using specific localization_backend_manager + /// Create new generator using specific localization_backend_manager /// generator(localization_backend_manager const &); @@ -94,7 +91,7 @@ namespace boost { /// Get types of facets that should be generated, default all /// locale_category_type categories() const; - + /// /// Set the characters type for which the facets should be generated, default all supported /// @@ -143,13 +140,13 @@ namespace boost { /// /// - Under the Windows platform the path is treated as a path in the locale's encoding so /// if you create locale "en_US.windows-1251" then path would be treated as cp1255, - /// and if it is en_US.UTF-8 it is treated as UTF-8. File name is always opened with + /// and if it is en_US.UTF-8 it is treated as UTF-8. File name is always opened with /// a wide file name as wide file names are the native file name on Windows. /// /// - Under POSIX platforms all paths passed as-is regardless of encoding as narrow /// encodings are the native encodings for POSIX platforms. - /// - /// + /// + /// void add_messages_path(std::string const &path); /// @@ -202,7 +199,7 @@ namespace boost { { return generate(id); } - + /// /// Set backend specific option /// @@ -215,7 +212,7 @@ namespace boost { private: - void set_all_options(shared_ptr<localization_backend> backend,std::string const &id) const; + void set_all_options(localization_backend& backend,std::string const &id) const; generator(generator const &); void operator=(generator const &); @@ -232,5 +229,4 @@ namespace boost { #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/generic_codecvt.hpp b/contrib/restricted/boost/locale/include/boost/locale/generic_codecvt.hpp index f6eb9c374a..ab3d50771e 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/generic_codecvt.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/generic_codecvt.hpp @@ -1,10 +1,9 @@ // -// Copyright (c) 2015 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2015 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_GENERIC_CODECVT_HPP #define BOOST_LOCALE_GENERIC_CODECVT_HPP @@ -47,7 +46,7 @@ public: /// /// Implementations should dervide from this class defining itself as CodecvtImpl and provide following members /// -/// - `state_type` - a type of special object that allows to store intermediate cached data, for example `iconv_t` descriptor +/// - `state_type` - a type of special object that allows to store intermediate cached data, for example `iconv_t` descriptor /// - `state_type initial_state(generic_codecvt_base::initial_convertion_state direction) const` - member function that creates initial state /// - `int max_encoding_length() const` - a maximal length that one Unicode code point is represented, for UTF-8 for example it is 4 from ISO-8859-1 it is 1 /// - `utf::code_point to_unicode(state_type &state,char const *&begin,char const *end)` - extract first code point from the text in range [begin,end), in case of success begin would point to the next character sequence to be encoded to next code point, in case of incomplete sequence - utf::incomplete shell be returned, and in case of invalid input sequence utf::illegal shell be returned and begin would remain unmodified @@ -59,12 +58,12 @@ public: /// \code /// /// template<typename CharType> -/// class latin1_codecvt :boost::locale::generic_codecvt<CharType,latin1_codecvt<CharType> > +/// class latin1_codecvt :boost::locale::generic_codecvt<CharType,latin1_codecvt<CharType> > /// { /// public: -/// -/// /* Standard codecvt constructor */ -/// latin1_codecvt(size_t refs = 0) : boost::locale::generic_codecvt<CharType,latin1_codecvt<CharType> >(refs) +/// +/// /* Standard codecvt constructor */ +/// latin1_codecvt(size_t refs = 0) : boost::locale::generic_codecvt<CharType,latin1_codecvt<CharType> >(refs) /// { /// } /// @@ -75,7 +74,7 @@ public: /// { /// return state_type(); /// } -/// +/// /// int max_encoding_length() const /// { /// return 1; @@ -85,7 +84,7 @@ public: /// { /// if(begin == end) /// return boost::locale::utf::incomplete; -/// return *begin++; +/// return *begin++; /// } /// /// boost::locale::utf::code_point from_unicode(state_type &,boost::locale::utf::code_point u,char *begin,char const *end) const @@ -95,23 +94,23 @@ public: /// if(begin == end) /// return boost::locale::utf::incomplete; /// *begin = u; -/// return 1; +/// return 1; /// } /// }; -/// +/// /// \endcode -/// +/// /// When external tools used for encoding conversion, the `state_type` is useful to save objects used for conversions. For example, /// icu::UConverter can be saved in such a state for an efficient use: /// /// \code /// template<typename CharType> -/// class icu_codecvt :boost::locale::generic_codecvt<CharType,icu_codecvt<CharType> > +/// class icu_codecvt :boost::locale::generic_codecvt<CharType,icu_codecvt<CharType> > /// { /// public: -/// -/// /* Standard codecvt constructor */ -/// icu_codecvt(std::string const &name,refs = 0) : +/// +/// /* Standard codecvt constructor */ +/// icu_codecvt(std::string const &name,refs = 0) : /// boost::locale::generic_codecvt<CharType,latin1_codecvt<CharType> >(refs) /// { ... } /// @@ -124,7 +123,7 @@ public: /// state_type ptr(ucnv_safeClone(converter_,0,0,&err,ucnv_close); /// return std::move(ptr); /// } -/// +/// /// boost::locale::utf::code_point to_unicode(state_type &ptr,char const *&begin,char const *end) const /// { /// UErrorCode err = U_ZERO_ERROR; @@ -154,7 +153,7 @@ public: typedef CharType uchar; - generic_codecvt(size_t refs = 0) : + generic_codecvt(size_t refs = 0) : std::codecvt<CharType,char,std::mbstate_t>(refs) { } @@ -166,39 +165,39 @@ public: protected: - virtual std::codecvt_base::result do_unshift(std::mbstate_t &s,char *from,char * /*to*/,char *&next) const + std::codecvt_base::result do_unshift(std::mbstate_t &s,char *from,char * /*to*/,char *&next) const BOOST_OVERRIDE { boost::uint16_t &state = *reinterpret_cast<boost::uint16_t *>(&s); -#ifdef DEBUG_CODECVT +#ifdef DEBUG_CODECVT std::cout << "Entering unshift " << std::hex << state << std::dec << std::endl; -#endif +#endif if(state != 0) return std::codecvt_base::error; next=from; return std::codecvt_base::ok; } - virtual int do_encoding() const noexcept + int do_encoding() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE { return 0; } - virtual int do_max_length() const noexcept + int do_max_length() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE { return implementation().max_encoding_length(); } - virtual bool do_always_noconv() const noexcept + bool do_always_noconv() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE { return false; } - virtual int - do_length( std::mbstate_t + int + do_length( std::mbstate_t #ifdef BOOST_LOCALE_DO_LENGTH_MBSTATE_CONST - const + const #endif &std_state, char const *from, char const *from_end, - size_t max) const + size_t max) const BOOST_OVERRIDE { #ifndef BOOST_LOCALE_DO_LENGTH_MBSTATE_CONST char const *save_from = from; @@ -208,8 +207,7 @@ protected: boost::uint16_t state = *reinterpret_cast<boost::uint16_t const *>(&std_state); #endif - typedef typename CodecvtImpl::state_type state_type; - state_type cvt_state = implementation().initial_state(generic_codecvt_base::to_unicode_state); + typename CodecvtImpl::state_type cvt_state = implementation().initial_state(generic_codecvt_base::to_unicode_state); while(max > 0 && from < from_end){ char const *prev_from = from; boost::uint32_t ch=implementation().to_unicode(cvt_state,from,from_end); @@ -226,46 +224,45 @@ protected: else { state = 0; } - } + } } #ifndef BOOST_LOCALE_DO_LENGTH_MBSTATE_CONST - return from - save_from; + return static_cast<int>(from - save_from); #else - return save_max - max; + return static_cast<int>(save_max - max); #endif } - - virtual std::codecvt_base::result + + std::codecvt_base::result do_in( std::mbstate_t &std_state, char const *from, char const *from_end, char const *&from_next, uchar *to, uchar *to_end, - uchar *&to_next) const + uchar *&to_next) const BOOST_OVERRIDE { std::codecvt_base::result r=std::codecvt_base::ok; - + // mbstate_t is POD type and should be initialized to 0 (i.a. state = stateT()) // according to standard. We use it to keep a flag 0/1 for surrogate pair writing // // if 0 no code above >0xFFFF observed, of 1 a code above 0xFFFF observerd // and first pair is written, but no input consumed boost::uint16_t &state = *reinterpret_cast<boost::uint16_t *>(&std_state); - typedef typename CodecvtImpl::state_type state_type; - state_type cvt_state = implementation().initial_state(generic_codecvt_base::to_unicode_state); + typename CodecvtImpl::state_type cvt_state = implementation().initial_state(generic_codecvt_base::to_unicode_state); while(to < to_end && from < from_end) { -#ifdef DEBUG_CODECVT - std::cout << "Entering IN--------------" << std::endl; - std::cout << "State " << std::hex << state <<std::endl; +#ifdef DEBUG_CODECVT + std::cout << "Entering IN--------------\n"; + std::cout << "State " << std::hex << state << std::endl; std::cout << "Left in " << std::dec << from_end - from << " out " << to_end -to << std::endl; -#endif +#endif char const *from_saved = from; - + uint32_t ch=implementation().to_unicode(cvt_state,from,from_end); - + if(ch==boost::locale::utf::illegal) { from = from_saved; r=std::codecvt_base::error; @@ -278,7 +275,7 @@ protected: } // Normal codepoints go direcly to stream if(ch <= 0xFFFF) { - *to++=ch; + *to++ = static_cast<uchar>(ch); } else { // for other codepoints we do following @@ -291,10 +288,8 @@ protected: // once again and then we would consume our input together with writing // second surrogate pair ch-=0x10000; - boost::uint16_t vh = ch >> 10; - boost::uint16_t vl = ch & 0x3FF; - boost::uint16_t w1 = vh + 0xD800; - boost::uint16_t w2 = vl + 0xDC00; + boost::uint16_t w1 = static_cast<boost::uint16_t>(0xD800 | (ch >> 10)); + boost::uint16_t w2 = static_cast<boost::uint16_t>(0xDC00 | (ch & 0x3FF)); if(state == 0) { from = from_saved; *to++ = w1; @@ -310,62 +305,61 @@ protected: to_next=to; if(r == std::codecvt_base::ok && (from!=from_end || state!=0)) r = std::codecvt_base::partial; -#ifdef DEBUG_CODECVT +#ifdef DEBUG_CODECVT std::cout << "Returning "; switch(r) { case std::codecvt_base::ok: - std::cout << "ok" << std::endl; + std::cout << "ok\n"; break; case std::codecvt_base::partial: - std::cout << "partial" << std::endl; + std::cout << "partial\n"; break; case std::codecvt_base::error: - std::cout << "error" << std::endl; + std::cout << "error\n"; break; default: - std::cout << "other" << std::endl; + std::cout << "other\n"; break; } - std::cout << "State " << std::hex << state <<std::endl; + std::cout << "State " << std::hex << state << std::endl; std::cout << "Left in " << std::dec << from_end - from << " out " << to_end -to << std::endl; -#endif +#endif return r; } - - virtual std::codecvt_base::result + + std::codecvt_base::result do_out( std::mbstate_t &std_state, uchar const *from, uchar const *from_end, uchar const *&from_next, char *to, char *to_end, - char *&to_next) const + char *&to_next) const BOOST_OVERRIDE { std::codecvt_base::result r=std::codecvt_base::ok; // mbstate_t is POD type and should be initialized to 0 (i.a. state = stateT()) // according to standard. We assume that sizeof(mbstate_t) >=2 in order - // to be able to store first observerd surrogate pair + // to be able to store first observed surrogate pair // // State: state!=0 - a first surrogate pair was observerd (state = first pair), // we expect the second one to come and then zero the state /// boost::uint16_t &state = *reinterpret_cast<boost::uint16_t *>(&std_state); - typedef typename CodecvtImpl::state_type state_type; - state_type cvt_state = implementation().initial_state(generic_codecvt_base::from_unicode_state); + typename CodecvtImpl::state_type cvt_state = implementation().initial_state(generic_codecvt_base::from_unicode_state); while(to < to_end && from < from_end) { -#ifdef DEBUG_CODECVT - std::cout << "Entering OUT --------------" << std::endl; - std::cout << "State " << std::hex << state <<std::endl; +#ifdef DEBUG_CODECVT + std::cout << "Entering OUT --------------\n"; + std::cout << "State " << std::hex << state << std::endl; std::cout << "Left in " << std::dec << from_end - from << " out " << to_end -to << std::endl; -#endif +#endif boost::uint32_t ch=0; if(state != 0) { - // if the state idecates that 1st surrogate pair was written + // if the state indicates that 1st surrogate pair was written // we should make sure that the second one that comes is actually // second surrogate boost::uint16_t w1 = state; - boost::uint16_t w2 = *from; + boost::uint16_t w2 = *from; // we don't forward from as writing may fail to incomplete or // partial conversion if(0xDC00 <= w2 && w2<=0xDFFF) { @@ -386,12 +380,12 @@ protected: // it into the state and consume it, note we don't // go forward as it should be illegal so we increase // the from pointer manually - state = ch; + state = static_cast<uint16_t>(ch); from++; continue; } else if(0xDC00 <= ch && ch<=0xDFFF) { - // if we observe second surrogate pair and + // if we observe second surrogate pair and // first only may be expected we should break from the loop with error // as it is illegal input r=std::codecvt_base::error; @@ -420,28 +414,28 @@ protected: to_next=to; if(r==std::codecvt_base::ok && from!=from_end) r = std::codecvt_base::partial; -#ifdef DEBUG_CODECVT +#ifdef DEBUG_CODECVT std::cout << "Returning "; switch(r) { case std::codecvt_base::ok: - std::cout << "ok" << std::endl; + std::cout << "ok\n"; break; case std::codecvt_base::partial: - std::cout << "partial" << std::endl; + std::cout << "partial\n"; break; case std::codecvt_base::error: - std::cout << "error" << std::endl; + std::cout << "error\n"; break; default: - std::cout << "other" << std::endl; + std::cout << "other\n"; break; } - std::cout << "State " << std::hex << state <<std::endl; + std::cout << "State " << std::hex << state << std::endl; std::cout << "Left in " << std::dec << from_end - from << " out " << to_end -to << std::endl; -#endif +#endif return r; } - + }; /// @@ -456,53 +450,52 @@ class generic_codecvt<CharType,CodecvtImpl,4> : public std::codecvt<CharType,cha public: typedef CharType uchar; - generic_codecvt(size_t refs = 0) : + generic_codecvt(size_t refs = 0) : std::codecvt<CharType,char,std::mbstate_t>(refs) { } - + CodecvtImpl const &implementation() const { return *static_cast<CodecvtImpl const *>(this); } - + protected: - virtual std::codecvt_base::result do_unshift(std::mbstate_t &/*s*/,char *from,char * /*to*/,char *&next) const + std::codecvt_base::result do_unshift(std::mbstate_t &/*s*/,char *from,char * /*to*/,char *&next) const BOOST_OVERRIDE { next=from; return std::codecvt_base::ok; } - virtual int do_encoding() const noexcept + int do_encoding() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE { return 0; } - virtual int do_max_length() const noexcept + int do_max_length() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE { return implementation().max_encoding_length(); } - virtual bool do_always_noconv() const noexcept + bool do_always_noconv() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE { return false; } - virtual int - do_length( std::mbstate_t + int + do_length( std::mbstate_t #ifdef BOOST_LOCALE_DO_LENGTH_MBSTATE_CONST - const - #endif + const + #endif &/*state*/, char const *from, char const *from_end, - size_t max) const + size_t max) const BOOST_OVERRIDE { - #ifndef BOOST_LOCALE_DO_LENGTH_MBSTATE_CONST + #ifndef BOOST_LOCALE_DO_LENGTH_MBSTATE_CONST char const *start_from = from; #else size_t save_max = max; #endif - typedef typename CodecvtImpl::state_type state_type; - state_type cvt_state = implementation().initial_state(generic_codecvt_base::to_unicode_state); + typename CodecvtImpl::state_type cvt_state = implementation().initial_state(generic_codecvt_base::to_unicode_state); while(max > 0 && from < from_end){ char const *save_from = from; boost::uint32_t ch=implementation().to_unicode(cvt_state,from,from_end); @@ -512,25 +505,25 @@ protected: } max--; } - #ifndef BOOST_LOCALE_DO_LENGTH_MBSTATE_CONST + #ifndef BOOST_LOCALE_DO_LENGTH_MBSTATE_CONST return from - start_from; #else return save_max - max; #endif } - - virtual std::codecvt_base::result + + std::codecvt_base::result do_in( std::mbstate_t &/*state*/, char const *from, char const *from_end, char const *&from_next, uchar *to, uchar *to_end, - uchar *&to_next) const + uchar *&to_next) const BOOST_OVERRIDE { std::codecvt_base::result r=std::codecvt_base::ok; - + // mbstate_t is POD type and should be initialized to 0 (i.a. state = stateT()) // according to standard. We use it to keep a flag 0/1 for surrogate pair writing // @@ -540,15 +533,15 @@ protected: state_type cvt_state = implementation().initial_state(generic_codecvt_base::to_unicode_state); while(to < to_end && from < from_end) { -#ifdef DEBUG_CODECVT - std::cout << "Entering IN--------------" << std::endl; - std::cout << "State " << std::hex << state <<std::endl; +#ifdef DEBUG_CODECVT + std::cout << "Entering IN--------------\n"; + std::cout << "State " << std::hex << state << std::endl; std::cout << "Left in " << std::dec << from_end - from << " out " << to_end -to << std::endl; -#endif +#endif char const *from_saved = from; - + uint32_t ch=implementation().to_unicode(cvt_state,from,from_end); - + if(ch==boost::locale::utf::illegal) { r=std::codecvt_base::error; from = from_saved; @@ -565,47 +558,47 @@ protected: to_next=to; if(r == std::codecvt_base::ok && from!=from_end) r = std::codecvt_base::partial; -#ifdef DEBUG_CODECVT +#ifdef DEBUG_CODECVT std::cout << "Returning "; switch(r) { case std::codecvt_base::ok: - std::cout << "ok" << std::endl; + std::cout << "ok\n"; break; case std::codecvt_base::partial: - std::cout << "partial" << std::endl; + std::cout << "partial\n"; break; case std::codecvt_base::error: - std::cout << "error" << std::endl; + std::cout << "error\n"; break; default: - std::cout << "other" << std::endl; + std::cout << "other\n"; break; } - std::cout << "State " << std::hex << state <<std::endl; + std::cout << "State " << std::hex << state << std::endl; std::cout << "Left in " << std::dec << from_end - from << " out " << to_end -to << std::endl; -#endif +#endif return r; } - - virtual std::codecvt_base::result + + std::codecvt_base::result do_out( std::mbstate_t &/*std_state*/, uchar const *from, uchar const *from_end, uchar const *&from_next, char *to, char *to_end, - char *&to_next) const + char *&to_next) const BOOST_OVERRIDE { std::codecvt_base::result r=std::codecvt_base::ok; typedef typename CodecvtImpl::state_type state_type; state_type cvt_state = implementation().initial_state(generic_codecvt_base::from_unicode_state); while(to < to_end && from < from_end) { -#ifdef DEBUG_CODECVT - std::cout << "Entering OUT --------------" << std::endl; - std::cout << "State " << std::hex << state <<std::endl; +#ifdef DEBUG_CODECVT + std::cout << "Entering OUT --------------\n"; + std::cout << "State " << std::hex << state << std::endl; std::cout << "Left in " << std::dec << from_end - from << " out " << to_end -to << std::endl; -#endif +#endif boost::uint32_t ch=0; ch = *from; if(!boost::locale::utf::is_valid_codepoint(ch)) { @@ -628,25 +621,25 @@ protected: to_next=to; if(r==std::codecvt_base::ok && from!=from_end) r = std::codecvt_base::partial; -#ifdef DEBUG_CODECVT +#ifdef DEBUG_CODECVT std::cout << "Returning "; switch(r) { case std::codecvt_base::ok: - std::cout << "ok" << std::endl; + std::cout << "ok\n"; break; case std::codecvt_base::partial: - std::cout << "partial" << std::endl; + std::cout << "partial\n"; break; case std::codecvt_base::error: - std::cout << "error" << std::endl; + std::cout << "error\n"; break; default: - std::cout << "other" << std::endl; + std::cout << "other\n"; break; } - std::cout << "State " << std::hex << state <<std::endl; + std::cout << "State " << std::hex << state << std::endl; std::cout << "Left in " << std::dec << from_end - from << " out " << to_end -to << std::endl; -#endif +#endif return r; } }; @@ -673,4 +666,3 @@ public: #endif /// -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/gnu_gettext.hpp b/contrib/restricted/boost/locale/include/boost/locale/gnu_gettext.hpp index d5612ff6ce..7981119a86 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/gnu_gettext.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/gnu_gettext.hpp @@ -1,16 +1,16 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCLAE_GNU_GETTEXT_HPP #define BOOST_LOCLAE_GNU_GETTEXT_HPP #include <boost/locale/message.hpp> #include <boost/function.hpp> #include <stdexcept> +#include <vector> namespace boost { namespace locale { @@ -38,7 +38,7 @@ namespace gnu_gettext { { } - std::string language; ///< The language we load the catalog for, like "ru", "en", "de" + std::string language; ///< The language we load the catalog for, like "ru", "en", "de" std::string country; ///< The country we load the catalog for, like "US", "IL" std::string variant; ///< Language variant, like "euro" so it would look for catalog like de_DE\@euro std::string encoding; ///< Required target charset encoding. Ignored for wide characters. @@ -47,7 +47,7 @@ namespace gnu_gettext { /// /// \brief This type represents GNU Gettext domain name for the messages. /// - /// It consists of two parameters: + /// It consists of two parameters: /// /// - name - the name of the domain - used for opening the file name /// - encoding - the encoding of the keys in the sources, default - UTF-8 @@ -63,7 +63,7 @@ namespace gnu_gettext { /// be "cp1255" and if n is "hello" then the name would be the same but encoding would be /// "UTF-8" /// - domain(std::string const &n) + domain(std::string const &n) { size_t pos = n.find('/'); if(pos==std::string::npos) { @@ -93,14 +93,14 @@ namespace gnu_gettext { } }; - + typedef std::vector<domain> domains_type; ///< Type that defines a list of domains that are loaded ///< The first one is the default one domains_type domains; ///< Message domains - application name, like my_app. So files named my_app.mo ///< would be loaded std::vector<std::string> paths; ///< Paths to search files in. Under MS Windows it uses encoding ///< parameter to convert them to wide OS specific paths. - + /// /// The callback for custom file system support. This callback should read the file named \a file_name /// encoded in \a encoding character set into std::vector<char> and return it. @@ -115,13 +115,13 @@ namespace gnu_gettext { std::vector<char>( std::string const &file_name, std::string const &encoding - ) + ) > callback_type; /// /// The callback for handling custom file systems, if it is empty, the real OS file-system /// is being used. - /// + /// callback_type callback; }; @@ -135,10 +135,10 @@ namespace gnu_gettext { message_format<CharType> *create_messages_facet(messages_info const &info); /// \cond INTERNAL - + template<> BOOST_LOCALE_DECL message_format<char> *create_messages_facet(messages_info const &info); - + template<> BOOST_LOCALE_DECL message_format<wchar_t> *create_messages_facet(messages_info const &info); @@ -146,7 +146,7 @@ namespace gnu_gettext { template<> BOOST_LOCALE_DECL message_format<char16_t> *create_messages_facet(messages_info const &info); #endif - + #ifdef BOOST_LOCALE_ENABLE_CHAR32_T template<> BOOST_LOCALE_DECL message_format<char32_t> *create_messages_facet(messages_info const &info); @@ -163,5 +163,4 @@ namespace gnu_gettext { #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/hold_ptr.hpp b/contrib/restricted/boost/locale/include/boost/locale/hold_ptr.hpp index 6b66b10f4f..aa29f42d18 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/hold_ptr.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/hold_ptr.hpp @@ -1,14 +1,15 @@ // -// Copyright (c) 2010 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2010 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_HOLD_PTR_H #define BOOST_LOCALE_HOLD_PTR_H -namespace boost { +#include <boost/locale/config.hpp> + +namespace boost { namespace locale { /// /// \brief a smart pointer similar to std::auto_ptr but it is non-copyable and the @@ -16,7 +17,7 @@ namespace locale { /// template<typename T> class hold_ptr { - hold_ptr(hold_ptr const &other); // non copyable + hold_ptr(hold_ptr const &other); // non copyable hold_ptr const &operator=(hold_ptr const &other); // non assignable public: /// @@ -31,7 +32,7 @@ namespace locale { /// /// Destroy smart pointer and the object it owns. /// - ~hold_ptr() + ~hold_ptr() { delete ptr_; } @@ -41,15 +42,15 @@ namespace locale { /// T const *get() const { return ptr_; } /// - /// Get a mutable pointer to the object + /// Get a mutable pointer to the object /// T *get() { return ptr_; } - /// + /// /// Get a const reference to the object /// T const &operator *() const { return *ptr_; } - /// + /// /// Get a mutable reference to the object /// T &operator *() { return *ptr_; } @@ -58,7 +59,7 @@ namespace locale { /// T const *operator->() const { return ptr_; } /// - /// Get a mutable pointer to the object + /// Get a mutable pointer to the object /// T *operator->() { return ptr_; } @@ -90,4 +91,3 @@ namespace locale { } // boost #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/info.hpp b/contrib/restricted/boost/locale/include/boost/locale/info.hpp index 814d007218..92e11f44e1 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/info.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/info.hpp @@ -1,20 +1,20 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_INFO_HPP_INCLUDED #define BOOST_LOCALE_INFO_HPP_INCLUDED + #include <boost/locale/config.hpp> +#include <locale> +#include <string> + #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4275 4251 4231 4660) #endif -#include <locale> -#include <string> - namespace boost { namespace locale { @@ -27,7 +27,9 @@ namespace boost { class BOOST_LOCALE_DECL info : public std::locale::facet { public: - static std::locale::id id; ///< This member uniquely defines this facet, required by STL + ~info(); + + static std::locale::id id; ///< This member uniquely defines this facet, required by STL /// /// String information about the locale @@ -47,17 +49,17 @@ namespace boost { utf8_property ///< Non zero value if uses UTF-8 encoding }; - + /// /// Standard facet's constructor - /// + /// info(size_t refs = 0) : std::locale::facet(refs) { } /// /// Get language name /// - std::string language() const + std::string language() const { return get_string_property(language_property); } @@ -98,7 +100,7 @@ namespace boost { { return get_integer_property(utf8_property) != 0; } - + #if defined (__SUNPRO_CC) && defined (_RWSTD_VER) std::locale::id& __get_id (void) const { return id; } #endif @@ -122,4 +124,3 @@ namespace boost { #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/localization_backend.hpp b/contrib/restricted/boost/locale/include/boost/locale/localization_backend.hpp index 95bf3bd2d7..fedc3462b3 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/localization_backend.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/localization_backend.hpp @@ -1,30 +1,31 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_LOCALIZATION_BACKEND_HPP #define BOOST_LOCALE_LOCALIZATION_BACKEND_HPP + #include <boost/locale/config.hpp> #include <boost/locale/generator.hpp> +#include <boost/locale/hold_ptr.hpp> +#include <locale> +#include <memory> +#include <string> +#include <vector> + #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4275 4251 4231 4660) #endif -#include <string> -#include <locale> -#include <vector> -#include <memory> -#include <boost/locale/hold_ptr.hpp> namespace boost { namespace locale { /// /// \brief this class represents a localization backend that can be used for localizing your application. - /// + /// /// Backends are usually registered inside the localization backends manager and allow transparent support /// of different backends, so a user can switch the backend by simply linking the application to the correct one. /// @@ -36,23 +37,19 @@ namespace boost { /// by default /// -# \c message_path - path to the location of message catalogs (vector of strings) /// -# \c message_application - the name of applications that use message catalogs (vector of strings) - /// + /// /// Each backend can be installed with a different default priotiry so when you work with two different backends, you /// can specify priotiry so this backend will be chosen according to their priority. /// - + class localization_backend { localization_backend(localization_backend const &); void operator=(localization_backend const &); public: - localization_backend() - { - } - - virtual ~localization_backend() - { - } + localization_backend() {} + + virtual ~localization_backend() {} /// /// Make a polymorphic copy of the backend @@ -70,11 +67,11 @@ namespace boost { virtual void clear_options() = 0; /// - /// Create a facet for category \a category and character type \a type + /// Create a facet for category \a category and character type \a type /// virtual std::locale install(std::locale const &base,locale_category_type category,character_facet_type type = nochar_facet) = 0; - }; // localization_backend + }; // localization_backend /// @@ -85,15 +82,15 @@ namespace boost { class BOOST_LOCALE_DECL localization_backend_manager { public: /// - /// New empty localization_backend_manager + /// New empty localization_backend_manager /// localization_backend_manager(); /// - /// Copy localization_backend_manager + /// Copy localization_backend_manager /// localization_backend_manager(localization_backend_manager const &); /// - /// Assign localization_backend_manager + /// Assign localization_backend_manager /// localization_backend_manager const &operator=(localization_backend_manager const &); @@ -102,7 +99,7 @@ namespace boost { /// ~localization_backend_manager(); - #if !defined(BOOST_LOCALE_HIDE_AUTO_PTR) && !defined(BOOST_NO_AUTO_PTR) + #if BOOST_LOCALE_USE_AUTO_PTR /// /// Create new localization backend according to current settings. /// @@ -145,29 +142,29 @@ namespace boost { /// Clear backend /// void remove_all_backends(); - + /// /// Get list of all available backends /// std::vector<std::string> get_all_backends() const; - + /// /// Select specific backend by name for a category \a category. It allows combining different /// backends for user preferences. /// void select(std::string const &backend_name,locale_category_type category = all_categories); - + /// /// Set new global backend manager, the old one is returned. /// /// This function is thread safe - /// + /// static localization_backend_manager global(localization_backend_manager const &); /// /// Get global backend manager /// /// This function is thread safe - /// + /// static localization_backend_manager global(); private: class impl; @@ -183,5 +180,4 @@ namespace boost { #endif #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/message.hpp b/contrib/restricted/boost/locale/include/boost/locale/message.hpp index a56bb8ada3..4e2fdf9e1b 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/message.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/message.hpp @@ -1,24 +1,22 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_MESSAGE_HPP_INCLUDED #define BOOST_LOCALE_MESSAGE_HPP_INCLUDED -#include <boost/locale/config.hpp> +#include <boost/locale/formatting.hpp> +#include <locale> +#include <memory> +#include <set> +#include <string> + #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4275 4251 4231 4660) #endif -#include <locale> -#include <string> -#include <vector> -#include <set> -#include <memory> -#include <boost/locale/formatting.hpp> // glibc < 2.3.4 declares those as macros if compiled with optimization turned on #ifdef gettext @@ -31,27 +29,25 @@ namespace boost { namespace locale { /// - /// \defgroup message Message Formatting (translation) + /// \defgroup message Message Formatting (translation) /// ///This module provides message translation functionality, i.e. allow your application to speak native language /// /// @{ - /// + /// - /// \cond INTERNAL + /// \cond INTERNAL template<typename CharType> - struct base_message_format: public std::locale::facet - { - }; - + struct base_message_format; + /// \endcond - + /// /// \brief This facet provides message formatting abilities /// template<typename CharType> - class message_format : public base_message_format<CharType> + class BOOST_SYMBOL_VISIBLE message_format : public base_message_format<CharType> { public: @@ -67,8 +63,7 @@ namespace boost { /// /// Default constructor /// - message_format(size_t refs = 0) : - base_message_format<CharType>(refs) + message_format(size_t refs = 0) : base_message_format<CharType>(refs) { } @@ -80,12 +75,12 @@ namespace boost { /// If \a context is NULL it is not considered to be a part of the key /// /// If a translated string is found, it is returned, otherwise NULL is returned - /// + /// /// virtual char_type const *get(int domain_id,char_type const *context,char_type const *id) const = 0; /// /// This function returns a pointer to the string for a plural message defined by a \a context - /// and identification string \a single_id. + /// and identification string \a single_id. /// /// If \a context is NULL it is not considered to be a part of the key /// @@ -94,7 +89,7 @@ namespace boost { /// number. /// /// If a translated string is found, it is returned, otherwise NULL is returned - /// + /// /// virtual char_type const *get(int domain_id,char_type const *context,char_type const *single_id,int n) const = 0; @@ -117,19 +112,16 @@ namespace boost { std::locale::id& __get_id (void) const { return id; } #endif protected: - virtual ~message_format() - { - } - + virtual ~message_format() {} }; - + /// \cond INTERNAL namespace details { inline bool is_us_ascii_char(char c) { // works for null terminated strings regardless char "signness" - return 0<c && c<0x7F; + return 0<c && c<0x7F; } inline bool is_us_ascii_string(char const *msg) { @@ -171,7 +163,7 @@ namespace boost { /// \brief This class represents a message that can be converted to a specific locale message /// /// It holds the original ASCII string that is queried in the dictionary when converting to the output string. - /// The created string may be UTF-8, UTF-16, UTF-32 or other 8-bit encoded string according to the target + /// The created string may be UTF-8, UTF-16, UTF-32 or other 8-bit encoded string according to the target /// character type and locale encoding. /// template<typename CharType> @@ -184,7 +176,7 @@ namespace boost { /// /// Create default empty message - /// + /// basic_message() : n_(0), c_id_(0), @@ -196,7 +188,7 @@ namespace boost { /// /// Create a simple message from 0 terminated string. The string should exist /// until the message is destroyed. Generally useful with static constant strings - /// + /// explicit basic_message(char_type const *id) : n_(0), c_id_(id), @@ -210,7 +202,7 @@ namespace boost { /// until the message is destroyed. Generally useful with static constant strings. /// /// \a n is the number, \a single and \a plural are singular and plural forms of the message - /// + /// explicit basic_message(char_type const *single,char_type const *plural,int n) : n_(n), c_id_(single), @@ -223,7 +215,7 @@ namespace boost { /// Create a simple message from 0 terminated strings, with context /// information. The string should exist /// until the message is destroyed. Generally useful with static constant strings - /// + /// explicit basic_message(char_type const *context,char_type const *id) : n_(0), c_id_(id), @@ -237,7 +229,7 @@ namespace boost { /// until the message is destroyed. Generally useful with static constant strings. /// /// \a n is the number, \a single and \a plural are singular and plural forms of the message - /// + /// explicit basic_message(char_type const *context,char_type const *single,char_type const *plural,int n) : n_(n), c_id_(single), @@ -263,7 +255,7 @@ namespace boost { /// Create a simple plural form message from strings. /// /// \a n is the number, \a single and \a plural are single and plural forms of the message - /// + /// explicit basic_message(string_type const &single,string_type const &plural,int number) : n_(number), c_id_(0), @@ -291,7 +283,7 @@ namespace boost { /// Create a simple plural form message from strings. /// /// \a n is the number, \a single and \a plural are single and plural forms of the message - /// + /// explicit basic_message(string_type const &context,string_type const &single,string_type const &plural,int number) : n_(number), c_id_(0), @@ -362,7 +354,7 @@ namespace boost { std::locale loc; return str(loc,0); } - + /// /// Translate message to a string in the locale \a locale, using default domain /// @@ -370,10 +362,10 @@ namespace boost { { return str(locale,0); } - + /// /// Translate message to a string using locale \a locale and message domain \a domain_id - /// + /// string_type str(std::locale const &locale,std::string const &domain_id) const { int id=0; @@ -384,7 +376,7 @@ namespace boost { /// /// Translate message to a string using the default locale and message domain \a domain_id - /// + /// string_type str(std::string const &domain_id) const { int id=0; @@ -394,13 +386,13 @@ namespace boost { return str(loc,id); } - + /// /// Translate message to a string using locale \a loc and message domain index \a id - /// + /// string_type str(std::locale const &loc,int id) const { - string_type buffer; + string_type buffer; char_type const *ptr = write(loc,id,buffer); if(ptr == buffer.c_str()) return buffer; @@ -411,7 +403,7 @@ namespace boost { /// - /// Translate message and write to stream \a out, using imbued locale and domain set to the + /// Translate message and write to stream \a out, using imbued locale and domain set to the /// stream /// void write(std::basic_ostream<char_type> &out) const @@ -444,7 +436,7 @@ namespace boost { { return c_id_ ? c_id_ : id_.c_str(); } - + char_type const *write(std::locale const &loc,int domain_id,string_type &buffer) const { char_type const *translated = 0; @@ -453,15 +445,15 @@ namespace boost { char_type const *id = this->id(); char_type const *context = this->context(); char_type const *plural = this->plural(); - + if(*id == 0) return empty_string; - + facet_type const *facet = 0; if(std::has_facet<facet_type>(loc)) facet = &std::use_facet<facet_type>(loc); - if(facet) { + if(facet) { if(!plural) { translated = facet->get(domain_id,context,id); } @@ -531,7 +523,7 @@ namespace boost { /// @{ /// - /// \brief Translate a message, \a msg is not copied + /// \brief Translate a message, \a msg is not copied /// template<typename CharType> inline basic_message<CharType> translate(CharType const *msg) @@ -539,7 +531,7 @@ namespace boost { return basic_message<CharType>(msg); } /// - /// \brief Translate a message in context, \a msg and \a context are not copied + /// \brief Translate a message in context, \a msg and \a context are not copied /// template<typename CharType> inline basic_message<CharType> translate( CharType const *context, @@ -548,7 +540,7 @@ namespace boost { return basic_message<CharType>(context,msg); } /// - /// \brief Translate a plural message form, \a single and \a plural are not copied + /// \brief Translate a plural message form, \a single and \a plural are not copied /// template<typename CharType> inline basic_message<CharType> translate( CharType const *single, @@ -558,7 +550,7 @@ namespace boost { return basic_message<CharType>(single,plural,n); } /// - /// \brief Translate a plural message from in constext, \a context, \a single and \a plural are not copied + /// \brief Translate a plural message from in constext, \a context, \a single and \a plural are not copied /// template<typename CharType> inline basic_message<CharType> translate( CharType const *context, @@ -568,18 +560,18 @@ namespace boost { { return basic_message<CharType>(context,single,plural,n); } - + /// - /// \brief Translate a message, \a msg is copied + /// \brief Translate a message, \a msg is copied /// template<typename CharType> inline basic_message<CharType> translate(std::basic_string<CharType> const &msg) { return basic_message<CharType>(msg); } - + /// - /// \brief Translate a message in context,\a context and \a msg is copied + /// \brief Translate a message in context,\a context and \a msg is copied /// template<typename CharType> inline basic_message<CharType> translate( std::basic_string<CharType> const &context, @@ -588,7 +580,7 @@ namespace boost { return basic_message<CharType>(context,msg); } /// - /// \brief Translate a plural message form in constext, \a context, \a single and \a plural are copied + /// \brief Translate a plural message form in constext, \a context, \a single and \a plural are copied /// template<typename CharType> inline basic_message<CharType> translate( std::basic_string<CharType> const &context, @@ -600,7 +592,7 @@ namespace boost { } /// - /// \brief Translate a plural message form, \a single and \a plural are copied + /// \brief Translate a plural message form, \a single and \a plural are copied /// template<typename CharType> @@ -613,8 +605,8 @@ namespace boost { /// @} - /// - /// \anchor boost_locale_gettext_family \name Direct message translation functions family + /// + /// \anchor boost_locale_gettext_family \name Direct message translation functions family /// /// @@ -710,29 +702,29 @@ namespace boost { /// /// \cond INTERNAL /// - + template<> - struct BOOST_LOCALE_DECL base_message_format<char> : public std::locale::facet + struct BOOST_LOCALE_DECL base_message_format<char> : public std::locale::facet { base_message_format(size_t refs = 0) : std::locale::facet(refs) { } static std::locale::id id; }; - + template<> - struct BOOST_LOCALE_DECL base_message_format<wchar_t> : public std::locale::facet + struct BOOST_LOCALE_DECL base_message_format<wchar_t> : public std::locale::facet { base_message_format(size_t refs = 0) : std::locale::facet(refs) { } static std::locale::id id; }; - + #ifdef BOOST_LOCALE_ENABLE_CHAR16_T template<> - struct BOOST_LOCALE_DECL base_message_format<char16_t> : public std::locale::facet + struct BOOST_LOCALE_DECL base_message_format<char16_t> : public std::locale::facet { base_message_format(size_t refs = 0) : std::locale::facet(refs) { @@ -745,14 +737,14 @@ namespace boost { #ifdef BOOST_LOCALE_ENABLE_CHAR32_T template<> - struct BOOST_LOCALE_DECL base_message_format<char32_t> : public std::locale::facet + struct BOOST_LOCALE_DECL base_message_format<char32_t> : public std::locale::facet { base_message_format(size_t refs = 0) : std::locale::facet(refs) { } static std::locale::id id; }; - + #endif /// \endcond @@ -781,17 +773,17 @@ namespace boost { /// \addtogroup manipulators /// /// @{ - + /// /// Manipulator for switching message domain in ostream, /// /// \note The returned object throws std::bad_cast if the I/O stream does not have \ref message_format facet installed - /// - inline + /// + inline #ifdef BOOST_LOCALE_DOXYGEN unspecified_type #else - details::set_domain + details::set_domain #endif domain(std::string const &id) { @@ -800,7 +792,7 @@ namespace boost { } /// @} } // as - } // locale + } // locale } // boost #ifdef BOOST_MSVC @@ -810,5 +802,4 @@ namespace boost { #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/time_zone.hpp b/contrib/restricted/boost/locale/include/boost/locale/time_zone.hpp index 2c4e76e893..d3af0fa8d4 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/time_zone.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/time_zone.hpp @@ -1,22 +1,20 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_TIME_ZONE_HPP_INCLUDED #define BOOST_LOCALE_TIME_ZONE_HPP_INCLUDED #include <boost/locale/config.hpp> +#include <string> + #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4275 4251 4231 4660) #endif -#include <string> - - namespace boost { namespace locale { /// @@ -51,4 +49,3 @@ namespace boost { #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/utf.hpp b/contrib/restricted/boost/locale/include/boost/locale/utf.hpp index 09f4449ef9..e31e29b081 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/utf.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/utf.hpp @@ -1,19 +1,19 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_UTF_HPP_INCLUDED #define BOOST_LOCALE_UTF_HPP_INCLUDED +#include <boost/locale/config.hpp> #include <boost/cstdint.hpp> namespace boost { namespace locale { /// -/// \brief Namespace that holds basic operations on UTF encoded sequences +/// \brief Namespace that holds basic operations on UTF encoded sequences /// /// All functions defined in this namespace do not require linking with Boost.Locale library /// @@ -50,7 +50,7 @@ namespace utf { { if(v>0x10FFFF) return false; - if(0xD800 <=v && v<= 0xDFFF) // surragates + if(0xD800 <=v && v<= 0xDFFF) // surrogates return false; return true; } @@ -78,7 +78,7 @@ namespace utf { /// Postconditions /// /// - p points to the last consumed character - /// + /// template<typename Iterator> static code_point decode(Iterator &p,Iterator e); @@ -102,7 +102,7 @@ namespace utf { /// Get the size of the trail part of variable length encoded sequence. /// /// Returns -1 if C is not valid lead character - /// + /// static int trail_length(char_type c); /// /// Returns true if c is trail code unit, always false for UTF-32 @@ -116,11 +116,11 @@ namespace utf { /// /// Convert valid Unicode code point \a value to the UTF sequence. /// - /// Requirements: + /// Requirements: /// /// - \a value is valid code point /// - \a out is an output iterator should be able to accept at least width(value) units - /// + /// /// Returns the iterator past the last written code unit. /// template<typename Iterator> @@ -133,7 +133,7 @@ namespace utf { template<typename Iterator> static code_point decode_valid(Iterator &p); }; - + #else template<typename CharType,int size=sizeof(CharType)> @@ -143,8 +143,8 @@ namespace utf { struct utf_traits<CharType,1> { typedef CharType char_type; - - static int trail_length(char_type ci) + + static int trail_length(char_type ci) { unsigned char c = ci; if(c < 128) @@ -159,7 +159,7 @@ namespace utf { return 3; return -1; } - + static const int max_width = 4; static int width(code_point value) @@ -188,7 +188,7 @@ namespace utf { { return !is_trail(ci); } - + template<typename Iterator> static code_point decode(Iterator &p,Iterator e) { @@ -209,8 +209,8 @@ namespace utf { // if(trail_size == 0) return lead; - - code_point c = lead & ((1<<(6-trail_size))-1); + + code_point c = lead & ((1 << (6-trail_size))-1); // Read the rest unsigned char tmp; @@ -222,6 +222,7 @@ namespace utf { if (!is_trail(tmp)) return illegal; c = (c << 6) | ( tmp & 0x3F); + BOOST_FALLTHROUGH; case 2: if(BOOST_LOCALE_UNLIKELY(p==e)) return incomplete; @@ -229,6 +230,7 @@ namespace utf { if (!is_trail(tmp)) return illegal; c = (c << 6) | ( tmp & 0x3F); + BOOST_FALLTHROUGH; case 1: if(BOOST_LOCALE_UNLIKELY(p==e)) return incomplete; @@ -250,7 +252,7 @@ namespace utf { return c; } - + template<typename Iterator> static code_point decode_valid(Iterator &p) { @@ -266,14 +268,16 @@ namespace utf { trail_size = 2; else trail_size = 3; - - code_point c = lead & ((1<<(6-trail_size))-1); + + code_point c = lead & ((1 << (6-trail_size))-1); switch(trail_size) { case 3: c = (c << 6) | ( static_cast<unsigned char>(*p++) & 0x3F); + BOOST_FALLTHROUGH; case 2: c = (c << 6) | ( static_cast<unsigned char>(*p++) & 0x3F); + BOOST_FALLTHROUGH; case 1: c = (c << 6) | ( static_cast<unsigned char>(*p++) & 0x3F); } @@ -397,7 +401,7 @@ namespace utf { } }; // utf16; - + template<typename CharType> struct utf_traits<CharType,4> { typedef CharType char_type; @@ -456,5 +460,4 @@ namespace utf { #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/utf8_codecvt.hpp b/contrib/restricted/boost/locale/include/boost/locale/utf8_codecvt.hpp index a037c3d593..8f02899e6d 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/utf8_codecvt.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/utf8_codecvt.hpp @@ -1,10 +1,9 @@ // -// Copyright (c) 2015 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2015 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_UTF8_CODECVT_HPP #define BOOST_LOCALE_UTF8_CODECVT_HPP @@ -18,12 +17,12 @@ namespace locale { /// /// \brief Geneneric utf8 codecvt facet, it allows to convert UTF-8 strings to UTF-16 and UTF-32 using wchar_t, char32_t and char16_t -/// +/// template<typename CharType> -class utf8_codecvt : public generic_codecvt<CharType,utf8_codecvt<CharType> > +class utf8_codecvt : public generic_codecvt<CharType,utf8_codecvt<CharType> > { public: - + struct state_type {}; utf8_codecvt(size_t refs = 0) : generic_codecvt<CharType,utf8_codecvt<CharType> >(refs) @@ -39,7 +38,7 @@ public: { return state_type(); } - static utf::code_point to_unicode(state_type &,char const *&begin,char const *end) + static utf::code_point to_unicode(state_type &,char const *&begin,char const *end) { char const *p=begin; @@ -49,7 +48,7 @@ public: return c; } - static utf::code_point from_unicode(state_type &,utf::code_point u,char *begin,char const *end) + static utf::code_point from_unicode(state_type &,utf::code_point u,char *begin,char const *end) { if(!utf::is_valid_codepoint(u)) return utf::illegal; @@ -66,4 +65,3 @@ public: #endif /// -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/include/boost/locale/util.hpp b/contrib/restricted/boost/locale/include/boost/locale/util.hpp index c3a79f9448..1b444740fd 100644 --- a/contrib/restricted/boost/locale/include/boost/locale/util.hpp +++ b/contrib/restricted/boost/locale/include/boost/locale/util.hpp @@ -1,20 +1,22 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_UTIL_HPP #define BOOST_LOCALE_UTIL_HPP -#include <locale> -#include <typeinfo> -#include <boost/cstdint.hpp> -#include <boost/locale/utf.hpp> + #include <boost/locale/generator.hpp> +#include <boost/locale/utf.hpp> #include <boost/assert.hpp> +#include <boost/cstdint.hpp> +#include <locale> +#ifndef BOOST_NO_CXX11_SMART_PTR +#include <memory> +#endif +#include <typeinfo> -#include <vector> namespace boost { namespace locale { /// @@ -22,13 +24,13 @@ namespace locale { /// implementations /// namespace util { - + /// /// \brief Return default system locale name in POSIX format. /// /// This function tries to detect the locale using, LC_CTYPE, LC_ALL and LANG environment /// variables in this order and if all of them unset, in POSIX platforms it returns "C" - /// + /// /// On Windows additionally to check the above environment variables, this function /// tries to creates locale name from ISO-339 and ISO-3199 country codes defined /// for user default locale. @@ -57,7 +59,7 @@ namespace util { /// is assumed to be US-ASCII and missing language is assumed to be "C" /// BOOST_LOCALE_DECL - std::locale create_info(std::locale const &in,std::string const &name); + std::locale create_info(std::locale const &in,std::string const &name); /// @@ -74,7 +76,7 @@ namespace util { /// decompose them in case composite characters are found. So be very careful when implementing /// these converters for certain character set. /// - class base_converter { + class BOOST_LOCALE_DECL base_converter { public: /// @@ -85,19 +87,17 @@ namespace util { static const uint32_t illegal=utf::illegal; /// - /// This value is returned in following cases: The of incomplete input sequence was found or + /// This value is returned in following cases: The of incomplete input sequence was found or /// insufficient output buffer was provided so complete output could not be written. /// static const uint32_t incomplete=utf::incomplete; - - virtual ~base_converter() - { - } + + virtual ~base_converter(); /// /// Return the maximal length that one Unicode code-point can be converted to, for example /// for UTF-8 it is 4, for Shift-JIS it is 2 and ISO-8859-1 is 1 /// - virtual int max_len() const + virtual int max_len() const { return 1; } @@ -110,14 +110,14 @@ namespace util { /// for example if you use iconv_t descriptor or UConverter as conversion object return false, /// and this object will be cloned for each use. /// - virtual bool is_thread_safe() const + virtual bool is_thread_safe() const { return false; } /// /// Create a polymorphic copy of this object, usually called only if is_thread_safe() return false /// - virtual base_converter *clone() const + virtual base_converter *clone() const { BOOST_ASSERT(typeid(*this)==typeid(base_converter)); return new base_converter(); @@ -136,9 +136,9 @@ namespace util { /// if invalid input sequence found, i.e. there is a sequence [\a begin, \a code_point_end) such as \a code_point_end <= \a end /// that is illegal for this encoding, \a illegal is returned and begin stays unchanged. For example if *begin = 0xFF and begin < end /// for UTF-8, then \a illegal is returned. - /// /// - virtual uint32_t to_unicode(char const *&begin,char const *end) + /// + virtual uint32_t to_unicode(char const *&begin,char const *end) { if(begin == end) return incomplete; @@ -156,12 +156,12 @@ namespace util { /// \a illegal should be returned /// /// If u can be converted to a sequence of bytes c1, ... , cN (1<= N <= max_len() ) then - /// + /// /// -# If end - begin >= N, c1, ... cN are written starting at begin and N is returned /// -# If end - begin < N, incomplete is returned, it is unspecified what would be /// stored in bytes in range [begin,end) - virtual uint32_t from_unicode(uint32_t u,char *begin,char const *end) + virtual uint32_t from_unicode(uint32_t u,char *begin,char const *end) { if(begin==end) return incomplete; @@ -172,7 +172,7 @@ namespace util { } }; - #if !defined(BOOST_LOCALE_HIDE_AUTO_PTR) && !defined(BOOST_NO_AUTO_PTR) + #if BOOST_LOCALE_USE_AUTO_PTR /// /// This function creates a \a base_converter that can be used for conversion between UTF-8 and /// unicode code points @@ -181,7 +181,7 @@ namespace util { /// /// This function creates a \a base_converter that can be used for conversion between single byte /// character encodings like ISO-8859-1, koi8-r, windows-1255 and Unicode code points, - /// + /// /// If \a encoding is not supported, empty pointer is returned. You should check if /// std::auto_ptr<base_converter>::get() != 0 /// @@ -194,7 +194,7 @@ namespace util { /// /// codecvt facet would convert between narrow and wide/char16_t/char32_t encodings using \a cvt converter. /// If \a cvt is null pointer, always failure conversion would be used that fails on every first input or output. - /// + /// /// Note: the codecvt facet handles both UTF-16 and UTF-32 wide encodings, it knows to break and join /// Unicode code-points above 0xFFFF to and from surrogate pairs correctly. \a cvt should be unaware /// of wide encoding type @@ -212,7 +212,7 @@ namespace util { /// /// This function creates a \a base_converter that can be used for conversion between single byte /// character encodings like ISO-8859-1, koi8-r, windows-1255 and Unicode code points, - /// + /// /// If \a encoding is not supported, empty pointer is returned. You should check if /// std::unique_ptr<base_converter>::get() != 0 /// @@ -224,7 +224,7 @@ namespace util { /// /// codecvt facet would convert between narrow and wide/char16_t/char32_t encodings using \a cvt converter. /// If \a cvt is null pointer, always failure conversion would be used that fails on every first input or output. - /// + /// /// Note: the codecvt facet handles both UTF-16 and UTF-32 wide encodings, it knows to break and join /// Unicode code-points above 0xFFFF to and from surrogate pairs correctly. \a cvt should be unaware /// of wide encoding type @@ -241,7 +241,7 @@ namespace util { /// /// This function creates a \a base_converter that can be used for conversion between single byte /// character encodings like ISO-8859-1, koi8-r, windows-1255 and Unicode code points, - /// + /// /// If \a encoding is not supported, empty pointer is returned. You should check if /// std::unique_ptr<base_converter>::get() != 0 /// @@ -253,34 +253,33 @@ namespace util { /// /// codecvt facet would convert between narrow and wide/char16_t/char32_t encodings using \a cvt converter. /// If \a cvt is null pointer, always failure conversion would be used that fails on every first input or output. - /// + /// /// Note: the codecvt facet handles both UTF-16 and UTF-32 wide encodings, it knows to break and join /// Unicode code-points above 0xFFFF to and from surrogate pairs correctly. \a cvt should be unaware /// of wide encoding type /// - /// ownership of cvt is transfered + /// ownership of cvt is transfered /// BOOST_LOCALE_DECL std::locale create_codecvt_from_pointer(std::locale const &in,base_converter *cvt,character_facet_type type); - /// + /// /// Install utf8 codecvt to UTF-16 or UTF-32 into locale \a in and return - /// new locale that is based on \a in and uses new facet. - /// + /// new locale that is based on \a in and uses new facet. + /// BOOST_LOCALE_DECL std::locale create_utf8_codecvt(std::locale const &in,character_facet_type type); /// /// This function installs codecvt that can be used for conversion between single byte /// character encodings like ISO-8859-1, koi8-r, windows-1255 and Unicode code points, - /// + /// /// Throws boost::locale::conv::invalid_charset_error if the chacater set is not supported or isn't single byte character /// set BOOST_LOCALE_DECL std::locale create_simple_codecvt(std::locale const &in,std::string const &encoding,character_facet_type type); } // util -} // locale +} // locale } // boost #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/encoding/codepage.cpp b/contrib/restricted/boost/locale/src/boost/locale/encoding/codepage.cpp index c19e36b8cf..9888c8925a 100644 --- a/contrib/restricted/boost/locale/src/encoding/codepage.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/encoding/codepage.cpp @@ -1,39 +1,37 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE -#include <boost/config.hpp> +#include <boost/locale/config.hpp> +#include <boost/locale/encoding.hpp> +#include <boost/locale/hold_ptr.hpp> +#include <cstring> +#include <memory> +#include <string> +#include "boost/locale/encoding/conv.hpp" #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) #define BOOST_LOCALE_WITH_WCONV #endif - #ifdef BOOST_LOCALE_WITH_ICONV -#include "iconv_codepage.ipp" +#include "boost/locale/encoding/iconv_codepage.ipp" #endif #ifdef BOOST_LOCALE_WITH_ICU -#include "uconv_codepage.ipp" +#include "boost/locale/encoding/uconv_codepage.ipp" #endif #ifdef BOOST_LOCALE_WITH_WCONV -#include "wconv_codepage.ipp" +#include "boost/locale/encoding/wconv_codepage.ipp" #endif -#include <boost/locale/encoding.hpp> -#include <boost/locale/hold_ptr.hpp> - -#include <string> -#include <cstring> -#include <memory> namespace boost { namespace locale { namespace conv { namespace impl { - + std::string convert_between(char const *begin, char const *end, char const *to_charset, @@ -126,12 +124,12 @@ namespace boost { } return charset; } - - } // impl + + } // impl using namespace impl; - + std::string between(char const *begin,char const *end, std::string const &to_charset,std::string const &from_charset,method_type how) { @@ -197,5 +195,4 @@ namespace boost { -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/encoding/conv.hpp b/contrib/restricted/boost/locale/src/boost/locale/encoding/conv.hpp index 5453aeded5..ddcf9c4de6 100644 --- a/contrib/restricted/boost/locale/src/encoding/conv.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/encoding/conv.hpp @@ -1,10 +1,8 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt #ifndef BOOST_LOCALE_CONV_IMPL_HPP #define BOOST_LOCALE_CONV_IMPL_HPP @@ -53,29 +51,27 @@ namespace boost { } std::string normalize_encoding(char const *encoding); - + inline int compare_encodings(char const *l,char const *r) { return normalize_encoding(l).compare(normalize_encoding(r)); } - + #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) int encoding_to_windows_codepage(char const *ccharset); #endif - + class converter_between { public: typedef char char_type; typedef std::string string_type; - + virtual bool open(char const *to_charset,char const *from_charset,method_type how) = 0; - + virtual std::string convert(char const *begin,char const *end) = 0; - - virtual ~converter_between() - { - } + + virtual ~converter_between() {} }; template<typename CharType> @@ -84,14 +80,12 @@ namespace boost { typedef CharType char_type; typedef std::basic_string<char_type> string_type; - + virtual bool open(char const *charset,method_type how) = 0; - + virtual std::string convert(CharType const *begin,CharType const *end) = 0; - - virtual ~converter_from_utf() - { - } + + virtual ~converter_from_utf() {} }; template<typename CharType> @@ -105,14 +99,11 @@ namespace boost { virtual string_type convert(char const *begin,char const *end) = 0; - virtual ~converter_to_utf() - { - } + virtual ~converter_to_utf() {} }; } } } } -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 #endif diff --git a/contrib/restricted/boost/locale/src/encoding/iconv_codepage.ipp b/contrib/restricted/boost/locale/src/boost/locale/encoding/iconv_codepage.ipp index 276c60b6b0..8e8ead191c 100644 --- a/contrib/restricted/boost/locale/src/encoding/iconv_codepage.ipp +++ b/contrib/restricted/boost/locale/src/boost/locale/encoding/iconv_codepage.ipp @@ -1,19 +1,16 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_IMPL_ICONV_CODEPAGE_HPP #define BOOST_LOCALE_IMPL_ICONV_CODEPAGE_HPP #include <boost/locale/encoding.hpp> -#include "../util/iconv.hpp" -#include <errno.h> -#include "conv.hpp" -#include <assert.h> -#include <vector> +#include <cerrno> +#include "boost/locale/util/iconv.hpp" +#include "boost/locale/encoding/conv.hpp" namespace boost { namespace locale { @@ -22,8 +19,8 @@ namespace impl { class iconverter_base { public: - - iconverter_base() : + + iconverter_base() : cvt_((iconv_t)(-1)) { } @@ -47,12 +44,12 @@ public: how_ = how; return cvt_ != (iconv_t)(-1); } - + template<typename OutChar,typename InChar> std::basic_string<OutChar> real_convert(InChar const *ubegin,InChar const *uend) { std::basic_string<OutChar> sresult; - + sresult.reserve(uend - ubegin); OutChar result[64]; @@ -60,20 +57,20 @@ public: char *out_start = reinterpret_cast<char *>(&result[0]); char const *begin = reinterpret_cast<char const *>(ubegin); char const *end = reinterpret_cast<char const *>(uend); - + enum { normal , unshifting , done } state = normal; while(state!=done) { size_t in_left = end - begin; size_t out_left = sizeof(result); - + char *out_ptr = out_start; size_t res = 0; if(in_left == 0) state = unshifting; - if(state == normal) + if(state == normal) res = conv(&begin,&in_left,&out_ptr,&out_left); else res = conv(0,0,&out_ptr,&out_left); @@ -81,7 +78,7 @@ public: int err = errno; size_t output_count = (out_ptr - out_start) / sizeof(OutChar); - + if(res!=0 && res!=(size_t)(-1)) { if(how_ == stop) { throw conversion_error(); @@ -133,7 +130,7 @@ private: cvt_ = (iconv_t)(-1); } } - + iconv_t cvt_; method_type how_; @@ -147,16 +144,15 @@ public: typedef CharType char_type; - virtual bool open(char const *charset,method_type how) + bool open(char const *charset,method_type how) BOOST_OVERRIDE { return self_.do_open(charset,utf_name<CharType>(),how); } - virtual std::string convert(char_type const *ubegin,char_type const *uend) + std::string convert(char_type const *ubegin,char_type const *uend) BOOST_OVERRIDE { return self_.template real_convert<char,char_type>(ubegin,uend); } - virtual ~iconv_from_utf() {} private: iconverter_base self_; }; @@ -164,15 +160,14 @@ private: class iconv_between: public converter_between { public: - virtual bool open(char const *to_charset,char const *from_charset,method_type how) + bool open(char const *to_charset,char const *from_charset,method_type how) BOOST_OVERRIDE { return self_.do_open(to_charset,from_charset,how); } - virtual std::string convert(char const *begin,char const *end) + std::string convert(char const *begin,char const *end) BOOST_OVERRIDE { return self_.real_convert<char,char>(begin,end); } - virtual ~iconv_between() {} private: iconverter_base self_; @@ -186,16 +181,15 @@ public: typedef CharType char_type; typedef std::basic_string<char_type> string_type; - virtual bool open(char const *charset,method_type how) + bool open(char const *charset,method_type how) BOOST_OVERRIDE { return self_.do_open(utf_name<CharType>(),charset,how); } - virtual string_type convert(char const *begin,char const *end) + string_type convert(char const *begin,char const *end) BOOST_OVERRIDE { return self_.template real_convert<char_type,char>(begin,end); } - virtual ~iconv_to_utf() {} private: iconverter_base self_; }; @@ -204,11 +198,10 @@ private: } // impl } // conv -} // locale +} // locale } // boost #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/encoding/uconv_codepage.ipp b/contrib/restricted/boost/locale/src/boost/locale/encoding/uconv_codepage.ipp index 51e7301bb1..a9c679e693 100644 --- a/contrib/restricted/boost/locale/src/encoding/uconv_codepage.ipp +++ b/contrib/restricted/boost/locale/src/boost/locale/encoding/uconv_codepage.ipp @@ -1,22 +1,18 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_IMPL_UCONV_CODEPAGE_HPP #define BOOST_LOCALE_IMPL_UCONV_CODEPAGE_HPP #include <boost/locale/encoding.hpp> -#include "conv.hpp" -#include "../icu/icu_util.hpp" -#include "../icu/uconv.hpp" +#include <boost/locale/hold_ptr.hpp> #include <unicode/ucnv.h> #include <unicode/ucnv_err.h> -#include <vector> -#include <memory> - -#include <boost/locale/hold_ptr.hpp> +#include "boost/locale/encoding/conv.hpp" +#include "boost/locale/icu/icu_util.hpp" +#include "boost/locale/icu/uconv.hpp" namespace boost { namespace locale { @@ -29,7 +25,7 @@ namespace impl { typedef std::basic_string<char_type> string_type; - virtual bool open(char const *charset,method_type how) + bool open(char const *charset,method_type how) BOOST_OVERRIDE { close(); try { @@ -48,7 +44,7 @@ namespace impl { cvt_to_.reset(); } - virtual string_type convert(char const *begin,char const *end) + string_type convert(char const *begin,char const *end) BOOST_OVERRIDE { try { return cvt_to_->std(cvt_from_->icu_checked(begin,end)); @@ -67,13 +63,13 @@ namespace impl { hold_ptr<to_type> cvt_to_; }; - - + + template<typename CharType> class uconv_from_utf : public converter_from_utf<CharType> { public: typedef CharType char_type; - virtual bool open(char const *charset,method_type how) + bool open(char const *charset,method_type how) BOOST_OVERRIDE { close(); try { @@ -92,7 +88,7 @@ namespace impl { cvt_to_.reset(); } - virtual std::string convert(CharType const *begin,CharType const *end) + std::string convert(CharType const *begin,CharType const *end) BOOST_OVERRIDE { try { return cvt_to_->std(cvt_from_->icu_checked(begin,end)); @@ -114,7 +110,7 @@ namespace impl { class uconv_between : public converter_between { public: - virtual bool open(char const *to_charset,char const *from_charset,method_type how) + bool open(char const *to_charset,char const *from_charset,method_type how) BOOST_OVERRIDE { close(); try { @@ -133,7 +129,7 @@ namespace impl { cvt_to_.reset(); } - virtual std::string convert(char const *begin,char const *end) + std::string convert(char const *begin,char const *end) BOOST_OVERRIDE { try { return cvt_to_->std(cvt_from_->icu(begin,end)); @@ -156,9 +152,8 @@ namespace impl { } // impl } // conv -} // locale +} // locale } // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 #endif diff --git a/contrib/restricted/boost/locale/src/encoding/wconv_codepage.ipp b/contrib/restricted/boost/locale/src/boost/locale/encoding/wconv_codepage.ipp index 4ab9ece083..0fc23c2893 100644 --- a/contrib/restricted/boost/locale/src/encoding/wconv_codepage.ipp +++ b/contrib/restricted/boost/locale/src/boost/locale/encoding/wconv_codepage.ipp @@ -1,33 +1,31 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt #ifndef BOOST_LOCALE_IMPL_WCONV_CODEPAGE_HPP #define BOOST_LOCALE_IMPL_WCONV_CODEPAGE_HPP - #include <boost/locale/encoding.hpp> #include <algorithm> +#include <cstddef> #include <cstring> +#include <limits> #include <string> -#include "conv.hpp" - +#include <vector> #ifndef NOMINMAX # define NOMINMAX #endif #include <windows.h> -#include <vector> +#include "boost/locale/encoding/conv.hpp" namespace boost { namespace locale { namespace conv { namespace impl { - + struct windows_encoding { char const *name; unsigned codepage; @@ -115,18 +113,21 @@ namespace impl { if(len == 2 && begin+1==end) return; n = MultiByteToWideChar(codepage,MB_ERR_INVALID_CHARS,begin,len,wide_buf,4); - for(int i=0;i<n;i++) + for(int i=0;i<n;i++) buf.push_back(wide_buf[i]); begin+=len; } } - + void multibyte_to_wide(int codepage,char const *begin,char const *end,bool do_skip,std::vector<wchar_t> &buf) { if(begin==end) return; - int n = MultiByteToWideChar(codepage,MB_ERR_INVALID_CHARS,begin,end-begin,0,0); + const std::ptrdiff_t num_chars = end-begin; + if(num_chars > std::numeric_limits<int>::max()) + throw conversion_error(); + int n = MultiByteToWideChar(codepage,MB_ERR_INVALID_CHARS,begin,static_cast<int>(num_chars),0,0); if(n == 0) { if(do_skip) { multibyte_to_wide_one_by_one(codepage,begin,end,buf); @@ -135,8 +136,8 @@ namespace impl { throw conversion_error(); } - buf.resize(n,0); - if(MultiByteToWideChar(codepage,MB_ERR_INVALID_CHARS,begin,end-begin,&buf.front(),buf.size())==0) + buf.resize(n); + if(MultiByteToWideChar(codepage,MB_ERR_INVALID_CHARS,begin,static_cast<int>(num_chars),&buf.front(),n)==0) throw conversion_error(); } @@ -148,20 +149,23 @@ namespace impl { BOOL *substitute_ptr = codepage == 65001 || codepage == 65000 ? 0 : &substitute; char subst_char = 0; char *subst_char_ptr = codepage == 65001 || codepage == 65000 ? 0 : &subst_char; - - int n = WideCharToMultiByte(codepage,0,begin,end-begin,0,0,subst_char_ptr,substitute_ptr); + + const std::ptrdiff_t num_chars = end - begin; + if(num_chars > std::numeric_limits<int>::max()) + throw conversion_error(); + int n = WideCharToMultiByte(codepage,0,begin,static_cast<int>(num_chars),0,0,subst_char_ptr,substitute_ptr); buf.resize(n); - - if(WideCharToMultiByte(codepage,0,begin,end-begin,&buf[0],n,subst_char_ptr,substitute_ptr)==0) + + if(WideCharToMultiByte(codepage,0,begin,static_cast<int>(num_chars),&buf[0],n,subst_char_ptr,substitute_ptr)==0) throw conversion_error(); if(substitute) { - if(do_skip) + if(do_skip) remove_substitutions(buf); - else + else throw conversion_error(); } } - + void wide_to_multibyte(int codepage,wchar_t const *begin,wchar_t const *end,bool do_skip,std::vector<char> &buf) { if(begin==end) @@ -180,12 +184,12 @@ namespace impl { b=e+1; e=std::find(b,end,L'0'); } - else + else break; } } - + int encoding_to_windows_codepage(char const *ccharset) { std::string charset = normalize_encoding(ccharset); @@ -210,11 +214,11 @@ namespace impl { } } return -1; - + } template<typename CharType> - bool validate_utf16(CharType const *str,unsigned len) + bool validate_utf16(CharType const *str,size_t len) { CharType const *begin = str; CharType const *end = str+len; @@ -227,10 +231,10 @@ namespace impl { } template<typename CharType,typename OutChar> - void clean_invalid_utf16(CharType const *str,unsigned len,std::vector<OutChar> &out) + void clean_invalid_utf16(CharType const *str,size_t len,std::vector<OutChar> &out) { out.reserve(len); - for(unsigned i=0;i<len;i++) { + for(size_t i=0;i<len;i++) { uint16_t c = static_cast<uint16_t>(str[i]); if(0xD800 <= c && c<= 0xDBFF) { @@ -253,13 +257,13 @@ namespace impl { class wconv_between : public converter_between { public: - wconv_between() : + wconv_between() : how_(skip), to_code_page_ (-1), from_code_page_ ( -1) { } - bool open(char const *to_charset,char const *from_charset,method_type how) + bool open(char const *to_charset,char const *from_charset,method_type how) BOOST_OVERRIDE { how_ = how; to_code_page_ = encoding_to_windows_codepage(to_charset); @@ -268,18 +272,18 @@ namespace impl { return false; return true; } - virtual std::string convert(char const *begin,char const *end) + std::string convert(char const *begin,char const *end) BOOST_OVERRIDE { if(to_code_page_ == 65001 && from_code_page_ == 65001) return utf_to_utf<char>(begin,end,how_); std::string res; - + std::vector<wchar_t> tmp; // buffer for mb2w std::wstring tmps; // buffer for utf_to_utf wchar_t const *wbegin=0; wchar_t const *wend=0; - + if(from_code_page_ == 65001) { tmps = utf_to_utf<wchar_t>(begin,end,how_); if(tmps.empty()) @@ -294,7 +298,7 @@ namespace impl { wbegin = &tmp[0]; wend = wbegin + tmp.size(); } - + if(to_code_page_ == 65001) { return utf_to_utf<char>(wbegin,wend,how_); } @@ -311,60 +315,64 @@ namespace impl { int to_code_page_; int from_code_page_; }; - - template<typename CharType,int size = sizeof(CharType) > + + template<typename CharType, int size = sizeof(CharType) > class wconv_to_utf; - template<typename CharType,int size = sizeof(CharType) > + template<typename CharType, int size = sizeof(CharType) > class wconv_from_utf; template<> - class wconv_to_utf<char,1> : public converter_to_utf<char> , public wconv_between { + class wconv_to_utf<char, 1> : public converter_to_utf<char> { public: - virtual bool open(char const *cs,method_type how) + bool open(char const *cs,method_type how) BOOST_OVERRIDE { - return wconv_between::open("UTF-8",cs,how); + return cvt.open("UTF-8",cs,how); } - virtual std::string convert(char const *begin,char const *end) + std::string convert(char const *begin,char const *end) BOOST_OVERRIDE { - return wconv_between::convert(begin,end); + return cvt.convert(begin,end); } + private: + wconv_between cvt; }; - + template<> - class wconv_from_utf<char,1> : public converter_from_utf<char> , public wconv_between { + class wconv_from_utf<char, 1> : public converter_from_utf<char> { public: - virtual bool open(char const *cs,method_type how) + bool open(char const *cs,method_type how) BOOST_OVERRIDE { - return wconv_between::open(cs,"UTF-8",how); + return cvt.open(cs,"UTF-8",how); } - virtual std::string convert(char const *begin,char const *end) + std::string convert(char const *begin,char const *end) BOOST_OVERRIDE { - return wconv_between::convert(begin,end); + return cvt.convert(begin,end); } + private: + wconv_between cvt; }; - + template<typename CharType> - class wconv_to_utf<CharType,2> : public converter_to_utf<CharType> { + class wconv_to_utf<CharType, 2> : public converter_to_utf<CharType> { public: typedef CharType char_type; typedef std::basic_string<char_type> string_type; - wconv_to_utf() : + wconv_to_utf() : how_(skip), code_page_(-1) { } - virtual bool open(char const *charset,method_type how) + bool open(char const *charset,method_type how) BOOST_OVERRIDE { how_ = how; code_page_ = encoding_to_windows_codepage(charset); return code_page_ != -1; } - virtual string_type convert(char const *begin,char const *end) + string_type convert(char const *begin,char const *end) BOOST_OVERRIDE { if(code_page_ == 65001) { return utf_to_utf<char_type>(begin,end,how_); @@ -381,28 +389,28 @@ namespace impl { method_type how_; int code_page_; }; - + template<typename CharType> - class wconv_from_utf<CharType,2> : public converter_from_utf<CharType> { + class wconv_from_utf<CharType, 2> : public converter_from_utf<CharType> { public: typedef CharType char_type; typedef std::basic_string<char_type> string_type; - wconv_from_utf() : + wconv_from_utf() : how_(skip), code_page_(-1) { } - virtual bool open(char const *charset,method_type how) + bool open(char const *charset,method_type how) BOOST_OVERRIDE { how_ = how; code_page_ = encoding_to_windows_codepage(charset); return code_page_ != -1; } - virtual std::string convert(CharType const *begin,CharType const *end) + std::string convert(CharType const *begin,CharType const *end) BOOST_OVERRIDE { if(code_page_ == 65001) { return utf_to_utf<char>(begin,end,how_); @@ -453,20 +461,20 @@ namespace impl { typedef std::basic_string<char_type> string_type; - wconv_to_utf() : + wconv_to_utf() : how_(skip), code_page_(-1) { } - virtual bool open(char const *charset,method_type how) + bool open(char const *charset,method_type how) BOOST_OVERRIDE { how_ = how; code_page_ = encoding_to_windows_codepage(charset); return code_page_ != -1; } - virtual string_type convert(char const *begin,char const *end) + string_type convert(char const *begin,char const *end) BOOST_OVERRIDE { if(code_page_ == 65001) { return utf_to_utf<char_type>(begin,end,how_); @@ -483,7 +491,7 @@ namespace impl { method_type how_; int code_page_; }; - + template<typename CharType> class wconv_from_utf<CharType,4> : public converter_from_utf<CharType> { public: @@ -491,20 +499,20 @@ namespace impl { typedef std::basic_string<char_type> string_type; - wconv_from_utf() : + wconv_from_utf() : how_(skip), code_page_(-1) { } - virtual bool open(char const *charset,method_type how) + bool open(char const *charset,method_type how) BOOST_OVERRIDE { how_ = how; code_page_ = encoding_to_windows_codepage(charset); return code_page_ != -1; } - virtual std::string convert(CharType const *begin,CharType const *end) + std::string convert(CharType const *begin,CharType const *end) BOOST_OVERRIDE { if(code_page_ == 65001) { return utf_to_utf<char>(begin,end,how_); @@ -532,8 +540,8 @@ namespace impl { } // impl } // conv -} // locale +} // locale } // boost #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 +// boostinspect:nominmax diff --git a/contrib/restricted/boost/locale/src/icu/all_generator.hpp b/contrib/restricted/boost/locale/src/boost/locale/icu/all_generator.hpp index ca8f26d63c..6b4542cf53 100644 --- a/contrib/restricted/boost/locale/src/icu/all_generator.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/icu/all_generator.hpp @@ -1,10 +1,9 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_IMPL_ALL_GENERATOR_HPP #define BOOST_LOCALE_IMPL_ALL_GENERATOR_HPP @@ -15,7 +14,7 @@ namespace boost { namespace impl_icu { struct cdata; std::locale create_convert(std::locale const &,cdata const &,character_facet_type); // ok - std::locale create_collate(std::locale const &,cdata const &,character_facet_type); // ok + std::locale create_collate(std::locale const &,cdata const &,character_facet_type); // ok std::locale create_formatting(std::locale const &,cdata const &,character_facet_type); // ok std::locale create_parsing(std::locale const &,cdata const &,character_facet_type); // ok std::locale create_codecvt(std::locale const &,std::string const &encoding,character_facet_type); // ok @@ -27,4 +26,3 @@ namespace boost { } #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/icu/boundary.cpp b/contrib/restricted/boost/locale/src/boost/locale/icu/boundary.cpp index 8d2651042c..e3aaf83c3b 100644 --- a/contrib/restricted/boost/locale/src/icu/boundary.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/icu/boundary.cpp @@ -1,25 +1,28 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE #include <boost/locale/boundary.hpp> #include <boost/locale/generator.hpp> #include <boost/locale/hold_ptr.hpp> -#include <unicode/uversion.h> -#if U_ICU_VERSION_MAJOR_NUM*100 + U_ICU_VERSION_MINOR_NUM >= 306 +#include "boost/locale/icu/all_generator.hpp" +#include "boost/locale/icu/cdata.hpp" +#include "boost/locale/icu/icu_util.hpp" +#include "boost/locale/icu/uconv.hpp" +#if BOOST_LOCALE_ICU_VERSION >= 306 #include <unicode/utext.h> #endif #include <unicode/brkiter.h> #include <unicode/rbbi.h> +#include <vector> -#include "cdata.hpp" -#include "all_generator.hpp" -#include "icu_util.hpp" -#include "uconv.hpp" +#ifdef BOOST_MSVC +#pragma warning(disable:4244) // 'argument' : conversion from 'int' +#pragma warning(disable:4267) // 'argument' : conversion from 'size_t' +#endif namespace boost { namespace locale { @@ -37,7 +40,7 @@ index_type map_direct(boundary_type t,icu::BreakIterator *it,int reserve) #else icu::RuleBasedBreakIterator *rbbi=dynamic_cast<icu::RuleBasedBreakIterator *>(it); #endif - + indx.push_back(break_info()); it->first(); int pos=0; @@ -55,7 +58,7 @@ index_type map_direct(boundary_type t,icu::BreakIterator *it,int reserve) UErrorCode err=U_ZERO_ERROR; int n = rbbi->getRuleStatusVec(buf,8,err); - + if(err == U_BUFFER_OVERFLOW_ERROR) { buf=&buffer.front(); buffer.resize(n,0); @@ -136,9 +139,10 @@ index_type do_map(boundary_type t,CharType const *begin,CharType const *end,icu: { index_type indx; hold_ptr<icu::BreakIterator> bi(get_iterator(t,loc)); - -#if U_ICU_VERSION_MAJOR_NUM*100 + U_ICU_VERSION_MINOR_NUM >= 306 + +#if BOOST_LOCALE_ICU_VERSION >= 306 UErrorCode err=U_ZERO_ERROR; +BOOST_LOCALE_START_CONST_CONDITION if(sizeof(CharType) == 2 || (sizeof(CharType)==1 && encoding=="UTF-8")) { UText *ut=0; @@ -147,6 +151,7 @@ index_type do_map(boundary_type t,CharType const *begin,CharType const *end,icu: ut=utext_openUTF8(0,reinterpret_cast<char const *>(begin),end-begin,&err); else // sizeof(CharType)==2 ut=utext_openUChars(0,reinterpret_cast<UChar const *>(begin),end-begin,&err); +BOOST_LOCALE_END_CONST_CONDITION check_and_throw_icu_error(err); err=U_ZERO_ERROR; @@ -163,7 +168,7 @@ index_type do_map(boundary_type t,CharType const *begin,CharType const *end,icu: } if(ut) utext_close(ut); } - else + else #endif { icu_std_converter<CharType> cvt(encoding); @@ -189,7 +194,7 @@ public: encoding_(data.encoding) { } - index_type map(boundary_type t,CharType const *begin,CharType const *end) const + index_type map(boundary_type t,CharType const *begin,CharType const *end) const { return do_map<CharType>(t,begin,end,locale_,encoding_); } @@ -228,4 +233,3 @@ namespace impl_icu { } // locale } // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/icu/cdata.hpp b/contrib/restricted/boost/locale/src/boost/locale/icu/cdata.hpp index 2bffeab4cc..9049e5eba6 100644 --- a/contrib/restricted/boost/locale/src/icu/cdata.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/icu/cdata.hpp @@ -1,13 +1,13 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_ICU_CDATA_HPP #define BOOST_LOCALE_ICU_CDATA_HPP +#include <boost/locale/config.hpp> #include <unicode/locid.h> #include <string> @@ -25,4 +25,3 @@ namespace boost { #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/icu/codecvt.cpp b/contrib/restricted/boost/locale/src/boost/locale/icu/codecvt.cpp index 2cecdb7dda..c657aaec54 100644 --- a/contrib/restricted/boost/locale/src/icu/codecvt.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/icu/codecvt.cpp @@ -1,39 +1,37 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE #include <boost/locale/encoding.hpp> #include <boost/locale/encoding_errors.hpp> -#include "../encoding/conv.hpp" -#include "all_generator.hpp" -#include "uconv.hpp" -#include <unicode/ucnv.h> -#include <unicode/ucnv_err.h> #include <boost/locale/util.hpp> #include <boost/locale/hold_ptr.hpp> -#include "codecvt.hpp" +#include "boost/locale/encoding/conv.hpp" +#include "boost/locale/icu/all_generator.hpp" +#include "boost/locale/icu/uconv.hpp" +#include "boost/locale/icu/codecvt.hpp" +#include "boost/locale/icu/icu_util.hpp" +#include <unicode/ucnv.h> +#include <unicode/ucnv_err.h> #ifdef BOOST_MSVC -# pragma warning(disable : 4244) // loose data +# pragma warning(disable : 4244) // loose data #endif -#include "icu_util.hpp" -#include <vector> namespace boost { namespace locale { namespace impl_icu { class uconv_converter : public util::base_converter { public: - + uconv_converter(std::string const &encoding) : encoding_(encoding) { UErrorCode err=U_ZERO_ERROR; - + // No need to check err each time, this // is how ICU works. cvt_ = ucnv_open(encoding.c_str(),&err); @@ -45,26 +43,26 @@ namespace impl_icu { ucnv_close(cvt_); throw conv::invalid_charset_error(encoding); } - + max_len_ = ucnv_getMaxCharSize(cvt_); } - - virtual ~uconv_converter() + + ~uconv_converter() { ucnv_close(cvt_); } - virtual bool is_thread_safe() const + bool is_thread_safe() const BOOST_OVERRIDE { return false; } - virtual uconv_converter *clone() const + uconv_converter *clone() const BOOST_OVERRIDE { return new uconv_converter(encoding_); } - uint32_t to_unicode(char const *&begin,char const *end) + uint32_t to_unicode(char const *&begin,char const *end) BOOST_OVERRIDE { UErrorCode err=U_ZERO_ERROR; char const *tmp = begin; @@ -81,12 +79,12 @@ namespace impl_icu { return c; } - uint32_t from_unicode(uint32_t u,char *begin,char const *end) + uint32_t from_unicode(uint32_t u,char *begin,char const *end) BOOST_OVERRIDE { UChar code_point[2]={0}; int len; if(u<=0xFFFF) { - if(0xD800 <=u && u<= 0xDFFF) // No surragates + if(0xD800 <=u && u<= 0xDFFF) // No surrogates return illegal; code_point[0]=u; len=1; @@ -107,7 +105,7 @@ namespace impl_icu { return olen; } - virtual int max_len() const + int max_len() const BOOST_OVERRIDE { return max_len_; } @@ -117,7 +115,7 @@ namespace impl_icu { UConverter *cvt_; int max_len_; }; - + util::base_converter *create_uconv_converter(std::string const &encoding) { hold_ptr<util::base_converter> cvt; @@ -153,7 +151,6 @@ namespace impl_icu { } } // impl_icu -} // locale +} // locale } // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/icu/codecvt.hpp b/contrib/restricted/boost/locale/src/boost/locale/icu/codecvt.hpp index 1e39879019..78ee524041 100644 --- a/contrib/restricted/boost/locale/src/icu/codecvt.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/icu/codecvt.hpp @@ -1,15 +1,16 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_IMPL_ICU_CODECVT_HPP #define BOOST_LOCALE_IMPL_ICU_CODECVT_HPP + #include <boost/locale/config.hpp> #include <boost/locale/util.hpp> -#include <memory> +#include <string> + namespace boost { namespace locale { namespace impl_icu { @@ -17,8 +18,7 @@ namespace impl_icu { util::base_converter *create_uconv_converter(std::string const &encoding); } // impl_icu -} // locale +} // locale } // boost #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/icu/collator.cpp b/contrib/restricted/boost/locale/src/boost/locale/icu/collator.cpp index 7f1ea6ae52..448de9d41a 100644 --- a/contrib/restricted/boost/locale/src/icu/collator.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/icu/collator.cpp @@ -1,32 +1,38 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE #include <boost/locale/collator.hpp> #include <boost/locale/generator.hpp> +#include "boost/locale/icu/all_generator.hpp" +#include "boost/locale/icu/cdata.hpp" +#include "boost/locale/icu/icu_util.hpp" +#include "boost/locale/icu/uconv.hpp" +#include "boost/locale/shared/mo_hash.hpp" #include <boost/thread.hpp> #include <vector> #include <limits> - -#include "cdata.hpp" -#include "all_generator.hpp" -#include "uconv.hpp" -#include "../shared/mo_hash.hpp" - #include <unicode/coll.h> -#if U_ICU_VERSION_MAJOR_NUM*100 + U_ICU_VERSION_MINOR_NUM >= 402 +#if BOOST_LOCALE_ICU_VERSION >= 402 +# define BOOST_LOCALE_WITH_STRINGPIECE 1 # include <unicode/stringpiece.h> +#else +# define BOOST_LOCALE_WITH_STRINGPIECE 0 +#endif + +#ifdef BOOST_MSVC +#pragma warning(disable:4244) // 'argument' : conversion from 'int' +#pragma warning(disable:4267) // 'argument' : conversion from 'size_t' #endif namespace boost { namespace locale { namespace impl_icu { template<typename CharType> - class collate_impl : public collator<CharType> + class collate_impl : public collator<CharType> { public: typedef typename collator<CharType>::level_type level_type; @@ -39,7 +45,7 @@ namespace boost { return level; } - #if U_ICU_VERSION_MAJOR_NUM*100 + U_ICU_VERSION_MINOR_NUM >= 402 + #if BOOST_LOCALE_WITH_STRINGPIECE int do_utf8_compare( level_type level, char const *b1,char const *e1, char const *b2,char const *e2, @@ -51,7 +57,7 @@ namespace boost { } #endif - + int do_ustring_compare( level_type level, CharType const *b1,CharType const *e1, CharType const *b2,CharType const *e2, @@ -61,7 +67,7 @@ namespace boost { icu::UnicodeString right=cvt_.icu(b2,e2); return get_collator(level)->compare(left,right,status); } - + int do_real_compare(level_type level, CharType const *b1,CharType const *e1, CharType const *b2,CharType const *e2, @@ -70,14 +76,14 @@ namespace boost { return do_ustring_compare(level,b1,e1,b2,e2,status); } - virtual int do_compare( level_type level, - CharType const *b1,CharType const *e1, - CharType const *b2,CharType const *e2) const + int do_compare(level_type level, + CharType const *b1,CharType const *e1, + CharType const *b2,CharType const *e2) const BOOST_OVERRIDE { UErrorCode status=U_ZERO_ERROR; - + int res = do_real_compare(level,b1,e1,b2,e2,status); - + if(U_FAILURE(status)) throw std::runtime_error(std::string("Collation failed:") + u_errorName(status)); if(res < 0) @@ -86,54 +92,54 @@ namespace boost { return 1; return 0; } - - std::vector<uint8_t> do_basic_transform(level_type level,CharType const *b,CharType const *e) const + + std::vector<uint8_t> do_basic_transform(level_type level,CharType const *b,CharType const *e) const { icu::UnicodeString str=cvt_.icu(b,e); std::vector<uint8_t> tmp; - tmp.resize(str.length()); + tmp.resize(str.length() + 1u); icu::Collator *collate = get_collator(level); - int len = collate->getSortKey(str,&tmp[0],tmp.size()); + const int len = collate->getSortKey(str,&tmp[0],tmp.size()); if(len > int(tmp.size())) { tmp.resize(len); collate->getSortKey(str,&tmp[0],tmp.size()); } - else + else tmp.resize(len); return tmp; } - std::basic_string<CharType> do_transform(level_type level,CharType const *b,CharType const *e) const + std::basic_string<CharType> do_transform(level_type level,CharType const *b,CharType const *e) const BOOST_OVERRIDE { std::vector<uint8_t> tmp = do_basic_transform(level,b,e); return std::basic_string<CharType>(tmp.begin(),tmp.end()); } - - long do_hash(level_type level,CharType const *b,CharType const *e) const + + long do_hash(level_type level,CharType const *b,CharType const *e) const BOOST_OVERRIDE { std::vector<uint8_t> tmp = do_basic_transform(level,b,e); tmp.push_back(0); return gnu_gettext::pj_winberger_hash_function(reinterpret_cast<char *>(&tmp.front())); } - collate_impl(cdata const &d) : + collate_impl(cdata const &d) : cvt_(d.encoding), locale_(d.locale), is_utf8_(d.utf8) { - + } icu::Collator *get_collator(level_type ilevel) const { int l = limit(ilevel); - static const icu::Collator::ECollationStrength levels[level_count] = - { + static const icu::Collator::ECollationStrength levels[level_count] = + { icu::Collator::PRIMARY, icu::Collator::SECONDARY, icu::Collator::TERTIARY, icu::Collator::QUATERNARY, icu::Collator::IDENTICAL }; - + icu::Collator *col = collates_[l].get(); if(col) return col; @@ -158,9 +164,9 @@ namespace boost { }; - #if U_ICU_VERSION_MAJOR_NUM*100 + U_ICU_VERSION_MINOR_NUM >= 402 + #if BOOST_LOCALE_WITH_STRINGPIECE template<> - int collate_impl<char>::do_real_compare( + int collate_impl<char>::do_real_compare( level_type level, char const *b1,char const *e1, char const *b2,char const *e2, @@ -172,7 +178,7 @@ namespace boost { return do_ustring_compare(level,b1,e1,b2,e2,status); } #endif - + std::locale create_collate(std::locale const &in,cdata const &cd,character_facet_type type) { switch(type) { @@ -198,4 +204,3 @@ namespace boost { } // locale } // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/icu/conversion.cpp b/contrib/restricted/boost/locale/src/boost/locale/icu/conversion.cpp index 193d64714c..7577e0b935 100644 --- a/contrib/restricted/boost/locale/src/icu/conversion.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/icu/conversion.cpp @@ -1,33 +1,31 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE #include <boost/locale/conversion.hpp> -#include "all_generator.hpp" +#include "boost/locale/icu/all_generator.hpp" +#include "boost/locale/icu/cdata.hpp" +#include "boost/locale/icu/icu_util.hpp" +#include "boost/locale/icu/uconv.hpp" + #include <unicode/normlzr.h> #include <unicode/ustring.h> #include <unicode/locid.h> #include <unicode/uversion.h> -#if U_ICU_VERSION_MAJOR_NUM*100 + U_ICU_VERSION_MINOR_NUM >= 308 +#if BOOST_LOCALE_ICU_VERSION >= 308 #include <unicode/ucasemap.h> -#define WITH_CASE_MAPS +#define BOOST_LOCALE_WITH_CASEMAP #endif - - -#include "cdata.hpp" -#include "uconv.hpp" - #include <vector> namespace boost { namespace locale { namespace impl_icu { - - + + namespace { void normalize_string(icu::UnicodeString &str,int flags) { @@ -69,7 +67,7 @@ namespace impl_icu { { } - virtual string_type convert(converter_base::conversion_type how,char_type const *begin,char_type const *end,int flags = 0) const + string_type convert(converter_base::conversion_type how, char_type const* begin, char_type const* end, int flags = 0) const BOOST_OVERRIDE { icu_std_converter<char_type> cvt(encoding_); icu::UnicodeString str=cvt.icu(begin,end); @@ -94,13 +92,13 @@ namespace impl_icu { } return cvt.std(str); } - + private: icu::Locale locale_; std::string encoding_; }; // converter_impl - #ifdef WITH_CASE_MAPS + #ifdef BOOST_LOCALE_WITH_CASEMAP class raii_casemap { raii_casemap(raii_casemap const &); void operator = (raii_casemap const&); @@ -138,24 +136,24 @@ namespace impl_icu { class utf8_converter_impl : public converter<char> { public: - + utf8_converter_impl(cdata const &d) : locale_id_(d.locale.getName()), map_(locale_id_) { } - virtual std::string convert(converter_base::conversion_type how,char const *begin,char const *end,int flags = 0) const + std::string convert(converter_base::conversion_type how,char const *begin,char const *end,int flags = 0) const BOOST_OVERRIDE { - + if(how == converter_base::normalization) { icu_std_converter<char> cvt("UTF-8"); icu::UnicodeString str=cvt.icu(begin,end); normalize_string(str,flags); return cvt.std(str); } - - switch(how) + + switch(how) { case converter_base::upper_case: return map_.convert(ucasemap_utf8ToUpper,begin,end); @@ -178,13 +176,13 @@ namespace impl_icu { raii_casemap map_; }; // converter_impl -#endif // WITH_CASE_MAPS +#endif // BOOST_LOCALE_WITH_CASEMAP std::locale create_convert(std::locale const &in,cdata const &cd,character_facet_type type) { switch(type) { case char_facet: - #ifdef WITH_CASE_MAPS + #ifdef BOOST_LOCALE_WITH_CASEMAP if(cd.utf8) return std::locale(in,new utf8_converter_impl(cd)); #endif @@ -203,10 +201,9 @@ namespace impl_icu { return in; } } - + } // impl_icu } // locale } // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/icu/date_time.cpp b/contrib/restricted/boost/locale/src/boost/locale/icu/date_time.cpp index 1c872c37ef..b53fda940e 100644 --- a/contrib/restricted/boost/locale/src/icu/date_time.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/icu/date_time.cpp @@ -1,36 +1,31 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE -#include <boost/locale/date_time_facet.hpp> #include <boost/locale/date_time.hpp> +#include <boost/locale/date_time_facet.hpp> #include <boost/locale/formatting.hpp> #include <boost/locale/hold_ptr.hpp> -#include "all_generator.hpp" - +#include "boost/locale/icu/all_generator.hpp" +#include "boost/locale/icu/cdata.hpp" +#include "boost/locale/icu/icu_util.hpp" +#include "boost/locale/icu/time_zone.hpp" +#include "boost/locale/icu/uconv.hpp" #include <boost/thread.hpp> +#include <cmath> +#include <iostream> +#include <memory> #include <unicode/calendar.h> #include <unicode/gregocal.h> #include <unicode/utypes.h> -#include <memory> -#include <math.h> - -#include "cdata.hpp" -#include "uconv.hpp" -#include "time_zone.hpp" - -#include <iostream> - - namespace boost { namespace locale { namespace impl_icu { - + static void check_and_throw_dt(UErrorCode &e) { if(U_FAILURE(e)) { @@ -68,13 +63,13 @@ namespace impl_icu { class calendar_impl : public abstract_calendar { public: - + calendar_impl(cdata const &dat) { UErrorCode err=U_ZERO_ERROR; calendar_.reset(icu::Calendar::createInstance(dat.locale,err)); check_and_throw_dt(err); - #if U_ICU_VERSION_MAJOR_NUM*100 + U_ICU_VERSION_MINOR_NUM < 402 + #if BOOST_LOCALE_ICU_VERSION < 402 // workaround old/invalid data, it should be 4 in general calendar_->setMinimalDaysInFirstWeek(4); #endif @@ -86,17 +81,17 @@ namespace impl_icu { encoding_ = other.encoding_; } - calendar_impl *clone() const + calendar_impl *clone() const BOOST_OVERRIDE { return new calendar_impl(*this); } - void set_value(period::marks::period_mark p,int value) + void set_value(period::marks::period_mark p,int value) BOOST_OVERRIDE { calendar_->set(to_icu(p),int32_t(value)); } - int get_value(period::marks::period_mark p,value_type type) const + int get_value(period::marks::period_mark p,value_type type) const BOOST_OVERRIDE { UErrorCode err=U_ZERO_ERROR; int v=0; @@ -135,14 +130,14 @@ namespace impl_icu { return v; } - virtual void set_time(posix_time const &p) + void set_time(posix_time const &p) BOOST_OVERRIDE { double utime = p.seconds * 1000.0 + p.nanoseconds / 1000000.0; UErrorCode code=U_ZERO_ERROR; calendar_->setTime(utime,code); check_and_throw_dt(code); } - virtual void normalize() + void normalize() BOOST_OVERRIDE { // Can't call complete() explicitly (protected) // calling get wich calls complete @@ -150,9 +145,9 @@ namespace impl_icu { calendar_->get(UCAL_YEAR,code); check_and_throw_dt(code); } - virtual posix_time get_time() const + posix_time get_time() const BOOST_OVERRIDE { - + UErrorCode code=U_ZERO_ERROR; double rtime = 0; { @@ -169,7 +164,7 @@ namespace impl_icu { res.nanoseconds = 999999999; return res; } - virtual void set_option(calendar_option_type opt,int /*v*/) + void set_option(calendar_option_type opt,int /*v*/) BOOST_OVERRIDE { switch(opt) { case is_gregorian: @@ -180,7 +175,7 @@ namespace impl_icu { ; } } - virtual int get_option(calendar_option_type opt) const + int get_option(calendar_option_type opt) const BOOST_OVERRIDE { switch(opt) { case is_gregorian: @@ -197,7 +192,7 @@ namespace impl_icu { return 0; } } - virtual void adjust_value(period::marks::period_mark p,update_type u,int difference) + void adjust_value(period::marks::period_mark p,update_type u,int difference) BOOST_OVERRIDE { UErrorCode err=U_ZERO_ERROR; switch(u) { @@ -210,14 +205,14 @@ namespace impl_icu { } check_and_throw_dt(err); } - virtual int difference(abstract_calendar const *other_ptr,period::marks::period_mark p) const + int difference(abstract_calendar const *other_ptr, period::marks::period_mark m) const BOOST_OVERRIDE { UErrorCode err=U_ZERO_ERROR; double other_time = 0; // // fieldDifference has side effect of moving calendar (WTF?) // So we clone it for performing this operation - // + // hold_ptr<icu::Calendar> self(calendar_->clone()); calendar_impl const *other_cal=dynamic_cast<calendar_impl const *>(other_ptr); @@ -227,27 +222,27 @@ namespace impl_icu { check_and_throw_dt(err); } else { - posix_time p = other_ptr->get_time(); - other_time = p.seconds * 1000.0 + p.nanoseconds / 1000000.0; + posix_time o_time = other_ptr->get_time(); + other_time = o_time.seconds * 1000.0 + o_time.nanoseconds / 1000000.0; } - int diff = self->fieldDifference(other_time,to_icu(p),err); + int diff = self->fieldDifference(other_time,to_icu(m),err); check_and_throw_dt(err); return diff; } - virtual void set_timezone(std::string const &tz) + void set_timezone(std::string const &tz) BOOST_OVERRIDE { calendar_->adoptTimeZone(get_time_zone(tz)); } - virtual std::string get_timezone() const + std::string get_timezone() const BOOST_OVERRIDE { icu::UnicodeString tz; calendar_->getTimeZone().getID(tz); icu_std_converter<char> cvt(encoding_); return cvt.std(tz); } - virtual bool same(abstract_calendar const *other) const + bool same(abstract_calendar const *other) const BOOST_OVERRIDE { calendar_impl const *oc=dynamic_cast<calendar_impl const *>(other); if(!oc) @@ -261,22 +256,22 @@ namespace impl_icu { std::string encoding_; hold_ptr<icu::Calendar> calendar_; }; - + class icu_calendar_facet : public calendar_facet { public: - icu_calendar_facet(cdata const &d,size_t refs = 0) : + icu_calendar_facet(cdata const &d,size_t refs = 0) : calendar_facet(refs), data_(d) { } - virtual abstract_calendar *create_calendar() const + abstract_calendar *create_calendar() const BOOST_OVERRIDE { return new calendar_impl(data_); } private: cdata data_; }; - + std::locale create_calendar(std::locale const &in,cdata const &d) { return std::locale(in,new icu_calendar_facet(d)); @@ -288,5 +283,4 @@ namespace impl_icu { -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/icu/formatter.cpp b/contrib/restricted/boost/locale/src/boost/locale/icu/formatter.cpp index 2af18eee95..24a7e918ad 100644 --- a/contrib/restricted/boost/locale/src/icu/formatter.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/icu/formatter.cpp @@ -1,61 +1,56 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE #include <boost/locale/formatting.hpp> -#include "formatter.hpp" +#include "boost/locale/icu/formatter.hpp" #include <boost/locale/info.hpp> -#include "uconv.hpp" - +#include "boost/locale/icu/uconv.hpp" +#include "boost/locale/icu/predefined_formatters.hpp" +#include "boost/locale/icu/time_zone.hpp" +#include <boost/core/ignore_unused.hpp> #include <unicode/numfmt.h> #include <unicode/rbnf.h> #include <unicode/datefmt.h> #include <unicode/smpdtfmt.h> #include <unicode/decimfmt.h> - #include <limits> - #include <iostream> -#include "predefined_formatters.hpp" -#include "time_zone.hpp" - #ifdef BOOST_MSVC -# pragma warning(disable : 4244) // lose data +# pragma warning(disable : 4244) // lose data #endif - namespace boost { namespace locale { namespace impl_icu { - - + + std::locale::id icu_formatters_cache::id; namespace { - struct init { init() { std::has_facet<icu_formatters_cache>(std::locale::classic()); } } instance; + struct init { init() { ignore_unused(std::has_facet<icu_formatters_cache>(std::locale::classic())); } } instance; } - + template<typename CharType> class number_format : public formatter<CharType> { public: typedef CharType char_type; typedef std::basic_string<CharType> string_type; - - virtual string_type format(double value,size_t &code_points) const + + string_type format(double value,size_t &code_points) const BOOST_OVERRIDE { icu::UnicodeString tmp; icu_fmt_->format(value,tmp); code_points=tmp.countChar32(); return cvt_.std(tmp); } - virtual string_type format(int64_t value,size_t &code_points) const + string_type format(int64_t value,size_t &code_points) const BOOST_OVERRIDE { icu::UnicodeString tmp; icu_fmt_->format(static_cast< ::int64_t>(value),tmp); @@ -63,10 +58,10 @@ namespace locale { return cvt_.std(tmp); } - virtual string_type format(int32_t value,size_t &code_points) const + string_type format(int32_t value,size_t &code_points) const BOOST_OVERRIDE { icu::UnicodeString tmp; - #ifdef __SUNPRO_CC + #ifdef __SUNPRO_CC icu_fmt_->format(static_cast<int>(value),tmp); #else icu_fmt_->format(::int32_t(value),tmp); @@ -75,16 +70,16 @@ namespace locale { return cvt_.std(tmp); } - virtual size_t parse(string_type const &str,double &value) const + size_t parse(string_type const &str,double &value) const BOOST_OVERRIDE { return do_parse(str,value); } - virtual size_t parse(string_type const &str,int64_t &value) const + size_t parse(string_type const &str,int64_t &value) const BOOST_OVERRIDE { return do_parse(str,value); } - virtual size_t parse(string_type const &str,int32_t &value) const + size_t parse(string_type const &str,int32_t &value) const BOOST_OVERRIDE { return do_parse(str,value); } @@ -94,9 +89,9 @@ namespace locale { icu_fmt_(fmt) { } - + private: - + bool get_value(double &v,icu::Formattable &fmt) const { UErrorCode err=U_ZERO_ERROR; @@ -147,37 +142,37 @@ namespace locale { icu_std_converter<CharType> cvt_; icu::NumberFormat *icu_fmt_; }; - - + + template<typename CharType> class date_format : public formatter<CharType> { public: typedef CharType char_type; typedef std::basic_string<CharType> string_type; - - virtual string_type format(double value,size_t &code_points) const + + string_type format(double value,size_t &code_points) const BOOST_OVERRIDE { return do_format(value,code_points); } - virtual string_type format(int64_t value,size_t &code_points) const + string_type format(int64_t value,size_t &code_points) const BOOST_OVERRIDE { return do_format(value,code_points); } - virtual string_type format(int32_t value,size_t &code_points) const + string_type format(int32_t value,size_t &code_points) const BOOST_OVERRIDE { return do_format(value,code_points); } - virtual size_t parse(string_type const &str,double &value) const + size_t parse(string_type const &str,double &value) const BOOST_OVERRIDE { return do_parse(str,value); } - virtual size_t parse(string_type const &str,int64_t &value) const + size_t parse(string_type const &str,int64_t &value) const BOOST_OVERRIDE { return do_parse(str,value); } - virtual size_t parse(string_type const &str,int32_t &value) const + size_t parse(string_type const &str,int32_t &value) const BOOST_OVERRIDE { return do_parse(str,value); } @@ -193,7 +188,7 @@ namespace locale { icu_fmt_ = fmt; } } - + private: template<typename ValueType> @@ -216,8 +211,8 @@ namespace locale { return cut; } - - string_type do_format(double value,size_t &codepoints) const + + string_type do_format(double value,size_t &codepoints) const { UDate date = value * 1000.0; /// UDate is time_t in miliseconds icu::UnicodeString tmp; @@ -372,7 +367,7 @@ namespace locale { result+="'"; return result; } - + template<typename CharType> formatter<CharType> *generate_formatter( std::ios_base &ios, @@ -390,9 +385,9 @@ namespace locale { if(disp == posix) return fmt.release(); - + UErrorCode err=U_ZERO_ERROR; - + switch(disp) { case number: { @@ -403,7 +398,7 @@ namespace locale { nf = cache.number_format(icu_formatters_cache::fmt_sci); else nf = cache.number_format(icu_formatters_cache::fmt_number); - + nf->setMaximumFractionDigits(ios.precision()); if(how == std::ios_base::scientific || how == std::ios_base::fixed ) { nf->setMinimumFractionDigits(ios.precision()); @@ -417,7 +412,7 @@ namespace locale { case currency: { icu::NumberFormat *nf; - + uint64_t curr = info.currency_flags(); if(curr == currency_default || curr == currency_national) @@ -440,7 +435,7 @@ namespace locale { nf->setMinimumFractionDigits(0); } fmt.reset(new number_format<CharType>(nf,encoding)); - + } break; case spellout: @@ -506,7 +501,7 @@ namespace locale { break; case strftime: { - if( !cache.date_format_[1].isEmpty() + if( !cache.date_format_[1].isEmpty() && !cache.time_format_[1].isEmpty() && !cache.date_time_format_[1][1].isEmpty()) { @@ -524,11 +519,11 @@ namespace locale { } sdf = 0; } - + if(!df) { icu::DateFormat::EStyle dstyle = icu::DateFormat::kDefault; icu::DateFormat::EStyle tstyle = icu::DateFormat::kDefault; - + switch(info.time_flags()) { case time_short: tstyle=icu::DateFormat::kShort; break; case time_medium: tstyle=icu::DateFormat::kMedium; break; @@ -541,7 +536,7 @@ namespace locale { case date_long: dstyle=icu::DateFormat::kLong; break; case date_full: dstyle=icu::DateFormat::kFull; break; } - + if(disp==date) adf.reset(icu::DateFormat::createDateInstance(dstyle,locale)); else if(disp==time) @@ -551,16 +546,16 @@ namespace locale { else {// strftime icu_std_converter<CharType> cvt_(encoding); std::basic_string<CharType> const &f=info.date_time_pattern<CharType>(); - icu::UnicodeString fmt = strftime_to_icu(cvt_.icu(f.data(),f.data()+f.size()),locale); - adf.reset(new icu::SimpleDateFormat(fmt,locale,err)); + icu::UnicodeString pattern = strftime_to_icu(cvt_.icu(f.data(),f.data()+f.size()),locale); + adf.reset(new icu::SimpleDateFormat(pattern,locale,err)); } - if(U_FAILURE(err)) + if(U_FAILURE(err)) return fmt.release(); df = adf.get(); } df->adoptTimeZone(get_time_zone(info.time_zone())); - + // Depending if we own formatter or not if(adf.get()) fmt.reset(new date_format<CharType>(adf.release(),true,encoding)); @@ -605,14 +600,10 @@ namespace locale { } #endif - + } // impl_icu } // locale } // boost - -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 - - - +// boostinspect:nominmax diff --git a/contrib/restricted/boost/locale/src/icu/formatter.hpp b/contrib/restricted/boost/locale/src/boost/locale/icu/formatter.hpp index 30414dc56d..e502916b02 100644 --- a/contrib/restricted/boost/locale/src/icu/formatter.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/icu/formatter.hpp @@ -1,22 +1,21 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_FORMATTER_HPP_INCLUDED #define BOOST_LOCALE_FORMATTER_HPP_INCLUDED +#include <boost/locale/config.hpp> +#include <boost/cstdint.hpp> #include <string> #include <memory> -#include <boost/cstdint.hpp> -#include <boost/locale/config.hpp> #include <unicode/locid.h> namespace boost { namespace locale { -namespace impl_icu { +namespace impl_icu { /// /// \brief Special base polymorphic class that is used as a character type independent base for all formatter classes @@ -24,9 +23,7 @@ namespace impl_icu { class base_formatter { public: - virtual ~base_formatter() - { - } + virtual ~base_formatter() {} }; /// @@ -82,18 +79,14 @@ namespace impl_icu { /// \code /// std::cout << as::spellout; /// for(int i=1;i<=10;i++) - /// std::cout << i <<std::endl; + /// std::cout << i << std::endl; /// \endcode /// /// Would create a new spelling formatter only once. /// static formatter *create(std::ios_base &ios,icu::Locale const &l,std::string const &enc); - - virtual ~formatter() - { - } }; // class formatter - + /// /// Specialization for real implementation /// @@ -129,4 +122,3 @@ namespace impl_icu { #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/icu/icu_backend.cpp b/contrib/restricted/boost/locale/src/boost/locale/icu/icu_backend.cpp index e3a5d4f58f..133d547dd7 100644 --- a/contrib/restricted/boost/locale/src/icu/icu_backend.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/icu/icu_backend.cpp @@ -1,18 +1,17 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE #include <boost/locale/localization_backend.hpp> #include <boost/locale/gnu_gettext.hpp> #include <boost/locale/util.hpp> -#include "all_generator.hpp" -#include "cdata.hpp" -#include "icu_backend.hpp" -#include "../util/locale_data.hpp" +#include "boost/locale/icu/all_generator.hpp" +#include "boost/locale/icu/cdata.hpp" +#include "boost/locale/icu/icu_backend.hpp" +#include "boost/locale/util/locale_data.hpp" #include <algorithm> #include <iterator> @@ -20,15 +19,15 @@ namespace boost { namespace locale { -namespace impl_icu { +namespace impl_icu { class icu_localization_backend : public localization_backend { public: - icu_localization_backend() : + icu_localization_backend() : invalid_(true), use_ansi_encoding_(false) { } - icu_localization_backend(icu_localization_backend const &other) : + icu_localization_backend(icu_localization_backend const &other) : localization_backend(), paths_(other.paths_), domains_(other.domains_), @@ -37,12 +36,12 @@ namespace impl_icu { use_ansi_encoding_(other.use_ansi_encoding_) { } - virtual icu_localization_backend *clone() const + icu_localization_backend *clone() const BOOST_OVERRIDE { return new icu_localization_backend(*this); } - void set_option(std::string const &name,std::string const &value) + void set_option(std::string const &name,std::string const &value) BOOST_OVERRIDE { invalid_ = true; if(name=="locale") @@ -55,7 +54,7 @@ namespace impl_icu { use_ansi_encoding_ = value == "true"; } - void clear_options() + void clear_options() BOOST_OVERRIDE { invalid_ = true; use_ansi_encoding_ = false; @@ -74,7 +73,7 @@ namespace impl_icu { bool utf8 = ! use_ansi_encoding_; real_id_ = util::get_system_locale(utf8); } - + util::locale_data d; d.parse(real_id_); @@ -85,10 +84,10 @@ namespace impl_icu { country_ = d.country; variant_ = d.variant; } - - virtual std::locale install(std::locale const &base, - locale_category_type category, - character_facet_type type = nochar_facet) + + std::locale install(std::locale const &base, + locale_category_type category, + character_facet_type type = nochar_facet) BOOST_OVERRIDE { prepare_data(); @@ -130,7 +129,7 @@ namespace impl_icu { } } case boundary_facet: - return create_boundary(base,data_,type); + return create_boundary(base,data_,type); case calendar_facet: return create_calendar(base,data_); case information_facet: @@ -154,7 +153,7 @@ namespace impl_icu { bool invalid_; bool use_ansi_encoding_; }; - + localization_backend *create_localization_backend() { return new icu_localization_backend(); @@ -163,4 +162,3 @@ namespace impl_icu { } // impl icu } // locale } // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/boost/locale/icu/icu_backend.hpp b/contrib/restricted/boost/locale/src/boost/locale/icu/icu_backend.hpp new file mode 100644 index 0000000000..ceb381b6dc --- /dev/null +++ b/contrib/restricted/boost/locale/src/boost/locale/icu/icu_backend.hpp @@ -0,0 +1,21 @@ +// +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) +// +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_LOCALE_IMPL_ICU_LOCALIZATION_BACKEND_HPP +#define BOOST_LOCALE_IMPL_ICU_LOCALIZATION_BACKEND_HPP + +#include <boost/locale/config.hpp> + +namespace boost { + namespace locale { + class localization_backend; + namespace impl_icu { + localization_backend *create_localization_backend(); + } // impl_icu + } // locale +} // boost +#endif + diff --git a/contrib/restricted/boost/locale/src/icu/icu_util.hpp b/contrib/restricted/boost/locale/src/boost/locale/icu/icu_util.hpp index 4330bda6b9..ba50473c12 100644 --- a/contrib/restricted/boost/locale/src/icu/icu_util.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/icu/icu_util.hpp @@ -1,15 +1,22 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_SRC_ICU_UTIL_HPP #define BOOST_SRC_ICU_UTIL_HPP + +#include <boost/locale/config.hpp> +#ifdef BOOST_HAS_STDINT_H +#include <stdint.h> // Avoid ICU defining e.g. INT8_MIN causing macro redefinition warnings +#endif #include <unicode/utypes.h> +#include <unicode/uversion.h> #include <stdexcept> +#define BOOST_LOCALE_ICU_VERSION (U_ICU_VERSION_MAJOR_NUM * 100 + U_ICU_VERSION_MINOR_NUM) + namespace boost { namespace locale { namespace impl_icu { @@ -29,4 +36,3 @@ namespace impl_icu { } // boost #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/icu/numeric.cpp b/contrib/restricted/boost/locale/src/boost/locale/icu/numeric.cpp index debecfb89c..1671345b29 100644 --- a/contrib/restricted/boost/locale/src/icu/numeric.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/icu/numeric.cpp @@ -1,22 +1,21 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE -#include <locale> -#include <string> -#include <ios> -#include <limits> -#include "formatter.hpp" #include <boost/locale/formatting.hpp> #include <boost/locale/hold_ptr.hpp> -#include "all_generator.hpp" -#include "cdata.hpp" +#include "boost/locale/icu/all_generator.hpp" +#include "boost/locale/icu/cdata.hpp" +#include "boost/locale/icu/formatter.hpp" +#include "boost/locale/icu/predefined_formatters.hpp" #include <algorithm> -#include "predefined_formatters.hpp" +#include <ios> +#include <limits> +#include <locale> +#include <string> namespace boost { namespace locale { @@ -25,7 +24,7 @@ namespace impl_icu { namespace details { template<typename V,int n=std::numeric_limits<V>::digits,bool integer=std::numeric_limits<V>::is_integer> struct cast_traits; - + template<typename v> struct cast_traits<v,7,true> { typedef int32_t cast_type; @@ -71,7 +70,7 @@ namespace details { bool Int=std::numeric_limits<V>::is_integer, bool Big=(sizeof(V) >= 8) > - struct use_parent_traits + struct use_parent_traits { static bool use(V /*v*/) { return false; } }; @@ -118,38 +117,38 @@ public: typedef formatter<CharType> formatter_type; typedef hold_ptr<formatter_type> formatter_ptr; - num_format(cdata const &d,size_t refs = 0) : + num_format(cdata const &d,size_t refs = 0) : std::num_put<CharType>(refs), loc_(d.locale), enc_(d.encoding) { } -protected: - +protected: - virtual iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, long val) const + + iter_type do_put(iter_type out, std::ios_base& ios, char_type fill, long val) const BOOST_OVERRIDE { return do_real_put(out,ios,fill,val); } - virtual iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, unsigned long val) const + iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, unsigned long val) const BOOST_OVERRIDE { return do_real_put(out,ios,fill,val); } - virtual iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, double val) const + iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, double val) const BOOST_OVERRIDE { return do_real_put(out,ios,fill,val); } - virtual iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, long double val) const + iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, long double val) const BOOST_OVERRIDE { return do_real_put(out,ios,fill,val); } - - #ifndef BOOST_NO_LONG_LONG - virtual iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, long long val) const + + #ifndef BOOST_NO_LONG_LONG + iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, long long val) const BOOST_OVERRIDE { return do_real_put(out,ios,fill,val); } - virtual iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, unsigned long long val) const + iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, unsigned long long val) const BOOST_OVERRIDE { return do_real_put(out,ios,fill,val); } @@ -168,18 +167,18 @@ private: formatter_ptr formatter(formatter_type::create(ios,loc_,enc_)); - if(formatter.get() == 0) + if(formatter.get() == 0) return std::num_put<char_type>::do_put(out,ios,fill,val); - + size_t code_points; typedef typename details::cast_traits<ValueType>::cast_type cast_type; string_type const &str = formatter->format(static_cast<cast_type>(val),code_points); std::streamsize on_left=0,on_right = 0,points = code_points; if(points < ios.width()) { std::streamsize n = ios.width() - points; - + std::ios_base::fmtflags flags = ios.flags() & std::ios_base::adjustfield; - + // // We do not really know internal point, so we assume that it does not // exist. So according to the standard field should be right aligned @@ -212,13 +211,13 @@ template<typename CharType> class num_parse : public std::num_get<CharType>, protected num_base { public: - num_parse(cdata const &d,size_t refs = 0) : + num_parse(cdata const &d,size_t refs = 0) : std::num_get<CharType>(refs), loc_(d.locale), enc_(d.encoding) { } -protected: +protected: typedef typename std::num_get<CharType>::iter_type iter_type; typedef std::basic_string<CharType> string_type; typedef CharType char_type; @@ -226,48 +225,48 @@ protected: typedef hold_ptr<formatter_type> formatter_ptr; typedef std::basic_istream<CharType> stream_type; - virtual iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,long &val) const + iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,long &val) const BOOST_OVERRIDE { return do_real_get(in,end,ios,err,val); } - virtual iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,unsigned short &val) const + iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,unsigned short &val) const BOOST_OVERRIDE { return do_real_get(in,end,ios,err,val); } - virtual iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,unsigned int &val) const + iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,unsigned int &val) const BOOST_OVERRIDE { return do_real_get(in,end,ios,err,val); } - virtual iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,unsigned long &val) const + iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,unsigned long &val) const BOOST_OVERRIDE { return do_real_get(in,end,ios,err,val); } - virtual iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,float &val) const + iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,float &val) const BOOST_OVERRIDE { return do_real_get(in,end,ios,err,val); } - virtual iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,double &val) const + iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,double &val) const BOOST_OVERRIDE { return do_real_get(in,end,ios,err,val); } - virtual iter_type do_get (iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,long double &val) const + iter_type do_get (iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,long double &val) const BOOST_OVERRIDE { return do_real_get(in,end,ios,err,val); } - #ifndef BOOST_NO_LONG_LONG - virtual iter_type do_get (iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,long long &val) const + #ifndef BOOST_NO_LONG_LONG + iter_type do_get (iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,long long &val) const BOOST_OVERRIDE { return do_real_get(in,end,ios,err,val); } - virtual iter_type do_get (iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,unsigned long long &val) const + iter_type do_get (iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,unsigned long long &val) const BOOST_OVERRIDE { return do_real_get(in,end,ios,err,val); } @@ -275,7 +274,7 @@ protected: #endif private: - + // // This is not really an efficient solution, but it works @@ -326,6 +325,7 @@ private: return in; } +BOOST_LOCALE_START_CONST_CONDITION template<typename ValueType,typename CastedType> bool valid(CastedType v) const { @@ -333,8 +333,8 @@ private: typedef std::numeric_limits<CastedType> casted_limits; if(v < 0 && value_limits::is_signed == false) return false; - - static const CastedType max_val = value_limits::max(); + + static const CastedType max_val = static_cast<CastedType>(value_limits::max()); if(sizeof(CastedType) > sizeof(ValueType) && v > max_val) return false; @@ -348,7 +348,8 @@ private: } return true; } - +BOOST_LOCALE_END_CONST_CONDITION + icu::Locale loc_; std::string enc_; @@ -360,7 +361,7 @@ std::locale install_formatting_facets(std::locale const &in,cdata const &cd) { std::locale tmp=std::locale(in,new num_format<CharType>(cd)); if(!std::has_facet<icu_formatters_cache>(in)) { - tmp=std::locale(tmp,new icu_formatters_cache(cd.locale)); + tmp=std::locale(tmp,new icu_formatters_cache(cd.locale)); } return tmp; } @@ -370,7 +371,7 @@ std::locale install_parsing_facets(std::locale const &in,cdata const &cd) { std::locale tmp=std::locale(in,new num_parse<CharType>(cd)); if(!std::has_facet<icu_formatters_cache>(in)) { - tmp=std::locale(tmp,new icu_formatters_cache(cd.locale)); + tmp=std::locale(tmp,new icu_formatters_cache(cd.locale)); } return tmp; } @@ -418,9 +419,7 @@ std::locale create_parsing(std::locale const &in,cdata const &cd,character_facet } // impl_icu -} // locale +} // locale } //boost - - -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 +// boostinspect:nominmax diff --git a/contrib/restricted/boost/locale/src/icu/predefined_formatters.hpp b/contrib/restricted/boost/locale/src/boost/locale/icu/predefined_formatters.hpp index 906dfe83e6..bbadafc27b 100644 --- a/contrib/restricted/boost/locale/src/icu/predefined_formatters.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/icu/predefined_formatters.hpp @@ -1,19 +1,19 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_PREDEFINED_FORMATTERS_HPP_INCLUDED #define BOOST_LOCALE_PREDEFINED_FORMATTERS_HPP_INCLUDED -#include <string> -#include <memory> -#include <boost/cstdint.hpp> -#include <boost/thread.hpp> #include <boost/locale/config.hpp> #include <boost/locale/hold_ptr.hpp> +#include "boost/locale/icu/icu_util.hpp" +#include <boost/cstdint.hpp> +#include <boost/thread.hpp> +#include <string> +#include <memory> #include <unicode/locid.h> #include <unicode/numfmt.h> @@ -24,7 +24,7 @@ namespace boost { namespace locale { - namespace impl_icu { + namespace impl_icu { class icu_formatters_cache : public std::locale::facet { public: @@ -35,7 +35,7 @@ namespace locale { locale_(locale) { - static const icu::DateFormat::EStyle styles[4] = { + static const icu::DateFormat::EStyle styles[4] = { icu::DateFormat::kShort, icu::DateFormat::kMedium, icu::DateFormat::kLong, @@ -99,28 +99,26 @@ namespace locale { case fmt_sci: ap.reset(icu::NumberFormat::createScientificInstance(locale_,err)); break; - #if U_ICU_VERSION_MAJOR_NUM*100 + U_ICU_VERSION_MINOR_NUM >= 402 - #if U_ICU_VERSION_MAJOR_NUM*100 + U_ICU_VERSION_MINOR_NUM >= 408 +#if BOOST_LOCALE_ICU_VERSION >= 408 case fmt_curr_nat: ap.reset(icu::NumberFormat::createInstance(locale_,UNUM_CURRENCY,err)); break; case fmt_curr_iso: ap.reset(icu::NumberFormat::createInstance(locale_,UNUM_CURRENCY_ISO,err)); break; - #else +#elif BOOST_LOCALE_ICU_VERSION >= 402 case fmt_curr_nat: ap.reset(icu::NumberFormat::createInstance(locale_,icu::NumberFormat::kCurrencyStyle,err)); break; case fmt_curr_iso: ap.reset(icu::NumberFormat::createInstance(locale_,icu::NumberFormat::kIsoCurrencyStyle,err)); break; - #endif - #else +#else case fmt_curr_nat: case fmt_curr_iso: ap.reset(icu::NumberFormat::createCurrencyInstance(locale_,err)); break; - #endif +#endif case fmt_per: ap.reset(icu::NumberFormat::createPercentInstance(locale_,err)); break; @@ -145,7 +143,7 @@ namespace locale { if(U_FAILURE(err)) throw std::runtime_error("Failed to create a formatter"); } - + icu::UnicodeString date_format_[4]; icu::UnicodeString time_format_[4]; icu::UnicodeString date_time_format_[4][4]; @@ -160,14 +158,14 @@ namespace locale { icu::DateFormat::kMedium, icu::DateFormat::kMedium, locale_)); - + if(dynamic_cast<icu::SimpleDateFormat *>(fmt.get())) { p = static_cast<icu::SimpleDateFormat *>(fmt.release()); date_formatter_.reset(p); } return p; } - + private: mutable boost::thread_specific_ptr<icu::NumberFormat> number_format_[fmt_count]; @@ -184,4 +182,3 @@ namespace locale { #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/icu/time_zone.cpp b/contrib/restricted/boost/locale/src/boost/locale/icu/time_zone.cpp index 8276231f9b..a31bf13660 100644 --- a/contrib/restricted/boost/locale/src/icu/time_zone.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/icu/time_zone.cpp @@ -1,12 +1,14 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE -#include "time_zone.hpp" +#include "boost/locale/icu/time_zone.hpp" +#include "boost/locale/icu/icu_util.hpp" +#include <boost/locale/hold_ptr.hpp> +#include <boost/predef/os.h> // // Bug - when ICU tries to find a file that is equivalent to /etc/localtime it finds /usr/share/zoneinfo/localtime @@ -18,24 +20,24 @@ // It is also relevant only for Linux, BSD and Apple (as I see in ICU code) // -#if U_ICU_VERSION_MAJOR_NUM == 4 && (U_ICU_VERSION_MINOR_NUM * 100 + U_ICU_VERSION_PATCHLEVEL_NUM) <= 402 -# if defined(__linux) || defined(__FreeBSD__) || defined(__APPLE__) +#if BOOST_LOCALE_ICU_VERSION >= 400 && BOOST_LOCALE_ICU_VERSION <= 406 \ + && (BOOST_LOCALE_ICU_VERSION != 404 || U_ICU_VERSION_PATCHLEVEL_NUM >= 3) +# if BOOST_OS_LINUX || BOOST_OS_BSD_FREE || defined(__APPLE__) # define BOOST_LOCALE_WORKAROUND_ICU_BUG # endif #endif #ifdef BOOST_LOCALE_WORKAROUND_ICU_BUG +#include <cstring> #include <dirent.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <fstream> #include <pthread.h> -#include <string.h> #include <memory> #endif -#include <boost/locale/hold_ptr.hpp> namespace boost { namespace locale { @@ -60,11 +62,11 @@ namespace boost { // // This is a workaround for an ICU timezone detection bug. - // It is \b very ICU specific and should not be used + // It is \b very ICU specific and should not be used // in general. It is also designed to work only on // specific patforms: Linux, BSD and Apple, where this bug may actually // occur - // + // namespace { // Under BSD, Linux and Mac OS X dirent has normal size @@ -98,7 +100,7 @@ namespace boost { struct dirent de; struct dirent *read_result; }; - + bool files_equal(std::string const &left,std::string const &right) { char l[256],r[256]; @@ -121,19 +123,19 @@ namespace boost { return false; return true; } - + std::string find_file_in(std::string const &ref,size_t size,std::string const &dir) { directory d(dir.c_str()); if(!d.is_open()) return std::string(); - + char const *name=0; while((name=d.next())!=0) { std::string file_name = name; - if( file_name == "." - || file_name ==".." - || file_name=="posixrules" + if( file_name == "." + || file_name ==".." + || file_name=="posixrules" || file_name=="localtime") { continue; @@ -146,7 +148,7 @@ namespace boost { if(!res.empty()) return file_name + "/" + res; } - else { + else { if(size_t(st.st_size) == size && files_equal(path,ref)) { return file_name; } @@ -160,7 +162,7 @@ namespace boost { // algorithm... just it ignores localtime std::string detect_correct_time_zone() { - + char const *tz_dir = "/usr/share/zoneinfo"; char const *tz_file = "/etc/localtime"; @@ -176,7 +178,7 @@ namespace boost { return r; } - + // // Using pthread as: // - This bug is relevant for only Linux, BSD, Mac OS X and @@ -236,4 +238,3 @@ namespace boost { } } -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/icu/time_zone.hpp b/contrib/restricted/boost/locale/src/boost/locale/icu/time_zone.hpp index 3fbeb83f41..1690c8d26d 100644 --- a/contrib/restricted/boost/locale/src/icu/time_zone.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/icu/time_zone.hpp @@ -1,13 +1,16 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_IMPL_ICU_GET_TIME_ZONE_HPP #define BOOST_LOCALE_IMPL_ICU_GET_TIME_ZONE_HPP +#include <boost/locale/config.hpp> +#ifdef BOOST_HAS_STDINT_H +#include <stdint.h> // Avoid ICU defining e.g. INT8_MIN causing macro redefinition warnings +#endif #include <unicode/calendar.h> #include <string> @@ -23,4 +26,3 @@ namespace boost { } } #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/icu/uconv.hpp b/contrib/restricted/boost/locale/src/boost/locale/icu/uconv.hpp index f9eb2d1bdc..555ee47ced 100644 --- a/contrib/restricted/boost/locale/src/icu/uconv.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/icu/uconv.hpp @@ -1,23 +1,28 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_SRC_LOCALE_ICU_UCONV_HPP #define BOOST_SRC_LOCALE_ICU_UCONV_HPP -#include <unicode/unistr.h> + +#include <boost/locale/encoding.hpp> +#include "boost/locale/icu/icu_util.hpp" + +#include <memory> +#include <string> #include <unicode/ucnv.h> +#include <unicode/unistr.h> #include <unicode/ustring.h> #include <unicode/utf.h> #include <unicode/utf16.h> -#include <boost/locale/encoding.hpp> - -#include <string> -#include <memory> -#include "icu_util.hpp" +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4244) // 'argument' : conversion from 'int' +#pragma warning(disable:4267) // 'argument' : conversion from 'size_t' +#endif namespace boost { namespace locale { @@ -28,14 +33,14 @@ namespace impl_icu { cvt_stop } cpcvt_type; - + template<typename CharType,int char_size = sizeof(CharType) > class icu_std_converter { public: typedef CharType char_type; typedef std::basic_string<char_type> string_type; - icu_std_converter(std::string charset,cpcvt_type cv=cvt_skip); + icu_std_converter(std::string charset,cpcvt_type cv=cvt_skip); icu::UnicodeString icu(char_type const *begin,char_type const *end) const; string_type std(icu::UnicodeString const &str) const; size_t cut(icu::UnicodeString const &str,char_type const *begin,char_type const *end,size_t n,size_t from_u=0,size_t from_c=0) const; @@ -47,7 +52,7 @@ namespace impl_icu { typedef CharType char_type; typedef std::basic_string<char_type> string_type; - + icu::UnicodeString icu_checked(char_type const *vb,char_type const *ve) const { return icu(vb,ve); // Already done @@ -62,14 +67,14 @@ namespace impl_icu { check_and_throw_icu_error(err); return tmp; } - + string_type std(icu::UnicodeString const &str) const { uconv cvt(charset_,cvt_type_); return cvt.go(str.getBuffer(),str.length(),max_len_); } - icu_std_converter(std::string charset,cpcvt_type cvt_type = cvt_skip) : + icu_std_converter(std::string charset,cpcvt_type cvt_type = cvt_skip) : charset_(charset), cvt_type_(cvt_type) { @@ -89,7 +94,7 @@ namespace impl_icu { uconv(uconv const &other); void operator=(uconv const &other); public: - uconv(std::string const &charset,cpcvt_type cvt_type=cvt_skip) + uconv(std::string const &charset,cpcvt_type cvt_type=cvt_skip) { UErrorCode err=U_ZERO_ERROR; cvt_ = ucnv_open(charset.c_str(),&err); @@ -98,12 +103,12 @@ namespace impl_icu { ucnv_close(cvt_); throw conv::invalid_charset_error(charset); } - + try { if(cvt_type==cvt_skip) { ucnv_setFromUCallBack(cvt_,UCNV_FROM_U_CALLBACK_SKIP,0,0,0,&err); check_and_throw_icu_error(err); - + err=U_ZERO_ERROR; ucnv_setToUCallBack(cvt_,UCNV_TO_U_CALLBACK_SKIP,0,0,0,&err); check_and_throw_icu_error(err); @@ -111,7 +116,7 @@ namespace impl_icu { else { ucnv_setFromUCallBack(cvt_,UCNV_FROM_U_CALLBACK_STOP,0,0,0,&err); check_and_throw_icu_error(err); - + err=U_ZERO_ERROR; ucnv_setToUCallBack(cvt_,UCNV_TO_U_CALLBACK_STOP,0,0,0,&err); check_and_throw_icu_error(err); @@ -156,7 +161,7 @@ namespace impl_icu { { ucnv_close(cvt_); } - + private: UConverter *cvt_; }; @@ -166,14 +171,14 @@ namespace impl_icu { std::string charset_; cpcvt_type cvt_type_; }; - + template<typename CharType> class icu_std_converter<CharType,2> { public: typedef CharType char_type; typedef std::basic_string<char_type> string_type; - + icu::UnicodeString icu_checked(char_type const *begin,char_type const *end) const { icu::UnicodeString tmp(end-begin,0,0); // make inital capacity @@ -199,7 +204,7 @@ namespace impl_icu { throw_if_needed(); } return tmp; - } + } void throw_if_needed() const { if(mode_ == cvt_stop) @@ -224,7 +229,7 @@ namespace impl_icu { { return n; } - + icu_std_converter(std::string /*charset*/,cpcvt_type mode=cvt_skip) : mode_(mode) { @@ -233,7 +238,7 @@ namespace impl_icu { cpcvt_type mode_; }; - + template<typename CharType> class icu_std_converter<CharType,4> { public: @@ -252,13 +257,13 @@ namespace impl_icu { throw_if_needed(); } return tmp; - } + } void throw_if_needed() const { if(mode_ == cvt_stop) throw conv::conversion_error(); } - + icu::UnicodeString icu(char_type const *begin,char_type const *end) const { icu::UnicodeString tmp(end-begin,0,0); // make inital capacity @@ -291,7 +296,7 @@ namespace impl_icu { return tmp; } - + size_t cut(icu::UnicodeString const &str,char_type const * /*begin*/,char_type const * /*end*/,size_t n, size_t from_u=0,size_t /*from_c*/=0) const { @@ -312,5 +317,7 @@ namespace impl_icu { #endif +#ifdef BOOST_MSVC +#pragma warning(push) +#endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/posix/all_generator.hpp b/contrib/restricted/boost/locale/src/boost/locale/posix/all_generator.hpp index 8a80e79d0b..a89ad5746b 100644 --- a/contrib/restricted/boost/locale/src/posix/all_generator.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/posix/all_generator.hpp @@ -1,17 +1,16 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_IMPL_POSIX_ALL_GENERATOR_HPP #define BOOST_LOCALE_IMPL_POSIX_ALL_GENERATOR_HPP #include <boost/locale/generator.hpp> #include <boost/shared_ptr.hpp> -#include <vector> -#include <locale.h> +#include <clocale> +#include <locale> #ifdef __APPLE__ #include <xlocale.h> @@ -45,4 +44,3 @@ namespace boost { } #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/posix/codecvt.cpp b/contrib/restricted/boost/locale/src/boost/locale/posix/codecvt.cpp index 897888a9cd..7d0a30e061 100644 --- a/contrib/restricted/boost/locale/src/posix/codecvt.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/posix/codecvt.cpp @@ -1,26 +1,24 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE +#include "boost/locale/posix/codecvt.hpp" #include <boost/locale/encoding.hpp> -#include <boost/shared_ptr.hpp> #include <boost/locale/hold_ptr.hpp> -#include "../encoding/conv.hpp" #include <boost/locale/util.hpp> -#include "all_generator.hpp" - -#include <errno.h> +#include <boost/shared_ptr.hpp> #include <algorithm> +#include <cerrno> #include <stdexcept> #include <vector> -#include "codecvt.hpp" +#include "boost/locale/posix/all_generator.hpp" +#include "boost/locale/encoding/conv.hpp" #ifdef BOOST_LOCALE_WITH_ICONV -#include "../util/iconv.hpp" +#include "boost/locale/util/iconv.hpp" #endif namespace boost { @@ -30,7 +28,7 @@ namespace impl_posix { #ifdef BOOST_LOCALE_WITH_ICONV class mb2_iconv_converter : public util::base_converter { public: - + mb2_iconv_converter(std::string const &encoding) : encoding_(encoding), to_utf_((iconv_t)(-1)), @@ -56,7 +54,7 @@ namespace impl_posix { first_byte_table.push_back(obuf[0]); continue; } - + // Test if this is illegal first byte or incomplete in = ibuf; insize = 1; @@ -64,8 +62,8 @@ namespace impl_posix { outsize = 8; call_iconv(d,0,0,0,0); size_t res = call_iconv(d,&in,&insize,&out,&outsize); - - // Now if this single byte starts a sequence we add incomplete + + // Now if this single byte starts a sequence we add incomplete // to know to ask that we need two bytes, othewise it may only be // illegal @@ -95,31 +93,30 @@ namespace impl_posix { from_utf_((iconv_t)(-1)) { } - - virtual ~mb2_iconv_converter() + + ~mb2_iconv_converter() { if(to_utf_ != (iconv_t)(-1)) iconv_close(to_utf_); if(from_utf_ != (iconv_t)(-1)) iconv_close(from_utf_); - } - virtual bool is_thread_safe() const + bool is_thread_safe() const BOOST_OVERRIDE { return false; } - virtual mb2_iconv_converter *clone() const + mb2_iconv_converter *clone() const BOOST_OVERRIDE { return new mb2_iconv_converter(*this); } - uint32_t to_unicode(char const *&begin,char const *end) + uint32_t to_unicode(char const *&begin,char const *end) BOOST_OVERRIDE { if(begin == end) return incomplete; - + unsigned char seq0 = *begin; uint32_t index = (*first_byte_table_)[seq0]; if(index == illegal) @@ -130,7 +127,7 @@ namespace impl_posix { } else if(begin+1 == end) return incomplete; - + open(to_utf_,utf32_encoding(),encoding_.c_str()); // maybe illegal or may be double byte @@ -149,7 +146,7 @@ namespace impl_posix { return illegal; } - uint32_t from_unicode(uint32_t cp,char *begin,char const *end) + uint32_t from_unicode(uint32_t cp,char *begin,char const *end) BOOST_OVERRIDE { if(cp == 0) { if(begin!=end) { @@ -200,7 +197,7 @@ namespace impl_posix { return "UTF-32BE"; } - virtual int max_len() const + int max_len() const BOOST_OVERRIDE { return 2; } @@ -246,7 +243,6 @@ namespace impl_posix { } } // impl_posix -} // locale +} // locale } // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/posix/codecvt.hpp b/contrib/restricted/boost/locale/src/boost/locale/posix/codecvt.hpp index 976c07e32e..26cb91d467 100644 --- a/contrib/restricted/boost/locale/src/posix/codecvt.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/posix/codecvt.hpp @@ -1,10 +1,9 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_IMPL_POSIX_CODECVT_HPP #define BOOST_LOCALE_IMPL_POSIX_CODECVT_HPP #include <boost/locale/config.hpp> @@ -20,9 +19,8 @@ namespace impl_posix { util::base_converter *create_iconv_converter(std::string const &encoding); } // impl_posix -} // locale +} // locale } // boost #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/posix/collate.cpp b/contrib/restricted/boost/locale/src/boost/locale/posix/collate.cpp index 859bb9cf6b..30966e2ecb 100644 --- a/contrib/restricted/boost/locale/src/posix/collate.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/posix/collate.cpp @@ -1,26 +1,25 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE +#include <boost/locale/generator.hpp> #if defined(__FreeBSD__) #include <xlocale.h> #endif +#include <clocale> +#include <cstring> #include <locale> -#include <locale.h> -#include <string.h> #include <wchar.h> #include <string> #include <stdexcept> #include <ios> #include <vector> -#include <boost/locale/generator.hpp> -#include "../shared/mo_hash.hpp" -#include "all_generator.hpp" +#include "boost/locale/shared/mo_hash.hpp" +#include "boost/locale/posix/all_generator.hpp" namespace boost { namespace locale { @@ -58,15 +57,13 @@ class collator : public std::collate<CharType> { public: typedef CharType char_type; typedef std::basic_string<char_type> string_type; - collator(boost::shared_ptr<locale_t> l,size_t refs = 0) : + collator(boost::shared_ptr<locale_t> l,size_t refs = 0) : std::collate<CharType>(refs), lc_(l) { } - virtual ~collator() - { - } - virtual int do_compare(char_type const *lb,char_type const *le,char_type const *rb,char_type const *re) const + + int do_compare(char_type const *lb,char_type const *le,char_type const *rb,char_type const *re) const BOOST_OVERRIDE { string_type left(lb,le-lb); string_type right(rb,re-rb); @@ -77,14 +74,14 @@ public: return 1; return 0; } - virtual long do_hash(char_type const *b,char_type const *e) const + long do_hash(char_type const *b,char_type const *e) const BOOST_OVERRIDE { string_type s(do_transform(b,e)); char const *begin = reinterpret_cast<char const *>(s.c_str()); char const *end = begin + s.size() * sizeof(char_type); return gnu_gettext::pj_winberger_hash_function(begin,end); } - virtual string_type do_transform(char_type const *b,char_type const *e) const + string_type do_transform(char_type const *b,char_type const *e) const BOOST_OVERRIDE { string_type s(b,e-b); std::vector<char_type> buf((e-b)*2+1); @@ -116,9 +113,8 @@ std::locale create_collate( std::locale const &in, } // impl_std -} // locale +} // locale } //boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/posix/converter.cpp b/contrib/restricted/boost/locale/src/boost/locale/posix/converter.cpp index bf8bc566d4..718c450550 100644 --- a/contrib/restricted/boost/locale/src/posix/converter.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/posix/converter.cpp @@ -1,27 +1,26 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE -#if defined(__FreeBSD__) -#include <xlocale.h> -#endif -#include <locale> -#include <stdexcept> #include <boost/locale/generator.hpp> #include <boost/locale/conversion.hpp> #include <boost/locale/encoding.hpp> #include <boost/shared_ptr.hpp> -#include <vector> -#include <string.h> -#include <wctype.h> -#include <ctype.h> +#include <cctype> +#include <cstring> #include <langinfo.h> -#include "all_generator.hpp" +#include <locale> +#include <stdexcept> +#include <wctype.h> +#if defined(__FreeBSD__) +#include <xlocale.h> +#endif + +#include "boost/locale/posix/all_generator.hpp" namespace boost { namespace locale { @@ -56,18 +55,18 @@ struct case_traits<wchar_t> { template<typename CharType> -class std_converter : public converter<CharType> +class std_converter : public converter<CharType> { public: typedef CharType char_type; typedef std::basic_string<char_type> string_type; typedef std::ctype<char_type> ctype_type; - std_converter(boost::shared_ptr<locale_t> lc,size_t refs = 0) : + std_converter(boost::shared_ptr<locale_t> lc,size_t refs = 0) : converter<CharType>(refs), lc_(lc) { } - virtual string_type convert(converter_base::conversion_type how,char_type const *begin,char_type const *end,int /*flags*/ = 0) const + string_type convert(converter_base::conversion_type how,char_type const *begin,char_type const *end,int /*flags*/ = 0) const BOOST_OVERRIDE { switch(how) { case converter_base::upper_case: @@ -99,12 +98,12 @@ private: class utf8_converter : public converter<char> { public: - utf8_converter(boost::shared_ptr<locale_t> lc,size_t refs = 0) : + utf8_converter(boost::shared_ptr<locale_t> lc,size_t refs = 0) : converter<char>(refs), lc_(lc) { } - virtual std::string convert(converter_base::conversion_type how,char const *begin,char const *end,int /*flags*/ = 0) const + std::string convert(converter_base::conversion_type how,char const *begin,char const *end,int /*flags*/ = 0) const BOOST_OVERRIDE { switch(how) { case upper_case: @@ -116,7 +115,7 @@ public: wres+=towupper_l(tmp[i],*lc_); return conv::from_utf<wchar_t>(wres,"UTF-8"); } - + case lower_case: case case_folding: { @@ -140,7 +139,7 @@ std::locale create_convert( std::locale const &in, character_facet_type type) { switch(type) { - case char_facet: + case char_facet: { std::string encoding = nl_langinfo_l(CODESET,*lc); for(unsigned i=0;i<encoding.size();i++) @@ -160,6 +159,5 @@ std::locale create_convert( std::locale const &in, } // namespace impl_std -} // locale +} // locale } // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/posix/numeric.cpp b/contrib/restricted/boost/locale/src/boost/locale/posix/numeric.cpp index 6771c02639..69d2f290ec 100644 --- a/contrib/restricted/boost/locale/src/posix/numeric.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/posix/numeric.cpp @@ -1,35 +1,37 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE #if defined(__FreeBSD__) #include <xlocale.h> #endif -#include <locale> -#include <string> -#include <ios> +#include <boost/locale/encoding.hpp> #include <boost/locale/formatting.hpp> #include <boost/locale/generator.hpp> -#include <boost/locale/encoding.hpp> +#include <boost/predef/os.h> #include <boost/shared_ptr.hpp> -#include <sstream> -#include <stdlib.h> -#include <time.h> -#include <string.h> -#include <wctype.h> -#include <ctype.h> +#include <cctype> +#include <cerrno> +#include <cstdlib> +#include <cstring> +#include <ctime> +#include <ios> #include <langinfo.h> +#include <locale> #include <monetary.h> -#include <errno.h> -#include "../util/numeric.hpp" -#include "all_generator.hpp" +#include <sstream> +#include <string> +#include <vector> +#include <wctype.h> +#include "boost/locale/util/numeric.hpp" +#include "boost/locale/posix/all_generator.hpp" -#if defined(__linux) || defined(__APPLE__) + +#if BOOST_OS_LINUX || defined(__APPLE__) #define BOOST_LOCALE_HAVE_WCSFTIME_L #endif @@ -45,22 +47,22 @@ public: typedef std::basic_string<CharType> string_type; typedef CharType char_type; - num_format(boost::shared_ptr<locale_t> lc,size_t refs = 0) : + num_format(boost::shared_ptr<locale_t> lc,size_t refs = 0) : util::base_num_format<CharType>(refs), lc_(lc) { } -protected: +protected: - virtual iter_type do_format_currency(bool intl,iter_type out,std::ios_base &/*ios*/,char_type /*fill*/,long double val) const + iter_type do_format_currency(bool intl,iter_type out,std::ios_base &/*ios*/,char_type /*fill*/,long double val) const BOOST_OVERRIDE { char buf[4]={}; char const *format = intl ? "%i" : "%n"; errno=0; ssize_t n = strfmon_l(buf,sizeof(buf),*lc_,format,static_cast<double>(val)); - if(n >= 0) + if(n >= 0) return write_it(out,buf,n); - + for(std::vector<char> tmp(sizeof(buf)*2);tmp.size() <= 4098;tmp.resize(tmp.size()*2)) { n = strfmon_l(&tmp.front(),tmp.size(),*lc_,format,static_cast<double>(val)); if(n >= 0) @@ -75,7 +77,7 @@ protected: *out++ = *ptr++; return out; } - + std::ostreambuf_iterator<wchar_t> write_it(std::ostreambuf_iterator<wchar_t> out,char const *ptr,size_t n) const { std::wstring tmp = conv::to_utf<wchar_t>(ptr,ptr+n,nl_langinfo_l(CODESET,*lc_)); @@ -149,19 +151,16 @@ struct ftime_traits<wchar_t> { template<typename CharType> class time_put_posix : public std::time_put<CharType> { public: - time_put_posix(boost::shared_ptr<locale_t> lc, size_t refs = 0) : + time_put_posix(boost::shared_ptr<locale_t> lc, size_t refs = 0) : std::time_put<CharType>(refs), lc_(lc) { } - virtual ~time_put_posix() - { - } typedef typename std::time_put<CharType>::iter_type iter_type; typedef CharType char_type; typedef std::basic_string<char_type> string_type; - virtual iter_type do_put(iter_type out,std::ios_base &/*ios*/,CharType /*fill*/,std::tm const *tm,char format,char modifier) const + iter_type do_put(iter_type out,std::ios_base &/*ios*/,CharType /*fill*/,std::tm const *tm,char format,char modifier) const BOOST_OVERRIDE { char_type fmt[4] = { '%' , static_cast<char_type>(modifier != 0 ? modifier : format) , static_cast<char_type>(modifier == 0 ? '\0' : format) }; string_type res = ftime_traits<char_type>::ftime(fmt,tm,*lc_); @@ -182,11 +181,11 @@ template<> class ctype_posix<char> : public std::ctype<char> { public: - ctype_posix(boost::shared_ptr<locale_t> lc) + ctype_posix(boost::shared_ptr<locale_t> lc) { lc_ = lc; } - + bool do_is(mask m,char c) const { if((m & space) && isspace_l(c,*lc_)) @@ -280,11 +279,11 @@ private: template<> class ctype_posix<wchar_t> : public std::ctype<wchar_t> { public: - ctype_posix(boost::shared_ptr<locale_t> lc) + ctype_posix(boost::shared_ptr<locale_t> lc) { lc_ = lc; } - + bool do_is(mask m,wchar_t c) const { if((m & space) && iswspace_l(c,*lc_)) @@ -382,11 +381,11 @@ struct basic_numpunct { std::string grouping; std::string thousands_sep; std::string decimal_point; - basic_numpunct() : + basic_numpunct() : decimal_point(".") { } - basic_numpunct(locale_t lc) + basic_numpunct(locale_t lc) { #if defined(__APPLE__) || defined(__FreeBSD__) lconv *cv = localeconv_l(lc); @@ -407,7 +406,7 @@ template<typename CharType> class num_punct_posix : public std::numpunct<CharType> { public: typedef std::basic_string<CharType> string_type; - num_punct_posix(locale_t lc,size_t refs = 0) : + num_punct_posix(locale_t lc,size_t refs = 0) : std::numpunct<CharType>(refs) { basic_numpunct np(lc); @@ -427,24 +426,24 @@ public: { s2=conv::to_utf<wchar_t>(s1,nl_langinfo_l(CODESET,lc)); } - virtual CharType do_decimal_point() const + CharType do_decimal_point() const BOOST_OVERRIDE { return *decimal_point_.c_str(); } - virtual CharType do_thousands_sep() const + CharType do_thousands_sep() const BOOST_OVERRIDE { return *thousands_sep_.c_str(); } - virtual std::string do_grouping() const + std::string do_grouping() const BOOST_OVERRIDE { return grouping_; } - virtual string_type do_truename() const + string_type do_truename() const BOOST_OVERRIDE { static const char t[]="true"; return string_type(t,t+sizeof(t)-1); } - virtual string_type do_falsename() const + string_type do_falsename() const BOOST_OVERRIDE { static const char t[]="false"; return string_type(t,t+sizeof(t)-1); @@ -480,7 +479,7 @@ std::locale create_formatting( std::locale const &in, character_facet_type type) { switch(type) { - case char_facet: + case char_facet: return create_formatting_impl<char>(in,lc); case wchar_t_facet: return create_formatting_impl<wchar_t>(in,lc); @@ -494,7 +493,7 @@ std::locale create_parsing( std::locale const &in, character_facet_type type) { switch(type) { - case char_facet: + case char_facet: return create_parsing_impl<char>(in,lc); case wchar_t_facet: return create_parsing_impl<wchar_t>(in,lc); @@ -506,9 +505,8 @@ std::locale create_parsing( std::locale const &in, } // impl_std -} // locale +} // locale } //boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/posix/posix_backend.cpp b/contrib/restricted/boost/locale/src/boost/locale/posix/posix_backend.cpp index 2ab121df9d..68da0e1241 100644 --- a/contrib/restricted/boost/locale/src/posix/posix_backend.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/posix/posix_backend.cpp @@ -1,39 +1,38 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE -#if defined(__FreeBSD__) -#include <xlocale.h> -#endif +#include "boost/locale/posix/posix_backend.hpp" #include <boost/locale/localization_backend.hpp> #include <boost/locale/gnu_gettext.hpp> #include <boost/locale/info.hpp> -#include "all_generator.hpp" -#include "posix_backend.hpp" - -#include "../util/locale_data.hpp" -#include "../util/gregorian.hpp" #include <boost/locale/util.hpp> #include <algorithm> #include <iterator> - #include <langinfo.h> +#include <vector> +#if defined(__FreeBSD__) +#include <xlocale.h> +#endif + +#include "boost/locale/posix/all_generator.hpp" +#include "boost/locale/util/gregorian.hpp" +#include "boost/locale/util/locale_data.hpp" namespace boost { namespace locale { -namespace impl_posix { - +namespace impl_posix { + class posix_localization_backend : public localization_backend { public: - posix_localization_backend() : + posix_localization_backend() : invalid_(true) { } - posix_localization_backend(posix_localization_backend const &other) : + posix_localization_backend(posix_localization_backend const &other) : localization_backend(), paths_(other.paths_), domains_(other.domains_), @@ -41,12 +40,12 @@ namespace impl_posix { invalid_(true) { } - virtual posix_localization_backend *clone() const + posix_localization_backend *clone() const BOOST_OVERRIDE { return new posix_localization_backend(*this); } - void set_option(std::string const &name,std::string const &value) + void set_option(std::string const &name,std::string const &value) BOOST_OVERRIDE { invalid_ = true; if(name=="locale") @@ -57,7 +56,7 @@ namespace impl_posix { domains_.push_back(value); } - void clear_options() + void clear_options() BOOST_OVERRIDE { invalid_ = true; locale_id_.clear(); @@ -80,18 +79,18 @@ namespace impl_posix { real_id_ = locale_id_; if(real_id_.empty()) real_id_ = util::get_system_locale(); - + locale_t tmp = newlocale(LC_ALL_MASK,real_id_.c_str(),0); - + if(!tmp) { tmp=newlocale(LC_ALL_MASK,"C",0); } if(!tmp) { throw std::runtime_error("newlocale failed"); } - + locale_t *tmp_p = 0; - + try { tmp_p = new locale_t(); } @@ -99,14 +98,14 @@ namespace impl_posix { freelocale(tmp); throw; } - + *tmp_p = tmp; lc_ = boost::shared_ptr<locale_t>(tmp_p,free_locale_by_ptr); } - - virtual std::locale install(std::locale const &base, - locale_category_type category, - character_facet_type type = nochar_facet) + + std::locale install(std::locale const &base, + locale_category_type category, + character_facet_type type = nochar_facet) BOOST_OVERRIDE { prepare_data(); @@ -172,7 +171,7 @@ namespace impl_posix { bool invalid_; boost::shared_ptr<locale_t> lc_; }; - + localization_backend *create_localization_backend() { return new posix_localization_backend(); @@ -181,4 +180,3 @@ namespace impl_posix { } // impl posix } // locale } // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/boost/locale/posix/posix_backend.hpp b/contrib/restricted/boost/locale/src/boost/locale/posix/posix_backend.hpp new file mode 100644 index 0000000000..bfc46120a9 --- /dev/null +++ b/contrib/restricted/boost/locale/src/boost/locale/posix/posix_backend.hpp @@ -0,0 +1,18 @@ +// +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) +// +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_LOCALE_IMPL_POSIX_LOCALIZATION_BACKEND_HPP +#define BOOST_LOCALE_IMPL_POSIX_LOCALIZATION_BACKEND_HPP +namespace boost { + namespace locale { + class localization_backend; + namespace impl_posix { + localization_backend *create_localization_backend(); + } // impl_std + } // locale +} // boost +#endif + diff --git a/contrib/restricted/boost/locale/src/shared/date_time.cpp b/contrib/restricted/boost/locale/src/boost/locale/shared/date_time.cpp index 4f68b7d8fd..c1c347de85 100644 --- a/contrib/restricted/boost/locale/src/shared/date_time.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/shared/date_time.cpp @@ -1,16 +1,15 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE #include <boost/locale/date_time.hpp> #include <boost/locale/formatting.hpp> #include <boost/thread/locks.hpp> #include <boost/thread/mutex.hpp> -#include <math.h> +#include <cmath> namespace boost { namespace locale { @@ -51,7 +50,7 @@ calendar::calendar(std::ios_base &ios) : impl_(std::use_facet<calendar_facet>(locale_).create_calendar()) { impl_->set_timezone(tz_); - + } calendar::calendar() : @@ -72,7 +71,7 @@ calendar::calendar(calendar const &other) : { } -calendar const &calendar::operator = (calendar const &other) +calendar const &calendar::operator = (calendar const &other) { if(this !=&other) { impl_.reset(other.impl_->clone()); @@ -244,36 +243,36 @@ date_time date_time::operator-(date_time_period const &v) const date_time date_time::operator<<(date_time_period const &v) const { date_time tmp(*this); - tmp<<=v; + tmp <<= v; return tmp; } date_time date_time::operator>>(date_time_period const &v) const { date_time tmp(*this); - tmp>>=v; + tmp >>= v; return tmp; } -date_time const &date_time::operator+=(date_time_period const &v) +date_time const &date_time::operator+=(date_time_period const &v) { impl_->adjust_value(v.type.mark(),abstract_calendar::move,v.value); return *this; } -date_time const &date_time::operator-=(date_time_period const &v) +date_time const &date_time::operator-=(date_time_period const &v) { impl_->adjust_value(v.type.mark(),abstract_calendar::move,-v.value); return *this; } -date_time const &date_time::operator<<=(date_time_period const &v) +date_time const &date_time::operator<<=(date_time_period const &v) { impl_->adjust_value(v.type.mark(),abstract_calendar::roll,v.value); return *this; } -date_time const &date_time::operator>>=(date_time_period const &v) +date_time const &date_time::operator>>=(date_time_period const &v) { impl_->adjust_value(v.type.mark(),abstract_calendar::roll,-v.value); return *this; @@ -297,18 +296,18 @@ date_time date_time::operator-(date_time_period_set const &v) const date_time date_time::operator<<(date_time_period_set const &v) const { date_time tmp(*this); - tmp<<=v; + tmp <<= v; return tmp; } date_time date_time::operator>>(date_time_period_set const &v) const { date_time tmp(*this); - tmp>>=v; + tmp >>= v; return tmp; } -date_time const &date_time::operator+=(date_time_period_set const &v) +date_time const &date_time::operator+=(date_time_period_set const &v) { for(unsigned i=0;i<v.size();i++) { *this+=v[i]; @@ -316,7 +315,7 @@ date_time const &date_time::operator+=(date_time_period_set const &v) return *this; } -date_time const &date_time::operator-=(date_time_period_set const &v) +date_time const &date_time::operator-=(date_time_period_set const &v) { for(unsigned i=0;i<v.size();i++) { *this-=v[i]; @@ -324,18 +323,18 @@ date_time const &date_time::operator-=(date_time_period_set const &v) return *this; } -date_time const &date_time::operator<<=(date_time_period_set const &v) +date_time const &date_time::operator<<=(date_time_period_set const &v) { for(unsigned i=0;i<v.size();i++) { - *this<<=v[i]; + *this <<= v[i]; } return *this; } -date_time const &date_time::operator>>=(date_time_period_set const &v) +date_time const &date_time::operator>>=(date_time_period_set const &v) { for(unsigned i=0;i<v.size();i++) { - *this>>=v[i]; + *this >>= v[i]; } return *this; } @@ -465,5 +464,4 @@ namespace time_zone { -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/shared/format.cpp b/contrib/restricted/boost/locale/src/boost/locale/shared/format.cpp index 839ee52226..a662e039f5 100644 --- a/contrib/restricted/boost/locale/src/shared/format.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/shared/format.cpp @@ -1,18 +1,16 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE #include <boost/locale/format.hpp> -#include <boost/locale/generator.hpp> #include <boost/locale/info.hpp> -#include <limits> -#include <stdlib.h> - +#include <boost/locale/generator.hpp> +#include <cstdlib> #include <iostream> +#include <limits> namespace boost { namespace locale { @@ -28,7 +26,7 @@ namespace boost { void (*imbuer)(void *,std::locale const &); }; - format_parser::format_parser(std::ios_base &ios,void *cookie,void (*imbuer)(void *,std::locale const &)) : + format_parser::format_parser(std::ios_base &ios,void *cookie,void (*imbuer)(void *,std::locale const &)) : ios_(ios), d(new data) { @@ -93,7 +91,7 @@ namespace boost { } else if(key=="cur" || key=="currency") { as::currency(ios_); - if(value=="iso") + if(value=="iso") as::currency_iso(ios_); else if(value=="nat" || value=="national") as::currency_national(ios_); @@ -171,9 +169,9 @@ namespace boost { std::string encoding=std::use_facet<info>(d->saved_locale).encoding(); generator gen; gen.categories(formatting_facet); - + std::locale new_loc; - if(value.find('.')==std::string::npos) + if(value.find('.')==std::string::npos) new_loc = gen(value + "." + encoding); else new_loc = gen(value); @@ -185,4 +183,4 @@ namespace boost { } } } -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 +// boostinspect:nominmax diff --git a/contrib/restricted/boost/locale/src/shared/formatting.cpp b/contrib/restricted/boost/locale/src/boost/locale/shared/formatting.cpp index 70c16c908c..b44db9952d 100644 --- a/contrib/restricted/boost/locale/src/shared/formatting.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/shared/formatting.cpp @@ -1,21 +1,20 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE #include <boost/locale/formatting.hpp> #include <boost/locale/date_time.hpp> #include <typeinfo> #include <algorithm> -#include "ios_prop.hpp" +#include "boost/locale/shared/ios_prop.hpp" namespace boost { namespace locale { - ios_info::string_set::string_set() : + ios_info::string_set::string_set() : type(0), size(0), ptr(0) @@ -39,14 +38,14 @@ namespace boost { type=0; } } - + void ios_info::string_set::swap(string_set &other) { std::swap(type,other.type); std::swap(size,other.size); std::swap(ptr,other.ptr); } - + ios_info::string_set const &ios_info::string_set::operator=(string_set const &other) { if(this!=&other) { @@ -58,7 +57,7 @@ namespace boost { struct ios_info::data {}; - ios_info::ios_info() : + ios_info::ios_info() : flags_(0), domain_id_(0), d(0) @@ -68,7 +67,7 @@ namespace boost { ios_info::~ios_info() { } - + ios_info::ios_info(ios_info const &other) { flags_ = other.flags_; @@ -89,23 +88,23 @@ namespace boost { return *this; } - void ios_info::display_flags(uint64_t f) + void ios_info::display_flags(uint64_t f) { flags_ = (flags_ & ~uint64_t(flags::display_flags_mask)) | f; } - void ios_info::currency_flags(uint64_t f) + void ios_info::currency_flags(uint64_t f) { flags_ = (flags_ & ~uint64_t(flags::currency_flags_mask)) | f; } - void ios_info::date_flags(uint64_t f) + void ios_info::date_flags(uint64_t f) { flags_ = (flags_ & ~uint64_t(flags::date_flags_mask)) | f; } - void ios_info::time_flags(uint64_t f) + void ios_info::time_flags(uint64_t f) { flags_ = (flags_ & ~uint64_t(flags::time_flags_mask)) | f; } - + void ios_info::domain_id(int id) { domain_id_ = id; @@ -130,7 +129,7 @@ namespace boost { { return flags_ & flags::date_flags_mask; } - + uint64_t ios_info::time_flags() const { return flags_ & flags::time_flags_mask; @@ -151,7 +150,7 @@ namespace boost { return datetime_; } - + ios_info::string_set &ios_info::date_time_pattern_set() { return datetime_; @@ -177,4 +176,3 @@ namespace boost { } // locale } // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/shared/generator.cpp b/contrib/restricted/boost/locale/src/boost/locale/shared/generator.cpp index a93ecb2730..00951cf70d 100644 --- a/contrib/restricted/boost/locale/src/shared/generator.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/shared/generator.cpp @@ -1,20 +1,19 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE #include <boost/locale/generator.hpp> #include <boost/locale/encoding.hpp> #include <boost/locale/localization_backend.hpp> -#include <map> -#include <vector> -#include <algorithm> #include <boost/shared_ptr.hpp> #include <boost/thread/locks.hpp> #include <boost/thread/mutex.hpp> +#include <algorithm> +#include <map> +#include <vector> namespace boost { namespace locale { @@ -72,7 +71,7 @@ namespace boost { { d->chars=t; } - + character_facet_type generator::characters() const { return d->chars; @@ -83,7 +82,7 @@ namespace boost { if(std::find(d->domains.begin(),d->domains.end(),domain) == d->domains.end()) d->domains.push_back(domain); } - + void generator::set_default_messages_domain(std::string const &domain) { std::vector<std::string>::iterator p; @@ -126,8 +125,8 @@ namespace boost { return p->second; } } - shared_ptr<localization_backend> backend(d->backend_manager.create()); - set_all_options(backend,id); + hold_ptr<localization_backend> backend(d->backend_manager.create()); + set_all_options(*backend,id); std::locale result = base; locale_category_type facets = d->cats; @@ -171,22 +170,21 @@ namespace boost { { return d->caching_enabled; } - void generator::locale_cache_enabled(bool enabled) + void generator::locale_cache_enabled(bool enabled) { d->caching_enabled = enabled; } - - void generator::set_all_options(shared_ptr<localization_backend> backend,std::string const &id) const + + void generator::set_all_options(localization_backend& backend,std::string const &id) const { - backend->set_option("locale",id); + backend.set_option("locale",id); if(d->use_ansi_encoding) - backend->set_option("use_ansi_encoding","true"); + backend.set_option("use_ansi_encoding","true"); for(size_t i=0;i<d->domains.size();i++) - backend->set_option("message_application",d->domains[i]); + backend.set_option("message_application",d->domains[i]); for(size_t i=0;i<d->paths.size();i++) - backend->set_option("message_path",d->paths[i]); + backend.set_option("message_path",d->paths[i]); } - + } // locale } // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/boost/locale/shared/ids.cpp b/contrib/restricted/boost/locale/src/boost/locale/shared/ids.cpp new file mode 100644 index 0000000000..b41d041c7c --- /dev/null +++ b/contrib/restricted/boost/locale/src/boost/locale/shared/ids.cpp @@ -0,0 +1,105 @@ +// +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) +// +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#define BOOST_LOCALE_SOURCE +#include <boost/locale/boundary.hpp> +#include <boost/locale/collator.hpp> +#include <boost/locale/conversion.hpp> +#include <boost/locale/date_time_facet.hpp> +#include <boost/locale/info.hpp> +#include <boost/locale/message.hpp> + +#include <boost/core/ignore_unused.hpp> + +namespace boost { + namespace locale { + + std::locale::id info::id; + // Make sure we have the VTable here (Export/Import issues) + info::~info() {} + std::locale::id calendar_facet::id; + + std::locale::id converter<char>::id; + converter<char>::~converter() {} + std::locale::id base_message_format<char>::id; + + std::locale::id converter<wchar_t>::id; + converter<wchar_t>::~converter() {} + std::locale::id base_message_format<wchar_t>::id; + + #ifdef BOOST_LOCALE_ENABLE_CHAR16_T + + std::locale::id converter<char16_t>::id; + converter<char16_t>::~converter() {} + std::locale::id base_message_format<char16_t>::id; + + #endif + + #ifdef BOOST_LOCALE_ENABLE_CHAR32_T + + std::locale::id converter<char32_t>::id; + converter<char32_t>::~converter() {} + std::locale::id base_message_format<char32_t>::id; + + #endif + + namespace boundary { + + std::locale::id boundary_indexing<char>::id; + boundary_indexing<char>::~boundary_indexing() {} + + std::locale::id boundary_indexing<wchar_t>::id; + boundary_indexing<wchar_t>::~boundary_indexing() {} + + #ifdef BOOST_LOCALE_ENABLE_CHAR16_T + std::locale::id boundary_indexing<char16_t>::id; + boundary_indexing<char16_t>::~boundary_indexing() {} + #endif + + #ifdef BOOST_LOCALE_ENABLE_CHAR32_T + std::locale::id boundary_indexing<char32_t>::id; + boundary_indexing<char32_t>::~boundary_indexing() {} + #endif + } + + namespace { + // Initialize each facet once to avoid issues where doing so + // in a multithreaded environment could cause problems (races) + struct init_all { + init_all() + { + const std::locale& l = std::locale::classic(); + init_by<char>(l); + init_by<wchar_t>(l); + #ifdef BOOST_LOCALE_ENABLE_CHAR16_T + init_by<char16_t>(l); + #endif + #ifdef BOOST_LOCALE_ENABLE_CHAR32_T + init_by<char32_t>(l); + #endif + + init_facet<info>(l); + init_facet<calendar_facet>(l); + } + template<typename Char> + void init_by(const std::locale& l) + { + init_facet<boundary::boundary_indexing<Char> >(l); + init_facet<converter<Char> >(l); + init_facet<message_format<Char> >(l); + } + template<typename Facet> + void init_facet(const std::locale& l) + { + // Use the facet to initialize e.g. their std::locale::id + ignore_unused(std::has_facet<Facet>(l)); + } + } facet_initializer; + } + + } +} + diff --git a/contrib/restricted/boost/locale/src/shared/ios_prop.hpp b/contrib/restricted/boost/locale/src/boost/locale/shared/ios_prop.hpp index 0a820e126b..efb61904be 100644 --- a/contrib/restricted/boost/locale/src/shared/ios_prop.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/shared/ios_prop.hpp @@ -1,10 +1,9 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_SRC_LOCALE_IOS_PROP_HPP #define BOOST_SRC_LOCALE_IOS_PROP_HPP #include <ios> @@ -12,8 +11,8 @@ namespace boost { namespace locale { namespace impl { - - template<typename Property> + + template<typename Property> class ios_prop { public: static void set(Property const &prop,std::ios_base &ios) @@ -30,7 +29,7 @@ namespace boost { *static_cast<Property *>(ios.pword(id))=prop; } } - + static Property &get(std::ios_base &ios) { int id=get_id(); @@ -38,7 +37,7 @@ namespace boost { set(Property(),ios); return *static_cast<Property *>(ios.pword(id)); } - + static bool has(std::ios_base &ios) { int id=get_id(); @@ -62,7 +61,7 @@ namespace boost { } private: static void * const invalid; - + static void callback(std::ios_base::event ev,std::ios_base &ios,int id) { switch(ev) { @@ -79,9 +78,9 @@ namespace boost { case std::ios_base::imbue_event: if(ios.pword(id)==invalid || ios.pword(id)==0) break; - reinterpret_cast<Property *>(ios.pword(id))->on_imbue(); + reinterpret_cast<Property *>(ios.pword(id))->on_imbue(); break; - + default: ; } } @@ -94,9 +93,6 @@ namespace boost { template<typename Property> void * const ios_prop<Property>::invalid = (void *)(-1); - - - } } } @@ -105,5 +101,4 @@ namespace boost { #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/shared/localization_backend.cpp b/contrib/restricted/boost/locale/src/boost/locale/shared/localization_backend.cpp index 0a9b7a2814..f2a80d248b 100644 --- a/contrib/restricted/boost/locale/src/shared/localization_backend.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/shared/localization_backend.cpp @@ -1,32 +1,31 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE #include <boost/locale/localization_backend.hpp> +#include <boost/locale/hold_ptr.hpp> #include <boost/shared_ptr.hpp> #include <boost/thread/locks.hpp> #include <boost/thread/mutex.hpp> -#include <boost/locale/hold_ptr.hpp> #include <vector> #ifdef BOOST_LOCALE_WITH_ICU -#include "../icu/icu_backend.hpp" +#include "boost/locale/icu/icu_backend.hpp" #endif #ifndef BOOST_LOCALE_NO_POSIX_BACKEND -#include "../posix/posix_backend.hpp" +#include "boost/locale/posix/posix_backend.hpp" #endif #ifndef BOOST_LOCALE_NO_STD_BACKEND -#include "../std/std_backend.hpp" +#include "boost/locale/std/std_backend.hpp" #endif #ifndef BOOST_LOCALE_NO_WINAPI_BACKEND -#include "../win32/win_backend.hpp" +#include "boost/locale/win32/win_backend.hpp" #endif namespace boost { @@ -44,7 +43,7 @@ namespace boost { all_backends_.push_back(v); } } - impl() : + impl() : default_backends_(32,-1) { } @@ -64,7 +63,7 @@ namespace boost { for(unsigned i=0;i<default_backends_.size();i++) default_backends_[i]=0; } - else { + else { for(unsigned i=0;i<all_backends_.size();i++) if(all_backends_[i].first == name) return; @@ -116,25 +115,25 @@ namespace boost { backends_[i].reset(backends[i]->clone()); } } - virtual actual_backend *clone() const + actual_backend *clone() const BOOST_OVERRIDE { return new actual_backend(backends_,index_); } - virtual void set_option(std::string const &name,std::string const &value) + void set_option(std::string const &name,std::string const &value) BOOST_OVERRIDE { for(unsigned i=0;i<backends_.size();i++) backends_[i]->set_option(name,value); } - virtual void clear_options() + void clear_options() BOOST_OVERRIDE { for(unsigned i=0;i<backends_.size();i++) backends_[i]->clear_options(); } - virtual std::locale install(std::locale const &l,locale_category_type category,character_facet_type type = nochar_facet) + std::locale install(std::locale const &l,locale_category_type category,character_facet_type type = nochar_facet) BOOST_OVERRIDE { int id; unsigned v; - for(v=1,id=0;v!=0;v<<=1,id++) { + for(v=1,id=0;v!=0;v <<= 1,id++) { if(category == v) break; } @@ -142,7 +141,7 @@ namespace boost { return l; if(unsigned(id) >= index_.size()) return l; - if(index_[id]==-1) + if(index_[id]==-1) return l; return backends_[index_[id]]->install(l,category,type); } @@ -158,7 +157,7 @@ namespace boost { - localization_backend_manager::localization_backend_manager() : + localization_backend_manager::localization_backend_manager() : pimpl_(new impl()) { } @@ -181,7 +180,7 @@ namespace boost { } - #if !defined(BOOST_LOCALE_HIDE_AUTO_PTR) && !defined(BOOST_NO_AUTO_PTR) + #if BOOST_LOCALE_USE_AUTO_PTR std::auto_ptr<localization_backend> localization_backend_manager::get() const { std::auto_ptr<localization_backend> r(pimpl_->create()); @@ -241,7 +240,7 @@ namespace boost { } struct init { - init() { + init() { localization_backend_manager mgr; #ifdef BOOST_LOCALE_WITH_ICU mgr.adopt_backend("icu",impl_icu::create_localization_backend()); @@ -254,7 +253,7 @@ namespace boost { #ifndef BOOST_LOCALE_NO_WINAPI_BACKEND mgr.adopt_backend("winapi",impl_win::create_localization_backend()); #endif - + #ifndef BOOST_LOCALE_NO_STD_BACKEND mgr.adopt_backend("std",impl_std::create_localization_backend()); #endif @@ -282,4 +281,3 @@ namespace boost { } // locale } // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/shared/message.cpp b/contrib/restricted/boost/locale/src/boost/locale/shared/message.cpp index e25d26fd88..51ef9188f4 100644 --- a/contrib/restricted/boost/locale/src/shared/message.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/shared/message.cpp @@ -1,56 +1,55 @@ // -// Copyright (c) 2009-2015 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2015 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE #define BOOST_DETAIL_NO_CONTAINER_FWD -#include <boost/config.hpp> -#include <boost/version.hpp> -#include <boost/locale/message.hpp> -#include <boost/locale/gnu_gettext.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/locale/hold_ptr.hpp> -#include <boost/locale/encoding.hpp> -#ifdef BOOST_MSVC -# pragma warning(disable : 4996) -#endif - -#if BOOST_VERSION >= 103600 -#define BOOST_LOCALE_UNORDERED_CATALOG +// Need _wfopen which is an extension on MinGW but not on MinGW-w64 +// So remove the strict-mode define on (only) MinGW before including anything +#if defined(__MINGW32__) && defined(__STRICT_ANSI__) +#include <_mingw.h> +#ifndef __MINGW64_VERSION_MAJOR +#undef __STRICT_ANSI__ #endif - -#ifdef BOOST_LOCALE_UNORDERED_CATALOG -#include <boost/unordered_map.hpp> -#else -#include <map> #endif -#include <iostream> - -#include "mo_hash.hpp" -#include "mo_lambda.hpp" +#include <boost/locale/message.hpp> +#include <boost/locale/encoding.hpp> +#include <boost/locale/gnu_gettext.hpp> +#include <boost/locale/hold_ptr.hpp> +#include <boost/shared_ptr.hpp> +#include <boost/unordered_map.hpp> +#include <boost/version.hpp> +#include <algorithm> +#include <cstdio> +#include <cstring> +#include <iostream> +#include <map> +#include <vector> -#include <stdio.h> +#include "boost/locale/shared/mo_hash.hpp" +#include "boost/locale/shared/mo_lambda.hpp" -#include <string.h> +#ifdef BOOST_MSVC +# pragma warning(disable : 4996) +#endif namespace boost { namespace locale { namespace gnu_gettext { - + class c_file { c_file(c_file const &); void operator=(c_file const &); public: - + FILE *file; - c_file() : + c_file() : file(0) { } @@ -90,7 +89,7 @@ namespace boost { #else // POSIX systems do not have all this Wide API crap, as native codepages are UTF-8 // We do not use encoding as we use native file name encoding - + bool open(std::string const &file_name,std::string const &/* encoding */) { close(); @@ -107,7 +106,7 @@ namespace boost { class mo_file { public: typedef std::pair<char const *,char const *> pair_type; - + mo_file(std::vector<char> &file) : native_byteorder_(true), size_(0) @@ -137,13 +136,13 @@ namespace boost { st = pj_winberger_hash::update_state(st,context_in); st = pj_winberger_hash::update_state(st,'\4'); // EOT st = pj_winberger_hash::update_state(st,key_in); - hkey = st; + hkey = st; } uint32_t incr = 1 + hkey % (hash_size_-2); hkey %= hash_size_; uint32_t orig=hkey; - - + + do { uint32_t idx = get(hash_offset_ + 4*hkey); /// Not found @@ -168,13 +167,13 @@ namespace boost { size_t key_len = strlen(key); if(cntx_len + 1 + key_len != real_len) return false; - return + return memcmp(real_key,cntx,cntx_len) == 0 && real_key[cntx_len] == '\4' && memcmp(real_key + cntx_len + 1 ,key,key_len) == 0; } } - + char const *key(int id) const { uint32_t off = get(keys_offset_ + id*8 + 4); @@ -240,14 +239,14 @@ namespace boost { // ok to ingnore fread result size_t four_bytes = fread(&magic,4,1,file); (void)four_bytes; // shut GCC - + if(magic == 0x950412de) native_byteorder_ = true; else if(magic == 0xde120495) native_byteorder_ = false; else throw std::runtime_error("Invalid file format"); - + fseek(file,0,SEEK_END); long len=ftell(file); if(len < 0) { @@ -260,7 +259,7 @@ namespace boost { data_ = &vdata_[0]; file_size_ = len; } - + uint32_t get(unsigned offset) const { uint32_t tmp; @@ -304,7 +303,7 @@ namespace boost { return pair_type((char_type const *)(0),(char_type const *)(0)); } }; - + template<> struct mo_file_use_traits<char> { static const bool in_use = true; @@ -332,7 +331,7 @@ namespace boost { private: std::string in_; }; - + template<> class converter<char> { public: @@ -377,7 +376,7 @@ namespace boost { if(c!=0) c_context_ = c; else - c_context_ = ∅ + c_context_ = ∅ } bool operator < (message_key const &other) const { @@ -453,8 +452,8 @@ namespace boost { return state; } }; - - + + // By default for wide types the conversion is not requiredyy template<typename CharType> CharType const *runtime_conversion(CharType const *msg, @@ -489,29 +488,25 @@ namespace boost { typedef CharType char_type; typedef std::basic_string<CharType> string_type; typedef message_key<CharType> key_type; - #ifdef BOOST_LOCALE_UNORDERED_CATALOG typedef boost::unordered_map<key_type,string_type,hash_function<CharType> > catalog_type; - #else - typedef std::map<key_type,string_type> catalog_type; - #endif typedef std::vector<catalog_type> catalogs_set_type; typedef std::map<std::string,int> domains_map_type; public: typedef std::pair<CharType const *,CharType const *> pair_type; - virtual char_type const *get(int domain_id,char_type const *context,char_type const *id) const + char_type const *get(int domain_id,char_type const *context,char_type const *in_id) const BOOST_OVERRIDE { - return get_string(domain_id,context,id).first; + return get_string(domain_id,context,in_id).first; } - virtual char_type const *get(int domain_id,char_type const *context,char_type const *single_id,int n) const + char_type const *get(int domain_id,char_type const *context,char_type const *single_id,int n) const BOOST_OVERRIDE { pair_type ptr = get_string(domain_id,context,single_id); if(!ptr.first) return 0; int form=0; - if(plural_forms_.at(domain_id)) + if(plural_forms_.at(domain_id)) form = (*plural_forms_[domain_id])(n); else form = n == 1 ? 0 : 1; // Fallback to english plural form @@ -528,7 +523,7 @@ namespace boost { return p; } - virtual int domain(std::string const &domain) const + int domain(std::string const &domain) const BOOST_OVERRIDE { domains_map_type::const_iterator p=domains_.find(domain); if(p==domains_.end()) @@ -545,17 +540,17 @@ namespace boost { std::string lc_cat = inf.locale_category; std::vector<messages_info::domain> const &domains = inf.domains; std::vector<std::string> const &search_paths = inf.paths; - + // - // List of fallbacks: en_US@euro, en@euro, en_US, en. + // List of fallbacks: en_US@euro, en@euro, en_US, en. // std::vector<std::string> paths; - if(!variant.empty() && !country.empty()) + if(!variant.empty() && !country.empty()) paths.push_back(language + "_" + country + "@" + variant); - if(!variant.empty()) + if(!variant.empty()) paths.push_back(language + "@" + variant); if(!country.empty()) @@ -568,35 +563,31 @@ namespace boost { plural_forms_.resize(domains.size()); - for(unsigned id=0;id<domains.size();id++) { - std::string domain=domains[id].name; - std::string key_encoding = domains[id].encoding; - domains_[domain]=id; + for(unsigned i=0;i<domains.size();i++) { + std::string domain=domains[i].name; + std::string key_encoding = domains[i].encoding; + domains_[domain]=i; - bool found=false; + bool found=false; for(unsigned j=0;!found && j<paths.size();j++) { - for(unsigned i=0;!found && i<search_paths.size();i++) { - std::string full_path = search_paths[i]+"/"+paths[j]+"/" + lc_cat + "/"+domain+".mo"; - found = load_file(full_path,encoding,key_encoding,id,inf.callback); + for(unsigned k=0;!found && k<search_paths.size();k++) { + std::string full_path = search_paths[k]+"/"+paths[j]+"/" + lc_cat + "/"+domain+".mo"; + found = load_file(full_path,encoding,key_encoding,i,inf.callback); } } } } - - char_type const *convert(char_type const *msg,string_type &buffer) const - { - return runtime_conversion<char_type>(msg,buffer,key_conversion_required_,locale_encoding_,key_encoding_); - } - virtual ~mo_message() + char_type const *convert(char_type const *msg,string_type &buffer) const BOOST_OVERRIDE { + return runtime_conversion<char_type>(msg,buffer,key_conversion_required_,locale_encoding_,key_encoding_); } private: int compare_encodings(std::string const &left,std::string const &right) { - return convert_encoding_name(left).compare(convert_encoding_name(right)); + return convert_encoding_name(left).compare(convert_encoding_name(right)); } std::string convert_encoding_name(std::string const &in) @@ -619,20 +610,20 @@ namespace boost { bool load_file( std::string const &file_name, std::string const &locale_encoding, std::string const &key_encoding, - int id, + int idx, messages_info::callback_type const &callback) { locale_encoding_ = locale_encoding; key_encoding_ = key_encoding; - - key_conversion_required_ = sizeof(CharType) == 1 + + key_conversion_required_ = sizeof(CharType) == 1 && compare_encodings(locale_encoding,key_encoding)!=0; boost::shared_ptr<mo_file> mo; if(callback) { std::vector<char> vfile = callback(file_name,locale_encoding); - if(vfile.empty()) + if(vfile.empty()) return false; mo.reset(new mo_file(vfile)); } @@ -643,7 +634,7 @@ namespace boost { return false; mo.reset(new mo_file(the_file.file)); } - + std::string plural = extract(mo->value(0).first,"plural=","\r\n;"); std::string mo_encoding = extract(mo->value(0).first,"charset="," \r\n;"); @@ -652,12 +643,12 @@ namespace boost { throw std::runtime_error("Invalid mo-format, encoding is not specified"); if(!plural.empty()) { - plural_forms_[id] = lambda::compile(plural.c_str());; + plural_forms_[idx] = lambda::compile(plural.c_str());; } if( mo_useable_directly(mo_encoding,*mo) ) { - mo_catalogs_[id]=mo; + mo_catalogs_[idx]=mo; } else { converter<CharType> cvt_value(locale_encoding,mo_encoding); @@ -666,10 +657,10 @@ namespace boost { char const *ckey = mo->key(i); string_type skey = cvt_key(ckey,ckey+strlen(ckey)); key_type key(skey); - + mo_file::pair_type tmp = mo->value(i); string_type value = cvt_value(tmp.first,tmp.second); - catalogs_[id][key].swap(value); + catalogs_[idx][key].swap(value); } } return true; @@ -684,8 +675,10 @@ namespace boost { bool mo_useable_directly( std::string const &mo_encoding, mo_file const &mo) { +BOOST_LOCALE_START_CONST_CONDITION if(sizeof(CharType) != 1) return false; +BOOST_LOCALE_END_CONST_CONDITION if(!mo.has_hash()) return false; if(compare_encodings(mo_encoding,locale_encoding_)!=0) @@ -701,7 +694,7 @@ namespace boost { return true; } - + static std::string extract(std::string const &meta,std::string const &key,char const *separator) { @@ -721,7 +714,9 @@ namespace boost { pair_type null_pair((CharType const *)0,(CharType const *)0); if(domain_id < 0 || size_t(domain_id) >= catalogs_.size()) return null_pair; +BOOST_LOCALE_START_CONST_CONDITION if(mo_file_use_traits<char_type>::in_use && mo_catalogs_[domain_id]) { +BOOST_LOCALE_END_CONST_CONDITION return mo_file_use_traits<char_type>::use(*mo_catalogs_[domain_id],context,in_id); } else { @@ -741,7 +736,7 @@ namespace boost { domains_map_type domains_; std::string locale_encoding_; - std::string key_encoding_; + std::string key_encoding_; bool key_conversion_required_; }; @@ -756,7 +751,7 @@ namespace boost { { return new mo_message<wchar_t>(info); } - + #ifdef BOOST_LOCALE_ENABLE_CHAR16_T template<> @@ -765,7 +760,7 @@ namespace boost { return new mo_message<char16_t>(info); } #endif - + #ifdef BOOST_LOCALE_ENABLE_CHAR32_T template<> @@ -780,5 +775,4 @@ namespace boost { } // locale } // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/shared/mo_hash.hpp b/contrib/restricted/boost/locale/src/boost/locale/shared/mo_hash.hpp index d8c8f69c3d..5be7d16592 100644 --- a/contrib/restricted/boost/locale/src/shared/mo_hash.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/shared/mo_hash.hpp @@ -1,10 +1,8 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt #include <boost/cstdint.hpp> @@ -57,5 +55,4 @@ namespace boost { } } -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/shared/mo_lambda.cpp b/contrib/restricted/boost/locale/src/boost/locale/shared/mo_lambda.cpp index ab4bb0d8e4..fb3a783156 100644 --- a/contrib/restricted/boost/locale/src/shared/mo_lambda.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/shared/mo_lambda.cpp @@ -1,13 +1,16 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // -// 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) -// -#include "mo_lambda.hpp" -#include <string.h> -#include <stdlib.h> +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include "boost/locale/shared/mo_lambda.hpp" +#include <cstring> +#include <cstdlib> + +#ifdef BOOST_MSVC +#pragma warning(disable:4512) //assignment operator could not be generated +#endif namespace boost { namespace locale { @@ -16,19 +19,19 @@ namespace lambda { namespace { // anon struct identity : public plural { - virtual int operator()(int n) const + int operator()(int n) const BOOST_OVERRIDE { return n; }; - virtual identity *clone() const + identity *clone() const BOOST_OVERRIDE { return new identity(); } }; - struct unary : public plural + struct unary : public plural { - unary(plural_ptr ptr) : + unary(plural_ptr ptr) : op1(ptr) { } @@ -37,7 +40,7 @@ namespace { // anon }; - struct binary : public plural + struct binary : public plural { binary(plural_ptr p1,plural_ptr p2) : op1(p1), @@ -50,15 +53,15 @@ namespace { // anon struct number : public plural { - number(int v) : + number(int v) : val(v) { } - virtual int operator()(int /*n*/) const + int operator()(int /*n*/) const BOOST_OVERRIDE { return val; } - virtual number *clone() const + number *clone() const BOOST_OVERRIDE { return new number(val); } @@ -72,11 +75,11 @@ namespace { // anon name(plural_ptr op) : unary(op) \ { \ }; \ - virtual int operator()(int n) const \ + int operator()(int n) const BOOST_OVERRIDE \ { \ return oper (*op1)(n); \ } \ - virtual name *clone() const \ + name *clone() const BOOST_OVERRIDE \ { \ plural_ptr op1_copy(op1->clone()); \ return new name(op1_copy); \ @@ -91,11 +94,11 @@ namespace { // anon { \ } \ \ - virtual int operator()(int n) const \ + int operator()(int n) const BOOST_OVERRIDE \ { \ return (*op1)(n) oper (*op2)(n); \ } \ - virtual name *clone() const \ + name *clone() const BOOST_OVERRIDE \ { \ plural_ptr op1_copy(op1->clone()); \ plural_ptr op2_copy(op2->clone()); \ @@ -109,13 +112,13 @@ namespace { // anon binary(p1,p2) \ { \ } \ - virtual int operator()(int n) const \ + int operator()(int n) const BOOST_OVERRIDE \ { \ int v1=(*op1)(n); \ int v2=(*op2)(n); \ return v2==0 ? 0 : v1 oper v2; \ } \ - virtual name *clone() const \ + name *clone() const BOOST_OVERRIDE \ { \ plural_ptr op1_copy(op1->clone()); \ plural_ptr op2_copy(op2->clone()); \ @@ -174,17 +177,17 @@ namespace { // anon op3(p3) { } - virtual int operator()(int n) const + int operator()(int n) const BOOST_OVERRIDE { return (*op1)(n) ? (*op2)(n) : (*op3)(n); } - virtual conditional *clone() const - { - plural_ptr op1_copy(op1->clone()); - plural_ptr op2_copy(op2->clone()); - plural_ptr op3_copy(op3->clone()); - return new conditional(op1_copy,op2_copy,op3_copy); - } + conditional *clone() const BOOST_OVERRIDE + { + plural_ptr op1_copy(op1->clone()); + plural_ptr op2_copy(op2->clone()); + plural_ptr op3_copy(op3->clone()); + return new conditional(op1_copy,op2_copy,op3_copy); + } private: plural_ptr op1,op2,op3; }; @@ -247,18 +250,18 @@ namespace { // anon } private: char const *text; - int pos; + size_t pos; int next_tocken; int int_value; bool is_blank(char c) { return c==' ' || c=='\r' || c=='\n' || c=='\t'; } - bool isdigit(char c) + bool isdigit(char c) { - return '0'<=c && c<='9'; + return '0'<=c && c<='9'; } - void step() + void step() { while(text[pos] && is_blank(text[pos])) pos++; char const *ptr=text+pos; @@ -339,14 +342,14 @@ namespace { // anon static int level_unary[]={3,'-','!','~'}; if(is_in(t.next(),level_unary)) { int op=t.get(); - if((op1=un_expr()).get()==0) + if((op1=un_expr()).get()==0) return plural_ptr(); switch(op) { - case '-': + case '-': return plural_ptr(new minus(op1)); - case '!': + case '!': return plural_ptr(new l_not(op1)); - case '~': + case '~': return plural_ptr(new bin_not(op1)); default: return plural_ptr(); @@ -407,5 +410,4 @@ plural_ptr compile(char const *str) } // locale } // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/shared/mo_lambda.hpp b/contrib/restricted/boost/locale/src/boost/locale/shared/mo_lambda.hpp index c14afd0771..96d2caf374 100644 --- a/contrib/restricted/boost/locale/src/shared/mo_lambda.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/shared/mo_lambda.hpp @@ -1,38 +1,35 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_SRC_LOCALE_MO_LAMBDA_HPP_INCLUDED #define BOOST_SRC_LOCALE_MO_LAMBDA_HPP_INCLUDED +#include <boost/locale/config.hpp> #include <boost/shared_ptr.hpp> namespace boost { namespace locale { namespace gnu_gettext { namespace lambda { - + struct plural { virtual int operator()(int n) const = 0; virtual plural *clone() const = 0; - virtual ~plural() - { - } + virtual ~plural() {} }; typedef boost::shared_ptr<plural> plural_ptr; plural_ptr compile(char const *c_expression); - } // lambda + } // lambda } // gnu_gettext - } // locale + } // locale } // boost #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/std/all_generator.hpp b/contrib/restricted/boost/locale/src/boost/locale/std/all_generator.hpp index d79525b71b..6dc4f7d50a 100644 --- a/contrib/restricted/boost/locale/src/std/all_generator.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/std/all_generator.hpp @@ -1,15 +1,15 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_IMPL_STD_ALL_GENERATOR_HPP #define BOOST_LOCALE_IMPL_STD_ALL_GENERATOR_HPP #include <boost/locale/generator.hpp> -#include <vector> +#include <locale> +#include <string> namespace boost { namespace locale { @@ -44,11 +44,10 @@ namespace boost { std::locale create_codecvt( std::locale const &in, std::string const &locale_name, character_facet_type type, - utf8_support utf = utf8_none); + utf8_support utf = utf8_none); } } } #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/std/codecvt.cpp b/contrib/restricted/boost/locale/src/boost/locale/std/codecvt.cpp index 9b62d2f4f6..c20bb4af7b 100644 --- a/contrib/restricted/boost/locale/src/std/codecvt.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/std/codecvt.cpp @@ -1,16 +1,14 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE -#include <locale> -#include <boost/cstdint.hpp> +#include "boost/locale/std/all_generator.hpp" #include <boost/locale/util.hpp> -#include "all_generator.hpp" -#include <vector> +#include <locale> + namespace boost { namespace locale { namespace impl_std { @@ -20,12 +18,11 @@ namespace impl_std { { return std::locale(in,new std::codecvt_byname<CharType,char,std::mbstate_t>(locale_name.c_str())); } - std::locale create_codecvt( std::locale const &in, std::string const &locale_name, character_facet_type type, - utf8_support utf) + utf8_support utf) { if(utf == utf8_from_wide) { return util::create_utf8_codecvt(in,type); @@ -35,11 +32,11 @@ namespace impl_std { return codecvt_bychar<char>(in,locale_name); case wchar_t_facet: return codecvt_bychar<wchar_t>(in,locale_name); - #if defined(BOOST_LOCALE_ENABLE_CHAR16_T) && !defined(BOOST_NO_CHAR16_T_CODECVT) + #if defined(BOOST_LOCALE_ENABLE_CHAR16_T) case char16_t_facet: return codecvt_bychar<char16_t>(in,locale_name); #endif - #if defined(BOOST_LOCALE_ENABLE_CHAR32_T) && !defined(BOOST_NO_CHAR32_T_CODECVT) + #if defined(BOOST_LOCALE_ENABLE_CHAR32_T) case char32_t_facet: return codecvt_bychar<char32_t>(in,locale_name); #endif @@ -49,7 +46,6 @@ namespace impl_std { } } // impl_std -} // locale +} // locale } // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/std/collate.cpp b/contrib/restricted/boost/locale/src/boost/locale/std/collate.cpp index 8b7127ad77..cf109f1731 100644 --- a/contrib/restricted/boost/locale/src/std/collate.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/std/collate.cpp @@ -1,16 +1,15 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE +#include <boost/locale/encoding.hpp> #include <locale> #include <string> #include <ios> -#include <boost/locale/encoding.hpp> -#include "all_generator.hpp" +#include "boost/locale/std/all_generator.hpp" namespace boost { namespace locale { @@ -19,29 +18,30 @@ namespace impl_std { class utf8_collator_from_wide : public std::collate<char> { public: typedef std::collate<wchar_t> wfacet; - utf8_collator_from_wide(std::locale const &base,size_t refs = 0) : + utf8_collator_from_wide(std::locale const &base,size_t refs = 0) : std::collate<char>(refs), base_(base) { } - virtual int do_compare(char const *lb,char const *le,char const *rb,char const *re) const + int do_compare(char const *lb,char const *le,char const *rb,char const *re) const BOOST_OVERRIDE { std::wstring l=conv::to_utf<wchar_t>(lb,le,"UTF-8"); std::wstring r=conv::to_utf<wchar_t>(rb,re,"UTF-8"); return std::use_facet<wfacet>(base_).compare( l.c_str(),l.c_str()+l.size(), r.c_str(),r.c_str()+r.size()); } - virtual long do_hash(char const *b,char const *e) const + long do_hash(char const *b,char const *e) const BOOST_OVERRIDE { std::wstring tmp=conv::to_utf<wchar_t>(b,e,"UTF-8"); return std::use_facet<wfacet>(base_).hash(tmp.c_str(),tmp.c_str()+tmp.size()); } - virtual std::string do_transform(char const *b,char const *e) const + std::string do_transform(char const *b,char const *e) const BOOST_OVERRIDE { std::wstring tmp=conv::to_utf<wchar_t>(b,e,"UTF-8"); - std::wstring wkey = + std::wstring wkey = std::use_facet<wfacet>(base_).transform(tmp.c_str(),tmp.c_str()+tmp.size()); std::string key; +BOOST_LOCALE_START_CONST_CONDITION if(sizeof(wchar_t)==2) key.reserve(wkey.size()*2); else @@ -60,6 +60,7 @@ public: key += char(tv & 0xFF); } } +BOOST_LOCALE_END_CONST_CONDITION return key; } private: @@ -105,9 +106,8 @@ std::locale create_collate( std::locale const &in, } // impl_std -} // locale +} // locale } //boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/std/converter.cpp b/contrib/restricted/boost/locale/src/boost/locale/std/converter.cpp index e4f925ade4..032d643deb 100644 --- a/contrib/restricted/boost/locale/src/std/converter.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/std/converter.cpp @@ -1,46 +1,42 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // -// 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) -// -#define BOOST_LOCALE_SOURCE +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt -#include <boost/config.hpp> -#ifdef BOOST_MSVC -# pragma warning(disable : 4996) -#endif +#define BOOST_LOCALE_SOURCE -#include <locale> -#include <stdexcept> -#include <boost/locale/generator.hpp> +#include <boost/locale/config.hpp> #include <boost/locale/conversion.hpp> #include <boost/locale/encoding.hpp> +#include <boost/locale/generator.hpp> +#include <locale> +#include <stdexcept> #include <vector> +#include "boost/locale/std/all_generator.hpp" - -#include "all_generator.hpp" +#ifdef BOOST_MSVC +# pragma warning(disable : 4996) +#endif namespace boost { namespace locale { namespace impl_std { - template<typename CharType> -class std_converter : public converter<CharType> +class std_converter : public converter<CharType> { public: typedef CharType char_type; typedef std::basic_string<char_type> string_type; typedef std::ctype<char_type> ctype_type; - std_converter(std::locale const &base,size_t refs = 0) : + std_converter(std::locale const &base,size_t refs = 0) : converter<CharType>(refs), base_(base) { } - virtual string_type convert(converter_base::conversion_type how,char_type const *begin,char_type const *end,int /*flags*/ = 0) const + string_type convert(converter_base::conversion_type how,char_type const *begin,char_type const *end,int /*flags*/ = 0) const BOOST_OVERRIDE { switch(how) { case converter_base::upper_case: @@ -70,12 +66,12 @@ class utf8_converter : public converter<char> { public: typedef std::ctype<char> ctype_type; typedef std::ctype<wchar_t> wctype_type; - utf8_converter(std::locale const &base,size_t refs = 0) : + utf8_converter(std::locale const &base,size_t refs = 0) : converter<char>(refs), base_(base) { } - virtual std::string convert(converter_base::conversion_type how,char const *begin,char const *end,int /*flags*/ = 0) const + std::string convert(converter_base::conversion_type how,char const *begin,char const *end,int /*flags*/ = 0) const BOOST_OVERRIDE { switch(how) { case upper_case: @@ -108,7 +104,7 @@ std::locale create_convert( std::locale const &in, utf8_support utf) { switch(type) { - case char_facet: + case char_facet: { if(utf == utf8_native_with_wide || utf == utf8_from_wide) { std::locale base(std::locale::classic(),new std::ctype_byname<wchar_t>(locale_name.c_str())); @@ -143,6 +139,5 @@ std::locale create_convert( std::locale const &in, } // namespace impl_std -} // locale +} // locale } // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/std/numeric.cpp b/contrib/restricted/boost/locale/src/boost/locale/std/numeric.cpp index cbb0d9de31..f5bc534b92 100644 --- a/contrib/restricted/boost/locale/src/std/numeric.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/std/numeric.cpp @@ -1,22 +1,21 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE -#include <locale> -#include <string> -#include <ios> +#include <boost/locale/encoding.hpp> #include <boost/locale/formatting.hpp> #include <boost/locale/generator.hpp> -#include <boost/locale/encoding.hpp> +#include <cstdlib> +#include <ios> +#include <locale> #include <sstream> -#include <stdlib.h> +#include <string> -#include "../util/numeric.hpp" -#include "all_generator.hpp" +#include "boost/locale/util/numeric.hpp" +#include "boost/locale/std/all_generator.hpp" namespace boost { namespace locale { @@ -25,14 +24,14 @@ namespace impl_std { template<typename CharType> class time_put_from_base : public std::time_put<CharType> { public: - time_put_from_base(std::locale const &base, size_t refs = 0) : + time_put_from_base(std::locale const &base, size_t refs = 0) : std::time_put<CharType>(refs), base_(base) { } typedef typename std::time_put<CharType>::iter_type iter_type; - virtual iter_type do_put(iter_type out,std::ios_base &/*ios*/,CharType fill,std::tm const *tm,char format,char modifier) const + iter_type do_put(iter_type out,std::ios_base &/*ios*/,CharType fill,std::tm const *tm,char format,char modifier) const BOOST_OVERRIDE { std::basic_stringstream<CharType> ss; ss.imbue(base_); @@ -44,12 +43,12 @@ private: class utf8_time_put_from_wide : public std::time_put<char> { public: - utf8_time_put_from_wide(std::locale const &base, size_t refs = 0) : + utf8_time_put_from_wide(std::locale const &base, size_t refs = 0) : std::time_put<char>(refs), base_(base) { } - virtual iter_type do_put(iter_type out,std::ios_base &/*ios*/,char fill,std::tm const *tm,char format,char modifier = 0) const + iter_type do_put(iter_type out,std::ios_base &/*ios*/,char fill,std::tm const *tm,char format,char modifier = 0) const BOOST_OVERRIDE { std::basic_ostringstream<wchar_t> wtmps; wtmps.imbue(base_); @@ -71,14 +70,14 @@ public: { typedef std::numpunct<wchar_t> wfacet_type; wfacet_type const &wfacet = std::use_facet<wfacet_type>(base); - + truename_ = conv::from_utf<wchar_t>(wfacet.truename(),"UTF-8"); falsename_ = conv::from_utf<wchar_t>(wfacet.falsename(),"UTF-8"); - + wchar_t tmp_decimal_point = wfacet.decimal_point(); wchar_t tmp_thousands_sep = wfacet.thousands_sep(); std::string tmp_grouping = wfacet.grouping(); - + if( 32 <= tmp_thousands_sep && tmp_thousands_sep <=126 && 32 <= tmp_decimal_point && tmp_decimal_point <=126) { @@ -105,23 +104,23 @@ public: } } - virtual char do_decimal_point() const + char do_decimal_point() const BOOST_OVERRIDE { return decimal_point_; } - virtual char do_thousands_sep() const + char do_thousands_sep() const BOOST_OVERRIDE { return thousands_sep_; } - virtual std::string do_grouping() const + std::string do_grouping() const BOOST_OVERRIDE { return grouping_; } - virtual std::string do_truename() const + std::string do_truename() const BOOST_OVERRIDE { return truename_; } - virtual std::string do_falsename() const + std::string do_falsename() const BOOST_OVERRIDE { return falsename_; } @@ -131,7 +130,7 @@ private: char thousands_sep_; char decimal_point_; std::string grouping_; - + }; template<bool Intl> @@ -178,45 +177,45 @@ public: } } - virtual char do_decimal_point() const + char do_decimal_point() const BOOST_OVERRIDE { return decimal_point_; } - virtual char do_thousands_sep() const + char do_thousands_sep() const BOOST_OVERRIDE { return thousands_sep_; } - virtual std::string do_grouping() const + std::string do_grouping() const BOOST_OVERRIDE { return grouping_; } - virtual std::string do_curr_symbol() const + std::string do_curr_symbol() const BOOST_OVERRIDE { return curr_symbol_; } - virtual std::string do_positive_sign () const + std::string do_positive_sign () const BOOST_OVERRIDE { return positive_sign_; } - virtual std::string do_negative_sign() const + std::string do_negative_sign() const BOOST_OVERRIDE { return negative_sign_; } - virtual int do_frac_digits() const + int do_frac_digits() const BOOST_OVERRIDE { return frac_digits_; } - virtual std::money_base::pattern do_pos_format() const + std::money_base::pattern do_pos_format() const BOOST_OVERRIDE { return pos_format_; } - virtual std::money_base::pattern do_neg_format() const + std::money_base::pattern do_neg_format() const BOOST_OVERRIDE { return neg_format_; } @@ -230,7 +229,7 @@ private: std::string negative_sign_; int frac_digits_; std::money_base::pattern pos_format_,neg_format_; - + }; class utf8_numpunct : public std::numpunct_byname<char> { @@ -240,7 +239,7 @@ public: std::numpunct_byname<char>(name,refs) { } - virtual char do_thousands_sep() const + char do_thousands_sep() const BOOST_OVERRIDE { unsigned char bs = base_type::do_thousands_sep(); if(bs > 127) @@ -251,7 +250,7 @@ public: else return bs; } - virtual std::string do_grouping() const + std::string do_grouping() const BOOST_OVERRIDE { unsigned char bs = base_type::do_thousands_sep(); if(bs > 127 && bs != 0xA0) @@ -268,7 +267,7 @@ public: std::moneypunct_byname<char,Intl>(name,refs) { } - virtual char do_thousands_sep() const + char do_thousands_sep() const BOOST_OVERRIDE { unsigned char bs = base_type::do_thousands_sep(); if(bs > 127) @@ -279,7 +278,7 @@ public: else return bs; } - virtual std::string do_grouping() const + std::string do_grouping() const BOOST_OVERRIDE { unsigned char bs = base_type::do_thousands_sep(); if(bs > 127 && bs != 0xA0) @@ -315,11 +314,11 @@ std::locale create_formatting( std::locale const &in, utf8_support utf) { switch(type) { - case char_facet: + case char_facet: { if(utf == utf8_from_wide ) { std::locale base = std::locale(locale_name.c_str()); - + std::locale tmp = std::locale(in,new utf8_time_put_from_wide(base)); tmp = std::locale(tmp,new utf8_numpunct_from_wide(base)); tmp = std::locale(tmp,new utf8_moneypunct_from_wide<true>(base)); @@ -388,7 +387,7 @@ std::locale create_parsing( std::locale const &in, { if(utf == utf8_from_wide ) { std::locale base = std::locale::classic(); - + base = std::locale(base,new std::numpunct_byname<wchar_t>(locale_name.c_str())); base = std::locale(base,new std::moneypunct_byname<wchar_t,true>(locale_name.c_str())); base = std::locale(base,new std::moneypunct_byname<wchar_t,false>(locale_name.c_str())); @@ -412,7 +411,7 @@ std::locale create_parsing( std::locale const &in, tmp = std::locale(tmp,new utf8_moneypunct_from_wide<false>(base)); return std::locale(tmp,new util::base_num_parse<char>()); } - else + else { std::locale tmp = create_basic_parsing<char>(in,locale_name); tmp = std::locale(in,new util::base_num_parse<char>()); @@ -448,9 +447,8 @@ std::locale create_parsing( std::locale const &in, } // impl_std -} // locale +} // locale } //boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/std/std_backend.cpp b/contrib/restricted/boost/locale/src/boost/locale/std/std_backend.cpp index f9afcb417e..b9599ec06a 100644 --- a/contrib/restricted/boost/locale/src/std/std_backend.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/std/std_backend.cpp @@ -1,43 +1,42 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE +#include "boost/locale/std/std_backend.hpp" #include <boost/locale/localization_backend.hpp> #include <boost/locale/gnu_gettext.hpp> -#include "all_generator.hpp" -#include "../util/locale_data.hpp" -#include "../util/gregorian.hpp" #include <boost/locale/util.hpp> #include <algorithm> #include <iterator> +#include <vector> #if defined(BOOST_WINDOWS) # ifndef NOMINMAX # define NOMINMAX # endif # include <windows.h> -# include "../encoding/conv.hpp" -# include "../win32/lcid.hpp" +# include "boost/locale/encoding/conv.hpp" +# include "boost/locale/win32/lcid.hpp" #endif - -#include "std_backend.hpp" +#include "boost/locale/std/all_generator.hpp" +#include "boost/locale/util/locale_data.hpp" +#include "boost/locale/util/gregorian.hpp" namespace boost { namespace locale { -namespace impl_std { - +namespace impl_std { + class std_localization_backend : public localization_backend { public: - std_localization_backend() : + std_localization_backend() : invalid_(true), use_ansi_encoding_(false) { } - std_localization_backend(std_localization_backend const &other) : + std_localization_backend(std_localization_backend const &other) : localization_backend(), paths_(other.paths_), domains_(other.domains_), @@ -46,12 +45,12 @@ namespace impl_std { use_ansi_encoding_(other.use_ansi_encoding_) { } - virtual std_localization_backend *clone() const + std_localization_backend *clone() const BOOST_OVERRIDE { return new std_localization_backend(*this); } - void set_option(std::string const &name,std::string const &value) + void set_option(std::string const &name,std::string const &value) BOOST_OVERRIDE { invalid_ = true; if(name=="locale") @@ -64,7 +63,7 @@ namespace impl_std { use_ansi_encoding_ = value == "true"; } - void clear_options() + void clear_options() BOOST_OVERRIDE { invalid_ = true; use_ansi_encoding_ = false; @@ -100,8 +99,8 @@ namespace impl_std { utf_mode_ = utf8_none; } #if defined(BOOST_WINDOWS) - else if(loadable(win_name) - && win_codepage == conv::impl::encoding_to_windows_codepage(data_.encoding.c_str())) + else if(loadable(win_name) + && win_codepage == conv::impl::encoding_to_windows_codepage(data_.encoding.c_str())) { name_ = win_name; utf_mode_ = utf8_none; @@ -121,7 +120,7 @@ namespace impl_std { #endif } } - + #if defined(BOOST_WINDOWS) std::pair<std::string,int> to_windows_name(std::string const &l) { @@ -137,7 +136,7 @@ namespace impl_std { lc_name += "_"; lc_name += win_country; } - + res.first = lc_name; if(GetLocaleInfoA(lcid,LOCALE_IDEFAULTANSICODEPAGE,win_codepage,sizeof(win_codepage))!=0) @@ -145,7 +144,7 @@ namespace impl_std { return res; } #endif - + bool loadable(std::string name) { try { @@ -156,10 +155,10 @@ namespace impl_std { return false; } } - - virtual std::locale install(std::locale const &base, + + std::locale install(std::locale const &base, locale_category_type category, - character_facet_type type = nochar_facet) + character_facet_type type = nochar_facet) BOOST_OVERRIDE { prepare_data(); @@ -222,7 +221,7 @@ namespace impl_std { bool invalid_; bool use_ansi_encoding_; }; - + localization_backend *create_localization_backend() { return new std_localization_backend(); @@ -231,4 +230,3 @@ namespace impl_std { } // impl icu } // locale } // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/boost/locale/std/std_backend.hpp b/contrib/restricted/boost/locale/src/boost/locale/std/std_backend.hpp new file mode 100644 index 0000000000..b96a4ab156 --- /dev/null +++ b/contrib/restricted/boost/locale/src/boost/locale/std/std_backend.hpp @@ -0,0 +1,18 @@ +// +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) +// +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_LOCALE_IMPL_STD_LOCALIZATION_BACKEND_HPP +#define BOOST_LOCALE_IMPL_STD_LOCALIZATION_BACKEND_HPP +namespace boost { + namespace locale { + class localization_backend; + namespace impl_std { + localization_backend *create_localization_backend(); + } // impl_std + } // locale +} // boost +#endif + diff --git a/contrib/restricted/boost/locale/src/util/codecvt_converter.cpp b/contrib/restricted/boost/locale/src/boost/locale/util/codecvt_converter.cpp index 1adb6b41dc..f1c91a2fef 100644 --- a/contrib/restricted/boost/locale/src/util/codecvt_converter.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/util/codecvt_converter.cpp @@ -1,59 +1,56 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE #include <boost/locale/generator.hpp> #include <boost/locale/encoding.hpp> #include <boost/locale/utf8_codecvt.hpp> - -#include "../encoding/conv.hpp" - #include <boost/locale/util.hpp> - -#ifdef BOOST_MSVC -# pragma warning(disable : 4244 4996) // loose data -#endif - -#include <cstddef> -#include <string.h> -#include <vector> #include <algorithm> +#include <cstddef> +#include <cstring> -//#define DEBUG_CODECVT +#include "boost/locale/encoding/conv.hpp" -#ifdef DEBUG_CODECVT +//#define DEBUG_CODECVT +#ifdef DEBUG_CODECVT #include <iostream> #endif +#ifdef BOOST_MSVC +# pragma warning(disable : 4244 4996) // loose data +#endif + namespace boost { namespace locale { namespace util { - + + base_converter::~base_converter() {} + class utf8_converter : public base_converter { public: - virtual int max_len() const + int max_len() const BOOST_OVERRIDE { return 4; } - virtual utf8_converter *clone() const + utf8_converter *clone() const BOOST_OVERRIDE { return new utf8_converter(); } - bool is_thread_safe() const + bool is_thread_safe() const BOOST_OVERRIDE { return true; } - virtual uint32_t to_unicode(char const *&begin,char const *end) + uint32_t to_unicode(char const *&begin,char const *end) BOOST_OVERRIDE { char const *p=begin; - + utf::code_point c = utf::utf_traits<char>::decode(p,end); if(c==utf::illegal) @@ -66,7 +63,7 @@ namespace util { return c; } - virtual uint32_t from_unicode(uint32_t u,char *begin,char const *end) + uint32_t from_unicode(uint32_t u,char *begin,char const *end) BOOST_OVERRIDE { if(!utf::is_valid_codepoint(u)) return illegal; @@ -81,7 +78,7 @@ namespace util { class simple_converter_impl { public: - + static const int hash_table_size = 1024; simple_converter_impl(std::string const &encoding) @@ -149,34 +146,30 @@ namespace util { class simple_converter : public base_converter { public: - virtual ~simple_converter() - { - } - - simple_converter(std::string const &encoding) : + simple_converter(std::string const &encoding) : cvt_(encoding) { } - virtual int max_len() const + int max_len() const BOOST_OVERRIDE { return 1; } - virtual bool is_thread_safe() const + bool is_thread_safe() const BOOST_OVERRIDE { return true; } - virtual base_converter *clone() const + base_converter *clone() const BOOST_OVERRIDE { - return new simple_converter(*this); + return new simple_converter(*this); } - virtual uint32_t to_unicode(char const *&begin,char const *end) + uint32_t to_unicode(char const *&begin,char const *end) BOOST_OVERRIDE { return cvt_.to_unicode(begin,end); } - virtual uint32_t from_unicode(uint32_t u,char *begin,char const *end) + uint32_t from_unicode(uint32_t u,char *begin,char const *end) BOOST_OVERRIDE { return cvt_.from_unicode(u,begin,end); } @@ -196,7 +189,7 @@ namespace util { } struct state_type {}; - static state_type initial_state(generic_codecvt_base::initial_convertion_state /* unused */) + static state_type initial_state(generic_codecvt_base::initial_convertion_state /* unused */) { return state_type(); } @@ -205,7 +198,7 @@ namespace util { return 1; } - utf::code_point to_unicode(state_type &,char const *&begin,char const *end) const + utf::code_point to_unicode(state_type &,char const *&begin,char const *end) const { return cvt_.to_unicode(begin,end); } @@ -215,8 +208,8 @@ namespace util { return cvt_.from_unicode(u,begin,end); } private: - simple_converter_impl cvt_; - + simple_converter_impl cvt_; + }; namespace { @@ -266,10 +259,9 @@ namespace util { simple_encoding_table + sizeof(simple_encoding_table)/sizeof(char const *), norm.c_str(), compare_strings); - return 0; } - - #if !defined(BOOST_LOCALE_HIDE_AUTO_PTR) && !defined(BOOST_NO_AUTO_PTR) + + #if BOOST_LOCALE_USE_AUTO_PTR std::auto_ptr<base_converter> create_utf8_converter() { std::auto_ptr<base_converter> res(create_utf8_converter_new_ptr()); @@ -313,7 +305,7 @@ namespace util { { return new utf8_converter(); } - + template<typename CharType> class code_converter : public generic_codecvt<CharType,code_converter<CharType> > { @@ -326,8 +318,8 @@ namespace util { #define PTR_TRANS(x) (x) #endif typedef base_converter_ptr state_type; - - code_converter(base_converter_ptr cvt,size_t refs = 0) : + + code_converter(base_converter_ptr cvt,size_t refs = 0) : generic_codecvt<CharType,code_converter<CharType> >(refs), cvt_(PTR_TRANS(cvt)) { @@ -349,7 +341,7 @@ namespace util { return r; } - utf::code_point to_unicode(base_converter_ptr &ptr,char const *&begin,char const *end) const + utf::code_point to_unicode(base_converter_ptr &ptr,char const *&begin,char const *end) const { if(thread_safe_) return cvt_->to_unicode(begin,end); @@ -364,7 +356,7 @@ namespace util { else return ptr->from_unicode(u,begin,end); } - + private: base_converter_ptr cvt_; int max_len_; @@ -382,11 +374,11 @@ namespace util { return std::locale(in,new code_converter<char>(PTR_TRANS(cvt))); case wchar_t_facet: return std::locale(in,new code_converter<wchar_t>(PTR_TRANS(cvt))); - #if defined(BOOST_LOCALE_ENABLE_CHAR16_T) && !defined(BOOST_NO_CHAR16_T_CODECVT) + #if defined(BOOST_LOCALE_ENABLE_CHAR16_T) case char16_t_facet: return std::locale(in,new code_converter<char16_t>(PTR_TRANS(cvt))); #endif - #if defined(BOOST_LOCALE_ENABLE_CHAR32_T) && !defined(BOOST_NO_CHAR32_T_CODECVT) + #if defined(BOOST_LOCALE_ENABLE_CHAR32_T) case char32_t_facet: return std::locale(in,new code_converter<char32_t>(PTR_TRANS(cvt))); #endif @@ -396,10 +388,10 @@ namespace util { } - /// + /// /// Install utf8 codecvt to UTF-16 or UTF-32 into locale \a in and return - /// new locale that is based on \a in and uses new facet. - /// + /// new locale that is based on \a in and uses new facet. + /// std::locale create_utf8_codecvt(std::locale const &in,character_facet_type type) { switch(type) { @@ -407,11 +399,11 @@ namespace util { return std::locale(in,new utf8_codecvt<char>()); case wchar_t_facet: return std::locale(in,new utf8_codecvt<wchar_t>()); - #if defined(BOOST_LOCALE_ENABLE_CHAR16_T) && !defined(BOOST_NO_CHAR16_T_CODECVT) + #if defined(BOOST_LOCALE_ENABLE_CHAR16_T) case char16_t_facet: return std::locale(in,new utf8_codecvt<char16_t>()); #endif - #if defined(BOOST_LOCALE_ENABLE_CHAR32_T) && !defined(BOOST_NO_CHAR32_T_CODECVT) + #if defined(BOOST_LOCALE_ENABLE_CHAR32_T) case char32_t_facet: return std::locale(in,new utf8_codecvt<char32_t>()); #endif @@ -423,7 +415,7 @@ namespace util { /// /// This function installs codecvt that can be used for conversion between single byte /// character encodings like ISO-8859-1, koi8-r, windows-1255 and Unicode code points, - /// + /// /// Throws invalid_charset_error if the chacater set is not supported or isn't single byte character /// set std::locale create_simple_codecvt(std::locale const &in,std::string const &encoding,character_facet_type type) @@ -436,11 +428,11 @@ namespace util { return std::locale(in,new simple_codecvt<char>(encoding)); case wchar_t_facet: return std::locale(in,new simple_codecvt<wchar_t>(encoding)); - #if defined(BOOST_LOCALE_ENABLE_CHAR16_T) && !defined(BOOST_NO_CHAR16_T_CODECVT) + #if defined(BOOST_LOCALE_ENABLE_CHAR16_T) case char16_t_facet: return std::locale(in,new simple_codecvt<char16_t>(encoding)); #endif - #if defined(BOOST_LOCALE_ENABLE_CHAR32_T) && !defined(BOOST_NO_CHAR32_T_CODECVT) + #if defined(BOOST_LOCALE_ENABLE_CHAR32_T) case char32_t_facet: return std::locale(in,new simple_codecvt<char32_t>(encoding)); #endif @@ -452,7 +444,6 @@ namespace util { } // util -} // locale +} // locale } // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/util/default_locale.cpp b/contrib/restricted/boost/locale/src/boost/locale/util/default_locale.cpp index b0aab03c71..ebb4232155 100644 --- a/contrib/restricted/boost/locale/src/util/default_locale.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/util/default_locale.cpp @@ -1,19 +1,12 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt #define BOOST_LOCALE_SOURCE #include <boost/locale/util.hpp> -#include <boost/config.hpp> -#include <stdlib.h> - -#ifdef BOOST_MSVC -# pragma warning(disable : 4996) -#endif +#include <cstdlib> #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) #ifndef NOMINMAX @@ -23,6 +16,10 @@ #define BOOST_LOCALE_USE_WIN32_API #endif +#ifdef BOOST_MSVC +# pragma warning(disable : 4996) +#endif + namespace boost { namespace locale { namespace util { @@ -69,12 +66,11 @@ namespace boost { lc_name += ".UTF-8"; } return lc_name; - + #endif } } // impl } // locale } // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/util/gregorian.cpp b/contrib/restricted/boost/locale/src/boost/locale/util/gregorian.cpp index 49e45c3a52..d39e747978 100644 --- a/contrib/restricted/boost/locale/src/util/gregorian.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/util/gregorian.cpp @@ -1,29 +1,27 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE -#include <boost/config.hpp> -#ifdef BOOST_MSVC -# pragma warning(disable : 4996) -#endif -#include <locale> -#include <string> -#include <ios> +#include "boost/locale/util/gregorian.hpp" #include <boost/locale/date_time_facet.hpp> #include <boost/locale/date_time.hpp> #include <boost/locale/hold_ptr.hpp> -#include <stdlib.h> -#include <ctime> -#include <memory> +#include "boost/locale/util/timezone.hpp" #include <algorithm> +#include <cstdlib> +#include <ctime> +#include <ios> #include <limits> +#include <locale> +#include <memory> +#include <string> -#include "timezone.hpp" -#include "gregorian.hpp" +#ifdef BOOST_MSVC +# pragma warning(disable : 4996) +#endif namespace boost { namespace locale { @@ -70,7 +68,7 @@ namespace util { }; return days[is_leap(year)][month-1] + day - 1; } - + std::time_t internal_timegm(std::tm const *t) { int year = t->tm_year + 1900; @@ -88,10 +86,10 @@ namespace util { int day = t->tm_mday; int day_of_year = days_from_1jan(year,month,day); int days_since_epoch = days_from_1970(year) + day_of_year; - + std::time_t seconds_in_day = 3600 * 24; std::time_t result = seconds_in_day * days_since_epoch + 3600 * t->tm_hour + 60 * t->tm_min + t->tm_sec; - + return result; } @@ -108,7 +106,7 @@ namespace util { { return strcmp(left,right) < 0; } - + // // Ref: CLDR 1.9 common/supplemental/supplementalData.xml // @@ -128,7 +126,7 @@ namespace util { "AR","AS","AZ","BW","CA","CN","FO","GE","GL","GU", "HK","IL","IN","JM","JP","KG","KR","LA","MH","MN", "MO","MP","MT","NZ","PH","PK","SG","TH","TT","TW", - "UM","US","UZ","VI","ZW" + "UM","US","UZ","VI","ZW" }; if(strcmp(terr,"MV") == 0) return 5; // fri @@ -143,7 +141,7 @@ namespace util { class gregorian_calendar : public abstract_calendar { public: - + gregorian_calendar(std::string const &terr) { first_day_of_week_ = first_day_of_week(terr.c_str()); @@ -152,11 +150,11 @@ namespace util { tzoff_ = 0; from_time(time_); } - + /// /// Make a polymorphic copy of the calendar /// - virtual gregorian_calendar *clone() const + gregorian_calendar *clone() const BOOST_OVERRIDE { return new gregorian_calendar(*this); } @@ -164,10 +162,10 @@ namespace util { /// /// Set specific \a value for period \a p, note not all values are settable. /// - virtual void set_value(period::marks::period_mark p,int value) + void set_value(period::marks::period_mark m,int value) BOOST_OVERRIDE { using namespace period::marks; - switch(p) { + switch(m) { case era: ///< Era i.e. AC, BC in Gregorian and Julian calendar, range [0,1] return; case year: ///< Year, it is calendar specific @@ -200,11 +198,11 @@ namespace util { tm_updated_.tm_mday += (value - (tm_updated_.tm_yday + 1)); break; case day_of_week: ///< Day of week, starting from Sunday, [1..7] - if(value < 1) // make sure it is positive + if(value < 1) // make sure it is positive value += (-value / 7) * 7 + 7; // convert to local DOW value = (value - 1 - first_day_of_week_ + 14) % 7 + 1; - // fall throght + BOOST_FALLTHROUGH; case day_of_week_local: ///< Local day of week, for example in France Monday is 1, in US Sunday is 1, [1..7] normalize(); tm_updated_.tm_mday += (value - 1) - (tm_updated_.tm_wday - first_day_of_week_ + 7) % 7; @@ -214,7 +212,7 @@ namespace util { case week_of_month: ///< The week number withing current month { normalize(); - int current_week = get_value(p,current); + int current_week = get_value(m,current); int diff = 7 * (value - current_week); tm_updated_.tm_mday += diff; } @@ -226,12 +224,12 @@ namespace util { normalized_ = false; } - void normalize() + void normalize() BOOST_OVERRIDE { if(!normalized_) { std::tm val = tm_updated_; val.tm_isdst = -1; - val.tm_wday = -1; // indecator of error + val.tm_wday = -1; // indicator of error std::time_t point = -1; if(is_local_) { point = std::mktime(&val); @@ -259,9 +257,9 @@ namespace util { if(!gmtime_r(&point,&val)) throw date_time_error("boost::locale::gregorian_calendar invalid time"); #endif - + } - + time_ = point - tzoff_; tm_ = val; tm_updated_ = val; @@ -281,7 +279,7 @@ namespace util { // Alaways use local week start int current_dow = (wday - first_day_of_week_ + 7) % 7; // Calculate local week day of Jan 1st. - int first_week_day = (current_dow + 700 - day) % 7; + int first_week_day = (current_dow + 700 - day) % 7; // adding something big devidable by 7 int start_of_period_in_weeks; @@ -300,10 +298,10 @@ namespace util { /// /// Get specific value for period \a p according to a value_type \a v /// - virtual int get_value(period::marks::period_mark p,value_type v) const + int get_value(period::marks::period_mark m,value_type v) const BOOST_OVERRIDE { using namespace period::marks; - switch(p) { + switch(m) { case era: return 1; case year: @@ -318,15 +316,17 @@ namespace util { if(sizeof(std::time_t) == 4) return 1901; // minimal year with 32 bit time_t else - return 1; + return 1; #endif case absolute_maximum: case least_maximum: case actual_maximum: +BOOST_LOCALE_START_CONST_CONDITION if(sizeof(std::time_t) == 4) return 2038; // Y2K38 - maximal with 32 bit time_t else return std::numeric_limits<int>::max(); +BOOST_LOCALE_END_CONST_CONDITION case current: return tm_.tm_year + 1900; }; @@ -477,7 +477,7 @@ namespace util { break; case period::marks::first_day_of_week: ///< For example Sunday in US, Monday in France return first_day_of_week_ + 1; - + case week_of_year: ///< The week number in the year switch(v) { case absolute_minimum: @@ -503,6 +503,7 @@ namespace util { return val; } } + break; case week_of_month: ///< The week number withing current month switch(v) { case absolute_minimum: @@ -527,7 +528,7 @@ namespace util { return val; } } - + break; case day_of_week_in_month: ///< Original number of the day of the week in month. switch(v) { case absolute_minimum: @@ -554,17 +555,17 @@ namespace util { ; } return 0; - + } /// /// Set current time point /// - virtual void set_time(posix_time const &p) + void set_time(posix_time const &p) BOOST_OVERRIDE { from_time(static_cast<std::time_t>(p.seconds)); } - virtual posix_time get_time() const + posix_time get_time() const BOOST_OVERRIDE { posix_time pt = { time_, 0}; return pt; @@ -573,7 +574,7 @@ namespace util { /// /// Set option for calendar, for future use /// - virtual void set_option(calendar_option_type opt,int /*v*/) + void set_option(calendar_option_type opt,int /*v*/) BOOST_OVERRIDE { switch(opt) { case is_gregorian: @@ -587,7 +588,7 @@ namespace util { /// /// Get option for calendar, currently only check if it is Gregorian calendar /// - virtual int get_option(calendar_option_type opt) const + int get_option(calendar_option_type opt) const BOOST_OVERRIDE { switch(opt) { case is_gregorian: @@ -603,13 +604,13 @@ namespace util { /// Adjust period's \a p value by \a difference items using a update_type \a u. /// Note: not all values are adjustable /// - virtual void adjust_value(period::marks::period_mark p,update_type u,int difference) + void adjust_value(period::marks::period_mark m,update_type u,int difference) BOOST_OVERRIDE { switch(u) { case move: { using namespace period::marks; - switch(p) { + switch(m) { case year: ///< Year, it is calendar specific case extended_year: ///< Extended year for Gregorian/Julian calendars, where 1 BC == 0, 2 BC == -1. tm_updated_.tm_year +=difference; @@ -650,16 +651,16 @@ namespace util { break; case roll: { // roll - int cur_min = get_value(p,actual_minimum); - int cur_max = get_value(p,actual_maximum); + int cur_min = get_value(m,actual_minimum); + int cur_max = get_value(m,actual_maximum); int max_diff = cur_max - cur_min + 1; if(max_diff > 0) { - int value = get_value(p,current); + int value = get_value(m,current); int addon = 0; if(difference < 0) addon = ((-difference/max_diff) + 1) * max_diff; value = (value - cur_min + difference + addon) % max_diff + cur_min; - set_value(p,value); + set_value(m,value); normalize(); } } @@ -668,12 +669,12 @@ namespace util { } } - int get_diff(period::marks::period_mark p,int diff,gregorian_calendar const *other) const + int get_diff(period::marks::period_mark m,int diff,gregorian_calendar const *other) const { if(diff == 0) return 0; hold_ptr<gregorian_calendar> self(clone()); - self->adjust_value(p,move,diff); + self->adjust_value(m,move,diff); if(diff > 0){ if(self->time_ > other->time_) return diff - 1; @@ -691,7 +692,7 @@ namespace util { /// /// Calculate the difference between this calendar and \a other in \a p units /// - virtual int difference(abstract_calendar const *other_cal,period::marks::period_mark p) const + int difference(abstract_calendar const *other_cal,period::marks::period_mark m) const BOOST_OVERRIDE { hold_ptr<gregorian_calendar> keeper; gregorian_calendar const *other = dynamic_cast<gregorian_calendar const *>(other_cal); @@ -704,7 +705,7 @@ namespace util { int factor = 1; // for weeks vs days handling using namespace period::marks; - switch(p) { + switch(m) { case era: return 0; case year: @@ -715,7 +716,7 @@ namespace util { } case month: { - int diff = 12 * (other->tm_.tm_year - tm_.tm_year) + int diff = 12 * (other->tm_.tm_year - tm_.tm_year) + other->tm_.tm_mon - tm_.tm_mon; return get_diff(period::marks::month,diff,other); } @@ -723,7 +724,7 @@ namespace util { case week_of_month: case week_of_year: factor = 7; - // fall + BOOST_FALLTHROUGH; case day: case day_of_year: case day_of_week: @@ -753,7 +754,7 @@ namespace util { /// /// Set time zone, empty - use system /// - virtual void set_timezone(std::string const &tz) + void set_timezone(std::string const &tz) BOOST_OVERRIDE { if(tz.empty()) { is_local_ = true; @@ -766,26 +767,22 @@ namespace util { from_time(time_); time_zone_name_ = tz; } - virtual std::string get_timezone() const + std::string get_timezone() const BOOST_OVERRIDE { return time_zone_name_; } - virtual bool same(abstract_calendar const *other) const + bool same(abstract_calendar const *other) const BOOST_OVERRIDE { gregorian_calendar const *gcal = dynamic_cast<gregorian_calendar const *>(other); if(!gcal) return false; - return - gcal->tzoff_ == tzoff_ + return + gcal->tzoff_ == tzoff_ && gcal->is_local_ == is_local_ && gcal->first_day_of_week_ == first_day_of_week_; } - virtual ~gregorian_calendar() - { - } - private: void from_time(std::time_t point) @@ -815,9 +812,9 @@ namespace util { bool is_local_; int tzoff_; std::string time_zone_name_; - + }; - + abstract_calendar *create_gregorian_calendar(std::string const &terr) { return new gregorian_calendar(terr); @@ -825,19 +822,19 @@ namespace util { class gregorian_facet : public calendar_facet { public: - gregorian_facet(std::string const &terr,size_t refs = 0) : + gregorian_facet(std::string const &terr,size_t refs = 0) : calendar_facet(refs), terr_(terr) { } - virtual abstract_calendar *create_calendar() const + abstract_calendar *create_calendar() const BOOST_OVERRIDE { return create_gregorian_calendar(terr_); } private: std::string terr_; }; - + std::locale install_gregorian_calendar(std::locale const &in,std::string const &terr) { return std::locale(in,new gregorian_facet(terr)); @@ -845,8 +842,7 @@ namespace util { } // util -} // locale +} // locale } //boost - -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 +// boostinspect:nominmax diff --git a/contrib/restricted/boost/locale/src/util/gregorian.hpp b/contrib/restricted/boost/locale/src/boost/locale/util/gregorian.hpp index dc8c5d5919..263964126b 100644 --- a/contrib/restricted/boost/locale/src/util/gregorian.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/util/gregorian.hpp @@ -1,10 +1,9 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_SRC_UTIL_GREGORIAN_HPP #define BOOST_LOCALE_SRC_UTIL_GREGORIAN_HPP @@ -17,9 +16,8 @@ namespace util { std::locale install_gregorian_calendar(std::locale const &in,std::string const &terr); } // util -} // locale +} // locale } //boost #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/util/iconv.hpp b/contrib/restricted/boost/locale/src/boost/locale/util/iconv.hpp index 3dc69fbc6a..8257de7059 100644 --- a/contrib/restricted/boost/locale/src/util/iconv.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/util/iconv.hpp @@ -1,10 +1,9 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_ICONV_FIXER_HPP #define BOOST_LOCALE_ICONV_FIXER_HPP @@ -51,8 +50,7 @@ namespace boost { } #endif - } // locale + } // locale } // boost #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/util/info.cpp b/contrib/restricted/boost/locale/src/boost/locale/util/info.cpp index 67266354e4..853df1095c 100644 --- a/contrib/restricted/boost/locale/src/util/info.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/util/info.cpp @@ -1,25 +1,25 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE -#include <locale> -#include <string> -#include <ios> #include <boost/locale/generator.hpp> #include <boost/locale/info.hpp> #include <boost/locale/util.hpp> +#include <cstdlib> +#include <ios> +#include <locale> #include <sstream> -#include <stdlib.h> +#include <string> -#include "locale_data.hpp" +#include "boost/locale/util/locale_data.hpp" namespace boost { namespace locale { namespace util { + class simple_info : public info { public: simple_info(std::string const &name,size_t refs = 0) : @@ -28,7 +28,7 @@ namespace util { { d.parse(name); } - virtual std::string get_string_property(string_propery v) const + std::string get_string_property(string_propery v) const BOOST_OVERRIDE { switch(v) { case language_property: @@ -46,7 +46,7 @@ namespace util { }; } - virtual int get_integer_property(integer_property v) const + int get_integer_property(integer_property v) const BOOST_OVERRIDE { switch(v) { case utf8_property: @@ -59,7 +59,7 @@ namespace util { locale_data d; std::string name_; }; - + std::locale create_info(std::locale const &in,std::string const &name) { return std::locale(in,new simple_info(name)); @@ -67,9 +67,8 @@ namespace util { } // util -} // locale +} // locale } //boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/util/locale_data.cpp b/contrib/restricted/boost/locale/src/boost/locale/util/locale_data.cpp index 6b9c617e3d..db9f507198 100644 --- a/contrib/restricted/boost/locale/src/util/locale_data.cpp +++ b/contrib/restricted/boost/locale/src/boost/locale/util/locale_data.cpp @@ -1,13 +1,12 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #define BOOST_LOCALE_SOURCE -#include "locale_data.hpp" -#include "../encoding/conv.hpp" +#include "boost/locale/util/locale_data.hpp" +#include "boost/locale/encoding/conv.hpp" #include <string> namespace boost { @@ -23,7 +22,7 @@ namespace util { parse_from_lang(locale_name); } - void locale_data::parse_from_lang(std::string const &locale_name) + void locale_data::parse_from_lang(std::string const &locale_name) { size_t end = locale_name.find_first_of("-_@."); std::string tmp = locale_name.substr(0,end); @@ -32,7 +31,7 @@ namespace util { for(unsigned i=0;i<tmp.size();i++) { if('A' <= tmp[i] && tmp[i]<='Z') tmp[i]=tmp[i]-'A'+'a'; - else if(tmp[i] < 'a' && 'z' < tmp[i]) + else if(tmp[i] < 'a' || 'z' < tmp[i]) return; } language = tmp; @@ -50,7 +49,7 @@ namespace util { } } - void locale_data::parse_from_country(std::string const &locale_name) + void locale_data::parse_from_country(std::string const &locale_name) { size_t end = locale_name.find_first_of("@."); std::string tmp = locale_name.substr(0,end); @@ -59,7 +58,7 @@ namespace util { for(unsigned i=0;i<tmp.size();i++) { if('a' <= tmp[i] && tmp[i]<='z') tmp[i]=tmp[i]-'a'+'A'; - else if(tmp[i] < 'A' && 'Z' < tmp[i]) + else if(tmp[i] < 'A' || 'Z' < tmp[i]) return; } @@ -74,8 +73,8 @@ namespace util { parse_from_variant(locale_name.substr(end+1)); } } - - void locale_data::parse_from_encoding(std::string const &locale_name) + + void locale_data::parse_from_encoding(std::string const &locale_name) { size_t end = locale_name.find_first_of('@'); std::string tmp = locale_name.substr(0,end); @@ -86,7 +85,7 @@ namespace util { tmp[i]=tmp[i]-'A'+'a'; } encoding = tmp; - + utf8 = conv::impl::normalize_encoding(encoding.c_str()) == "utf8"; if(end >= locale_name.size()) @@ -107,7 +106,6 @@ namespace util { } } // util -} // locale +} // locale } // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/util/locale_data.hpp b/contrib/restricted/boost/locale/src/boost/locale/util/locale_data.hpp index 5b929f1485..fbd2000bfe 100644 --- a/contrib/restricted/boost/locale/src/util/locale_data.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/util/locale_data.hpp @@ -1,10 +1,9 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_IMPL_UTIL_LOCALE_DATA_HPP #define BOOST_LOCALE_IMPL_UTIL_LOCALE_DATA_HPP @@ -13,10 +12,10 @@ namespace boost { namespace locale { namespace util { - + class locale_data { public: - locale_data() : + locale_data() : language("C"), encoding("us-ascii"), utf8(false) @@ -40,8 +39,7 @@ namespace boost { }; } // util - } // locale + } // locale } // boost #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/util/numeric.hpp b/contrib/restricted/boost/locale/src/boost/locale/util/numeric.hpp index 892427dfcf..b42ddf3b98 100644 --- a/contrib/restricted/boost/locale/src/util/numeric.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/util/numeric.hpp @@ -1,30 +1,29 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_IMPL_UTIL_NUMERIC_HPP #define BOOST_LOCALE_IMPL_UTIL_NUMERIC_HPP +#include <boost/locale/info.hpp> +#include <boost/locale/formatting.hpp> +#include <boost/predef/os.h> +#include <ctime> +#include <cstdlib> +#include <ios> #include <locale> #include <string> -#include <ios> -#include <boost/locale/formatting.hpp> -#include <boost/locale/info.hpp> #include <sstream> #include <vector> -#include <ctime> -#include <stdlib.h> -#include "timezone.hpp" +#include "boost/locale/util/timezone.hpp" // This is internal header so disable crappy "unsecure functions" for all #ifdef BOOST_MSVC # pragma warning(disable : 4996) #endif - namespace boost { namespace locale { namespace util { @@ -69,36 +68,36 @@ public: typedef std::basic_string<CharType> string_type; typedef CharType char_type; - base_num_format(size_t refs = 0) : + base_num_format(size_t refs = 0) : std::num_put<CharType>(refs) { } -protected: - +protected: - virtual iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, long val) const + + iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, long val) const BOOST_OVERRIDE { return do_real_put(out,ios,fill,val); } - virtual iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, unsigned long val) const + iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, unsigned long val) const BOOST_OVERRIDE { return do_real_put(out,ios,fill,val); } - virtual iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, double val) const + iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, double val) const BOOST_OVERRIDE { return do_real_put(out,ios,fill,val); } - virtual iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, long double val) const + iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, long double val) const BOOST_OVERRIDE { return do_real_put(out,ios,fill,val); } - - #ifndef BOOST_NO_LONG_LONG - virtual iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, long long val) const + + #ifndef BOOST_NO_LONG_LONG + iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, long long val) const BOOST_OVERRIDE { return do_real_put(out,ios,fill,val); } - virtual iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, unsigned long long val) const + iter_type do_put (iter_type out, std::ios_base &ios, char_type fill, unsigned long long val) const BOOST_OVERRIDE { return do_real_put(out,ios,fill,val); } @@ -139,7 +138,7 @@ private: return format_time(out,ios,fill,static_cast<std::time_t>(val),info.date_time_pattern<char_type>()); case flags::currency: { - bool nat = info.currency_flags()==flags::currency_default + bool nat = info.currency_flags()==flags::currency_default || info.currency_flags() == flags::currency_national; bool intl = !nat; return do_format_currency(intl,out,ios,fill,static_cast<long double>(val)); @@ -190,7 +189,7 @@ private: { std::string tz = ios_info::get(ios).time_zone(); std::tm tm; - #if defined(__linux) || defined(__FreeBSD__) || defined(__APPLE__) + #if BOOST_OS_LINUX || BOOST_OS_BSD_FREE || defined(__APPLE__) std::vector<char> tmp_buf(tz.c_str(),tz.c_str()+tz.size()+1); #endif if(tz.empty()) { @@ -210,8 +209,8 @@ private: #else gmtime_r(&time,&tm); #endif - - #if defined(__linux) || defined(__FreeBSD__) || defined(__APPLE__) + + #if BOOST_OS_LINUX || BOOST_OS_BSD_FREE || defined(__APPLE__) // These have extra fields to specify timezone if(gmtoff!=0) { // bsd and apple want tm_zone be non-const @@ -224,13 +223,13 @@ private: std::use_facet<std::time_put<char_type> >(ios.getloc()).put(tmp_out,tmp_out,fill,&tm,format.c_str(),format.c_str()+format.size()); string_type str = tmp_out.str(); std::streamsize on_left=0,on_right = 0; - std::streamsize points = + std::streamsize points = formatting_size_traits<char_type>::size(str,ios.getloc()); if(points < ios.width()) { std::streamsize n = ios.width() - points; - + std::ios_base::fmtflags flags = ios.flags() & std::ios_base::adjustfield; - + // // we do not really know internal point, so we assume that it does not // exist. so according to the standard field should be right aligned @@ -259,57 +258,57 @@ template<typename CharType> class base_num_parse : public std::num_get<CharType> { public: - base_num_parse(size_t refs = 0) : + base_num_parse(size_t refs = 0) : std::num_get<CharType>(refs) { } -protected: +protected: typedef typename std::num_get<CharType>::iter_type iter_type; typedef std::basic_string<CharType> string_type; typedef CharType char_type; - virtual iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,long &val) const + iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,long &val) const BOOST_OVERRIDE { return do_real_get(in,end,ios,err,val); } - virtual iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,unsigned short &val) const + iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,unsigned short &val) const BOOST_OVERRIDE { return do_real_get(in,end,ios,err,val); } - virtual iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,unsigned int &val) const + iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,unsigned int &val) const BOOST_OVERRIDE { return do_real_get(in,end,ios,err,val); } - virtual iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,unsigned long &val) const + iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,unsigned long &val) const BOOST_OVERRIDE { return do_real_get(in,end,ios,err,val); } - virtual iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,float &val) const + iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,float &val) const BOOST_OVERRIDE { return do_real_get(in,end,ios,err,val); } - virtual iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,double &val) const + iter_type do_get(iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,double &val) const BOOST_OVERRIDE { return do_real_get(in,end,ios,err,val); } - virtual iter_type do_get (iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,long double &val) const + iter_type do_get (iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,long double &val) const BOOST_OVERRIDE { return do_real_get(in,end,ios,err,val); } - #ifndef BOOST_NO_LONG_LONG - virtual iter_type do_get (iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,long long &val) const + #ifndef BOOST_NO_LONG_LONG + iter_type do_get (iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,long long &val) const BOOST_OVERRIDE { return do_real_get(in,end,ios,err,val); } - virtual iter_type do_get (iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,unsigned long long &val) const + iter_type do_get (iter_type in, iter_type end, std::ios_base &ios,std::ios_base::iostate &err,unsigned long long &val) const BOOST_OVERRIDE { return do_real_get(in,end,ios,err,val); } @@ -317,7 +316,7 @@ protected: #endif private: - + template<typename ValueType> iter_type do_real_get(iter_type in,iter_type end,std::ios_base &ios,std::ios_base::iostate &err,ValueType &val) const { @@ -383,11 +382,10 @@ private: }; } // util -} // locale +} // locale } //boost #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/util/timezone.hpp b/contrib/restricted/boost/locale/src/boost/locale/util/timezone.hpp index 07a8c8ca25..506946b34c 100644 --- a/contrib/restricted/boost/locale/src/util/timezone.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/util/timezone.hpp @@ -1,19 +1,19 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_IMPL_UTIL_TIMEZONE_HPP #define BOOST_LOCALE_IMPL_UTIL_TIMEZONE_HPP +#include <cstdlib> +#include <cstring> #include <string> -#include <stdlib.h> -#include <string.h> + namespace boost { namespace locale { namespace util { - inline int parse_tz(std::string const &tz) + inline int parse_tz(std::string const &tz) { int gmtoff = 0; std::string ltz; @@ -45,9 +45,8 @@ namespace util { } } // util -} // locale +} // locale } //boost #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/win32/lcid.hpp b/contrib/restricted/boost/locale/src/boost/locale/win32/lcid.hpp index ed988394ec..2ec2284602 100644 --- a/contrib/restricted/boost/locale/src/win32/lcid.hpp +++ b/contrib/restricted/boost/locale/src/boost/locale/win32/lcid.hpp @@ -1,10 +1,9 @@ // -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) // +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + #ifndef BOOST_LOCALE_IMPL_WIN32_LCID_HPP #define BOOST_LOCALE_IMPL_WIN32_LCID_HPP @@ -22,4 +21,3 @@ namespace boost { } // boost #endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/boost/locale/win32/win_backend.hpp b/contrib/restricted/boost/locale/src/boost/locale/win32/win_backend.hpp new file mode 100644 index 0000000000..e63d69e346 --- /dev/null +++ b/contrib/restricted/boost/locale/src/boost/locale/win32/win_backend.hpp @@ -0,0 +1,18 @@ +// +// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) +// +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_LOCALE_IMPL_WIN32_LOCALIZATION_BACKEND_HPP +#define BOOST_LOCALE_IMPL_WIN32_LOCALIZATION_BACKEND_HPP +namespace boost { + namespace locale { + class localization_backend; + namespace impl_win { + localization_backend *create_localization_backend(); + } // impl_win + } // locale +} // boost +#endif + diff --git a/contrib/restricted/boost/locale/src/icu/icu_backend.hpp b/contrib/restricted/boost/locale/src/icu/icu_backend.hpp deleted file mode 100644 index d43cb2db2a..0000000000 --- a/contrib/restricted/boost/locale/src/icu/icu_backend.hpp +++ /dev/null @@ -1,20 +0,0 @@ -// -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) -// -#ifndef BOOST_LOCALE_IMPL_ICU_LOCALIZATION_BACKEND_HPP -#define BOOST_LOCALE_IMPL_ICU_LOCALIZATION_BACKEND_HPP -namespace boost { - namespace locale { - class localization_backend; - namespace impl_icu { - localization_backend *create_localization_backend(); - } // impl_icu - } // locale -} // boost -#endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 - diff --git a/contrib/restricted/boost/locale/src/posix/posix_backend.hpp b/contrib/restricted/boost/locale/src/posix/posix_backend.hpp deleted file mode 100644 index 586a33abdb..0000000000 --- a/contrib/restricted/boost/locale/src/posix/posix_backend.hpp +++ /dev/null @@ -1,20 +0,0 @@ -// -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) -// -#ifndef BOOST_LOCALE_IMPL_POSIX_LOCALIZATION_BACKEND_HPP -#define BOOST_LOCALE_IMPL_POSIX_LOCALIZATION_BACKEND_HPP -namespace boost { - namespace locale { - class localization_backend; - namespace impl_posix { - localization_backend *create_localization_backend(); - } // impl_std - } // locale -} // boost -#endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 - diff --git a/contrib/restricted/boost/locale/src/shared/ids.cpp b/contrib/restricted/boost/locale/src/shared/ids.cpp deleted file mode 100644 index 952fa85a52..0000000000 --- a/contrib/restricted/boost/locale/src/shared/ids.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) -// -#define BOOST_LOCALE_SOURCE -#include <boost/locale/boundary.hpp> -#include <boost/locale/collator.hpp> -#include <boost/locale/conversion.hpp> -#include <boost/locale/date_time_facet.hpp> -#include <boost/locale/message.hpp> -#include <boost/locale/info.hpp> - -namespace boost { - namespace locale { - - std::locale::id info::id; - std::locale::id calendar_facet::id; - - std::locale::id converter<char>::id; - std::locale::id base_message_format<char>::id; - - std::locale::id converter<wchar_t>::id; - std::locale::id base_message_format<wchar_t>::id; - - #ifdef BOOST_LOCALE_ENABLE_CHAR16_T - - std::locale::id converter<char16_t>::id; - std::locale::id base_message_format<char16_t>::id; - - #endif - - #ifdef BOOST_LOCALE_ENABLE_CHAR32_T - - std::locale::id converter<char32_t>::id; - std::locale::id base_message_format<char32_t>::id; - - #endif - - namespace boundary { - - std::locale::id boundary_indexing<char>::id; - - std::locale::id boundary_indexing<wchar_t>::id; - - #ifdef BOOST_LOCALE_ENABLE_CHAR16_T - std::locale::id boundary_indexing<char16_t>::id; - #endif - - #ifdef BOOST_LOCALE_ENABLE_CHAR32_T - std::locale::id boundary_indexing<char32_t>::id; - #endif - } - - namespace { - struct install_all { - install_all() - { - std::locale l = std::locale::classic(); - install_by<char>(); - install_by<wchar_t>(); - #ifdef BOOST_LOCALE_ENABLE_CHAR16_T - install_by<char16_t>(); - #endif - #ifdef BOOST_LOCALE_ENABLE_CHAR32_T - install_by<char32_t>(); - #endif - - std::has_facet<info>(l); - std::has_facet<calendar_facet>(l); - } - template<typename Char> - void install_by() - { - std::locale l = std::locale::classic(); - std::has_facet<boundary::boundary_indexing<Char> >(l); - std::has_facet<converter<Char> >(l); - std::has_facet<base_message_format<Char> >(l); - } - } installer; - } - - } -} - -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/locale/src/std/std_backend.hpp b/contrib/restricted/boost/locale/src/std/std_backend.hpp deleted file mode 100644 index 0caf779c67..0000000000 --- a/contrib/restricted/boost/locale/src/std/std_backend.hpp +++ /dev/null @@ -1,20 +0,0 @@ -// -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) -// -#ifndef BOOST_LOCALE_IMPL_STD_LOCALIZATION_BACKEND_HPP -#define BOOST_LOCALE_IMPL_STD_LOCALIZATION_BACKEND_HPP -namespace boost { - namespace locale { - class localization_backend; - namespace impl_std { - localization_backend *create_localization_backend(); - } // impl_std - } // locale -} // boost -#endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 - diff --git a/contrib/restricted/boost/locale/src/win32/win_backend.hpp b/contrib/restricted/boost/locale/src/win32/win_backend.hpp deleted file mode 100644 index 82f5401f6a..0000000000 --- a/contrib/restricted/boost/locale/src/win32/win_backend.hpp +++ /dev/null @@ -1,20 +0,0 @@ -// -// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh) -// -// 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) -// -#ifndef BOOST_LOCALE_IMPL_WIN32_LOCALIZATION_BACKEND_HPP -#define BOOST_LOCALE_IMPL_WIN32_LOCALIZATION_BACKEND_HPP -namespace boost { - namespace locale { - class localization_backend; - namespace impl_win { - localization_backend *create_localization_backend(); - } // impl_win - } // locale -} // boost -#endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 - |