8 #ifndef BOOST_LOCALE_FORMATTING_HPP_INCLUDED
9 #define BOOST_LOCALE_FORMATTING_HPP_INCLUDED
11 #include <boost/locale/config.hpp>
13 # pragma warning(push)
14 # pragma warning(disable : 4275 4251 4231 4660)
16 #include <boost/cstdint.hpp>
17 #include <boost/locale/time_zone.hpp>
47 display_flags_mask = 31,
49 currency_default = 0 << 5,
50 currency_iso = 1 << 5,
51 currency_national = 2 << 5,
53 currency_flags_mask = 3 << 5,
55 time_default = 0 << 7,
60 time_flags_mask = 7 << 7,
62 date_default = 0 << 10,
64 date_medium = 2 << 10,
67 date_flags_mask = 7 << 10,
69 datetime_flags_mask = date_flags_mask | time_flags_mask
113 static ios_info &
get(std::ios_base &ios);
118 void display_flags(uint64_t flags);
123 void currency_flags(uint64_t flags);
128 void date_flags(uint64_t flags);
133 void time_flags(uint64_t flags);
138 void datetime_flags(uint64_t flags);
154 template<
typename CharType>
157 string_set &s = date_time_pattern_set();
158 s.set<CharType>(str.c_str());
165 uint64_t display_flags()
const;
170 uint64_t currency_flags()
const;
176 uint64_t date_flags()
const;
181 uint64_t time_flags()
const;
186 uint64_t datetime_flags()
const;
191 int domain_id()
const;
201 template<
typename CharType>
204 string_set
const &s = date_time_pattern_set();
205 return s.get<CharType>();
216 string_set
const &date_time_pattern_set()
const;
217 string_set &date_time_pattern_set();
219 class BOOST_LOCALE_DECL string_set {
223 string_set(string_set
const &other);
224 string_set
const &operator=(string_set
const &other);
225 void swap(string_set &other);
227 template<
typename Char>
228 void set(Char
const *s)
234 while(*end!=0) end++;
236 size =
sizeof(Char)*(end - s+1);
237 ptr =
new char[size];
241 template<
typename Char>
242 std::basic_string<Char>
get()
const
244 if(type==0 || *type!=
typeid(Char))
245 throw std::bad_cast();
246 std::basic_string<Char> result =
reinterpret_cast<Char
const *
>(ptr);
251 std::type_info
const *type;
258 std::string time_zone_;
259 string_set datetime_;
282 inline std::ios_base &
posix(std::ios_base & ios)
292 inline std::ios_base &
number(std::ios_base & ios)
301 inline std::ios_base &
currency(std::ios_base & ios)
310 inline std::ios_base &
percent(std::ios_base & ios)
319 inline std::ios_base &
date(std::ios_base & ios)
328 inline std::ios_base &
time(std::ios_base & ios)
337 inline std::ios_base &
datetime(std::ios_base & ios)
347 inline std::ios_base &
strftime(std::ios_base & ios)
356 inline std::ios_base &
spellout(std::ios_base & ios)
365 inline std::ios_base &
ordinal(std::ios_base & ios)
491 template<
typename CharType>
494 std::basic_string<CharType>
ftime;
496 void apply(std::basic_ios<CharType> &ios)
const
504 template<
typename CharType>
505 std::basic_ostream<CharType> &operator<<(std::basic_ostream<CharType> &out,add_ftime<CharType>
const &fmt)
511 template<
typename CharType>
512 std::basic_istream<CharType> &
operator>>(std::basic_istream<CharType> &in,add_ftime<CharType>
const &fmt)
557 template<
typename CharType>
558 #ifdef BOOST_LOCALE_DOXYGEN
561 details::add_ftime<CharType>
565 details::add_ftime<CharType> fmt;
573 template<
typename CharType>
574 #ifdef BOOST_LOCALE_DOXYGEN
577 details::add_ftime<CharType>
581 details::add_ftime<CharType> fmt;
588 struct set_timezone {
591 template<
typename CharType>
592 std::basic_ostream<CharType> &operator<<(std::basic_ostream<CharType> &out,set_timezone
const &fmt)
598 template<
typename CharType>
599 std::basic_istream<CharType> &
operator>>(std::basic_istream<CharType> &in,set_timezone
const &fmt)
610 inline std::ios_base &
gmt(std::ios_base &ios)
629 #ifdef BOOST_LOCALE_DOXYGEN
632 details::set_timezone
636 details::set_timezone tz;
645 #ifdef BOOST_LOCALE_DOXYGEN
648 details::set_timezone
652 details::set_timezone tz;
std::ios_base & date_long(std::ios_base &ios)
Definition: formatting.hpp:473
unspecified_type time_zone(std::string const &id)
Definition: formatting.hpp:650
std::ios_base & time_default(std::ios_base &ios)
Definition: formatting.hpp:401
std::ios_base & strftime(std::ios_base &ios)
Definition: formatting.hpp:347
std::ios_base & date_medium(std::ios_base &ios)
Definition: formatting.hpp:464
std::ios_base & currency(std::ios_base &ios)
Definition: formatting.hpp:301
std::ios_base & time_full(std::ios_base &ios)
Definition: formatting.hpp:437
unspecified_type time_zone(char const *id)
Definition: formatting.hpp:634
std::ios_base & ordinal(std::ios_base &ios)
Definition: formatting.hpp:365
unspecified_type ftime(std::basic_string< CharType > const &format)
Definition: formatting.hpp:563
std::ios_base & date_full(std::ios_base &ios)
Definition: formatting.hpp:482
std::ios_base & posix(std::ios_base &ios)
Definition: formatting.hpp:282
std::ios_base & currency_default(std::ios_base &ios)
Definition: formatting.hpp:374
std::ios_base & time_medium(std::ios_base &ios)
Definition: formatting.hpp:419
void date_flags(uint64_t flags)
std::ios_base & time_long(std::ios_base &ios)
Definition: formatting.hpp:428
std::ios_base & gmt(std::ios_base &ios)
Definition: formatting.hpp:610
display_flags_type
Definition: formatting.hpp:35
std::ios_base & number(std::ios_base &ios)
Definition: formatting.hpp:292
std::ios_base & percent(std::ios_base &ios)
Definition: formatting.hpp:310
std::ios_base & spellout(std::ios_base &ios)
Definition: formatting.hpp:356
std::ios_base & currency_national(std::ios_base &ios)
Definition: formatting.hpp:392
time zone name
Definition: formatting.hpp:79
std::ios_base & date(std::ios_base &ios)
Definition: formatting.hpp:319
void display_flags(uint64_t flags)
static ios_info & get(std::ios_base &ios)
This class holds an external data - beyond existing fmtflags that std::ios_base holds.
Definition: formatting.hpp:98
strftime like formatting
Definition: formatting.hpp:78
std::basic_string< CharType > date_time_pattern() const
Definition: formatting.hpp:202
void time_flags(uint64_t flags)
std::ios_base & date_default(std::ios_base &ios)
Definition: formatting.hpp:446
std::ios_base & datetime(std::ios_base &ios)
Definition: formatting.hpp:337
void time_zone(std::string const &)
std::ios_base & time_short(std::ios_base &ios)
Definition: formatting.hpp:410
std::ios_base & date_short(std::ios_base &ios)
Definition: formatting.hpp:455
std::ios_base & local_time(std::ios_base &ios)
Definition: formatting.hpp:619
std::basic_istream< CharType > & operator>>(std::basic_istream< CharType > &in, date_time &t)
Definition: date_time.hpp:901
std::ios_base & time(std::ios_base &ios)
Definition: formatting.hpp:328
void currency_flags(uint64_t flags)
Domain code - for message formatting.
Definition: formatting.hpp:86
void date_time_pattern(std::basic_string< CharType > const &str)
Definition: formatting.hpp:155
pattern_type
Definition: formatting.hpp:77
value_type
Definition: formatting.hpp:85
std::ios_base & currency_iso(std::ios_base &ios)
Definition: formatting.hpp:383