generator.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_GENERATOR_HPP
#define BOOSTER_LOCALE_GENERATOR_HPP
#include <booster/config.h>
#include <booster/cstdint.h>
#ifdef BOOSTER_MSVC
# pragma warning(push)
# pragma warning(disable : 4275 4251 4231 4660)
#endif
#include <string>
#include <locale>
#include <memory>
namespace booster {
template<typename Type>
class shared_ptr;
namespace locale {
class localization_backend;
class localization_backend_manager;
static const uint32_t nochar_facet = 0;
static const uint32_t char_facet = 1 << 0;
static const uint32_t wchar_t_facet = 1 << 1;
static const uint32_t char16_t_facet = 1 << 2;
static const uint32_t char32_t_facet = 1 << 3;
static const uint32_t character_first_facet = char_facet;
static const uint32_t character_last_facet = char32_t_facet;
static const uint32_t all_characters = 0xFFFF;
typedef uint32_t character_facet_type;
static const uint32_t convert_facet = 1 << 0;
static const uint32_t collation_facet = 1 << 1;
static const uint32_t formatting_facet= 1 << 2;
static const uint32_t parsing_facet = 1 << 3;
static const uint32_t message_facet = 1 << 4;
static const uint32_t codepage_facet = 1 << 5;
static const uint32_t boundary_facet = 1 << 6;
static const uint32_t per_character_facet_first = convert_facet;
static const uint32_t per_character_facet_last = boundary_facet;
static const uint32_t calendar_facet = 1 << 16;
static const uint32_t information_facet = 1 << 17;
static const uint32_t non_character_facet_first = calendar_facet;
static const uint32_t non_character_facet_last = information_facet;
static const uint32_t all_categories = 0xFFFFFFFFu;
typedef uint32_t locale_category_type;
class BOOSTER_API generator {
public:
generator();
generator(localization_backend_manager const &);
~generator();
void categories(locale_category_type cats);
locale_category_type categories() const;
void characters(character_facet_type chars);
character_facet_type characters() const;
void add_messages_domain(std::string const &domain);
void set_default_messages_domain(std::string const &domain);
void clear_domains();
void add_messages_path(std::string const &path);
void clear_paths();
void clear_cache();
void locale_cache_enabled(bool on);
bool locale_cache_enabled() const;
bool use_ansi_encoding() const;
void use_ansi_encoding(bool enc);
std::locale generate(std::string const &id) const;
std::locale generate(std::locale const &base,std::string const &id) const;
std::locale operator()(std::string const &id) const
{
return generate(id);
}
void set_option(std::string const &name,std::string const &value);
void clear_options();
private:
void set_all_options(shared_ptr<localization_backend> backend,std::string const &id) const;
generator(generator const &);
void operator=(generator const &);
struct data;
std::auto_ptr<data> d;
};
}
}
#ifdef BOOSTER_MSVC
#pragma warning(pop)
#endif
#endif
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
booster::locale::as::domain
details::set_domain domain(std::string const &id)
Definition: message.h:789
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::generator::operator()
std::locale operator()(std::string const &id) const
Definition: generator.h:200
booster::shared_ptr
Definition: log.h:25
booster::locale::generator
the major class used for locale generation
Definition: generator.h:74
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::calendar_facet
the facet that generates calendar for specific locale
Definition: date_time_facet.h:234