Added thirdparty: boost library

This commit is contained in:
Viacheslav Demydiuk
2024-01-06 19:55:56 +02:00
parent bf49f439e1
commit bccd1e7051
15683 changed files with 3239840 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
//
// Copyright (c) 2022-2023 Alexander Grund
//
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#ifndef BOOST_LOCALE_DETAIL_ENCODING_HPP_INCLUDED
#define BOOST_LOCALE_DETAIL_ENCODING_HPP_INCLUDED
#include <boost/locale/config.hpp>
#include <boost/locale/encoding_errors.hpp>
#include <boost/utility/string_view.hpp>
#include <memory>
#include <string>
/// \cond INTERNAL
namespace boost { namespace locale { namespace conv { namespace detail {
template<typename CharIn, typename CharOut>
class BOOST_SYMBOL_VISIBLE charset_converter {
public:
using char_out_type = CharOut;
using char_in_type = CharIn;
using string_type = std::basic_string<CharOut>;
virtual ~charset_converter() = default;
virtual string_type convert(const CharIn* begin, const CharIn* end) = 0;
string_type convert(const boost::basic_string_view<CharIn>& text)
{
return convert(text.data(), text.data() + text.length());
}
};
using narrow_converter = charset_converter<char, char>;
template<typename CharType>
using utf_encoder = charset_converter<char, CharType>;
template<typename CharType>
using utf_decoder = charset_converter<CharType, char>;
enum class conv_backend { Default, IConv, ICU, WinAPI };
template<typename Char>
BOOST_LOCALE_DECL std::unique_ptr<utf_encoder<Char>>
make_utf_encoder(const std::string& charset, method_type how, conv_backend impl = conv_backend::Default);
template<typename Char>
BOOST_LOCALE_DECL std::unique_ptr<utf_decoder<Char>>
make_utf_decoder(const std::string& charset, method_type how, conv_backend impl = conv_backend::Default);
BOOST_LOCALE_DECL std::unique_ptr<narrow_converter>
make_narrow_converter(const std::string& src_encoding,
const std::string& target_encoding,
method_type how,
conv_backend impl = conv_backend::Default);
}}}} // namespace boost::locale::conv::detail
/// \endcond
#endif
+35
View File
@@ -0,0 +1,35 @@
//
// Copyright (c) 2022-2023 Alexander Grund
//
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#ifndef BOOST_LOCALE_DETAIL_FACET_ID_HPP_INCLUDED
#define BOOST_LOCALE_DETAIL_FACET_ID_HPP_INCLUDED
#include <boost/locale/config.hpp>
#include <locale>
/// \cond INTERNAL
namespace boost { namespace locale { namespace detail {
#if BOOST_CLANG_VERSION >= 40900
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wundefined-var-template"
#endif
/// CRTP base class to hold the id required for facets
///
/// Required because the id needs to be defined in a CPP file and hence ex/imported for shared libraries.
/// However the virtual classes need to be declared as BOOST_VISIBLE to combine the VTables because otherwise
/// casts/virtual-calls might be flagged as invalid by UBSAN
template<class Derived>
struct BOOST_LOCALE_DECL facet_id {
static std::locale::id id;
};
#if BOOST_CLANG_VERSION >= 40900
# pragma clang diagnostic pop
#endif
}}} // namespace boost::locale::detail
/// \endcond
#endif
+48
View File
@@ -0,0 +1,48 @@
//
// Copyright (c) 2022-2023 Alexander Grund
//
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#ifndef BOOST_LOCALE_DETAIL_IS_SUPPORTED_CHAR_HPP_INCLUDED
#define BOOST_LOCALE_DETAIL_IS_SUPPORTED_CHAR_HPP_INCLUDED
#include <boost/locale/config.hpp>
#include <type_traits>
/// \cond INTERNAL
namespace boost { namespace locale { namespace detail {
/// Trait, returns true iff the argument is a supported character type
template<typename Char>
struct is_supported_char : std::false_type {};
template<>
struct is_supported_char<char> : std::true_type {};
template<>
struct is_supported_char<wchar_t> : std::true_type {};
#ifdef __cpp_char8_t
template<>
struct is_supported_char<char8_t> : std::true_type {};
#endif
#ifdef BOOST_LOCALE_ENABLE_CHAR16_T
template<>
struct is_supported_char<char16_t> : std::true_type {};
#endif
#ifdef BOOST_LOCALE_ENABLE_CHAR32_T
template<>
struct is_supported_char<char32_t> : std::true_type {};
#endif
template<typename Char>
using enable_if_is_supported_char = typename std::enable_if<is_supported_char<Char>::value>::type;
}}} // namespace boost::locale::detail
#define BOOST_LOCALE_ASSERT_IS_SUPPORTED(Char) \
static_assert(boost::locale::detail::is_supported_char<Char>::value, "Unsupported Char type")
/// \endcond
#endif