annotate DEPENDENCIES/generic/include/boost/locale/localization_backend.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 //
Chris@16 2 // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
Chris@16 3 //
Chris@16 4 // Distributed under the Boost Software License, Version 1.0. (See
Chris@16 5 // accompanying file LICENSE_1_0.txt or copy at
Chris@16 6 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 7 //
Chris@16 8 #ifndef BOOST_LOCALE_LOCALIZATION_BACKEND_HPP
Chris@16 9 #define BOOST_LOCALE_LOCALIZATION_BACKEND_HPP
Chris@16 10 #include <boost/locale/config.hpp>
Chris@16 11 #include <boost/locale/generator.hpp>
Chris@16 12 #ifdef BOOST_MSVC
Chris@16 13 # pragma warning(push)
Chris@16 14 # pragma warning(disable : 4275 4251 4231 4660)
Chris@16 15 #endif
Chris@16 16 #include <string>
Chris@16 17 #include <locale>
Chris@16 18 #include <vector>
Chris@16 19 #include <memory>
Chris@16 20
Chris@16 21 namespace boost {
Chris@16 22 namespace locale {
Chris@16 23
Chris@16 24 ///
Chris@16 25 /// \brief this class represents a localization backend that can be used for localizing your application.
Chris@16 26 ///
Chris@16 27 /// Backends are usually registered inside the localization backends manager and allow transparent support
Chris@16 28 /// of different backends, so a user can switch the backend by simply linking the application to the correct one.
Chris@16 29 ///
Chris@16 30 /// Backends may support different tuning options, but these are the default options available to the user
Chris@16 31 /// for all of them
Chris@16 32 ///
Chris@16 33 /// -# \c locale - the name of the locale in POSIX format like en_US.UTF-8
Chris@16 34 /// -# \c use_ansi_encoding - select system locale using ANSI codepages rather then UTF-8 under Windows
Chris@16 35 /// by default
Chris@16 36 /// -# \c message_path - path to the location of message catalogs (vector of strings)
Chris@16 37 /// -# \c message_application - the name of applications that use message catalogs (vector of strings)
Chris@16 38 ///
Chris@16 39 /// Each backend can be installed with a different default priotiry so when you work with two different backends, you
Chris@16 40 /// can specify priotiry so this backend will be chosen according to their priority.
Chris@16 41 ///
Chris@16 42
Chris@16 43 class localization_backend {
Chris@16 44 localization_backend(localization_backend const &);
Chris@16 45 void operator=(localization_backend const &);
Chris@16 46 public:
Chris@16 47
Chris@16 48 localization_backend()
Chris@16 49 {
Chris@16 50 }
Chris@16 51
Chris@16 52 virtual ~localization_backend()
Chris@16 53 {
Chris@16 54 }
Chris@16 55
Chris@16 56 ///
Chris@16 57 /// Make a polymorphic copy of the backend
Chris@16 58 ///
Chris@16 59 virtual localization_backend *clone() const = 0;
Chris@16 60
Chris@16 61 ///
Chris@16 62 /// Set option for backend, for example "locale" or "encoding"
Chris@16 63 ///
Chris@16 64 virtual void set_option(std::string const &name,std::string const &value) = 0;
Chris@16 65
Chris@16 66 ///
Chris@16 67 /// Clear all options
Chris@16 68 ///
Chris@16 69 virtual void clear_options() = 0;
Chris@16 70
Chris@16 71 ///
Chris@16 72 /// Create a facet for category \a category and character type \a type
Chris@16 73 ///
Chris@16 74 virtual std::locale install(std::locale const &base,locale_category_type category,character_facet_type type = nochar_facet) = 0;
Chris@16 75
Chris@16 76 }; // localization_backend
Chris@16 77
Chris@16 78
Chris@16 79 ///
Chris@16 80 /// \brief Localization backend manager is a class that holds various backend and allows creation
Chris@16 81 /// of their combination or selection
Chris@16 82 ///
Chris@16 83
Chris@16 84 class BOOST_LOCALE_DECL localization_backend_manager {
Chris@16 85 public:
Chris@16 86 ///
Chris@16 87 /// New empty localization_backend_manager
Chris@16 88 ///
Chris@16 89 localization_backend_manager();
Chris@16 90 ///
Chris@16 91 /// Copy localization_backend_manager
Chris@16 92 ///
Chris@16 93 localization_backend_manager(localization_backend_manager const &);
Chris@16 94 ///
Chris@16 95 /// Assign localization_backend_manager
Chris@16 96 ///
Chris@16 97 localization_backend_manager const &operator=(localization_backend_manager const &);
Chris@16 98
Chris@16 99 ///
Chris@16 100 /// Destructor
Chris@16 101 ///
Chris@16 102 ~localization_backend_manager();
Chris@16 103
Chris@16 104 ///
Chris@16 105 /// Create new localization backend according to current settings.
Chris@16 106 ///
Chris@16 107 std::auto_ptr<localization_backend> get() const;
Chris@16 108
Chris@16 109 ///
Chris@16 110 /// Add new backend to the manager, each backend should be uniquely defined by its name.
Chris@16 111 ///
Chris@16 112 /// This library provides: "icu", "posix", "winapi" and "std" backends.
Chris@16 113 ///
Chris@16 114 void add_backend(std::string const &name,std::auto_ptr<localization_backend> backend);
Chris@16 115
Chris@16 116 ///
Chris@16 117 /// Clear backend
Chris@16 118 ///
Chris@16 119 void remove_all_backends();
Chris@16 120
Chris@16 121 ///
Chris@16 122 /// Get list of all available backends
Chris@16 123 ///
Chris@16 124 std::vector<std::string> get_all_backends() const;
Chris@16 125
Chris@16 126 ///
Chris@16 127 /// Select specific backend by name for a category \a category. It allows combining different
Chris@16 128 /// backends for user preferences.
Chris@16 129 ///
Chris@16 130 void select(std::string const &backend_name,locale_category_type category = all_categories);
Chris@16 131
Chris@16 132 ///
Chris@16 133 /// Set new global backend manager, the old one is returned.
Chris@16 134 ///
Chris@16 135 /// This function is thread safe
Chris@16 136 ///
Chris@16 137 static localization_backend_manager global(localization_backend_manager const &);
Chris@16 138 ///
Chris@16 139 /// Get global backend manager
Chris@16 140 ///
Chris@16 141 /// This function is thread safe
Chris@16 142 ///
Chris@16 143 static localization_backend_manager global();
Chris@16 144 private:
Chris@16 145 class impl;
Chris@16 146 std::auto_ptr<impl> pimpl_;
Chris@16 147 };
Chris@16 148
Chris@16 149 } // locale
Chris@16 150 } // boost
Chris@16 151
Chris@16 152
Chris@16 153 #ifdef BOOST_MSVC
Chris@16 154 #pragma warning(pop)
Chris@16 155 #endif
Chris@16 156
Chris@16 157 #endif
Chris@16 158 // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
Chris@16 159