|
||||
File indexing completed on 2025-01-18 09:30:38
0001 #ifndef _BOOST_DATE_TIME_FIND_MATCH_HPP___ 0002 #define _BOOST_DATE_TIME_FIND_MATCH_HPP___ 0003 0004 /* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. 0005 * Use, modification and distribution is subject to the 0006 * Boost Software License, Version 1.0. (See accompanying 0007 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 0008 * Author: Jeff Garland, Bart Garst 0009 * $Date$ 0010 */ 0011 0012 #include <string> 0013 0014 namespace boost { 0015 namespace date_time { 0016 0017 0018 //! Find index of a string in either of 2 arrays 0019 /*! find_match searches both arrays for a match to 's'. Both arrays 0020 * must contain 'size' elements. The index of the match is returned. 0021 * If no match is found, 'size' is returned. 0022 * Ex. "Jan" returns 0, "Dec" returns 11, "Tue" returns 2. 0023 * 'size' can be sent in with: (greg_month::max)() (which 12), 0024 * (greg_weekday::max)() + 1 (which is 7) or date_time::NumSpecialValues */ 0025 template<class charT> 0026 short find_match(const charT* const* short_names, 0027 const charT* const* long_names, 0028 short size, 0029 const std::basic_string<charT>& s) { 0030 for(short i = 0; i < size; ++i){ 0031 if(short_names[i] == s || long_names[i] == s){ 0032 return i; 0033 } 0034 } 0035 return size; // not-found, return a value out of range 0036 } 0037 0038 0039 } } //namespace date_time 0040 0041 0042 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |