diff options
author | neksard <neksard@yandex-team.ru> | 2022-02-10 16:45:33 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:33 +0300 |
commit | 1d9c550e7c38e051d7961f576013a482003a70d9 (patch) | |
tree | b2cc84ee7850122e7ccf51d0ea21e4fa7e7a5685 /contrib/restricted/boost/libs/locale/src/posix | |
parent | 8f7cf138264e0caa318144bf8a2c950e0b0a8593 (diff) | |
download | ydb-1d9c550e7c38e051d7961f576013a482003a70d9.tar.gz |
Restoring authorship annotation for <neksard@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/restricted/boost/libs/locale/src/posix')
8 files changed, 1333 insertions, 1333 deletions
diff --git a/contrib/restricted/boost/libs/locale/src/posix/all_generator.hpp b/contrib/restricted/boost/libs/locale/src/posix/all_generator.hpp index 1d11b338e5..8a80e79d0b 100644 --- a/contrib/restricted/boost/libs/locale/src/posix/all_generator.hpp +++ b/contrib/restricted/boost/libs/locale/src/posix/all_generator.hpp @@ -1,48 +1,48 @@ -// -// 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 BOOST_LOCALE_IMPL_POSIX_ALL_GENERATOR_HPP -#define BOOST_LOCALE_IMPL_POSIX_ALL_GENERATOR_HPP - -#include <boost/locale/generator.hpp> -#include <boost/shared_ptr.hpp> -#include <vector> -#include <locale.h> - -#ifdef __APPLE__ -#include <xlocale.h> -#endif - -namespace boost { - namespace locale { - namespace impl_posix { - - std::locale create_convert( std::locale const &in, - boost::shared_ptr<locale_t> lc, - character_facet_type type); - - std::locale create_collate( std::locale const &in, - boost::shared_ptr<locale_t> lc, - character_facet_type type); - - std::locale create_formatting( std::locale const &in, - boost::shared_ptr<locale_t> lc, - character_facet_type type); - - std::locale create_parsing( std::locale const &in, - boost::shared_ptr<locale_t> lc, - character_facet_type type); - std::locale create_codecvt( std::locale const &in, - std::string const &encoding, - character_facet_type type); - - } - } -} - -#endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 +// +// 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 BOOST_LOCALE_IMPL_POSIX_ALL_GENERATOR_HPP +#define BOOST_LOCALE_IMPL_POSIX_ALL_GENERATOR_HPP + +#include <boost/locale/generator.hpp> +#include <boost/shared_ptr.hpp> +#include <vector> +#include <locale.h> + +#ifdef __APPLE__ +#include <xlocale.h> +#endif + +namespace boost { + namespace locale { + namespace impl_posix { + + std::locale create_convert( std::locale const &in, + boost::shared_ptr<locale_t> lc, + character_facet_type type); + + std::locale create_collate( std::locale const &in, + boost::shared_ptr<locale_t> lc, + character_facet_type type); + + std::locale create_formatting( std::locale const &in, + boost::shared_ptr<locale_t> lc, + character_facet_type type); + + std::locale create_parsing( std::locale const &in, + boost::shared_ptr<locale_t> lc, + character_facet_type type); + std::locale create_codecvt( std::locale const &in, + std::string const &encoding, + character_facet_type type); + + } + } +} + +#endif +// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/libs/locale/src/posix/codecvt.cpp b/contrib/restricted/boost/libs/locale/src/posix/codecvt.cpp index 3c61f2258d..897888a9cd 100644 --- a/contrib/restricted/boost/libs/locale/src/posix/codecvt.cpp +++ b/contrib/restricted/boost/libs/locale/src/posix/codecvt.cpp @@ -1,252 +1,252 @@ -// -// 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 <boost/locale/encoding.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/locale/hold_ptr.hpp> -#include "../encoding/conv.hpp" -#include <boost/locale/util.hpp> -#include "all_generator.hpp" - -#include <errno.h> -#include <algorithm> -#include <stdexcept> -#include <vector> -#include "codecvt.hpp" - -#ifdef BOOST_LOCALE_WITH_ICONV -#include "../util/iconv.hpp" -#endif - -namespace boost { -namespace locale { -namespace impl_posix { - -#ifdef BOOST_LOCALE_WITH_ICONV - class mb2_iconv_converter : public util::base_converter { - public: +// +// 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 <boost/locale/encoding.hpp> +#include <boost/shared_ptr.hpp> +#include <boost/locale/hold_ptr.hpp> +#include "../encoding/conv.hpp" +#include <boost/locale/util.hpp> +#include "all_generator.hpp" + +#include <errno.h> +#include <algorithm> +#include <stdexcept> +#include <vector> +#include "codecvt.hpp" + +#ifdef BOOST_LOCALE_WITH_ICONV +#include "../util/iconv.hpp" +#endif + +namespace boost { +namespace locale { +namespace impl_posix { + +#ifdef BOOST_LOCALE_WITH_ICONV + class mb2_iconv_converter : public util::base_converter { + public: + + mb2_iconv_converter(std::string const &encoding) : + encoding_(encoding), + to_utf_((iconv_t)(-1)), + from_utf_((iconv_t)(-1)) + { + iconv_t d = (iconv_t)(-1); + std::vector<uint32_t> first_byte_table; + try { + d = iconv_open(utf32_encoding(),encoding.c_str()); + if(d == (iconv_t)(-1)) { + throw std::runtime_error("Unsupported encoding" + encoding); + } + for(unsigned c=0;c<256;c++) { + char ibuf[2] = { char(c) , 0 }; + char *in = ibuf; + size_t insize =2; + uint32_t obuf[2] = {illegal,illegal}; + char *out = reinterpret_cast<char *>(obuf); + size_t outsize = 8; + // Basic sigle codepoint conversion + call_iconv(d,&in,&insize,&out,&outsize); + if(insize == 0 && outsize == 0 && obuf[1] == 0) { + first_byte_table.push_back(obuf[0]); + continue; + } + + // Test if this is illegal first byte or incomplete + in = ibuf; + insize = 1; + out = reinterpret_cast<char *>(obuf); + outsize = 8; + call_iconv(d,0,0,0,0); + size_t res = call_iconv(d,&in,&insize,&out,&outsize); + + // Now if this single byte starts a sequence we add incomplete + // to know to ask that we need two bytes, othewise it may only be + // illegal + + uint32_t point; + if(res == (size_t)(-1) && errno == EINVAL) + point = incomplete; + else + point = illegal; + first_byte_table.push_back(point); + + } + } + catch(...) { + if(d!=(iconv_t)(-1)) + iconv_close(d); + throw; + } + iconv_close(d); + first_byte_table_.reset(new std::vector<uint32_t>()); + first_byte_table_->swap(first_byte_table); + } + + mb2_iconv_converter(mb2_iconv_converter const &other) : + first_byte_table_(other.first_byte_table_), + encoding_(other.encoding_), + to_utf_((iconv_t)(-1)), + from_utf_((iconv_t)(-1)) + { + } - mb2_iconv_converter(std::string const &encoding) : - encoding_(encoding), - to_utf_((iconv_t)(-1)), - from_utf_((iconv_t)(-1)) - { - iconv_t d = (iconv_t)(-1); - std::vector<uint32_t> first_byte_table; - try { - d = iconv_open(utf32_encoding(),encoding.c_str()); - if(d == (iconv_t)(-1)) { - throw std::runtime_error("Unsupported encoding" + encoding); - } - for(unsigned c=0;c<256;c++) { - char ibuf[2] = { char(c) , 0 }; - char *in = ibuf; - size_t insize =2; - uint32_t obuf[2] = {illegal,illegal}; - char *out = reinterpret_cast<char *>(obuf); - size_t outsize = 8; - // Basic sigle codepoint conversion - call_iconv(d,&in,&insize,&out,&outsize); - if(insize == 0 && outsize == 0 && obuf[1] == 0) { - first_byte_table.push_back(obuf[0]); - continue; - } - - // Test if this is illegal first byte or incomplete - in = ibuf; - insize = 1; - out = reinterpret_cast<char *>(obuf); - outsize = 8; - call_iconv(d,0,0,0,0); - size_t res = call_iconv(d,&in,&insize,&out,&outsize); - - // Now if this single byte starts a sequence we add incomplete - // to know to ask that we need two bytes, othewise it may only be - // illegal - - uint32_t point; - if(res == (size_t)(-1) && errno == EINVAL) - point = incomplete; - else - point = illegal; - first_byte_table.push_back(point); - - } - } - catch(...) { - if(d!=(iconv_t)(-1)) - iconv_close(d); - throw; - } - iconv_close(d); - first_byte_table_.reset(new std::vector<uint32_t>()); - first_byte_table_->swap(first_byte_table); - } - - mb2_iconv_converter(mb2_iconv_converter const &other) : - first_byte_table_(other.first_byte_table_), - encoding_(other.encoding_), - to_utf_((iconv_t)(-1)), - from_utf_((iconv_t)(-1)) - { - } - - virtual ~mb2_iconv_converter() - { - if(to_utf_ != (iconv_t)(-1)) - iconv_close(to_utf_); - if(from_utf_ != (iconv_t)(-1)) - iconv_close(from_utf_); - - } - - virtual bool is_thread_safe() const - { - return false; - } - - virtual mb2_iconv_converter *clone() const - { - return new mb2_iconv_converter(*this); - } - - uint32_t to_unicode(char const *&begin,char const *end) - { - if(begin == end) - return incomplete; - - unsigned char seq0 = *begin; - uint32_t index = (*first_byte_table_)[seq0]; - if(index == illegal) - return illegal; - if(index != incomplete) { - begin++; - return index; - } - else if(begin+1 == end) - return incomplete; - - open(to_utf_,utf32_encoding(),encoding_.c_str()); - - // maybe illegal or may be double byte - - char inseq[3] = { static_cast<char>(seq0) , begin[1], 0}; - char *inbuf = inseq; - size_t insize = 3; - uint32_t result[2] = { illegal, illegal }; - size_t outsize = 8; - char *outbuf = reinterpret_cast<char*>(result); - call_iconv(to_utf_,&inbuf,&insize,&outbuf,&outsize); - if(outsize == 0 && insize == 0 && result[1]==0 ) { - begin+=2; - return result[0]; - } - return illegal; - } - - uint32_t from_unicode(uint32_t cp,char *begin,char const *end) - { - if(cp == 0) { - if(begin!=end) { - *begin = 0; - return 1; - } - else { - return incomplete; - } - } - - open(from_utf_,encoding_.c_str(),utf32_encoding()); - - uint32_t codepoints[2] = {cp,0}; - char *inbuf = reinterpret_cast<char *>(codepoints); - size_t insize = sizeof(codepoints); - char outseq[3] = {0}; - char *outbuf = outseq; - size_t outsize = 3; - - call_iconv(from_utf_,&inbuf,&insize,&outbuf,&outsize); - - if(insize != 0 || outsize > 1) - return illegal; - size_t len = 2 - outsize ; - size_t reminder = end - begin; - if(reminder < len) - return incomplete; - for(unsigned i=0;i<len;i++) - *begin++ = outseq[i]; - return len; - } - - void open(iconv_t &d,char const *to,char const *from) - { - if(d!=(iconv_t)(-1)) - return; - d=iconv_open(to,from); - } - - static char const *utf32_encoding() - { - union { char one; uint32_t value; } test; - test.value = 1; - if(test.one == 1) - return "UTF-32LE"; - else - return "UTF-32BE"; - } - - virtual int max_len() const - { - return 2; - } - - private: - boost::shared_ptr<std::vector<uint32_t> > first_byte_table_; - std::string encoding_; - iconv_t to_utf_; - iconv_t from_utf_; - }; - - util::base_converter *create_iconv_converter(std::string const &encoding) - { - hold_ptr<util::base_converter> cvt; - try { - cvt.reset(new mb2_iconv_converter(encoding)); - } - catch(std::exception const &e) { - // Nothing to do, just retrun empty cvt - } - return cvt.release(); - } - -#else // no iconv - util::base_converter *create_iconv_converter(std::string const &/*encoding*/) - { - return 0; - } -#endif - - std::locale create_codecvt(std::locale const &in,std::string const &encoding,character_facet_type type) - { - if(conv::impl::normalize_encoding(encoding.c_str())=="utf8") - return util::create_utf8_codecvt(in,type); - - try { - return util::create_simple_codecvt(in,encoding,type); - } - catch(conv::invalid_charset_error const &) { - util::base_converter *cvt = create_iconv_converter(encoding); - return util::create_codecvt_from_pointer(in,cvt,type); - } - } - -} // impl_posix -} // locale -} // boost - -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 + virtual ~mb2_iconv_converter() + { + if(to_utf_ != (iconv_t)(-1)) + iconv_close(to_utf_); + if(from_utf_ != (iconv_t)(-1)) + iconv_close(from_utf_); + + } + + virtual bool is_thread_safe() const + { + return false; + } + + virtual mb2_iconv_converter *clone() const + { + return new mb2_iconv_converter(*this); + } + + uint32_t to_unicode(char const *&begin,char const *end) + { + if(begin == end) + return incomplete; + + unsigned char seq0 = *begin; + uint32_t index = (*first_byte_table_)[seq0]; + if(index == illegal) + return illegal; + if(index != incomplete) { + begin++; + return index; + } + else if(begin+1 == end) + return incomplete; + + open(to_utf_,utf32_encoding(),encoding_.c_str()); + + // maybe illegal or may be double byte + + char inseq[3] = { static_cast<char>(seq0) , begin[1], 0}; + char *inbuf = inseq; + size_t insize = 3; + uint32_t result[2] = { illegal, illegal }; + size_t outsize = 8; + char *outbuf = reinterpret_cast<char*>(result); + call_iconv(to_utf_,&inbuf,&insize,&outbuf,&outsize); + if(outsize == 0 && insize == 0 && result[1]==0 ) { + begin+=2; + return result[0]; + } + return illegal; + } + + uint32_t from_unicode(uint32_t cp,char *begin,char const *end) + { + if(cp == 0) { + if(begin!=end) { + *begin = 0; + return 1; + } + else { + return incomplete; + } + } + + open(from_utf_,encoding_.c_str(),utf32_encoding()); + + uint32_t codepoints[2] = {cp,0}; + char *inbuf = reinterpret_cast<char *>(codepoints); + size_t insize = sizeof(codepoints); + char outseq[3] = {0}; + char *outbuf = outseq; + size_t outsize = 3; + + call_iconv(from_utf_,&inbuf,&insize,&outbuf,&outsize); + + if(insize != 0 || outsize > 1) + return illegal; + size_t len = 2 - outsize ; + size_t reminder = end - begin; + if(reminder < len) + return incomplete; + for(unsigned i=0;i<len;i++) + *begin++ = outseq[i]; + return len; + } + + void open(iconv_t &d,char const *to,char const *from) + { + if(d!=(iconv_t)(-1)) + return; + d=iconv_open(to,from); + } + + static char const *utf32_encoding() + { + union { char one; uint32_t value; } test; + test.value = 1; + if(test.one == 1) + return "UTF-32LE"; + else + return "UTF-32BE"; + } + + virtual int max_len() const + { + return 2; + } + + private: + boost::shared_ptr<std::vector<uint32_t> > first_byte_table_; + std::string encoding_; + iconv_t to_utf_; + iconv_t from_utf_; + }; + + util::base_converter *create_iconv_converter(std::string const &encoding) + { + hold_ptr<util::base_converter> cvt; + try { + cvt.reset(new mb2_iconv_converter(encoding)); + } + catch(std::exception const &e) { + // Nothing to do, just retrun empty cvt + } + return cvt.release(); + } + +#else // no iconv + util::base_converter *create_iconv_converter(std::string const &/*encoding*/) + { + return 0; + } +#endif + + std::locale create_codecvt(std::locale const &in,std::string const &encoding,character_facet_type type) + { + if(conv::impl::normalize_encoding(encoding.c_str())=="utf8") + return util::create_utf8_codecvt(in,type); + + try { + return util::create_simple_codecvt(in,encoding,type); + } + catch(conv::invalid_charset_error const &) { + util::base_converter *cvt = create_iconv_converter(encoding); + return util::create_codecvt_from_pointer(in,cvt,type); + } + } + +} // impl_posix +} // locale +} // boost + +// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/libs/locale/src/posix/codecvt.hpp b/contrib/restricted/boost/libs/locale/src/posix/codecvt.hpp index 1bc3357263..976c07e32e 100644 --- a/contrib/restricted/boost/libs/locale/src/posix/codecvt.hpp +++ b/contrib/restricted/boost/libs/locale/src/posix/codecvt.hpp @@ -1,28 +1,28 @@ -// -// 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 BOOST_LOCALE_IMPL_POSIX_CODECVT_HPP -#define BOOST_LOCALE_IMPL_POSIX_CODECVT_HPP -#include <boost/locale/config.hpp> -#include <boost/locale/util.hpp> - -#include <memory> -#include <string> - -namespace boost { -namespace locale { -namespace impl_posix { - BOOST_LOCALE_DECL - util::base_converter *create_iconv_converter(std::string const &encoding); - -} // impl_posix -} // locale -} // boost - -#endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 - +// +// 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 BOOST_LOCALE_IMPL_POSIX_CODECVT_HPP +#define BOOST_LOCALE_IMPL_POSIX_CODECVT_HPP +#include <boost/locale/config.hpp> +#include <boost/locale/util.hpp> + +#include <memory> +#include <string> + +namespace boost { +namespace locale { +namespace impl_posix { + BOOST_LOCALE_DECL + util::base_converter *create_iconv_converter(std::string const &encoding); + +} // impl_posix +} // locale +} // boost + +#endif +// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 + diff --git a/contrib/restricted/boost/libs/locale/src/posix/collate.cpp b/contrib/restricted/boost/libs/locale/src/posix/collate.cpp index 6afaa91d17..859bb9cf6b 100644 --- a/contrib/restricted/boost/libs/locale/src/posix/collate.cpp +++ b/contrib/restricted/boost/libs/locale/src/posix/collate.cpp @@ -1,124 +1,124 @@ -// -// 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 -#if defined(__FreeBSD__) -#include <xlocale.h> -#endif -#include <locale> -#include <locale.h> -#include <string.h> -#include <wchar.h> -#include <string> -#include <stdexcept> -#include <ios> -#include <vector> -#include <boost/locale/generator.hpp> -#include "../shared/mo_hash.hpp" - -#include "all_generator.hpp" - -namespace boost { -namespace locale { -namespace impl_posix { - -template<typename CharType> -struct coll_traits; - -template<> -struct coll_traits<char> { - static size_t xfrm(char *out,char const *in,size_t n,locale_t l) - { - return strxfrm_l(out,in,n,l); - } - static size_t coll(char const *left,char const *right,locale_t l) - { - return strcoll_l(left,right,l); - } -}; - -template<> -struct coll_traits<wchar_t> { - static size_t xfrm(wchar_t *out,wchar_t const *in,size_t n,locale_t l) - { - return wcsxfrm_l(out,in,n,l); - } - static size_t coll(wchar_t const *left,wchar_t const *right,locale_t l) - { - return wcscoll_l(left,right,l); - } -}; - -template<typename CharType> -class collator : public std::collate<CharType> { -public: - typedef CharType char_type; - typedef std::basic_string<char_type> string_type; - collator(boost::shared_ptr<locale_t> l,size_t refs = 0) : - std::collate<CharType>(refs), - lc_(l) - { - } - virtual ~collator() - { - } - virtual int do_compare(char_type const *lb,char_type const *le,char_type const *rb,char_type const *re) const - { - string_type left(lb,le-lb); - string_type right(rb,re-rb); - int res = coll_traits<char_type>::coll(left.c_str(),right.c_str(),*lc_); - if(res < 0) - return -1; - if(res > 0) - return 1; - return 0; - } - virtual long do_hash(char_type const *b,char_type const *e) const - { - string_type s(do_transform(b,e)); - char const *begin = reinterpret_cast<char const *>(s.c_str()); - char const *end = begin + s.size() * sizeof(char_type); - return gnu_gettext::pj_winberger_hash_function(begin,end); - } - virtual string_type do_transform(char_type const *b,char_type const *e) const - { - string_type s(b,e-b); - std::vector<char_type> buf((e-b)*2+1); - size_t n = coll_traits<char_type>::xfrm(&buf.front(),s.c_str(),buf.size(),*lc_); - if(n>buf.size()) { - buf.resize(n); - coll_traits<char_type>::xfrm(&buf.front(),s.c_str(),n,*lc_); - } - return string_type(&buf.front(),n); - } -private: - boost::shared_ptr<locale_t> lc_; -}; - - -std::locale create_collate( std::locale const &in, - boost::shared_ptr<locale_t> lc, - character_facet_type type) -{ - switch(type) { - case char_facet: - return std::locale(in,new collator<char>(lc)); - case wchar_t_facet: - return std::locale(in,new collator<wchar_t>(lc)); - default: - return in; - } -} - - -} // impl_std -} // locale -} //boost - - - -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 +// +// 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 +#if defined(__FreeBSD__) +#include <xlocale.h> +#endif +#include <locale> +#include <locale.h> +#include <string.h> +#include <wchar.h> +#include <string> +#include <stdexcept> +#include <ios> +#include <vector> +#include <boost/locale/generator.hpp> +#include "../shared/mo_hash.hpp" + +#include "all_generator.hpp" + +namespace boost { +namespace locale { +namespace impl_posix { + +template<typename CharType> +struct coll_traits; + +template<> +struct coll_traits<char> { + static size_t xfrm(char *out,char const *in,size_t n,locale_t l) + { + return strxfrm_l(out,in,n,l); + } + static size_t coll(char const *left,char const *right,locale_t l) + { + return strcoll_l(left,right,l); + } +}; + +template<> +struct coll_traits<wchar_t> { + static size_t xfrm(wchar_t *out,wchar_t const *in,size_t n,locale_t l) + { + return wcsxfrm_l(out,in,n,l); + } + static size_t coll(wchar_t const *left,wchar_t const *right,locale_t l) + { + return wcscoll_l(left,right,l); + } +}; + +template<typename CharType> +class collator : public std::collate<CharType> { +public: + typedef CharType char_type; + typedef std::basic_string<char_type> string_type; + collator(boost::shared_ptr<locale_t> l,size_t refs = 0) : + std::collate<CharType>(refs), + lc_(l) + { + } + virtual ~collator() + { + } + virtual int do_compare(char_type const *lb,char_type const *le,char_type const *rb,char_type const *re) const + { + string_type left(lb,le-lb); + string_type right(rb,re-rb); + int res = coll_traits<char_type>::coll(left.c_str(),right.c_str(),*lc_); + if(res < 0) + return -1; + if(res > 0) + return 1; + return 0; + } + virtual long do_hash(char_type const *b,char_type const *e) const + { + string_type s(do_transform(b,e)); + char const *begin = reinterpret_cast<char const *>(s.c_str()); + char const *end = begin + s.size() * sizeof(char_type); + return gnu_gettext::pj_winberger_hash_function(begin,end); + } + virtual string_type do_transform(char_type const *b,char_type const *e) const + { + string_type s(b,e-b); + std::vector<char_type> buf((e-b)*2+1); + size_t n = coll_traits<char_type>::xfrm(&buf.front(),s.c_str(),buf.size(),*lc_); + if(n>buf.size()) { + buf.resize(n); + coll_traits<char_type>::xfrm(&buf.front(),s.c_str(),n,*lc_); + } + return string_type(&buf.front(),n); + } +private: + boost::shared_ptr<locale_t> lc_; +}; + + +std::locale create_collate( std::locale const &in, + boost::shared_ptr<locale_t> lc, + character_facet_type type) +{ + switch(type) { + case char_facet: + return std::locale(in,new collator<char>(lc)); + case wchar_t_facet: + return std::locale(in,new collator<wchar_t>(lc)); + default: + return in; + } +} + + +} // impl_std +} // locale +} //boost + + + +// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/libs/locale/src/posix/converter.cpp b/contrib/restricted/boost/libs/locale/src/posix/converter.cpp index ec2de248b0..bf8bc566d4 100644 --- a/contrib/restricted/boost/libs/locale/src/posix/converter.cpp +++ b/contrib/restricted/boost/libs/locale/src/posix/converter.cpp @@ -1,165 +1,165 @@ -// -// 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 - -#if defined(__FreeBSD__) -#include <xlocale.h> -#endif -#include <locale> -#include <stdexcept> -#include <boost/locale/generator.hpp> -#include <boost/locale/conversion.hpp> -#include <boost/locale/encoding.hpp> -#include <boost/shared_ptr.hpp> -#include <vector> -#include <string.h> -#include <wctype.h> -#include <ctype.h> -#include <langinfo.h> -#include "all_generator.hpp" - -namespace boost { -namespace locale { -namespace impl_posix { - -template<typename CharType> -struct case_traits; - -template<> -struct case_traits<char> { - static char lower(char c,locale_t lc) - { - return tolower_l(c,lc); - } - static char upper(char c,locale_t lc) - { - return toupper_l(c,lc); - } -}; - -template<> -struct case_traits<wchar_t> { - static wchar_t lower(wchar_t c,locale_t lc) - { - return towlower_l(c,lc); - } - static wchar_t upper(wchar_t c,locale_t lc) - { - return towupper_l(c,lc); - } -}; - - -template<typename CharType> -class std_converter : public converter<CharType> -{ -public: - typedef CharType char_type; - typedef std::basic_string<char_type> string_type; - typedef std::ctype<char_type> ctype_type; - std_converter(boost::shared_ptr<locale_t> lc,size_t refs = 0) : - converter<CharType>(refs), - lc_(lc) - { - } - virtual string_type convert(converter_base::conversion_type how,char_type const *begin,char_type const *end,int /*flags*/ = 0) const - { - switch(how) { - case converter_base::upper_case: - { - string_type res; - res.reserve(end-begin); - while(begin!=end) { - res+=case_traits<char_type>::upper(*begin++,*lc_); - } - return res; - } - case converter_base::lower_case: - case converter_base::case_folding: - { - string_type res; - res.reserve(end-begin); - while(begin!=end) { - res+=case_traits<char_type>::lower(*begin++,*lc_); - } - return res; - } - default: - return string_type(begin,end-begin); - } - } -private: - boost::shared_ptr<locale_t> lc_; -}; - -class utf8_converter : public converter<char> { -public: - utf8_converter(boost::shared_ptr<locale_t> lc,size_t refs = 0) : - converter<char>(refs), - lc_(lc) - { - } - virtual std::string convert(converter_base::conversion_type how,char const *begin,char const *end,int /*flags*/ = 0) const - { - switch(how) { - case upper_case: - { - std::wstring tmp = conv::to_utf<wchar_t>(begin,end,"UTF-8"); - std::wstring wres; - wres.reserve(tmp.size()); - for(unsigned i=0;i<tmp.size();i++) - wres+=towupper_l(tmp[i],*lc_); - return conv::from_utf<wchar_t>(wres,"UTF-8"); - } - - case lower_case: - case case_folding: - { - std::wstring tmp = conv::to_utf<wchar_t>(begin,end,"UTF-8"); - std::wstring wres; - wres.reserve(tmp.size()); - for(unsigned i=0;i<tmp.size();i++) - wres+=towlower_l(tmp[i],*lc_); - return conv::from_utf<wchar_t>(wres,"UTF-8"); - } - default: - return std::string(begin,end-begin); - } - } -private: - boost::shared_ptr<locale_t> lc_; -}; - -std::locale create_convert( std::locale const &in, - boost::shared_ptr<locale_t> lc, - character_facet_type type) -{ - switch(type) { - case char_facet: - { - std::string encoding = nl_langinfo_l(CODESET,*lc); - for(unsigned i=0;i<encoding.size();i++) - if('A'<=encoding[i] && encoding[i]<='Z') - encoding[i]=encoding[i]-'A'+'a'; - if(encoding=="utf-8" || encoding=="utf8" || encoding=="utf_8") { - return std::locale(in,new utf8_converter(lc)); - } - return std::locale(in,new std_converter<char>(lc)); - } - case wchar_t_facet: - return std::locale(in,new std_converter<wchar_t>(lc)); - default: - return in; - } -} - - -} // namespace impl_std -} // locale -} // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 +// +// 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 + +#if defined(__FreeBSD__) +#include <xlocale.h> +#endif +#include <locale> +#include <stdexcept> +#include <boost/locale/generator.hpp> +#include <boost/locale/conversion.hpp> +#include <boost/locale/encoding.hpp> +#include <boost/shared_ptr.hpp> +#include <vector> +#include <string.h> +#include <wctype.h> +#include <ctype.h> +#include <langinfo.h> +#include "all_generator.hpp" + +namespace boost { +namespace locale { +namespace impl_posix { + +template<typename CharType> +struct case_traits; + +template<> +struct case_traits<char> { + static char lower(char c,locale_t lc) + { + return tolower_l(c,lc); + } + static char upper(char c,locale_t lc) + { + return toupper_l(c,lc); + } +}; + +template<> +struct case_traits<wchar_t> { + static wchar_t lower(wchar_t c,locale_t lc) + { + return towlower_l(c,lc); + } + static wchar_t upper(wchar_t c,locale_t lc) + { + return towupper_l(c,lc); + } +}; + + +template<typename CharType> +class std_converter : public converter<CharType> +{ +public: + typedef CharType char_type; + typedef std::basic_string<char_type> string_type; + typedef std::ctype<char_type> ctype_type; + std_converter(boost::shared_ptr<locale_t> lc,size_t refs = 0) : + converter<CharType>(refs), + lc_(lc) + { + } + virtual string_type convert(converter_base::conversion_type how,char_type const *begin,char_type const *end,int /*flags*/ = 0) const + { + switch(how) { + case converter_base::upper_case: + { + string_type res; + res.reserve(end-begin); + while(begin!=end) { + res+=case_traits<char_type>::upper(*begin++,*lc_); + } + return res; + } + case converter_base::lower_case: + case converter_base::case_folding: + { + string_type res; + res.reserve(end-begin); + while(begin!=end) { + res+=case_traits<char_type>::lower(*begin++,*lc_); + } + return res; + } + default: + return string_type(begin,end-begin); + } + } +private: + boost::shared_ptr<locale_t> lc_; +}; + +class utf8_converter : public converter<char> { +public: + utf8_converter(boost::shared_ptr<locale_t> lc,size_t refs = 0) : + converter<char>(refs), + lc_(lc) + { + } + virtual std::string convert(converter_base::conversion_type how,char const *begin,char const *end,int /*flags*/ = 0) const + { + switch(how) { + case upper_case: + { + std::wstring tmp = conv::to_utf<wchar_t>(begin,end,"UTF-8"); + std::wstring wres; + wres.reserve(tmp.size()); + for(unsigned i=0;i<tmp.size();i++) + wres+=towupper_l(tmp[i],*lc_); + return conv::from_utf<wchar_t>(wres,"UTF-8"); + } + + case lower_case: + case case_folding: + { + std::wstring tmp = conv::to_utf<wchar_t>(begin,end,"UTF-8"); + std::wstring wres; + wres.reserve(tmp.size()); + for(unsigned i=0;i<tmp.size();i++) + wres+=towlower_l(tmp[i],*lc_); + return conv::from_utf<wchar_t>(wres,"UTF-8"); + } + default: + return std::string(begin,end-begin); + } + } +private: + boost::shared_ptr<locale_t> lc_; +}; + +std::locale create_convert( std::locale const &in, + boost::shared_ptr<locale_t> lc, + character_facet_type type) +{ + switch(type) { + case char_facet: + { + std::string encoding = nl_langinfo_l(CODESET,*lc); + for(unsigned i=0;i<encoding.size();i++) + if('A'<=encoding[i] && encoding[i]<='Z') + encoding[i]=encoding[i]-'A'+'a'; + if(encoding=="utf-8" || encoding=="utf8" || encoding=="utf_8") { + return std::locale(in,new utf8_converter(lc)); + } + return std::locale(in,new std_converter<char>(lc)); + } + case wchar_t_facet: + return std::locale(in,new std_converter<wchar_t>(lc)); + default: + return in; + } +} + + +} // namespace impl_std +} // locale +} // boost +// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/libs/locale/src/posix/numeric.cpp b/contrib/restricted/boost/libs/locale/src/posix/numeric.cpp index dfc7983242..6771c02639 100644 --- a/contrib/restricted/boost/libs/locale/src/posix/numeric.cpp +++ b/contrib/restricted/boost/libs/locale/src/posix/numeric.cpp @@ -1,514 +1,514 @@ -// -// 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 -#if defined(__FreeBSD__) -#include <xlocale.h> -#endif -#include <locale> -#include <string> -#include <ios> -#include <boost/locale/formatting.hpp> -#include <boost/locale/generator.hpp> -#include <boost/locale/encoding.hpp> -#include <boost/shared_ptr.hpp> -#include <sstream> -#include <stdlib.h> -#include <time.h> -#include <string.h> -#include <wctype.h> -#include <ctype.h> -#include <langinfo.h> -#include <monetary.h> -#include <errno.h> -#include "../util/numeric.hpp" -#include "all_generator.hpp" - - -#if defined(__linux) || defined(__APPLE__) -#define BOOST_LOCALE_HAVE_WCSFTIME_L -#endif - -namespace boost { -namespace locale { -namespace impl_posix { - -template<typename CharType> -class num_format : public util::base_num_format<CharType> -{ -public: - typedef typename std::num_put<CharType>::iter_type iter_type; - typedef std::basic_string<CharType> string_type; - typedef CharType char_type; - - num_format(boost::shared_ptr<locale_t> lc,size_t refs = 0) : - util::base_num_format<CharType>(refs), - lc_(lc) - { - } -protected: - - virtual iter_type do_format_currency(bool intl,iter_type out,std::ios_base &/*ios*/,char_type /*fill*/,long double val) const - { - char buf[4]={}; - char const *format = intl ? "%i" : "%n"; - errno=0; - ssize_t n = strfmon_l(buf,sizeof(buf),*lc_,format,static_cast<double>(val)); - if(n >= 0) - return write_it(out,buf,n); - - for(std::vector<char> tmp(sizeof(buf)*2);tmp.size() <= 4098;tmp.resize(tmp.size()*2)) { - n = strfmon_l(&tmp.front(),tmp.size(),*lc_,format,static_cast<double>(val)); - if(n >= 0) - return write_it(out,&tmp.front(),n); - } - return out; - } - - std::ostreambuf_iterator<char> write_it(std::ostreambuf_iterator<char> out,char const *ptr,size_t n) const - { - for(size_t i=0;i<n;i++) - *out++ = *ptr++; - return out; - } - - std::ostreambuf_iterator<wchar_t> write_it(std::ostreambuf_iterator<wchar_t> out,char const *ptr,size_t n) const - { - std::wstring tmp = conv::to_utf<wchar_t>(ptr,ptr+n,nl_langinfo_l(CODESET,*lc_)); - for(size_t i=0;i<tmp.size();i++) - *out++ = tmp[i]; - return out; - } -private: - - boost::shared_ptr<locale_t> lc_; - -}; /// num_format - - -template<typename CharType> -struct ftime_traits; - -template<> -struct ftime_traits<char> { - static std::string ftime(char const *format,const struct tm *t,locale_t lc) - { - char buf[16]; - size_t n=strftime_l(buf,sizeof(buf),format,t,lc); - if(n == 0) { - // should be big enough - // - // Note standard specifies that in case of the error - // the function returns 0, however 0 may be actually - // valid output value of for example empty format or an - // output of %p in some locales - // - // Thus we try to guess that 1024 would be enough. - std::vector<char> v(1024); - n = strftime_l(&v.front(),1024,format,t,lc); - return std::string(&v.front(),n); - } - return std::string(buf,n); - } -}; - -template<> -struct ftime_traits<wchar_t> { - static std::wstring ftime(wchar_t const *format,const struct tm *t,locale_t lc) - { - #ifdef HAVE_WCSFTIME_L - wchar_t buf[16]; - size_t n=wcsftime_l(buf,sizeof(buf)/sizeof(buf[0]),format,t,lc); - if(n == 0) { - // should be big enough - // - // Note standard specifies that in case of the error - // the function returns 0, however 0 may be actually - // valid output value of for example empty format or an - // output of %p in some locales - // - // Thus we try to guess that 1024 would be enough. - std::vector<wchar_t> v(1024); - n = wcsftime_l(&v.front(),1024,format,t,lc); - } - return std::wstring(&v.front(),n); - #else - std::string enc = nl_langinfo_l(CODESET,lc); - std::string nformat = conv::from_utf<wchar_t>(format,enc); - std::string nres = ftime_traits<char>::ftime(nformat.c_str(),t,lc); - return conv::to_utf<wchar_t>(nres,enc); - #endif - } -}; - - -template<typename CharType> -class time_put_posix : public std::time_put<CharType> { -public: - time_put_posix(boost::shared_ptr<locale_t> lc, size_t refs = 0) : - std::time_put<CharType>(refs), - lc_(lc) - { - } - virtual ~time_put_posix() - { - } - typedef typename std::time_put<CharType>::iter_type iter_type; - typedef CharType char_type; - typedef std::basic_string<char_type> string_type; - - virtual iter_type do_put(iter_type out,std::ios_base &/*ios*/,CharType /*fill*/,std::tm const *tm,char format,char modifier) const - { - char_type fmt[4] = { '%' , static_cast<char_type>(modifier != 0 ? modifier : format) , static_cast<char_type>(modifier == 0 ? '\0' : format) }; - string_type res = ftime_traits<char_type>::ftime(fmt,tm,*lc_); - for(unsigned i=0;i<res.size();i++) - *out++ = res[i]; - return out; - } - -private: - boost::shared_ptr<locale_t> lc_; -}; - - -template<typename CharType> -class ctype_posix; - -template<> -class ctype_posix<char> : public std::ctype<char> { -public: - - ctype_posix(boost::shared_ptr<locale_t> lc) - { - lc_ = lc; - } - - bool do_is(mask m,char c) const - { - if((m & space) && isspace_l(c,*lc_)) - return true; - if((m & print) && isprint_l(c,*lc_)) - return true; - if((m & cntrl) && iscntrl_l(c,*lc_)) - return true; - if((m & upper) && isupper_l(c,*lc_)) - return true; - if((m & lower) && islower_l(c,*lc_)) - return true; - if((m & alpha) && isalpha_l(c,*lc_)) - return true; - if((m & digit) && isdigit_l(c,*lc_)) - return true; - if((m & xdigit) && isxdigit_l(c,*lc_)) - return true; - if((m & punct) && ispunct_l(c,*lc_)) - return true; - return false; - } - char const *do_is(char const *begin,char const *end,mask *m) const - { - while(begin!=end) { - char c= *begin++; - int r=0; - if(isspace_l(c,*lc_)) - r|=space; - if(isprint_l(c,*lc_)) - r|=cntrl; - if(iscntrl_l(c,*lc_)) - r|=space; - if(isupper_l(c,*lc_)) - r|=upper; - if(islower_l(c,*lc_)) - r|=lower; - if(isalpha_l(c,*lc_)) - r|=alpha; - if(isdigit_l(c,*lc_)) - r|=digit; - if(isxdigit_l(c,*lc_)) - r|=xdigit; - if(ispunct_l(c,*lc_)) - r|=punct; - // r actually should be mask, but some standard - // libraries (like STLPort) - // do not define operator | properly so using int+cast - *m++ = static_cast<mask>(r); - } - return begin; - } - char const *do_scan_is(mask m,char const *begin,char const *end) const - { - while(begin!=end) - if(do_is(m,*begin)) - return begin; - return begin; - } - char const *do_scan_not(mask m,char const *begin,char const *end) const - { - while(begin!=end) - if(!do_is(m,*begin)) - return begin; - return begin; - } - char toupper(char c) const - { - return toupper_l(c,*lc_); - } - char const *toupper(char *begin,char const *end) const - { - for(;begin!=end;begin++) - *begin = toupper_l(*begin,*lc_); - return begin; - } - char tolower(char c) const - { - return tolower_l(c,*lc_); - } - char const *tolower(char *begin,char const *end) const - { - for(;begin!=end;begin++) - *begin = tolower_l(*begin,*lc_); - return begin; - } -private: - boost::shared_ptr<locale_t> lc_; -}; - -template<> -class ctype_posix<wchar_t> : public std::ctype<wchar_t> { -public: - ctype_posix(boost::shared_ptr<locale_t> lc) - { - lc_ = lc; - } +// +// 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 +#if defined(__FreeBSD__) +#include <xlocale.h> +#endif +#include <locale> +#include <string> +#include <ios> +#include <boost/locale/formatting.hpp> +#include <boost/locale/generator.hpp> +#include <boost/locale/encoding.hpp> +#include <boost/shared_ptr.hpp> +#include <sstream> +#include <stdlib.h> +#include <time.h> +#include <string.h> +#include <wctype.h> +#include <ctype.h> +#include <langinfo.h> +#include <monetary.h> +#include <errno.h> +#include "../util/numeric.hpp" +#include "all_generator.hpp" + + +#if defined(__linux) || defined(__APPLE__) +#define BOOST_LOCALE_HAVE_WCSFTIME_L +#endif + +namespace boost { +namespace locale { +namespace impl_posix { + +template<typename CharType> +class num_format : public util::base_num_format<CharType> +{ +public: + typedef typename std::num_put<CharType>::iter_type iter_type; + typedef std::basic_string<CharType> string_type; + typedef CharType char_type; + + num_format(boost::shared_ptr<locale_t> lc,size_t refs = 0) : + util::base_num_format<CharType>(refs), + lc_(lc) + { + } +protected: + + virtual iter_type do_format_currency(bool intl,iter_type out,std::ios_base &/*ios*/,char_type /*fill*/,long double val) const + { + char buf[4]={}; + char const *format = intl ? "%i" : "%n"; + errno=0; + ssize_t n = strfmon_l(buf,sizeof(buf),*lc_,format,static_cast<double>(val)); + if(n >= 0) + return write_it(out,buf,n); + + for(std::vector<char> tmp(sizeof(buf)*2);tmp.size() <= 4098;tmp.resize(tmp.size()*2)) { + n = strfmon_l(&tmp.front(),tmp.size(),*lc_,format,static_cast<double>(val)); + if(n >= 0) + return write_it(out,&tmp.front(),n); + } + return out; + } + + std::ostreambuf_iterator<char> write_it(std::ostreambuf_iterator<char> out,char const *ptr,size_t n) const + { + for(size_t i=0;i<n;i++) + *out++ = *ptr++; + return out; + } - bool do_is(mask m,wchar_t c) const - { - if((m & space) && iswspace_l(c,*lc_)) - return true; - if((m & print) && iswprint_l(c,*lc_)) - return true; - if((m & cntrl) && iswcntrl_l(c,*lc_)) - return true; - if((m & upper) && iswupper_l(c,*lc_)) - return true; - if((m & lower) && iswlower_l(c,*lc_)) - return true; - if((m & alpha) && iswalpha_l(c,*lc_)) - return true; - if((m & digit) && iswdigit_l(c,*lc_)) - return true; - if((m & xdigit) && iswxdigit_l(c,*lc_)) - return true; - if((m & punct) && iswpunct_l(c,*lc_)) - return true; - return false; - } - wchar_t const *do_is(wchar_t const *begin,wchar_t const *end,mask *m) const - { - while(begin!=end) { - wchar_t c= *begin++; - int r=0; - if(iswspace_l(c,*lc_)) - r|=space; - if(iswprint_l(c,*lc_)) - r|=cntrl; - if(iswcntrl_l(c,*lc_)) - r|=space; - if(iswupper_l(c,*lc_)) - r|=upper; - if(iswlower_l(c,*lc_)) - r|=lower; - if(iswalpha_l(c,*lc_)) - r|=alpha; - if(iswdigit_l(c,*lc_)) - r|=digit; - if(iswxdigit_l(c,*lc_)) - r|=xdigit; - if(iswpunct_l(c,*lc_)) - r|=punct; - // r actually should be mask, but some standard - // libraries (like STLPort) - // do not define operator | properly so using int+cast - *m++ = static_cast<mask>(r); - } - return begin; - } - wchar_t const *do_scan_is(mask m,wchar_t const *begin,wchar_t const *end) const - { - while(begin!=end) - if(do_is(m,*begin)) - return begin; - return begin; - } - wchar_t const *do_scan_not(mask m,wchar_t const *begin,wchar_t const *end) const - { - while(begin!=end) - if(!do_is(m,*begin)) - return begin; - return begin; - } - wchar_t toupper(wchar_t c) const - { - return towupper_l(c,*lc_); - } - wchar_t const *toupper(wchar_t *begin,wchar_t const *end) const - { - for(;begin!=end;begin++) - *begin = towupper_l(*begin,*lc_); - return begin; - } - wchar_t tolower(wchar_t c) const - { - return tolower_l(c,*lc_); - } - wchar_t const *tolower(wchar_t *begin,wchar_t const *end) const - { - for(;begin!=end;begin++) - *begin = tolower_l(*begin,*lc_); - return begin; - } -private: - boost::shared_ptr<locale_t> lc_; -}; - - - - -struct basic_numpunct { - std::string grouping; - std::string thousands_sep; - std::string decimal_point; - basic_numpunct() : - decimal_point(".") - { - } - basic_numpunct(locale_t lc) - { - #if defined(__APPLE__) || defined(__FreeBSD__) - lconv *cv = localeconv_l(lc); - grouping = cv->grouping; - thousands_sep = cv->thousands_sep; - decimal_point = cv->decimal_point; - #else - thousands_sep = nl_langinfo_l(THOUSEP,lc); - decimal_point = nl_langinfo_l(RADIXCHAR,lc); - #ifdef GROUPING - grouping = nl_langinfo_l(GROUPING,lc); - #endif - #endif - } -}; - -template<typename CharType> -class num_punct_posix : public std::numpunct<CharType> { -public: - typedef std::basic_string<CharType> string_type; - num_punct_posix(locale_t lc,size_t refs = 0) : - std::numpunct<CharType>(refs) - { - basic_numpunct np(lc); - to_str(np.thousands_sep,thousands_sep_,lc); - to_str(np.decimal_point,decimal_point_,lc); - grouping_ = np.grouping; - if(thousands_sep_.size() > 1) - grouping_ = std::string(); - if(decimal_point_.size() > 1) - decimal_point_ = CharType('.'); - } - void to_str(std::string &s1,std::string &s2,locale_t /*lc*/) - { - s2.swap(s1); - } - void to_str(std::string &s1,std::wstring &s2,locale_t lc) - { - s2=conv::to_utf<wchar_t>(s1,nl_langinfo_l(CODESET,lc)); - } - virtual CharType do_decimal_point() const - { - return *decimal_point_.c_str(); - } - virtual CharType do_thousands_sep() const - { - return *thousands_sep_.c_str(); - } - virtual std::string do_grouping() const - { - return grouping_; - } - virtual string_type do_truename() const - { - static const char t[]="true"; - return string_type(t,t+sizeof(t)-1); - } - virtual string_type do_falsename() const - { - static const char t[]="false"; - return string_type(t,t+sizeof(t)-1); - } -private: - string_type decimal_point_; - string_type thousands_sep_; - std::string grouping_; -}; - -template<typename CharType> -std::locale create_formatting_impl(std::locale const &in,boost::shared_ptr<locale_t> lc) -{ - std::locale tmp = std::locale(in,new num_punct_posix<CharType>(*lc)); - tmp = std::locale(tmp,new ctype_posix<CharType>(lc)); - tmp = std::locale(tmp,new time_put_posix<CharType>(lc)); - tmp = std::locale(tmp,new num_format<CharType>(lc)); - return tmp; -} - -template<typename CharType> -std::locale create_parsing_impl(std::locale const &in,boost::shared_ptr<locale_t> lc) -{ - std::locale tmp = std::locale(in,new num_punct_posix<CharType>(*lc)); - tmp = std::locale(tmp,new ctype_posix<CharType>(lc)); - tmp = std::locale(tmp,new util::base_num_parse<CharType>()); - return tmp; -} - - -std::locale create_formatting( std::locale const &in, - boost::shared_ptr<locale_t> lc, - character_facet_type type) -{ - switch(type) { - case char_facet: - return create_formatting_impl<char>(in,lc); - case wchar_t_facet: - return create_formatting_impl<wchar_t>(in,lc); - default: - return in; - } -} - -std::locale create_parsing( std::locale const &in, - boost::shared_ptr<locale_t> lc, - character_facet_type type) -{ - switch(type) { - case char_facet: - return create_parsing_impl<char>(in,lc); - case wchar_t_facet: - return create_parsing_impl<wchar_t>(in,lc); - default: - return in; - } -} - - - -} // impl_std -} // locale -} //boost - - - -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 + std::ostreambuf_iterator<wchar_t> write_it(std::ostreambuf_iterator<wchar_t> out,char const *ptr,size_t n) const + { + std::wstring tmp = conv::to_utf<wchar_t>(ptr,ptr+n,nl_langinfo_l(CODESET,*lc_)); + for(size_t i=0;i<tmp.size();i++) + *out++ = tmp[i]; + return out; + } +private: + + boost::shared_ptr<locale_t> lc_; + +}; /// num_format + + +template<typename CharType> +struct ftime_traits; + +template<> +struct ftime_traits<char> { + static std::string ftime(char const *format,const struct tm *t,locale_t lc) + { + char buf[16]; + size_t n=strftime_l(buf,sizeof(buf),format,t,lc); + if(n == 0) { + // should be big enough + // + // Note standard specifies that in case of the error + // the function returns 0, however 0 may be actually + // valid output value of for example empty format or an + // output of %p in some locales + // + // Thus we try to guess that 1024 would be enough. + std::vector<char> v(1024); + n = strftime_l(&v.front(),1024,format,t,lc); + return std::string(&v.front(),n); + } + return std::string(buf,n); + } +}; + +template<> +struct ftime_traits<wchar_t> { + static std::wstring ftime(wchar_t const *format,const struct tm *t,locale_t lc) + { + #ifdef HAVE_WCSFTIME_L + wchar_t buf[16]; + size_t n=wcsftime_l(buf,sizeof(buf)/sizeof(buf[0]),format,t,lc); + if(n == 0) { + // should be big enough + // + // Note standard specifies that in case of the error + // the function returns 0, however 0 may be actually + // valid output value of for example empty format or an + // output of %p in some locales + // + // Thus we try to guess that 1024 would be enough. + std::vector<wchar_t> v(1024); + n = wcsftime_l(&v.front(),1024,format,t,lc); + } + return std::wstring(&v.front(),n); + #else + std::string enc = nl_langinfo_l(CODESET,lc); + std::string nformat = conv::from_utf<wchar_t>(format,enc); + std::string nres = ftime_traits<char>::ftime(nformat.c_str(),t,lc); + return conv::to_utf<wchar_t>(nres,enc); + #endif + } +}; + + +template<typename CharType> +class time_put_posix : public std::time_put<CharType> { +public: + time_put_posix(boost::shared_ptr<locale_t> lc, size_t refs = 0) : + std::time_put<CharType>(refs), + lc_(lc) + { + } + virtual ~time_put_posix() + { + } + typedef typename std::time_put<CharType>::iter_type iter_type; + typedef CharType char_type; + typedef std::basic_string<char_type> string_type; + + virtual iter_type do_put(iter_type out,std::ios_base &/*ios*/,CharType /*fill*/,std::tm const *tm,char format,char modifier) const + { + char_type fmt[4] = { '%' , static_cast<char_type>(modifier != 0 ? modifier : format) , static_cast<char_type>(modifier == 0 ? '\0' : format) }; + string_type res = ftime_traits<char_type>::ftime(fmt,tm,*lc_); + for(unsigned i=0;i<res.size();i++) + *out++ = res[i]; + return out; + } + +private: + boost::shared_ptr<locale_t> lc_; +}; + + +template<typename CharType> +class ctype_posix; + +template<> +class ctype_posix<char> : public std::ctype<char> { +public: + + ctype_posix(boost::shared_ptr<locale_t> lc) + { + lc_ = lc; + } + + bool do_is(mask m,char c) const + { + if((m & space) && isspace_l(c,*lc_)) + return true; + if((m & print) && isprint_l(c,*lc_)) + return true; + if((m & cntrl) && iscntrl_l(c,*lc_)) + return true; + if((m & upper) && isupper_l(c,*lc_)) + return true; + if((m & lower) && islower_l(c,*lc_)) + return true; + if((m & alpha) && isalpha_l(c,*lc_)) + return true; + if((m & digit) && isdigit_l(c,*lc_)) + return true; + if((m & xdigit) && isxdigit_l(c,*lc_)) + return true; + if((m & punct) && ispunct_l(c,*lc_)) + return true; + return false; + } + char const *do_is(char const *begin,char const *end,mask *m) const + { + while(begin!=end) { + char c= *begin++; + int r=0; + if(isspace_l(c,*lc_)) + r|=space; + if(isprint_l(c,*lc_)) + r|=cntrl; + if(iscntrl_l(c,*lc_)) + r|=space; + if(isupper_l(c,*lc_)) + r|=upper; + if(islower_l(c,*lc_)) + r|=lower; + if(isalpha_l(c,*lc_)) + r|=alpha; + if(isdigit_l(c,*lc_)) + r|=digit; + if(isxdigit_l(c,*lc_)) + r|=xdigit; + if(ispunct_l(c,*lc_)) + r|=punct; + // r actually should be mask, but some standard + // libraries (like STLPort) + // do not define operator | properly so using int+cast + *m++ = static_cast<mask>(r); + } + return begin; + } + char const *do_scan_is(mask m,char const *begin,char const *end) const + { + while(begin!=end) + if(do_is(m,*begin)) + return begin; + return begin; + } + char const *do_scan_not(mask m,char const *begin,char const *end) const + { + while(begin!=end) + if(!do_is(m,*begin)) + return begin; + return begin; + } + char toupper(char c) const + { + return toupper_l(c,*lc_); + } + char const *toupper(char *begin,char const *end) const + { + for(;begin!=end;begin++) + *begin = toupper_l(*begin,*lc_); + return begin; + } + char tolower(char c) const + { + return tolower_l(c,*lc_); + } + char const *tolower(char *begin,char const *end) const + { + for(;begin!=end;begin++) + *begin = tolower_l(*begin,*lc_); + return begin; + } +private: + boost::shared_ptr<locale_t> lc_; +}; + +template<> +class ctype_posix<wchar_t> : public std::ctype<wchar_t> { +public: + ctype_posix(boost::shared_ptr<locale_t> lc) + { + lc_ = lc; + } + + bool do_is(mask m,wchar_t c) const + { + if((m & space) && iswspace_l(c,*lc_)) + return true; + if((m & print) && iswprint_l(c,*lc_)) + return true; + if((m & cntrl) && iswcntrl_l(c,*lc_)) + return true; + if((m & upper) && iswupper_l(c,*lc_)) + return true; + if((m & lower) && iswlower_l(c,*lc_)) + return true; + if((m & alpha) && iswalpha_l(c,*lc_)) + return true; + if((m & digit) && iswdigit_l(c,*lc_)) + return true; + if((m & xdigit) && iswxdigit_l(c,*lc_)) + return true; + if((m & punct) && iswpunct_l(c,*lc_)) + return true; + return false; + } + wchar_t const *do_is(wchar_t const *begin,wchar_t const *end,mask *m) const + { + while(begin!=end) { + wchar_t c= *begin++; + int r=0; + if(iswspace_l(c,*lc_)) + r|=space; + if(iswprint_l(c,*lc_)) + r|=cntrl; + if(iswcntrl_l(c,*lc_)) + r|=space; + if(iswupper_l(c,*lc_)) + r|=upper; + if(iswlower_l(c,*lc_)) + r|=lower; + if(iswalpha_l(c,*lc_)) + r|=alpha; + if(iswdigit_l(c,*lc_)) + r|=digit; + if(iswxdigit_l(c,*lc_)) + r|=xdigit; + if(iswpunct_l(c,*lc_)) + r|=punct; + // r actually should be mask, but some standard + // libraries (like STLPort) + // do not define operator | properly so using int+cast + *m++ = static_cast<mask>(r); + } + return begin; + } + wchar_t const *do_scan_is(mask m,wchar_t const *begin,wchar_t const *end) const + { + while(begin!=end) + if(do_is(m,*begin)) + return begin; + return begin; + } + wchar_t const *do_scan_not(mask m,wchar_t const *begin,wchar_t const *end) const + { + while(begin!=end) + if(!do_is(m,*begin)) + return begin; + return begin; + } + wchar_t toupper(wchar_t c) const + { + return towupper_l(c,*lc_); + } + wchar_t const *toupper(wchar_t *begin,wchar_t const *end) const + { + for(;begin!=end;begin++) + *begin = towupper_l(*begin,*lc_); + return begin; + } + wchar_t tolower(wchar_t c) const + { + return tolower_l(c,*lc_); + } + wchar_t const *tolower(wchar_t *begin,wchar_t const *end) const + { + for(;begin!=end;begin++) + *begin = tolower_l(*begin,*lc_); + return begin; + } +private: + boost::shared_ptr<locale_t> lc_; +}; + + + + +struct basic_numpunct { + std::string grouping; + std::string thousands_sep; + std::string decimal_point; + basic_numpunct() : + decimal_point(".") + { + } + basic_numpunct(locale_t lc) + { + #if defined(__APPLE__) || defined(__FreeBSD__) + lconv *cv = localeconv_l(lc); + grouping = cv->grouping; + thousands_sep = cv->thousands_sep; + decimal_point = cv->decimal_point; + #else + thousands_sep = nl_langinfo_l(THOUSEP,lc); + decimal_point = nl_langinfo_l(RADIXCHAR,lc); + #ifdef GROUPING + grouping = nl_langinfo_l(GROUPING,lc); + #endif + #endif + } +}; + +template<typename CharType> +class num_punct_posix : public std::numpunct<CharType> { +public: + typedef std::basic_string<CharType> string_type; + num_punct_posix(locale_t lc,size_t refs = 0) : + std::numpunct<CharType>(refs) + { + basic_numpunct np(lc); + to_str(np.thousands_sep,thousands_sep_,lc); + to_str(np.decimal_point,decimal_point_,lc); + grouping_ = np.grouping; + if(thousands_sep_.size() > 1) + grouping_ = std::string(); + if(decimal_point_.size() > 1) + decimal_point_ = CharType('.'); + } + void to_str(std::string &s1,std::string &s2,locale_t /*lc*/) + { + s2.swap(s1); + } + void to_str(std::string &s1,std::wstring &s2,locale_t lc) + { + s2=conv::to_utf<wchar_t>(s1,nl_langinfo_l(CODESET,lc)); + } + virtual CharType do_decimal_point() const + { + return *decimal_point_.c_str(); + } + virtual CharType do_thousands_sep() const + { + return *thousands_sep_.c_str(); + } + virtual std::string do_grouping() const + { + return grouping_; + } + virtual string_type do_truename() const + { + static const char t[]="true"; + return string_type(t,t+sizeof(t)-1); + } + virtual string_type do_falsename() const + { + static const char t[]="false"; + return string_type(t,t+sizeof(t)-1); + } +private: + string_type decimal_point_; + string_type thousands_sep_; + std::string grouping_; +}; + +template<typename CharType> +std::locale create_formatting_impl(std::locale const &in,boost::shared_ptr<locale_t> lc) +{ + std::locale tmp = std::locale(in,new num_punct_posix<CharType>(*lc)); + tmp = std::locale(tmp,new ctype_posix<CharType>(lc)); + tmp = std::locale(tmp,new time_put_posix<CharType>(lc)); + tmp = std::locale(tmp,new num_format<CharType>(lc)); + return tmp; +} + +template<typename CharType> +std::locale create_parsing_impl(std::locale const &in,boost::shared_ptr<locale_t> lc) +{ + std::locale tmp = std::locale(in,new num_punct_posix<CharType>(*lc)); + tmp = std::locale(tmp,new ctype_posix<CharType>(lc)); + tmp = std::locale(tmp,new util::base_num_parse<CharType>()); + return tmp; +} + + +std::locale create_formatting( std::locale const &in, + boost::shared_ptr<locale_t> lc, + character_facet_type type) +{ + switch(type) { + case char_facet: + return create_formatting_impl<char>(in,lc); + case wchar_t_facet: + return create_formatting_impl<wchar_t>(in,lc); + default: + return in; + } +} + +std::locale create_parsing( std::locale const &in, + boost::shared_ptr<locale_t> lc, + character_facet_type type) +{ + switch(type) { + case char_facet: + return create_parsing_impl<char>(in,lc); + case wchar_t_facet: + return create_parsing_impl<wchar_t>(in,lc); + default: + return in; + } +} + + + +} // impl_std +} // locale +} //boost + + + +// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/libs/locale/src/posix/posix_backend.cpp b/contrib/restricted/boost/libs/locale/src/posix/posix_backend.cpp index cbea8610c4..2ab121df9d 100644 --- a/contrib/restricted/boost/libs/locale/src/posix/posix_backend.cpp +++ b/contrib/restricted/boost/libs/locale/src/posix/posix_backend.cpp @@ -1,184 +1,184 @@ -// -// 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 -#if defined(__FreeBSD__) -#include <xlocale.h> -#endif -#include <boost/locale/localization_backend.hpp> -#include <boost/locale/gnu_gettext.hpp> -#include <boost/locale/info.hpp> -#include "all_generator.hpp" -#include "posix_backend.hpp" - -#include "../util/locale_data.hpp" -#include "../util/gregorian.hpp" -#include <boost/locale/util.hpp> -#include <algorithm> -#include <iterator> - -#include <langinfo.h> - -namespace boost { -namespace locale { -namespace impl_posix { - - class posix_localization_backend : public localization_backend { - public: - posix_localization_backend() : - invalid_(true) - { - } - posix_localization_backend(posix_localization_backend const &other) : - localization_backend(), - paths_(other.paths_), - domains_(other.domains_), - locale_id_(other.locale_id_), - invalid_(true) - { - } - virtual posix_localization_backend *clone() const - { - return new posix_localization_backend(*this); - } - - void set_option(std::string const &name,std::string const &value) - { - invalid_ = true; - if(name=="locale") - locale_id_ = value; - else if(name=="message_path") - paths_.push_back(value); - else if(name=="message_application") - domains_.push_back(value); - - } - void clear_options() - { - invalid_ = true; - locale_id_.clear(); - paths_.clear(); - domains_.clear(); - } - - static void free_locale_by_ptr(locale_t *lc) - { - freelocale(*lc); - delete lc; - } - - void prepare_data() - { - if(!invalid_) - return; - invalid_ = false; - lc_.reset(); - real_id_ = locale_id_; - if(real_id_.empty()) - real_id_ = util::get_system_locale(); - - locale_t tmp = newlocale(LC_ALL_MASK,real_id_.c_str(),0); - - if(!tmp) { - tmp=newlocale(LC_ALL_MASK,"C",0); - } - if(!tmp) { - throw std::runtime_error("newlocale failed"); - } - - locale_t *tmp_p = 0; - - try { - tmp_p = new locale_t(); - } - catch(...) { - freelocale(tmp); - throw; - } - - *tmp_p = tmp; - lc_ = boost::shared_ptr<locale_t>(tmp_p,free_locale_by_ptr); - } - - virtual std::locale install(std::locale const &base, - locale_category_type category, - character_facet_type type = nochar_facet) - { - prepare_data(); - - switch(category) { - case convert_facet: - return create_convert(base,lc_,type); - case collation_facet: - return create_collate(base,lc_,type); - case formatting_facet: - return create_formatting(base,lc_,type); - case parsing_facet: - return create_parsing(base,lc_,type); - case codepage_facet: - return create_codecvt(base,nl_langinfo_l(CODESET,*lc_),type); - case calendar_facet: - { - util::locale_data inf; - inf.parse(real_id_); - return util::install_gregorian_calendar(base,inf.country); - } - case message_facet: - { - gnu_gettext::messages_info minf; - util::locale_data inf; - inf.parse(real_id_); - minf.language = inf.language; - minf.country = inf.country; - minf.variant = inf.variant; - minf.encoding = inf.encoding; - std::copy(domains_.begin(),domains_.end(),std::back_inserter<gnu_gettext::messages_info::domains_type>(minf.domains)); - minf.paths = paths_; - switch(type) { - case char_facet: - return std::locale(base,gnu_gettext::create_messages_facet<char>(minf)); - case wchar_t_facet: - return std::locale(base,gnu_gettext::create_messages_facet<wchar_t>(minf)); - #ifdef BOOST_LOCALE_ENABLE_CHAR16_T - case char16_t_facet: - return std::locale(base,gnu_gettext::create_messages_facet<char16_t>(minf)); - #endif - #ifdef BOOST_LOCALE_ENABLE_CHAR32_T - case char32_t_facet: - return std::locale(base,gnu_gettext::create_messages_facet<char32_t>(minf)); - #endif - default: - return base; - } - } - case information_facet: - return util::create_info(base,real_id_); - default: - return base; - } - } - - private: - - std::vector<std::string> paths_; - std::vector<std::string> domains_; - std::string locale_id_; - std::string real_id_; - - bool invalid_; - boost::shared_ptr<locale_t> lc_; - }; - - localization_backend *create_localization_backend() - { - return new posix_localization_backend(); - } - -} // impl posix -} // locale -} // boost -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 +// +// 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 +#if defined(__FreeBSD__) +#include <xlocale.h> +#endif +#include <boost/locale/localization_backend.hpp> +#include <boost/locale/gnu_gettext.hpp> +#include <boost/locale/info.hpp> +#include "all_generator.hpp" +#include "posix_backend.hpp" + +#include "../util/locale_data.hpp" +#include "../util/gregorian.hpp" +#include <boost/locale/util.hpp> +#include <algorithm> +#include <iterator> + +#include <langinfo.h> + +namespace boost { +namespace locale { +namespace impl_posix { + + class posix_localization_backend : public localization_backend { + public: + posix_localization_backend() : + invalid_(true) + { + } + posix_localization_backend(posix_localization_backend const &other) : + localization_backend(), + paths_(other.paths_), + domains_(other.domains_), + locale_id_(other.locale_id_), + invalid_(true) + { + } + virtual posix_localization_backend *clone() const + { + return new posix_localization_backend(*this); + } + + void set_option(std::string const &name,std::string const &value) + { + invalid_ = true; + if(name=="locale") + locale_id_ = value; + else if(name=="message_path") + paths_.push_back(value); + else if(name=="message_application") + domains_.push_back(value); + + } + void clear_options() + { + invalid_ = true; + locale_id_.clear(); + paths_.clear(); + domains_.clear(); + } + + static void free_locale_by_ptr(locale_t *lc) + { + freelocale(*lc); + delete lc; + } + + void prepare_data() + { + if(!invalid_) + return; + invalid_ = false; + lc_.reset(); + real_id_ = locale_id_; + if(real_id_.empty()) + real_id_ = util::get_system_locale(); + + locale_t tmp = newlocale(LC_ALL_MASK,real_id_.c_str(),0); + + if(!tmp) { + tmp=newlocale(LC_ALL_MASK,"C",0); + } + if(!tmp) { + throw std::runtime_error("newlocale failed"); + } + + locale_t *tmp_p = 0; + + try { + tmp_p = new locale_t(); + } + catch(...) { + freelocale(tmp); + throw; + } + + *tmp_p = tmp; + lc_ = boost::shared_ptr<locale_t>(tmp_p,free_locale_by_ptr); + } + + virtual std::locale install(std::locale const &base, + locale_category_type category, + character_facet_type type = nochar_facet) + { + prepare_data(); + + switch(category) { + case convert_facet: + return create_convert(base,lc_,type); + case collation_facet: + return create_collate(base,lc_,type); + case formatting_facet: + return create_formatting(base,lc_,type); + case parsing_facet: + return create_parsing(base,lc_,type); + case codepage_facet: + return create_codecvt(base,nl_langinfo_l(CODESET,*lc_),type); + case calendar_facet: + { + util::locale_data inf; + inf.parse(real_id_); + return util::install_gregorian_calendar(base,inf.country); + } + case message_facet: + { + gnu_gettext::messages_info minf; + util::locale_data inf; + inf.parse(real_id_); + minf.language = inf.language; + minf.country = inf.country; + minf.variant = inf.variant; + minf.encoding = inf.encoding; + std::copy(domains_.begin(),domains_.end(),std::back_inserter<gnu_gettext::messages_info::domains_type>(minf.domains)); + minf.paths = paths_; + switch(type) { + case char_facet: + return std::locale(base,gnu_gettext::create_messages_facet<char>(minf)); + case wchar_t_facet: + return std::locale(base,gnu_gettext::create_messages_facet<wchar_t>(minf)); + #ifdef BOOST_LOCALE_ENABLE_CHAR16_T + case char16_t_facet: + return std::locale(base,gnu_gettext::create_messages_facet<char16_t>(minf)); + #endif + #ifdef BOOST_LOCALE_ENABLE_CHAR32_T + case char32_t_facet: + return std::locale(base,gnu_gettext::create_messages_facet<char32_t>(minf)); + #endif + default: + return base; + } + } + case information_facet: + return util::create_info(base,real_id_); + default: + return base; + } + } + + private: + + std::vector<std::string> paths_; + std::vector<std::string> domains_; + std::string locale_id_; + std::string real_id_; + + bool invalid_; + boost::shared_ptr<locale_t> lc_; + }; + + localization_backend *create_localization_backend() + { + return new posix_localization_backend(); + } + +} // impl posix +} // locale +} // boost +// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 diff --git a/contrib/restricted/boost/libs/locale/src/posix/posix_backend.hpp b/contrib/restricted/boost/libs/locale/src/posix/posix_backend.hpp index 76919c1c99..586a33abdb 100644 --- a/contrib/restricted/boost/libs/locale/src/posix/posix_backend.hpp +++ b/contrib/restricted/boost/libs/locale/src/posix/posix_backend.hpp @@ -1,20 +1,20 @@ -// -// 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 BOOST_LOCALE_IMPL_POSIX_LOCALIZATION_BACKEND_HPP -#define BOOST_LOCALE_IMPL_POSIX_LOCALIZATION_BACKEND_HPP -namespace boost { - namespace locale { - class localization_backend; - namespace impl_posix { - localization_backend *create_localization_backend(); - } // impl_std - } // locale -} // boost -#endif -// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 - +// +// 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 BOOST_LOCALE_IMPL_POSIX_LOCALIZATION_BACKEND_HPP +#define BOOST_LOCALE_IMPL_POSIX_LOCALIZATION_BACKEND_HPP +namespace boost { + namespace locale { + class localization_backend; + namespace impl_posix { + localization_backend *create_localization_backend(); + } // impl_std + } // locale +} // boost +#endif +// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 + |