/usr/include/boost/date_time
NameSizeModeActions
gregorian/-0755rm
local_time/-0755rm
posix_time/-0755rm
adjust_functors.hpp54670644editdlrm
compiler_config.hpp56400644editdlrm
constrained_value.hpp42240644editdlrm
c_local_time_adjustor.hpp26310644editdlrm
c_time.hpp44960644editdlrm
date.hpp73570644editdlrm
date_clock_device.hpp22990644editdlrm
date_defs.hpp7010644editdlrm
date_duration.hpp46690644editdlrm
date_duration_types.hpp91860644editdlrm
date_facet.hpp293140644editdlrm
date_formatting.hpp42080644editdlrm
date_formatting_limited.hpp34610644editdlrm
date_formatting_locales.hpp67480644editdlrm
date_format_simple.hpp31280644editdlrm
date_generators.hpp165080644editdlrm
date_generator_formatter.hpp117150644editdlrm
date_generator_parser.hpp130640644editdlrm
date_iterator.hpp33050644editdlrm
date_names_put.hpp107540644editdlrm
date_parsing.hpp141460644editdlrm
dst_rules.hpp154010644editdlrm
dst_transition_generators.hpp22930644editdlrm
filetime_functions.hpp31630644editdlrm
find_match.hpp13550644editdlrm
format_date_parser.hpp239090644editdlrm
gregorian_calendar.hpp27140644editdlrm
gregorian_calendar.ipp79470644editdlrm
int_adapter.hpp144630644editdlrm
iso_format.hpp56400644editdlrm
locale_config.hpp12060644editdlrm
local_timezone_defs.hpp76180644editdlrm
local_time_adjustor.hpp85780644editdlrm
microsec_time_clock.hpp62570644editdlrm
parse_format_base.hpp9610644editdlrm
period.hpp119360644editdlrm
period_formatter.hpp72370644editdlrm
period_parser.hpp79320644editdlrm
special_defs.hpp6330644editdlrm
special_values_formatter.hpp36570644editdlrm
special_values_parser.hpp61610644editdlrm
strings_from_facet.hpp45050644editdlrm
string_convert.hpp10020644editdlrm
string_parse_tree.hpp84050644editdlrm
time.hpp67880644editdlrm
time_clock.hpp22450644editdlrm
time_defs.hpp9420644editdlrm
time_duration.hpp105690644editdlrm
time_facet.hpp589880644editdlrm
time_formatting_streams.hpp37520644editdlrm
time_iterator.hpp14380644editdlrm
time_parsing.hpp118460644editdlrm
time_resolution_traits.hpp67600644editdlrm
time_system_counted.hpp90510644editdlrm
time_system_split.hpp80770644editdlrm
time_zone_base.hpp37110644editdlrm
time_zone_names.hpp31030644editdlrm
tz_db_base.hpp159150644editdlrm
wrapping_int.hpp58240644editdlrm
year_month_day.hpp13750644editdlrm
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 #include 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 special_values_parser { public: typedef std::basic_string string_type; typedef std::basic_stringstream stringstream_type; typedef std::istreambuf_iterator stream_itr_type; typedef typename date_type::duration_type duration_type; typedef string_parse_tree parse_tree_type; typedef typename parse_tree_type::parse_match_result_type match_results; typedef std::vector > 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(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(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 const typename special_values_parser::char_type special_values_parser::nadt_string[16] = {'n','o','t','-','a','-','d','a','t','e','-','t','i','m','e'}; template const typename special_values_parser::char_type special_values_parser::neg_inf_string[10] = {'-','i','n','f','i','n','i','t','y'}; template const typename special_values_parser::char_type special_values_parser::pos_inf_string[10] = {'+','i','n','f','i','n','i','t','y'}; template const typename special_values_parser::char_type special_values_parser::min_date_time_string[18] = {'m','i','n','i','m','u','m','-','d','a','t','e','-','t','i','m','e'}; template const typename special_values_parser::char_type special_values_parser::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__