~dc4lan/adchpp-lan/trunk

« back to all changes in this revision

Viewing changes to boost/libs/locale/src/util/info.cpp

  • Committer: klondike
  • Date: 2013-09-28 16:16:39 UTC
  • mfrom: (639.1.25 adchpp)
  • Revision ID: klondike@klondike.es-20130928161639-ryo8wvu5hbjjw57h
Merging

Show diffs side-by-side

added added

removed removed

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