123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- #ifndef BOOST_LOCALE_DATE_TIME_FACET_HPP_INCLUDED
- #define BOOST_LOCALE_DATE_TIME_FACET_HPP_INCLUDED
- #include <boost/locale/config.hpp>
- #include <boost/locale/detail/facet_id.hpp>
- #include <cstdint>
- #include <locale>
- #ifdef BOOST_MSVC
- # pragma warning(push)
- # pragma warning(disable : 4275 4251 4231 4660)
- #endif
- namespace boost { namespace locale {
-
- namespace period {
-
- namespace marks {
-
- enum period_mark {
- invalid,
- era,
- year,
- extended_year,
- month,
- day,
- day_of_year,
- day_of_week,
-
-
-
-
- day_of_week_in_month,
-
- day_of_week_local,
- hour,
- hour_12,
- am_pm,
- minute,
- second,
- week_of_year,
- week_of_month,
- first_day_of_week,
- };
- }
-
-
-
-
-
-
-
-
-
- class period_type {
- public:
-
- period_type(marks::period_mark m = marks::invalid) : mark_(m) {}
-
- marks::period_mark mark() const { return mark_; }
-
- bool operator==(const period_type& other) const { return mark() == other.mark(); }
-
- bool operator!=(const period_type& other) const { return mark() != other.mark(); }
- private:
- marks::period_mark mark_;
- };
- }
-
-
- struct posix_time {
- int64_t seconds;
- uint32_t nanoseconds;
- };
-
-
-
- class BOOST_SYMBOL_VISIBLE abstract_calendar {
- public:
-
- enum value_type {
- absolute_minimum,
- actual_minimum,
- greatest_minimum,
- current,
- least_maximum,
-
- actual_maximum,
- absolute_maximum,
- };
-
- enum update_type {
- move,
- roll,
- };
-
- enum calendar_option_type {
- is_gregorian,
- is_dst
- };
-
- virtual abstract_calendar* clone() const = 0;
-
-
-
-
-
-
-
-
- virtual void set_value(period::marks::period_mark m, int value) = 0;
-
- virtual void normalize() = 0;
-
- virtual int get_value(period::marks::period_mark m, value_type v) const = 0;
-
- virtual void set_time(const posix_time& p) = 0;
-
- virtual posix_time get_time() const = 0;
-
- virtual double get_time_ms() const = 0;
-
- virtual void set_option(calendar_option_type opt, int v) = 0;
-
- virtual int get_option(calendar_option_type opt) const = 0;
-
-
- virtual void adjust_value(period::marks::period_mark m, update_type u, int difference) = 0;
-
- virtual int difference(const abstract_calendar& other, period::marks::period_mark m) const = 0;
-
- virtual void set_timezone(const std::string& tz) = 0;
-
- virtual std::string get_timezone() const = 0;
-
- virtual bool same(const abstract_calendar* other) const = 0;
- virtual ~abstract_calendar() = default;
- };
-
- class BOOST_SYMBOL_VISIBLE calendar_facet : public std::locale::facet, public detail::facet_id<calendar_facet> {
- public:
-
- calendar_facet(size_t refs = 0) : std::locale::facet(refs) {}
-
- virtual abstract_calendar* create_calendar() const = 0;
- };
- }}
- #ifdef BOOST_MSVC
- # pragma warning(pop)
- #endif
- #endif
|