info.h
//
// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOSTER_LOCALE_INFO_H_INCLUDED
#define BOOSTER_LOCALE_INFO_H_INCLUDED
#include <booster/config.h>
#ifdef BOOSTER_MSVC
# pragma warning(push)
# pragma warning(disable : 4275 4251 4231 4660)
#endif
#include <locale>
#include <string>
namespace booster {
namespace locale {
class BOOSTER_API info : public std::locale::facet
{
public:
static std::locale::id id;
enum string_propery {
language_property,
country_property,
variant_property,
encoding_property,
name_property
};
enum integer_property {
utf8_property
};
info(size_t refs = 0) : std::locale::facet(refs)
{
}
std::string language() const
{
return get_string_property(language_property);
}
std::string country() const
{
return get_string_property(country_property);
}
std::string variant() const
{
return get_string_property(variant_property);
}
std::string encoding() const
{
return get_string_property(encoding_property);
}
std::string name() const
{
return get_string_property(name_property);
}
bool utf8() const
{
return get_integer_property(utf8_property) != 0;
}
#if defined (__SUNPRO_CC) && defined (_RWSTD_VER)
std::locale::id& __get_id (void) const { return id; }
#endif
protected:
virtual std::string get_string_property(string_propery v) const = 0;
virtual int get_integer_property(integer_property v) const = 0;
};
}
}
#ifdef BOOSTER_MSVC
#pragma warning(pop)
#endif
#endif
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
booster::locale::info::info
info(size_t refs=0)
Definition: info.h:54
booster::locale::info::variant_property
Variant for locale.
Definition: info.h:38
booster::locale::info::string_propery
string_propery
Definition: info.h:35
booster::locale::info::language_property
ISO 639 language id.
Definition: info.h:36
booster::locale::info::language
std::string language() const
Definition: info.h:60
booster::locale::info::id
static std::locale::id id
This member uniquely defines this facet, required by STL.
Definition: info.h:30
booster::locale::info::utf8
bool utf8() const
Definition: info.h:97
booster::locale::info::encoding_property
encoding name
Definition: info.h:39
booster::locale::info::encoding
std::string encoding() const
Definition: info.h:81
booster::locale::info
a facet that holds general information about locale
Definition: info.h:27
booster::locale::info::country
std::string country() const
Definition: info.h:67
booster::locale::info::name
std::string name() const
Definition: info.h:89
booster::locale::info::country_property
ISO 3166 country id.
Definition: info.h:37
booster::locale::info::integer_property
integer_property
Definition: info.h:46
booster::locale::info::variant
std::string variant() const
Definition: info.h:74