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

Class template date_generator_formatter

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 date_generator_formatter

boost::date_time::date_generator_formatter — Formats date_generators for output.

Synopsis

// In header: <boost/date_time/date_generator_formatter.hpp>
template<typename date_type, typename CharT, 
         typename OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> > > 
class date_generator_formatter {
public:
  // types
  typedef partial_date< date_type >        partial_date_type;
  typedef nth_kday_of_month< date_type >   nth_kday_type;    
  typedef first_kday_of_month< date_type > first_kday_type;  
  typedef last_kday_of_month< date_type >  last_kday_type;   
  typedef first_kday_after< date_type >    kday_after_type;  
  typedef first_kday_before< date_type >   kday_before_type; 
  typedef CharT                            char_type;        
  typedef std::basic_string< char_type >   string_type;      
  typedef std::vector< string_type >       collection_type;  
  enum phrase_elements { first = =0, second, third, fourth, fifth, last, 
                         before, after, of, number_of_phrase_elements };
  // construct/copy/destruct
  date_generator_formatter();
  date_generator_formatter(const string_type &, const string_type &, 
                           const string_type &, const string_type &, 
                           const string_type &, const string_type &, 
                           const string_type &, const string_type &, 
                           const string_type &);
  // public member functions
  void elements(const collection_type &, phrase_elements = first);
  template<typename facet_type> 
    OutItrT put_partial_date(OutItrT, std::ios_base &, CharT, 
                             const partial_date_type &, const facet_type &) const;
  template<typename facet_type> 
    OutItrT put_nth_kday(OutItrT, std::ios_base &, CharT, 
                         const nth_kday_type &, const facet_type &) const;
  template<typename facet_type> 
    OutItrT put_first_kday(OutItrT, std::ios_base &, CharT, 
                           const first_kday_type &, const facet_type &) const;
  template<typename facet_type> 
    OutItrT put_last_kday(OutItrT, std::ios_base &, CharT, 
                          const last_kday_type &, const facet_type &) const;
  template<typename facet_type> 
    OutItrT put_kday_before(OutItrT, std::ios_base &, CharT, 
                            const kday_before_type &, const facet_type &) const;
  template<typename facet_type> 
    OutItrT put_kday_after(OutItrT, std::ios_base &, CharT, 
                           const kday_after_type &, const facet_type &) const;
  // private member functions
  OutItrT put_string(OutItrT, const string_type &) const;
  // public data members
  static const char_type first_string;
  static const char_type second_string;
  static const char_type third_string;
  static const char_type fourth_string;
  static const char_type fifth_string;
  static const char_type last_string;
  static const char_type before_string;
  static const char_type after_string;
  static const char_type of_string;
};

Description

Форматирование генераторов дат выполняет конкретные заказы для различных типов генераторов дат.

  • Partial_date=>«dd месяц»

  • nth_day_of_the_week_in_month =>«день недели месяца»

  • first_day_of_the_week_in_month =>"первый будний день месяца"

  • Last_day_of_the_week_in_month =>"Последний будний день месяца"

  • first_day_of_the_week_after =>"weekday after"

  • first_day_of_the_week_before =>"за день до" Хотя порядок элементов в этих фразах не может быть изменен, сами элементы могут быть изменены. День недели и месяц получают свои форматы и имена изdate_facet. Остальные элементы хранятся вdate_generator_formatterи могут быть настроены при строительстве или через функцию члена. Элементами по умолчанию являются те, которые показаны в примерах выше.

date_generator_formatter public construct/copy/destruct

  1. <
    date_generator_formatter();
    >Используемые элементы формата по умолчанию.
  2. <
    date_generator_formatter(conststring_type&first_str,
                            conststring_type&second_str,
                            conststring_type&third_str,
                            conststring_type&fourth_str,
                            conststring_type&fifth_str,
                            conststring_type&last_str,
                            conststring_type&before_str,
                            conststring_type&after_str,
                            conststring_type&of_str);
    >Конструктор, позволяющий настраивать набор элементов фразы.

date_generator_formatter public member functions

  1. voidelements(constcollection_type&new_strings,
                 phrase_elementsbeg_pos=first);
    Заменить набор элементов фразы теми, которые содержатся в новых строках.

    Порядок строк в данном сборнике важен. Они должны следовать:

    • Первый, второй, третий, четвертый, пятый, последний, до, после.

    Не обязательно отправлять полный набор, если необходимо заменить только несколько элементов, если используется правильный beg_pos.

    Ex: Сохранить по умолчанию сначала с помощью пятых элементов, но заменить остальные с помощью набора:

    • «окончательный», «предшествующий», «следующий», «в». Будет использоваться beg_pos of date_generator_formatter::last.

  2. template<typenamefacet_type>
     OutItrTput_partial_date(OutItrTnext,std::ios_base&a_ios,CharTa_fill,
                              constpartial_date_type&pd,
                              constfacet_type&facet)const;
    Поставьтеpartial_date=>«dd Месяц».
  3. <
    template<typenamefacet_type>
     OutItrTput_nth_kday(OutItrTnext,std::ios_base&a_ios,CharTa_fill,
                          constnth_kday_type&nkd,constfacet_type&facet)const;
    >Поместите nth_day_of_the_week_in_month =>"nth weekday of month".
  4. <
    template<typenamefacet_type>
     OutItrTput_first_kday(OutItrTnext,std::ios_base&a_ios,CharTa_fill,
                            constfirst_kday_type&fkd,
                            constfacet_type&facet)const;
    >Положите первый_день_недели_в_месяце =>"первый будний день месяца".
  5. <
    template<typenamefacet_type>
     OutItrTput_last_kday(OutItrTnext,std::ios_base&a_ios,CharTa_fill,
                           constlast_kday_type&lkd,constfacet_type&facet)const;
    >Поставьте last_day_of_the_week_in_month =>«последний будний день месяца».
  6. template<typenamefacet_type>
     OutItrTput_kday_before(OutItrTnext,std::ios_base&a_ios,CharTa_fill,
                             constkday_before_type&fkb,
                             constfacet_type&facet)const;
    Положите первый_день_недели_до =>"за день до".
  7. template<typenamefacet_type>
     OutItrTput_kday_after(OutItrTnext,std::ios_base&a_ios,CharTa_fill,
                            constkday_after_type&fka,
                            constfacet_type&facet)const;
    Положите первый день_of_the_week_after =>«послезавтра».

date_generator_formatter private member functions

  1. <
    OutItrTput_string(OutItrTnext,conststring_type&str)const;
    >функция помощника, чтобы поместить различные строки в поток

PrevUpHomeNext

Статья Class template date_generator_formatter раздела 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-07-05 09:59:08/0.017462968826294/0