Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения

Class template time_facet

Boost , The Boost C++ Libraries BoostBook Documentation Subset , Library Reference

Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

Class template time_facet

boost::date_time::time_facet

Synopsis

// In header: <boost/date_time/time_facet.hpp>
template<typename time_type, typename CharT, 
         typename OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> > > 
class time_facet :
  public boost::date_time::date_facet< time_type::date_type, CharT, OutItrT >
{
public:
  // types
  typedef time_type::date_type                                                          date_type;                    
  typedef time_type::time_duration_type                                                 time_duration_type;           
  typedef boost::date_time::period< time_type, time_duration_type >                     period_type;                  
  typedef boost::date_time::date_facet< typename time_type::date_type, CharT, OutItrT > base_type;                    
  typedef base_type::string_type                                                        string_type;                  
  typedef base_type::char_type                                                          char_type;                    
  typedef base_type::period_formatter_type                                              period_formatter_type;        
  typedef base_type::special_values_formatter_type                                      special_values_formatter_type;
  typedef base_type::date_gen_formatter_type                                            date_gen_formatter_type;      
  // construct/copy/destruct
  explicit time_facet(::size_t = 0);
  explicit time_facet(const char_type *, 
                      period_formatter_type = period_formatter_type(), 
                      const special_values_formatter_type & = special_values_formatter_type(), 
                      date_gen_formatter_type = date_gen_formatter_type(), 
                      ::size_t = 0);
  // public member functions
  std::locale::id & __get_id(void) const;
  void time_duration_format(const char_type *const);
  virtual void set_iso_format();
  virtual void set_iso_extended_format();
  OutItrT put(OutItrT, std::ios_base &, char_type, const time_type &) const;
  OutItrT put(OutItrT, std::ios_base &, char_type, const time_duration_type &) const;
  OutItrT put(OutItrT, std::ios_base &, char_type, const period_type &) const;
  // protected static functions
  static string_type 
  fractional_seconds_as_string(const time_duration_type &, bool);
  static string_type hours_as_string(const time_duration_type &, int = 2);
  template<typename IntT> static string_type integral_as_string(IntT, int = 2);
  // public data members
  static const char_type * fractional_seconds_format;
  static const char_type * fractional_seconds_or_none_format;
  static const char_type * seconds_with_fractional_seconds_format;
  static const char_type * seconds_format;
  static const char_type * hours_format;
  static const char_type * unrestricted_hours_format;
  static const char_type * standard_format;
  static const char_type * zone_abbrev_format;
  static const char_type * zone_name_format;
  static const char_type * zone_iso_format;
  static const char_type * zone_iso_extended_format;
  static const char_type * posix_zone_string_format;
  static const char_type * duration_seperator;
  static const char_type * duration_sign_always;
  static const char_type * duration_sign_negative_only;
  static const char_type * negative_sign;
  static const char_type * positive_sign;
  static const char_type * iso_time_format_specifier;
  static const char_type * iso_time_format_extended_specifier;
  static const char_type * default_time_format;
  static const char_type * default_time_duration_format;
  static std::locale::id id;
};

Description

Facet используется для форматного вывода типов времени Этот класс предусматривает использование строк формата для вывода времени. В дополнение к флагам для форматирования элементов даты, следующие флаги разрешенного формата:

  • x X => формат по умолчанию - позволяет добавлять больше флагов по умолчанию (т.е. "%x%X%z")

  • f => дробные секунды ".123456"

  • F => дробные секунды или нет: как frac sec, но пустой, если frac sec == 0<1

  • s => секунды w/фракционные секунды "02.123" (это то же самое, что "%S%f) - %S => секунды "02" - %z => сокращенный часовой пояс "EDT" - %Z => полный часовой пояс название "Восточное дневное время"

time_facet public construct/copy/destruct

  1. explicit time_facet(::size_t ref_arg = 0);
    sets default formats for ptime, local_date_time, and time_duration
  2. explicit time_facet(const char_type * format_arg, 
                        period_formatter_type period_formatter_arg = period_formatter_type(), 
                        const special_values_formatter_type & special_value_formatter = special_values_formatter_type(), 
                        date_gen_formatter_type dg_formatter = date_gen_formatter_type(), 
                        ::size_t ref_arg = 0);
    Construct the facet with an explicitly specified format.

time_facet public member functions

  1. std::locale::id &_get_id(void:2>const;
  2. voidtime_duration_format(constchar_typeconstconstформат;
    Изменение формата для time_duration.
  3. virtual void set_iso_format;
  4. virtual void set_iso_extended_format;
  5. OutItrTput( next_arg, std::ios_base & ios_arg, char_type, const &const;
  6. OutItrT put(OutItrT next_arg, std::ios_base & ios_arg, char_type fill_arg, 
                const time_duration_type & time_dur_arg) const;
    put function for time_duration
  7. OutItrTput(OutItrT Next,std::ios_base & ios_arg, char_type fill, const&const;

time_facet protected static functions

  1. static string_typefractional_seconds_as_string(const time_duration_type & time_arg, boolnull_when_zero;
  2. static string_typehours_as_stringconst time_duration_type & time_arg, int ширина =2>;
  3. templatetypename IntT> static string_typeintegral_as_string(IntTval,intширина =2>2;

PrevUpHomeNext

Статья Class template time_facet раздела The Boost C++ Libraries BoostBook Documentation Subset Library Reference может быть полезна для разработчиков на c++ и boost.




Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



:: Главная :: Library Reference ::


реклама


©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
Top.Mail.Ru

Время компиляции файла: 2024-08-30 11:47:00
2025-05-19 20:31:07/0.0091671943664551/1