Boost.Locale: boost/locale/info.hpp Source File

| Boost.Locale

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

- File List

info.hpp
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 BOOST_LOCALE_INFO_HPP_INCLUDED
9 #define BOOST_LOCALE_INFO_HPP_INCLUDED
10 #include <boost/locale/config.hpp>
11 #ifdef BOOST_MSVC
12 # pragma warning(push)
13 # pragma warning(disable : 4275 4251 4231 4660)
14 #endif
15 #include <locale>
16 #include <string>
17
18
19 namespace boost {
20 namespace locale {
21
27 class BOOST_LOCALE_DECL info : public std::locale::facet
28 {
29 public:
30 static std::locale::id id;
31
35 enum string_propery {
36 language_property,
37 country_property,
38 variant_property,
39 encoding_property,
40 name_property
41 };
42
46 enum integer_property {
47 utf8_property
48 };
49
50
54 info(size_t refs = 0) : std::locale::facet(refs)
55 {
56 }
60 std::string language() const
61 {
62 return get_string_property(language_property);
63 }
67 std::string country() const
68 {
69 return get_string_property(country_property);
70 }
74 std::string variant() const
75 {
76 return get_string_property(variant_property);
77 }
81 std::string encoding() const
82 {
83 return get_string_property(encoding_property);
84 }
85
89 std::string name() const
90 {
91 return get_string_property(name_property);
92 }
93
97 bool utf8() const
98 {
99 return get_integer_property(utf8_property) != 0;
100 }
101
102 #if defined (__SUNPRO_CC) && defined (_RWSTD_VER)
103 std::locale::id& __get_id (void) const { return id; }
104 #endif
105 protected:
109 virtual std::string get_string_property(string_propery v) const = 0;
113 virtual int get_integer_property(integer_property v) const = 0;
114 };
115
116 }
117 }
118
119 #ifdef BOOST_MSVC
120 #pragma warning(pop)
121 #endif
122
123 #endif
124
125 // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
boost::locale::info::country_property
ISO 3166 country id.
Definition: info.hpp:37
boost::locale::info::language_property
ISO 639 language id.
Definition: info.hpp:36
boost::locale::info
a facet that holds general information about locale
Definition: info.hpp:27
boost::locale::info::variant_property
Variant for locale.
Definition: info.hpp:38
boost::locale::info::info
info(size_t refs=0)
Definition: info.hpp:54
boost::locale::info::integer_property
integer_property
Definition: info.hpp:46
boost::locale::info::name
std::string name() const
Definition: info.hpp:89
boost::locale::info::country
std::string country() const
Definition: info.hpp:67
boost::locale::info::string_propery
string_propery
Definition: info.hpp:35
boost::locale::info::encoding
std::string encoding() const
Definition: info.hpp:81
boost::locale::info::id
static std::locale::id id
This member uniquely defines this facet, required by STL.
Definition: info.hpp:30
boost::locale::info::utf8
bool utf8() const
Definition: info.hpp:97
boost::locale::info::variant
std::string variant() const
Definition: info.hpp:74
boost::locale::info::encoding_property
encoding name
Definition: info.hpp:39
boost::locale::info::language
std::string language() const
Definition: info.hpp:60
- © Copyright 2009-2012 Artyom Beilis, Distributed under the Boost Software License, Version 1.0.