Sha256: 629145180e219bfaafcc6c64d535f101c540d856dd88505968dee0c166647d02

Contents?: true

Size: 1.32 KB

Versions: 15

Compression:

Stored size: 1.32 KB

Contents

#ifndef _BOOST_DATE_TIME_FIND_MATCH_HPP___
#define _BOOST_DATE_TIME_FIND_MATCH_HPP___

/* Copyright (c) 2002,2003,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 <string>

namespace boost {
namespace date_time {


    //! Find index of a string in either of 2 arrays
    /*! find_match searches both arrays for a match to 's'. Both arrays
     * must contain 'size' elements. The index of the match is returned.
     * If no match is found, 'size' is returned.
     * Ex. "Jan" returns 0, "Dec" returns 11, "Tue" returns 2.
     * 'size' can be sent in with: (greg_month::max)() (which 12),
     * (greg_weekday::max)() + 1 (which is 7) or date_time::NumSpecialValues */
    template<class charT>
    short find_match(const charT* const* short_names,
                     const charT* const* long_names,
                     short size,
                     const std::basic_string<charT>& s) {
      for(short i = 0; i < size; ++i){
        if(short_names[i] == s || long_names[i] == s){
          return i;
        }
      }
      return size; // not-found, return a value out of range
    }


} } //namespace date_time


#endif

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
passenger-6.0.24 src/cxx_supportlib/vendor-modified/boost/date_time/find_match.hpp
passenger-6.0.23 src/cxx_supportlib/vendor-modified/boost/date_time/find_match.hpp
passenger-6.0.20 src/cxx_supportlib/vendor-modified/boost/date_time/find_match.hpp
passenger-6.0.19 src/cxx_supportlib/vendor-modified/boost/date_time/find_match.hpp
passenger-6.0.18 src/cxx_supportlib/vendor-modified/boost/date_time/find_match.hpp
passenger-6.0.17 src/cxx_supportlib/vendor-modified/boost/date_time/find_match.hpp
passenger-6.0.16 src/cxx_supportlib/vendor-modified/boost/date_time/find_match.hpp
passenger-6.0.15 src/cxx_supportlib/vendor-modified/boost/date_time/find_match.hpp
passenger-6.0.14 src/cxx_supportlib/vendor-modified/boost/date_time/find_match.hpp
passenger-6.0.13 src/cxx_supportlib/vendor-modified/boost/date_time/find_match.hpp
passenger-6.0.12 src/cxx_supportlib/vendor-modified/boost/date_time/find_match.hpp
passenger-6.0.11 src/cxx_supportlib/vendor-modified/boost/date_time/find_match.hpp
passenger-6.0.10 src/cxx_supportlib/vendor-modified/boost/date_time/find_match.hpp
passenger-6.0.9 src/cxx_supportlib/vendor-modified/boost/date_time/find_match.hpp
passenger-6.0.8 src/cxx_supportlib/vendor-modified/boost/date_time/find_match.hpp