CppCMS

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

- File List
- File Members

gnu_gettext.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_LOCLAE_GNU_GETTEXT_HPP
9 #define BOOSTER_LOCLAE_GNU_GETTEXT_HPP
10
11 #include <booster/locale/message.h>
12 #include <booster/function.h>
13 #include <booster/backtrace.h>
14
15 namespace booster {
16 namespace locale {
19
20
24 namespace gnu_gettext {
25
34 struct messages_info {
35 messages_info() :
36 language("C"),
37 locale_category("LC_MESSAGES")
38 {
39 }
40
41 std::string language;
42 std::string country;
43 std::string variant;
44 std::string encoding;
45 std::string locale_category;
47 struct domain {
56
57 std::string name;
58 std::string encoding;
59 domain() {}
66 domain(std::string const &n)
67 {
68 size_t pos = n.find("/");
69 if(pos==std::string::npos) {
70 name = n;
71 encoding = "UTF-8";
72 }
73 else {
74 name = n.substr(0,pos);
75 encoding = n.substr(pos+1);
76 }
77
78 }
79
83 bool operator==(domain const &other) const
84 {
85 return name==other.name;
86 }
90 bool operator!=(domain const &other) const
91 {
92 return !(*this==other);
93 }
94
95 };
96
97 typedef std::vector<domain> domains_type;
98 domains_type domains;
100 std::vector<std::string> paths;
102
114 typedef function<
115 std::vector<char>(
116 std::string const &file_name,
117 std::string const &encoding
118 )
119 > callback_type;
120
125 callback_type callback;
126
127 };
128
133
134 template<typename CharType>
135 message_format<CharType> *create_messages_facet(messages_info const &info);
136
138
139 template<>
140 BOOSTER_API message_format<char> *create_messages_facet(messages_info const &info);
141
142 template<>
143 BOOSTER_API message_format<wchar_t> *create_messages_facet(messages_info const &info);
144
145 #ifdef BOOSTER_HAS_CHAR16_T
146 template<>
147 BOOSTER_API message_format<char16_t> *create_messages_facet(messages_info const &info);
148 #endif
149
150 #ifdef BOOSTER_HAS_CHAR32_T
151 template<>
152 BOOSTER_API message_format<char32_t> *create_messages_facet(messages_info const &info);
153 #endif
154
156
157 } // gnu_gettext
158
160
161 } // locale
162 } // boost
163
164 #endif
165
166 // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
167
booster::locale::gnu_gettext::messages_info::callback
callback_type callback
Definition: gnu_gettext.h:125
booster::locale::gnu_gettext::messages_info::variant
std::string variant
Language variant, like "euro" so it would look for catalog like de_DE@euro.
Definition: gnu_gettext.h:43
booster::locale::gnu_gettext::messages_info::domain::operator==
bool operator==(domain const &other) const
Definition: gnu_gettext.h:83
booster::locale::gnu_gettext::messages_info::domain
This type represents GNU Gettext domain name for the messages.
Definition: gnu_gettext.h:55
booster::locale::gnu_gettext::messages_info::language
std::string language
The language we load the catalog for, like "ru", "en", "de".
Definition: gnu_gettext.h:41
booster::locale::message_format
This facet provides message formatting abilities.
Definition: message.h:47
booster::locale::gnu_gettext::messages_info::locale_category
std::string locale_category
Definition: gnu_gettext.h:46
booster::locale::gnu_gettext::messages_info::country
std::string country
The country we load the catalog for, like "US", "IL".
Definition: gnu_gettext.h:42
booster::locale::gnu_gettext::messages_info::domain::name
std::string name
The name of the domain.
Definition: gnu_gettext.h:57
booster::locale::gnu_gettext::messages_info::encoding
std::string encoding
Definition: gnu_gettext.h:44
booster::locale::gnu_gettext::messages_info::domains_type
std::vector< domain > domains_type
Definition: gnu_gettext.h:97
booster::locale::gnu_gettext::create_messages_facet
message_format< CharType > * create_messages_facet(messages_info const &info)
booster::locale::gnu_gettext::messages_info::domains
domains_type domains
Definition: gnu_gettext.h:99
booster::locale::gnu_gettext::messages_info::paths
std::vector< std::string > paths
Definition: gnu_gettext.h:101
booster::locale::gnu_gettext::messages_info::domain::domain
domain(std::string const &n)
Definition: gnu_gettext.h:66
booster::locale
This is the main namespace that encloses all localization classes.
Definition: locale_fwd.h:14
booster::function
Definition: function.h:16
booster::locale::info
a facet that holds general information about locale
Definition: info.h:27
booster::locale::gnu_gettext::messages_info
This structure holds all information required for creating gnu-gettext message catalogs,.
Definition: gnu_gettext.h:34
booster
Booster library namespace. The library that implements Boost Like API in ABI backward compatible way...
Definition: application.h:23
booster::locale::gnu_gettext::messages_info::domain::encoding
std::string encoding
The character encoding for the domain.
Definition: gnu_gettext.h:58
booster::locale::gnu_gettext::messages_info::domain::operator!=
bool operator!=(domain const &other) const
Definition: gnu_gettext.h:90