CppCMS

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

localization_backend.h
1 //
2 // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //
8 #ifndef BOOSTER_LOCALE_LOCALIZATION_BACKEND_HPP
9 #define BOOSTER_LOCALE_LOCALIZATION_BACKEND_HPP
10 #include <booster/config.h>
11 #include <booster/locale/generator.h>
12 #ifdef BOOSTER_MSVC
13 # pragma warning(push)
14 # pragma warning(disable : 4275 4251 4231 4660)
15 #endif
16 #include <string>
17 #include <locale>
18 #include <vector>
19 #include <booster/auto_ptr_inc.h>
20
21 namespace booster {
22 namespace locale {
23
42
43 class localization_backend {
44 localization_backend(localization_backend const &);
45 void operator=(localization_backend const &);
46 public:
47
48 localization_backend()
49 {
50 }
51
52 virtual ~localization_backend()
53 {
54 }
55
59 virtual localization_backend *clone() const = 0;
60
64 virtual void set_option(std::string const &name,std::string const &value) = 0;
65
69 virtual void clear_options() = 0;
70
74 virtual std::locale install(std::locale const &base,locale_category_type category,character_facet_type type = nochar_facet) = 0;
75
76 }; // localization_backend
77
78
83
84 class BOOSTER_API localization_backend_manager {
85 public:
89 localization_backend_manager();
93 localization_backend_manager(localization_backend_manager const &);
97 localization_backend_manager const &operator=(localization_backend_manager const &);
98
102 ~localization_backend_manager();
103
107 std::auto_ptr<localization_backend> get() const;
108
114 void add_backend(std::string const &name,std::auto_ptr<localization_backend> backend);
115
119 void remove_all_backends();
120
124 std::vector<std::string> get_all_backends() const;
125
130 void select(std::string const &backend_name,locale_category_type category = all_categories);
131
137 static localization_backend_manager global(localization_backend_manager const &);
143 static localization_backend_manager global();
144 private:
145 class impl;
146 std::auto_ptr<impl> pimpl_;
147 };
148
149 } // locale
150 } // boost
151
152
153 #ifdef BOOSTER_MSVC
154 #pragma warning(pop)
155 #endif
156
157 #endif
158 // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
159
booster::locale::localization_backend::install
virtual std::locale install(std::locale const &base, locale_category_type category, character_facet_type type=nochar_facet)=0
booster::locale::character_facet_type
uint32_t character_facet_type
type that specifies the character type that locales can be generated for
Definition: generator.h:43
booster::locale::locale_category_type
uint32_t locale_category_type
a type used for more fine grained generation of facets
Definition: generator.h:65
booster::locale::all_categories
static const uint32_t all_categories
Generate all of them.
Definition: generator.h:63
booster::locale::localization_backend::clone
virtual localization_backend * clone() const =0
booster::locale
This is the main namespace that encloses all localization classes.
Definition: locale_fwd.h:14
booster::locale::localization_backend::set_option
virtual void set_option(std::string const &name, std::string const &value)=0
booster::locale::localization_backend::clear_options
virtual void clear_options()=0
booster::locale::nochar_facet
static const uint32_t nochar_facet
Unspecified character category for character independent facets.
Definition: generator.h:33
booster::locale::localization_backend_manager
Localization backend manager is a class that holds various backend and allows creation of their combi...
Definition: localization_backend.h:84
booster::locale::localization_backend
this class represents a localization backend that can be used for localizing your application...
Definition: localization_backend.h:43
booster
Booster library namespace. The library that implements Boost Like API in ABI backward compatible way...
Definition: application.h:23