Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::locale::abstract_calendar Class Referenceabstract

This class defines generic calendar class, it is used by date_time and calendar objects internally. More...

#include <date_time_facet.hpp>

Public Types

enum  value_type {
  absolute_minimum,
  actual_minimum,
  greatest_minimum,
  current,
  least_maximum,
  actual_maximum,
  absolute_maximum
}
 Type that defines how to fetch the value. More...
 
enum  update_type {
  move,
  roll
}
 A way to update the value. More...
 
enum  calendar_option_type {
  is_gregorian,
  is_dst
}
 Information about calendar. More...
 

Public Member Functions

virtual abstract_calendarclone () const =0
 Make a polymorphic copy of the calendar. More...
 
virtual void set_value (period::marks::period_mark p, int value)=0
 Set specific value for period p, note not all values are settable. More...
 
virtual void normalize ()=0
 Recalculate all periods after setting them, should be called after use of set_value() function. More...
 
virtual int get_value (period::marks::period_mark p, value_type v) const =0
 Get specific value for period p according to a value_type v. More...
 
virtual void set_time (posix_time const &p)=0
 Set current time point. More...
 
virtual posix_time get_time () const =0
 Get current time point. More...
 
virtual void set_option (calendar_option_type opt, int v)=0
 Set option for calendar, for future use. More...
 
virtual int get_option (calendar_option_type opt) const =0
 Get option for calendar, currently only check if it is Gregorian calendar. More...
 
virtual void adjust_value (period::marks::period_mark p, update_type u, int difference)=0
 Adjust period's p value by difference items using a update_type u. More...
 
virtual int difference (abstract_calendar const *other, period::marks::period_mark p) const =0
 Calculate the difference between this calendar and other in p units. More...
 
virtual void set_timezone (std::string const &tz)=0
 Set time zone, empty - use system. More...
 
virtual std::string get_timezone () const =0
 Get current time zone, empty - system one. More...
 
virtual bool same (abstract_calendar const *other) const =0
 Check of two calendars have same rules. More...
 
virtual ~abstract_calendar ()
 

Detailed Description

This class defines generic calendar class, it is used by date_time and calendar objects internally.

It is less useful for end users, but it is build for localization backend implementation

Member Enumeration Documentation

Information about calendar.

Enumerator
is_gregorian 

Check if the calendar is Gregorian.

is_dst 

Check if the current time is in daylight time savings.

A way to update the value.

Enumerator
move 

Change the value up or down effecting others for example 1990-12-31 + 1 day = 1991-01-01.

roll 

Change the value up or down not effecting others for example 1990-12-31 + 1 day = 1990-12-01.

Type that defines how to fetch the value.

Enumerator
absolute_minimum 

Absolute possible minimum for the value, for example for day is 1.

actual_minimum 

Actual minimal value for this period.

greatest_minimum 

Maximal minimum value that can be for this period.

current 

Current value of this period.

least_maximum 

The last maximal value for this period, For example for Gregorian calendar day it is 28.

actual_maximum 

Actual maximum, for it can be 28, 29, 30, 31 for day according to current month.

absolute_maximum 

Maximal value, for Gregorian day it would be 31.

Constructor & Destructor Documentation

virtual boost::locale::abstract_calendar::~abstract_calendar ( )
inlinevirtual

Member Function Documentation

virtual void boost::locale::abstract_calendar::adjust_value ( period::marks::period_mark  p,
update_type  u,
int  difference 
)
pure virtual

Adjust period's p value by difference items using a update_type u.

Note: not all values are adjustable

virtual abstract_calendar* boost::locale::abstract_calendar::clone ( ) const
pure virtual

Make a polymorphic copy of the calendar.

virtual int boost::locale::abstract_calendar::difference ( abstract_calendar const *  other,
period::marks::period_mark  p 
) const
pure virtual

Calculate the difference between this calendar and other in p units.

virtual int boost::locale::abstract_calendar::get_option ( calendar_option_type  opt) const
pure virtual

Get option for calendar, currently only check if it is Gregorian calendar.

virtual posix_time boost::locale::abstract_calendar::get_time ( ) const
pure virtual

Get current time point.

virtual std::string boost::locale::abstract_calendar::get_timezone ( ) const
pure virtual

Get current time zone, empty - system one.

virtual int boost::locale::abstract_calendar::get_value ( period::marks::period_mark  p,
value_type  v 
) const
pure virtual

Get specific value for period p according to a value_type v.

virtual void boost::locale::abstract_calendar::normalize ( )
pure virtual

Recalculate all periods after setting them, should be called after use of set_value() function.

virtual bool boost::locale::abstract_calendar::same ( abstract_calendar const *  other) const
pure virtual

Check of two calendars have same rules.

virtual void boost::locale::abstract_calendar::set_option ( calendar_option_type  opt,
int  v 
)
pure virtual

Set option for calendar, for future use.

virtual void boost::locale::abstract_calendar::set_time ( posix_time const &  p)
pure virtual

Set current time point.

virtual void boost::locale::abstract_calendar::set_timezone ( std::string const &  tz)
pure virtual

Set time zone, empty - use system.

virtual void boost::locale::abstract_calendar::set_value ( period::marks::period_mark  p,
int  value 
)
pure virtual

Set specific value for period p, note not all values are settable.

After call of set_value you may want to call normalize() function to make sure vall periods are updated, if you set sereral fields that are part of single date/time representation you should call set_value several times and then call normalize().

If normalize() is not called after set_value, the behavior is undefined


The documentation for this class was generated from the following file: