7#ifndef BOOST_LOCALE_DATE_TIME_FACET_HPP_INCLUDED
8#define BOOST_LOCALE_DATE_TIME_FACET_HPP_INCLUDED
10#include <boost/locale/config.hpp>
11#include <boost/locale/detail/facet_id.hpp>
17# pragma warning(disable : 4275 4251 4231 4660)
20namespace boost {
namespace locale {
171 class BOOST_SYMBOL_VISIBLE
calendar_facet :
public std::locale::facet,
public detail::facet_id<calendar_facet> {
Definition: date_time_facet.hpp:95
virtual int get_option(calendar_option_type opt) const =0
Get option for calendar, currently only check if it is Gregorian calendar.
virtual void set_value(period::marks::period_mark m, int value)=0
virtual abstract_calendar * clone() const =0
Make a polymorphic copy of the calendar.
virtual bool same(const abstract_calendar *other) const =0
Check of two calendars have same rules.
virtual int difference(const abstract_calendar &other, period::marks::period_mark m) const =0
Calculate the difference between this calendar and other in p units.
virtual std::string get_timezone() const =0
Get current time zone, empty - system one.
calendar_option_type
Information about calendar.
Definition: date_time_facet.hpp:116
@ is_gregorian
Check if the calendar is Gregorian.
Definition: date_time_facet.hpp:117
virtual void set_timezone(const std::string &tz)=0
Set time zone, empty - use system.
virtual posix_time get_time() const =0
Get current time point.
virtual void set_option(calendar_option_type opt, int v)=0
Set option for calendar, for future use.
update_type
A way to update the value.
Definition: date_time_facet.hpp:110
@ roll
Change the value up or down not effecting others for example 1990-12-31 + 1 day = 1990-12-01.
Definition: date_time_facet.hpp:112
@ move
Change the value up or down effecting others for example 1990-12-31 + 1 day = 1991-01-01.
Definition: date_time_facet.hpp:111
virtual void normalize()=0
Recalculate all periods after setting them, should be called after use of set_value() function.
virtual int get_value(period::marks::period_mark m, value_type v) const =0
Get specific value for period p according to a value_type v.
virtual void adjust_value(period::marks::period_mark m, update_type u, int difference)=0
virtual void set_time(const posix_time &p)=0
Set current time point.
virtual double get_time_ms() const =0
Get current time since epoch in milliseconds.
value_type
Type that defines how to fetch the value.
Definition: date_time_facet.hpp:98
@ absolute_minimum
Absolute possible minimum for the value, for example for day is 1.
Definition: date_time_facet.hpp:99
@ actual_maximum
Actual maximum, for it can be 28, 29, 30, 31 for day according to current month.
Definition: date_time_facet.hpp:105
@ actual_minimum
Actual minimal value for this period.
Definition: date_time_facet.hpp:100
@ greatest_minimum
Maximal minimum value that can be for this period.
Definition: date_time_facet.hpp:101
@ current
Current value of this period.
Definition: date_time_facet.hpp:102
@ absolute_maximum
Maximal value, for Gregorian day it would be 31.
Definition: date_time_facet.hpp:106
the facet that generates calendar for specific locale
Definition: date_time_facet.hpp:171
calendar_facet(size_t refs=0)
Basic constructor.
Definition: date_time_facet.hpp:174
virtual abstract_calendar * create_calendar() const =0
Create a new calendar that points to current point of time.
This class holds a type that represents certain period of time like year, hour, second and so on.
Definition: date_time_facet.hpp:66
bool operator!=(const period_type &other) const
Check if two periods are different.
Definition: date_time_facet.hpp:77
bool operator==(const period_type &other) const
Check if two periods are the same.
Definition: date_time_facet.hpp:75
period_type(marks::period_mark m=marks::invalid)
Create a period of specific type, default is invalid.
Definition: date_time_facet.hpp:69
marks::period_mark mark() const
Get the value of marks::period_mark it was created with.
Definition: date_time_facet.hpp:72
period_mark
the type that defines a flag that holds a period identifier
Definition: date_time_facet.hpp:29
@ day_of_week_local
Local day of week, for example in France Monday is 1, in US Sunday is 1, [1..7].
Definition: date_time_facet.hpp:44
@ month
The month of year, calendar specific, in Gregorian [0..11].
Definition: date_time_facet.hpp:34
@ minute
minute [0..59]
Definition: date_time_facet.hpp:48
@ hour_12
12 clock hour [0..11]
Definition: date_time_facet.hpp:46
@ second
second [0..59]
Definition: date_time_facet.hpp:49
@ year
Year, it is calendar specific, for example 2011 in Gregorian calendar.
Definition: date_time_facet.hpp:32
@ day_of_year
The number of day in year, starting from 1, in Gregorian [1..366].
Definition: date_time_facet.hpp:36
@ week_of_year
The week number in the year.
Definition: date_time_facet.hpp:50
@ extended_year
Extended year for Gregorian/Julian calendars, where 1 BC == 0, 2 BC == -1.
Definition: date_time_facet.hpp:33
@ hour
24 clock hour [0..23]
Definition: date_time_facet.hpp:45
@ am_pm
am or pm marker [0..1]
Definition: date_time_facet.hpp:47
@ first_day_of_week
First day of week, constant, for example Sunday in US = 1, Monday in France = 2.
Definition: date_time_facet.hpp:52
@ week_of_month
The week number within current month.
Definition: date_time_facet.hpp:51
@ invalid
Special invalid value, should not be used directly.
Definition: date_time_facet.hpp:30
@ day
The day of month, calendar specific, in Gregorian [1..31].
Definition: date_time_facet.hpp:35
@ era
Era i.e. AC, BC in Gregorian and Julian calendar, range [0,1].
Definition: date_time_facet.hpp:31
@ day_of_week_in_month
Definition: date_time_facet.hpp:42
@ day_of_week
Definition: date_time_facet.hpp:37
Definition: date_time_facet.hpp:87
int64_t seconds
Seconds since epoch.
Definition: date_time_facet.hpp:88
uint32_t nanoseconds
Nanoseconds resolution.
Definition: date_time_facet.hpp:89