blob: 67266354e4b9d9e1edd09d4c0c41b70c8a2e6040 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
//
// 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)
//
#define BOOST_LOCALE_SOURCE
#include <locale>
#include <string>
#include <ios>
#include <boost/locale/generator.hpp>
#include <boost/locale/info.hpp>
#include <boost/locale/util.hpp>
#include <sstream>
#include <stdlib.h>
#include "locale_data.hpp"
namespace boost {
namespace locale {
namespace util {
class simple_info : public info {
public:
simple_info(std::string const &name,size_t refs = 0) :
info(refs),
name_(name)
{
d.parse(name);
}
virtual std::string get_string_property(string_propery v) const
{
switch(v) {
case language_property:
return d.language;
case country_property:
return d.country;
case variant_property:
return d.variant;
case encoding_property:
return d.encoding;
case name_property:
return name_;
default:
return "";
};
}
virtual int get_integer_property(integer_property v) const
{
switch(v) {
case utf8_property:
return d.utf8;
default:
return 0;
}
}
private:
locale_data d;
std::string name_;
};
std::locale create_info(std::locale const &in,std::string const &name)
{
return std::locale(in,new simple_info(name));
}
} // util
} // locale
} //boost
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
|