/
usr
/
include
/
boost
/
date_time
/
/usr/include/boost/date_time
mkdir
upload
Name
Size
Mode
Actions
gregorian/
-
0755
rm
local_time/
-
0755
rm
posix_time/
-
0755
rm
adjust_functors.hpp
5467
0644
edit
dl
rm
compiler_config.hpp
5640
0644
edit
dl
rm
constrained_value.hpp
4224
0644
edit
dl
rm
c_local_time_adjustor.hpp
2631
0644
edit
dl
rm
c_time.hpp
4496
0644
edit
dl
rm
date.hpp
7357
0644
edit
dl
rm
date_clock_device.hpp
2299
0644
edit
dl
rm
date_defs.hpp
701
0644
edit
dl
rm
date_duration.hpp
4669
0644
edit
dl
rm
date_duration_types.hpp
9186
0644
edit
dl
rm
date_facet.hpp
29314
0644
edit
dl
rm
date_formatting.hpp
4208
0644
edit
dl
rm
date_formatting_limited.hpp
3461
0644
edit
dl
rm
date_formatting_locales.hpp
6748
0644
edit
dl
rm
date_format_simple.hpp
3128
0644
edit
dl
rm
date_generators.hpp
16508
0644
edit
dl
rm
date_generator_formatter.hpp
11715
0644
edit
dl
rm
date_generator_parser.hpp
13064
0644
edit
dl
rm
date_iterator.hpp
3305
0644
edit
dl
rm
date_names_put.hpp
10754
0644
edit
dl
rm
date_parsing.hpp
14146
0644
edit
dl
rm
dst_rules.hpp
15401
0644
edit
dl
rm
dst_transition_generators.hpp
2293
0644
edit
dl
rm
filetime_functions.hpp
3163
0644
edit
dl
rm
find_match.hpp
1355
0644
edit
dl
rm
format_date_parser.hpp
23909
0644
edit
dl
rm
gregorian_calendar.hpp
2714
0644
edit
dl
rm
gregorian_calendar.ipp
7947
0644
edit
dl
rm
int_adapter.hpp
14463
0644
edit
dl
rm
iso_format.hpp
5640
0644
edit
dl
rm
locale_config.hpp
1206
0644
edit
dl
rm
local_timezone_defs.hpp
7618
0644
edit
dl
rm
local_time_adjustor.hpp
8578
0644
edit
dl
rm
microsec_time_clock.hpp
6257
0644
edit
dl
rm
parse_format_base.hpp
961
0644
edit
dl
rm
period.hpp
11936
0644
edit
dl
rm
period_formatter.hpp
7237
0644
edit
dl
rm
period_parser.hpp
7932
0644
edit
dl
rm
special_defs.hpp
633
0644
edit
dl
rm
special_values_formatter.hpp
3657
0644
edit
dl
rm
special_values_parser.hpp
6161
0644
edit
dl
rm
strings_from_facet.hpp
4505
0644
edit
dl
rm
string_convert.hpp
1002
0644
edit
dl
rm
string_parse_tree.hpp
8405
0644
edit
dl
rm
time.hpp
6788
0644
edit
dl
rm
time_clock.hpp
2245
0644
edit
dl
rm
time_defs.hpp
942
0644
edit
dl
rm
time_duration.hpp
10569
0644
edit
dl
rm
time_facet.hpp
58988
0644
edit
dl
rm
time_formatting_streams.hpp
3752
0644
edit
dl
rm
time_iterator.hpp
1438
0644
edit
dl
rm
time_parsing.hpp
11846
0644
edit
dl
rm
time_resolution_traits.hpp
6760
0644
edit
dl
rm
time_system_counted.hpp
9051
0644
edit
dl
rm
time_system_split.hpp
8077
0644
edit
dl
rm
time_zone_base.hpp
3711
0644
edit
dl
rm
time_zone_names.hpp
3103
0644
edit
dl
rm
tz_db_base.hpp
15915
0644
edit
dl
rm
wrapping_int.hpp
5824
0644
edit
dl
rm
year_month_day.hpp
1375
0644
edit
dl
rm
Edit:
/usr/include/boost/date_time/special_values_parser.hpp
(6161B)
#ifndef DATE_TIME_SPECIAL_VALUES_PARSER_HPP__ #define DATE_TIME_SPECIAL_VALUES_PARSER_HPP__ /* Copyright (c) 2005 CrystalClear Software, Inc. * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst * $Date: */ #include "boost/date_time/string_parse_tree.hpp" #include "boost/date_time/special_defs.hpp" #include <string> #include <vector> namespace boost { namespace date_time { //! Class for special_value parsing /*! * TODO: add doc-comments for which elements can be changed * Parses input stream for strings representing special_values. * Special values parsed are: * - not_a_date_time * - neg_infin * - pod_infin * - min_date_time * - max_date_time */ template<class date_type, typename charT> class special_values_parser { public: typedef std::basic_string<charT> string_type; typedef std::basic_stringstream<charT> stringstream_type; typedef std::istreambuf_iterator<charT> stream_itr_type; typedef typename date_type::duration_type duration_type; typedef string_parse_tree<charT> parse_tree_type; typedef typename parse_tree_type::parse_match_result_type match_results; typedef std::vector<std::basic_string<charT> > collection_type; typedef charT char_type; static const char_type nadt_string[16]; static const char_type neg_inf_string[10]; static const char_type pos_inf_string[10]; static const char_type min_date_time_string[18]; static const char_type max_date_time_string[18]; //! Creates a special_values_parser with the default set of "sv_strings" special_values_parser() { sv_strings(string_type(nadt_string), string_type(neg_inf_string), string_type(pos_inf_string), string_type(min_date_time_string), string_type(max_date_time_string)); } //! Creates a special_values_parser using a user defined set of element strings special_values_parser(const string_type& nadt_str, const string_type& neg_inf_str, const string_type& pos_inf_str, const string_type& min_dt_str, const string_type& max_dt_str) { sv_strings(nadt_str, neg_inf_str, pos_inf_str, min_dt_str, max_dt_str); } special_values_parser(typename collection_type::iterator beg, typename collection_type::iterator end) { collection_type phrases; std::copy(beg, end, std::back_inserter(phrases)); m_sv_strings = parse_tree_type(phrases, static_cast<int>(not_a_date_time)); } //! Replace special value strings void sv_strings(const string_type& nadt_str, const string_type& neg_inf_str, const string_type& pos_inf_str, const string_type& min_dt_str, const string_type& max_dt_str) { collection_type phrases; phrases.push_back(nadt_str); phrases.push_back(neg_inf_str); phrases.push_back(pos_inf_str); phrases.push_back(min_dt_str); phrases.push_back(max_dt_str); m_sv_strings = parse_tree_type(phrases, static_cast<int>(not_a_date_time)); } //! The parser is expensive to create, and not thread-safe so it cannot be static //! therefore given a string, determine if it is likely to be a special value. //! A negative response is a definite no, whereas a positive is only likely and //! match() should be called and return value checked. //! \param[in] str the string to check //! \returns false if it is definitely not a special value static bool likely(const string_type& str) { if (!str.empty()) { switch (str[0]) { // See string definitions at the end of this class.. case '+': case '-': case 'n': case 'm': return true; default: break; } } return false; } //! Given an input iterator, attempt to match it to a known special value //! \param[in] sitr the start iterator //! \param[in] str_end the end iterator //! \param[out] mr the match result: //! mr.current_match is set to the corresponding special_value or -1 //! \returns whether something matched bool match(stream_itr_type& sitr, stream_itr_type& str_end, match_results& mr) const { unsigned int level = 0; m_sv_strings.match(sitr, str_end, mr, level); return (mr.current_match != match_results::PARSE_ERROR); } private: parse_tree_type m_sv_strings; }; template<class date_type, class CharT> const typename special_values_parser<date_type, CharT>::char_type special_values_parser<date_type, CharT>::nadt_string[16] = {'n','o','t','-','a','-','d','a','t','e','-','t','i','m','e'}; template<class date_type, class CharT> const typename special_values_parser<date_type, CharT>::char_type special_values_parser<date_type, CharT>::neg_inf_string[10] = {'-','i','n','f','i','n','i','t','y'}; template<class date_type, class CharT> const typename special_values_parser<date_type, CharT>::char_type special_values_parser<date_type, CharT>::pos_inf_string[10] = {'+','i','n','f','i','n','i','t','y'}; template<class date_type, class CharT> const typename special_values_parser<date_type, CharT>::char_type special_values_parser<date_type, CharT>::min_date_time_string[18] = {'m','i','n','i','m','u','m','-','d','a','t','e','-','t','i','m','e'}; template<class date_type, class CharT> const typename special_values_parser<date_type, CharT>::char_type special_values_parser<date_type, CharT>::max_date_time_string[18] = {'m','a','x','i','m','u','m','-','d','a','t','e','-','t','i','m','e'}; } } //namespace #endif // DATE_TIME_SPECIAL_VALUES_PARSER_HPP__
Save
cmd:
run