8 #ifndef BOOSTER_LOCALE_FORMATTING_H_INCLUDED 9 #define BOOSTER_LOCALE_FORMATTING_H_INCLUDED 11 #include <booster/config.h> 13 # pragma warning(push) 14 # pragma warning(disable : 4275 4251 4231 4660) 16 #include <booster/cstdint.h> 17 #include <booster/locale/time_zone.h> 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;
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 BOOSTER_API 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)
374 inline std::ios_base & currency_default(std::ios_base & ios)
383 inline std::ios_base & currency_iso(std::ios_base & ios)
392 inline std::ios_base & currency_national(std::ios_base & ios)
401 inline std::ios_base & time_default(std::ios_base & ios)
410 inline std::ios_base & time_short(std::ios_base & ios)
419 inline std::ios_base & time_medium(std::ios_base & ios)
428 inline std::ios_base & time_long(std::ios_base & ios)
437 inline std::ios_base & time_full(std::ios_base & ios)
446 inline std::ios_base & date_default(std::ios_base & ios)
455 inline std::ios_base & date_short(std::ios_base & ios)
464 inline std::ios_base & date_medium(std::ios_base & ios)
473 inline std::ios_base & date_long(std::ios_base & ios)
482 inline std::ios_base & date_full(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 BOOSTER_LOCALE_DOXYGEN 561 details::add_ftime<CharType>
565 details::add_ftime<CharType> fmt;
573 template<
typename CharType>
574 #ifdef BOOSTER_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 BOOSTER_LOCALE_DOXYGEN 632 details::set_timezone
636 details::set_timezone tz;
645 #ifdef BOOSTER_LOCALE_DOXYGEN 648 details::set_timezone
652 details::set_timezone tz;
time zone name
Definition: formatting.h:79
std::basic_string< CharType > date_time_pattern() const
Definition: formatting.h:202
std::basic_istream< CharType > & operator>>(std::basic_istream< CharType > &in, date_time &t)
Definition: date_time.h:901
details::set_timezone time_zone(std::string const &id)
Definition: formatting.h:650
pattern_type
Definition: formatting.h:77
value_type
Definition: formatting.h:85
void currency_flags(uint64_t flags)
strftime like formatting
Definition: formatting.h:78
details::add_ftime< CharType > ftime(CharType const *format)
Definition: formatting.h:579
static ios_info & get(std::ios_base &ios)
Domain code - for message formatting.
Definition: formatting.h:86
display_flags_type
Definition: formatting.h:35
std::ios_base & gmt(std::ios_base &ios)
Definition: formatting.h:610
This is the main namespace that encloses all localization classes.
Definition: locale_fwd.h:14
BOOSTER_API std::string global()
void time_zone(std::string const &)
void date_time_pattern(std::basic_string< CharType > const &str)
Definition: formatting.h:155
void time_flags(uint64_t flags)
std::ios_base & strftime(std::ios_base &ios)
Definition: formatting.h:347
void display_flags(uint64_t flags)
Booster library namespace. The library that implements Boost Like API in ABI backward compatible way...
Definition: application.h:23
void date_flags(uint64_t flags)
BOOSTER_API std::tm local_time(time_t pt)
This class holds an external data - beyond existing fmtflags that std::ios_base holds.
Definition: formatting.h:98