File indexing completed on 2025-01-18 09:39:16
0001
0002
0003
0004
0005
0006
0007 #ifndef BOOST_LOCALE_LOCALIZATION_BACKEND_HPP
0008 #define BOOST_LOCALE_LOCALIZATION_BACKEND_HPP
0009
0010 #include <boost/locale/generator.hpp>
0011 #include <boost/locale/hold_ptr.hpp>
0012 #include <locale>
0013 #include <memory>
0014 #include <string>
0015 #include <vector>
0016
0017 #ifdef BOOST_MSVC
0018 # pragma warning(push)
0019 # pragma warning(disable : 4275 4251 4231 4660)
0020 #endif
0021
0022 namespace boost { namespace locale {
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 class BOOST_LOCALE_DECL localization_backend {
0041 protected:
0042 localization_backend(const localization_backend&) = default;
0043 localization_backend& operator=(const localization_backend&) = default;
0044
0045 public:
0046 localization_backend() = default;
0047 virtual ~localization_backend();
0048
0049
0050 virtual localization_backend* clone() const = 0;
0051
0052
0053 virtual void set_option(const std::string& name, const std::string& value) = 0;
0054
0055
0056 virtual void clear_options() = 0;
0057
0058
0059 virtual std::locale install(const std::locale& base, category_t category, char_facet_t type) = 0;
0060
0061 };
0062
0063
0064
0065 class BOOST_LOCALE_DECL localization_backend_manager {
0066 public:
0067
0068 localization_backend_manager();
0069
0070 localization_backend_manager(const localization_backend_manager&);
0071
0072 localization_backend_manager& operator=(const localization_backend_manager&);
0073
0074 localization_backend_manager(localization_backend_manager&&) noexcept;
0075
0076 localization_backend_manager& operator=(localization_backend_manager&&) noexcept;
0077
0078
0079 ~localization_backend_manager();
0080
0081
0082 std::unique_ptr<localization_backend> create() const;
0083
0084 BOOST_DEPRECATED("This function is deprecated, use 'create()' instead")
0085 std::unique_ptr<localization_backend> get() const { return create(); }
0086 BOOST_DEPRECATED("This function is deprecated, use 'create()' instead")
0087 std::unique_ptr<localization_backend> get_unique_ptr() const { return create(); }
0088
0089
0090
0091
0092 void add_backend(const std::string& name, std::unique_ptr<localization_backend> backend);
0093
0094
0095 BOOST_DEPRECATED("This function is deprecated, use 'add_backend' instead")
0096 void adopt_backend(const std::string& name, localization_backend* backend) { add_backend(name, std::unique_ptr<localization_backend>(backend)); }
0097
0098
0099
0100 void remove_all_backends();
0101
0102
0103 std::vector<std::string> get_all_backends() const;
0104
0105
0106
0107 void select(const std::string& backend_name, category_t category = all_categories);
0108
0109
0110
0111
0112 static localization_backend_manager global(const localization_backend_manager&);
0113
0114
0115
0116 static localization_backend_manager global();
0117
0118 private:
0119 class impl;
0120 hold_ptr<impl> pimpl_;
0121 };
0122
0123 }}
0124
0125 #ifdef BOOST_MSVC
0126 # pragma warning(pop)
0127 #endif
0128
0129 #endif