BVB Source Codes

mars Show parsers.hpp Source code

Return Download mars: download parsers.hpp Source code - Download mars Source code - Type:.hpp
  1. #ifndef GREGORIAN_PARSERS_HPP___
  2. #define GREGORIAN_PARSERS_HPP___
  3.  
  4. /* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
  5.  * Use, modification and distribution is subject to the
  6.  * Boost Software License, Version 1.0. (See accompanying
  7.  * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  8.  * Author: Jeff Garland, Bart Garst
  9.  * $Date$
  10.  */
  11.  
  12. #include "boost/date_time/gregorian/gregorian_types.hpp"
  13. #include "boost/date_time/date_parsing.hpp"
  14. #include "boost/date_time/compiler_config.hpp"
  15. #include "boost/date_time/parse_format_base.hpp"
  16. #include <string>
  17. #include <sstream>
  18.  
  19. namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost {
  20. namespace gregorian {
  21.  
  22.   //! Return special_value from string argument
  23.   /*! Return special_value from string argument. If argument is
  24.    * not one of the special value names (defined in src/gregorian/names.hpp),
  25.    * return 'not_special' */
  26.   BOOST_DATE_TIME_DECL special_values special_value_from_string(const std::string& s);
  27.  
  28.   //! Deprecated: Use from_simple_string
  29.   inline date from_string(std::string s) {
  30.     return date_time::parse_date<date>(s);
  31.   }
  32.  
  33.   //! From delimited date string where with order year-month-day eg: 2002-1-25 or 2003-Jan-25 (full month name is also accepted)
  34.   inline date from_simple_string(std::string s) {
  35.     return date_time::parse_date<date>(s, date_time::ymd_order_iso);
  36.   }
  37.  
  38.   //! From delimited date string where with order year-month-day eg: 1-25-2003 or Jan-25-2003 (full month name is also accepted)
  39.   inline date from_us_string(std::string s) {
  40.     return date_time::parse_date<date>(s, date_time::ymd_order_us);
  41.   }
  42.  
  43.   //! From delimited date string where with order day-month-year eg: 25-1-2002 or 25-Jan-2003 (full month name is also accepted)
  44.   inline date from_uk_string(std::string s) {
  45.     return date_time::parse_date<date>(s, date_time::ymd_order_dmy);
  46.   }
  47.  
  48.   //! From iso type date string where with order year-month-day eg: 20020125
  49.   inline date from_undelimited_string(std::string s) {
  50.     return date_time::parse_undelimited_date<date>(s);
  51.   }
  52.  
  53.   //! From iso type date string where with order year-month-day eg: 20020125
  54.   inline date date_from_iso_string(const std::string& s) {
  55.     return date_time::parse_undelimited_date<date>(s);
  56.   }
  57.  
  58. #if !(defined(BOOST_NO_STD_ITERATOR_TRAITS))
  59.   //! Stream should hold a date in the form of: 2002-1-25. Month number, abbrev, or name are accepted
  60.   /* Arguments passed in by-value for convertability of char[]
  61.    * to iterator_type. Calls to from_stream_type are by-reference
  62.    * since conversion is already done */
  63.   template<class iterator_type>
  64.   inline date from_stream(iterator_type beg, iterator_type end) {
  65.     if(beg == end)
  66.     {
  67.       return date(not_a_date_time);
  68.     }
  69.     typedef typename std::iterator_traits<iterator_type>::value_type value_type;
  70.     return  date_time::from_stream_type<date>(beg, end, value_type());
  71.   }
  72. #endif //BOOST_NO_STD_ITERATOR_TRAITS
  73.  
  74. #if (defined(_MSC_VER) && (_MSC_VER < 1300))
  75.     // This function cannot be compiled with MSVC 6.0 due to internal compiler shorcomings
  76. #else
  77.   //! Function to parse a date_period from a string (eg: [2003-Oct-31/2003-Dec-25])
  78.   inline date_period date_period_from_string(const std::string& s){
  79.     return date_time::from_simple_string_type<date,char>(s);
  80.   }
  81. #  if !defined(BOOST_NO_STD_WSTRING)
  82.   //! Function to parse a date_period from a wstring (eg: [2003-Oct-31/2003-Dec-25])
  83.   inline date_period date_period_from_wstring(const std::wstring& s){
  84.     return date_time::from_simple_string_type<date,wchar_t>(s);
  85.   }
  86. #  endif // BOOST_NO_STD_WSTRING
  87. #endif
  88.  
  89. } } //namespace gregorian
  90.  
  91. #endif
  92.  
downloadparsers.hpp Source code - Download mars Source code
Related Source Codes/Software:
Hero - Elegant transition library for iOS & tvOS 2017-06-09
deep-photo-styletransfer - Code and data for paper "Deep Photo Style Transfer... 2017-06-09
mastodon - A GNU Social-compatible microblogging server ... 2017-06-09
plyr - A simple HTML5, YouTube and Vimeo player ... 2017-06-08
prepack - Prepack is a partial evaluator for JavaScript. Pre... 2017-06-08
Public-APIs - 2017-06-09
lottie-ios - An iOS library to natively render After Effects ve... 2017-06-09
Awesome-Hacking - A collection of various awesome lists for hackers,... 2017-06-09
algorithms - Minimal examples of data structures and algorithms... 2017-06-10
lectures - Oxford Deep NLP 2017 course 2017-06-10
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top