2010-05-11 21:42:16 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2010-05-11 23:36:01 +02:00
|
|
|
// The LLVM Compiler Infrastructure
|
2010-05-11 21:42:16 +02:00
|
|
|
//
|
2010-11-16 23:09:02 +01:00
|
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
|
|
// Source Licenses. See LICENSE.TXT for details.
|
2010-05-11 21:42:16 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// <streambuf>
|
|
|
|
|
|
|
|
// template <class charT, class traits = char_traits<charT> >
|
|
|
|
// class basic_streambuf;
|
|
|
|
|
|
|
|
// locale pubimbue(const locale& loc);
|
|
|
|
// locale getloc() const;
|
|
|
|
|
|
|
|
#include <streambuf>
|
|
|
|
#include <cassert>
|
|
|
|
|
2013-01-05 04:21:01 +01:00
|
|
|
#include "platform_support.h" // locale name macros
|
2011-10-03 17:23:59 +02:00
|
|
|
|
2010-05-11 21:42:16 +02:00
|
|
|
template <class CharT>
|
|
|
|
struct test
|
|
|
|
: public std::basic_streambuf<CharT>
|
|
|
|
{
|
|
|
|
test() {}
|
|
|
|
|
|
|
|
void imbue(const std::locale&)
|
|
|
|
{
|
2011-10-03 17:23:59 +02:00
|
|
|
assert(this->getloc().name() == LOCALE_en_US_UTF_8);
|
2010-05-11 21:42:16 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
test<char> t;
|
|
|
|
assert(t.getloc().name() == "C");
|
|
|
|
}
|
2011-10-03 17:23:59 +02:00
|
|
|
std::locale::global(std::locale(LOCALE_en_US_UTF_8));
|
2010-05-11 21:42:16 +02:00
|
|
|
{
|
|
|
|
test<char> t;
|
2011-10-03 17:23:59 +02:00
|
|
|
assert(t.getloc().name() == LOCALE_en_US_UTF_8);
|
|
|
|
assert(t.pubimbue(std::locale(LOCALE_fr_FR_UTF_8)).name() == "en_US.UTF-8");
|
|
|
|
assert(t.getloc().name() == LOCALE_fr_FR_UTF_8);
|
2010-05-11 21:42:16 +02:00
|
|
|
}
|
|
|
|
}
|