7 #ifndef BOOST_LOCALE_DATE_TIME_HPP_INCLUDED 8 #define BOOST_LOCALE_DATE_TIME_HPP_INCLUDED 10 #include <boost/locale/date_time_facet.hpp> 11 #include <boost/locale/formatting.hpp> 12 #include <boost/locale/hold_ptr.hpp> 13 #include <boost/locale/time_zone.hpp> 19 # pragma warning(push) 20 # pragma warning(disable : 4275 4251 4231 4660) 23 namespace boost {
namespace locale {
413 periods_.push_back(f);
427 return 4 + periods_.size();
434 throw std::out_of_range(
"Invalid index to date_time_period");
438 return periods_[n - 4];
443 std::vector<date_time_period> periods_;
450 for(
unsigned i = 0; i < b.
size(); i++)
459 for(
unsigned i = 0; i < b.
size(); i++)
480 calendar(
const std::locale& l,
const std::string& zone);
515 int first_day_of_week()
const;
518 std::locale get_locale()
const;
520 std::string get_time_zone()
const;
523 bool is_gregorian()
const;
701 bool is_in_daylight_saving_time()
const;
718 template<
typename CharType>
721 double time_point = t.
time();
723 if(display_flags == flags::date || display_flags == flags::time || display_flags == flags::datetime
724 || display_flags == flags::strftime)
738 template<
typename CharType>
743 if(display_flags == flags::date || display_flags == flags::time || display_flags == flags::datetime
744 || display_flags == flags::strftime)
758 # pragma warning(push) 759 # pragma warning(disable : 4512) // assignment operator could not be generated 789 # pragma warning(pop) 993 # pragma warning(pop) date_time & operator>>=(period::period_type f)
roll backward a date by single period f.
Definition: date_time.hpp:627
period_type am_pm()
Get period_type for: am or pm marker [0..1].
Definition: date_time.hpp:122
int get(period::period_type f) const
get specific period f value
period_type week_of_year()
Get period_type for: The week number in the year.
Definition: date_time.hpp:137
period_type minute()
Get period_type for: minute [0..59].
Definition: date_time.hpp:127
The week number within current month.
Definition: date_time_facet.hpp:50
date_time_error(const std::string &e)
Constructor of date_time_error class.
Definition: date_time.hpp:33
period::period_type type
The type of period, i.e. era, year, day etc.
Definition: date_time.hpp:43
Definition: date_time_facet.hpp:41
period_type extended_year()
Get period_type for: Extended year for Gregorian/Julian calendars, where 1 BC == 0,...
Definition: date_time.hpp:71
date_time_period saturday()
Get predefined constant for Saturday.
Definition: date_time.hpp:336
date_time_period_set()
Default constructor - empty set.
Definition: date_time.hpp:398
date_time & operator+=(period::period_type f)
add single period f to the current date_time
Definition: date_time.hpp:616
int get(period::period_type f) const
find a difference in terms of period_type f
Definition: date_time.hpp:775
Definition: date_time_facet.hpp:36
Year, it is calendar specific, for example 2011 in Gregorian calendar.
Definition: date_time_facet.hpp:31
this class that represents a set of periods,
Definition: date_time.hpp:395
date_time_period january()
Get predefined constant for January.
Definition: date_time.hpp:245
date_time & operator<<=(period::period_type f)
roll forward a date by single period f.
Definition: date_time.hpp:625
date_time_period november()
Get predefined constant for November.
Definition: date_time.hpp:295
This class represents a period: a pair of two date_time objects.
Definition: date_time.hpp:768
date_time_period_set operator+(const date_time_period_set &a, const date_time_period_set &b)
Append two periods sets. Note this operator is not commutative.
Definition: date_time.hpp:447
const date_time_period & operator[](size_t n) const
Get item at position n the set, n should be in range [0,size)
Definition: date_time.hpp:431
Generate boundary analysis facet.
date_time_period march()
Get predefined constant for March.
Definition: date_time.hpp:255
period_type day_of_week()
Definition: date_time.hpp:96
bool operator>(const segment< IteratorL > &l, const segment< IteratorR > &r)
Compare two segments.
Definition: segment.hpp:179
The number of day in year, starting from 1, in Gregorian [1..366].
Definition: date_time_facet.hpp:35
bool operator==(const BaseIterator &l, const boundary_point< BaseIterator > &r)
Check if the boundary point r points to same location as an iterator l.
Definition: boundary_point.hpp:88
date_time_period monday()
Get predefined constant for Monday.
Definition: date_time.hpp:311
date_time_period february()
Get predefined constant for February.
Definition: date_time.hpp:250
bool operator<(const segment< IteratorL > &l, const segment< IteratorR > &r)
Compare two segments.
Definition: segment.hpp:167
date_time_period april()
Get predefined constant for April.
Definition: date_time.hpp:260
period_type first_day_of_week()
Get period_type for: First day of week, constant, for example Sunday in US = 1, Monday in France = 2.
Definition: date_time.hpp:147
this class provides an access to general calendar information.
Definition: date_time.hpp:469
date_time_period august()
Get predefined constant for August.
Definition: date_time.hpp:280
int operator/(period::period_type f) const
Syntactic sugar for get(f)
Definition: date_time.hpp:777
date_time_period operator+() const
Operator + returns copy of itself.
Definition: date_time.hpp:46
date_time_period am()
Get predefined constant for AM (Ante Meridiem)
Definition: date_time.hpp:341
date_time_period october()
Get predefined constant for October.
Definition: date_time.hpp:290
date_time operator<<(period::period_type f) const
roll forward a date by single period f.
Definition: date_time.hpp:621
void add(date_time_period f)
Append date_time_period f to the set.
Definition: date_time.hpp:407
date_time operator+(period::period_type f) const
add single period f to the current date_time
Definition: date_time.hpp:612
int difference(const date_time &other, period::period_type f) const
calculate the distance from this date_time to other in terms of periods f
bool operator>=(const segment< IteratorL > &l, const segment< IteratorR > &r)
Compare two segments.
Definition: segment.hpp:185
bool operator!=(const BaseIterator &l, const boundary_point< BaseIterator > &r)
Check if the boundary point r points to different location from an iterator l.
Definition: boundary_point.hpp:94
date_time_period december()
Get predefined constant for December.
Definition: date_time.hpp:300
period_type era()
Get period_type for: Era i.e. AC, BC in Gregorian and Julian calendar, range [0,1].
Definition: date_time.hpp:61
period_type hour()
Get period_type for: 24 clock hour [0..23].
Definition: date_time.hpp:112
a smart pointer similar to std::unique_ptr but the underlying object has the same constness as the po...
Definition: hold_ptr.hpp:16
date_time_period_set operator-(const date_time_period_set &a, const date_time_period_set &b)
Append two period sets when all periods of set change their sign.
Definition: date_time.hpp:456
void display_flags(uint64_t flags)
Set flags that define how to format data, e.g. number, spell, currency etc.
static ios_info & get(std::ios_base &ios)
Get ios_info instance for specific stream object.
The week number in the year.
Definition: date_time_facet.hpp:49
24 clock hour [0..23]
Definition: date_time_facet.hpp:44
Special invalid value, should not be used directly.
Definition: date_time_facet.hpp:29
The day of month, calendar specific, in Gregorian [1..31].
Definition: date_time_facet.hpp:34
period_type day_of_week_local()
Get period_type for: Local day of week, for example in France Monday is 1, in US Sunday is 1,...
Definition: date_time.hpp:107
minute [0..59]
Definition: date_time_facet.hpp:47
The month of year, calendar specific, in Gregorian [0..11].
Definition: date_time_facet.hpp:33
Local day of week, for example in France Monday is 1, in US Sunday is 1, [1..7].
Definition: date_time_facet.hpp:43
date_time_period operator-(period::period_type f)
convert period_type to date_time_period(f,-1)
Definition: date_time.hpp:357
date_time_period operator *(period::period_type f, T v)
Create date_time_period of type f with value v.
Definition: date_time.hpp:364
period_type day_of_week_in_month()
Definition: date_time.hpp:102
12 clock hour [0..11]
Definition: date_time_facet.hpp:45
date_time operator-(period::period_type f) const
subtract single period f from the current date_time
Definition: date_time.hpp:614
std::basic_ostream< CharType > & operator<<(std::basic_ostream< CharType > &out, const date_time &t)
Definition: date_time.hpp:719
This class represents a pair of period_type and the integer values that describes its amount....
Definition: date_time.hpp:42
date_time_period pm()
Get predefined constant for PM (Post Meridiem)
Definition: date_time.hpp:346
period_type day()
Get period_type for: The day of month, calendar specific, in Gregorian [1..31].
Definition: date_time.hpp:81
period_type year()
Get period_type for: Year, it is calendar specific, for example 2011 in Gregorian calendar.
Definition: date_time.hpp:66
period_type week_of_month()
Get period_type for: The week number within current month.
Definition: date_time.hpp:142
date_time_period wednesday()
Get predefined constant for Wednesday.
Definition: date_time.hpp:321
This error is thrown in case of invalid state that occurred.
Definition: date_time.hpp:30
date_time_period thursday()
Get predefined constant for Thursday.
Definition: date_time.hpp:326
am or pm marker [0..1]
Definition: date_time_facet.hpp:46
date_time_period_set(period::period_type f)
Create a set of single period with value 1.
Definition: date_time.hpp:401
date_time_duration(const date_time &first, const date_time &second)
Definition: date_time.hpp:772
bool operator<=(const segment< IteratorL > &l, const segment< IteratorR > &r)
Compare two segments.
Definition: segment.hpp:173
const date_time & start() const
Get starting point.
Definition: date_time.hpp:780
date_time & operator-=(period::period_type f)
subtract single period f from the current date_time
Definition: date_time.hpp:618
date_time_period sunday()
Get predefined constant for Sunday.
Definition: date_time.hpp:306
size_t size() const
Get number if items in list.
Definition: date_time.hpp:417
date_time_period friday()
Get predefined constant for Friday.
Definition: date_time.hpp:331
const date_time & end() const
Get ending point.
Definition: date_time.hpp:782
date_time_period tuesday()
Get predefined constant for Tuesday.
Definition: date_time.hpp:316
int value
Definition: date_time.hpp:44
date_time_period operator+(period::period_type f)
convert period_type to date_time_period(f,1)
Definition: date_time.hpp:352
period_type day_of_year()
Get period_type for: The number of day in year, starting from 1, in Gregorian [1.....
Definition: date_time.hpp:86
date_time_period_set(const date_time_period &fl)
Create a set of single period fl.
Definition: date_time.hpp:404
Era i.e. AC, BC in Gregorian and Julian calendar, range [0,1].
Definition: date_time_facet.hpp:30
First day of week, constant, for example Sunday in US = 1, Monday in France = 2.
Definition: date_time_facet.hpp:51
period_type hour_12()
Get period_type for: 12 clock hour [0..11].
Definition: date_time.hpp:117
std::basic_istream< CharType > & operator>>(std::basic_istream< CharType > &in, date_time &t)
Definition: date_time.hpp:739
Extended year for Gregorian/Julian calendars, where 1 BC == 0, 2 BC == -1.
Definition: date_time_facet.hpp:32
period_type invalid()
Get period_type for: special invalid value, should not be used directly.
Definition: date_time.hpp:56
date_time_period june()
Get predefined constant for June.
Definition: date_time.hpp:270
date_time_period may()
Get predefined constant for May.
Definition: date_time.hpp:265
this class represents a date time and allows to perform various operation according to the locale set...
Definition: date_time.hpp:561
date_time operator>>(period::period_type f) const
roll backward a date by single period f.
Definition: date_time.hpp:623
date_time_period operator-() const
Operator -, switches the sign of period.
Definition: date_time.hpp:48
std::ios_base & time(std::ios_base &ios)
Format a time, number is treated as POSIX time.
Definition: formatting.hpp:239
date_time_period(period::period_type f=period::period_type(), int v=1)
Constructor that creates date_time_period from period_type f and a value v – default 1.
Definition: date_time.hpp:51
period_type second()
Get period_type for: second [0..59].
Definition: date_time.hpp:132
second [0..59]
Definition: date_time_facet.hpp:48
period_type month()
Get period_type for: The month of year, calendar specific, in Gregorian [0..11].
Definition: date_time.hpp:76
date_time_period july()
Get predefined constant for July.
Definition: date_time.hpp:275
date_time_period september()
Get predefined constant for September.
Definition: date_time.hpp:285
int operator/(period::period_type f) const
syntactic sugar for get(f)
Definition: date_time.hpp:609
This class holds a type that represents certain period of time like year, hour, second and so on.
Definition: date_time_facet.hpp:65