File indexing completed on 2025-01-30 09:44:57
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_LOCALE_INFO_HPP_INCLUDED
0009 #define BOOST_LOCALE_INFO_HPP_INCLUDED
0010
0011 #include <boost/locale/config.hpp>
0012 #include <boost/locale/detail/facet_id.hpp>
0013 #include <locale>
0014 #include <string>
0015
0016 #ifdef BOOST_MSVC
0017 # pragma warning(push)
0018 # pragma warning(disable : 4275 4251 4231 4660)
0019 #endif
0020
0021 namespace boost { namespace locale {
0022
0023
0024
0025
0026 class BOOST_SYMBOL_VISIBLE info : public std::locale::facet, public detail::facet_id<info> {
0027 public:
0028
0029 enum string_property {
0030 language_property,
0031 country_property,
0032 variant_property,
0033 encoding_property,
0034 name_property
0035 };
0036
0037
0038 enum integer_property {
0039 utf8_property
0040 };
0041
0042
0043 info(size_t refs = 0) : std::locale::facet(refs) {}
0044
0045 std::string language() const { return get_string_property(language_property); }
0046
0047 std::string country() const { return get_string_property(country_property); }
0048
0049 std::string variant() const { return get_string_property(variant_property); }
0050
0051 std::string encoding() const { return get_string_property(encoding_property); }
0052
0053
0054 std::string name() const { return get_string_property(name_property); }
0055
0056
0057 bool utf8() const { return get_integer_property(utf8_property) != 0; }
0058
0059 protected:
0060
0061 virtual std::string get_string_property(string_property v) const = 0;
0062
0063 virtual int get_integer_property(integer_property v) const = 0;
0064 };
0065
0066 }}
0067
0068 #ifdef BOOST_MSVC
0069 # pragma warning(pop)
0070 #endif
0071
0072 #endif