Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 10:01:54

0001 /*=============================================================================
0002     Copyright (c) 1998-2003 Joel de Guzman
0003     http://spirit.sourceforge.net/
0004 
0005     Use, modification and distribution is subject to the Boost Software
0006     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0007     http://www.boost.org/LICENSE_1_0.txt)
0008 =============================================================================*/
0009 #if !defined(BOOST_SPIRIT_MATCH_IPP)
0010 #define BOOST_SPIRIT_MATCH_IPP
0011 #include <algorithm>
0012 
0013 namespace boost { namespace spirit {
0014 
0015 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
0016 
0017     template <typename T>
0018     inline match<T>::match()
0019     : len(-1), val() {}
0020 
0021     template <typename T>
0022     inline match<T>::match(std::size_t length_)
0023     : len(length_), val() {}
0024 
0025     template <typename T>
0026     inline match<T>::match(std::size_t length_, ctor_param_t val_)
0027     : len(length_), val(val_) {}
0028 
0029     template <typename T>
0030     inline bool
0031     match<T>::operator!() const
0032     {
0033         return len < 0;
0034     }
0035 
0036     template <typename T>
0037     inline std::ptrdiff_t
0038     match<T>::length() const
0039     {
0040         return len;
0041     }
0042 
0043     template <typename T>
0044     inline bool
0045     match<T>::has_valid_attribute() const
0046     {
0047         return val.is_initialized();
0048     }
0049 
0050     template <typename T>
0051     inline typename match<T>::return_t
0052     match<T>::value() const
0053     {
0054         BOOST_SPIRIT_ASSERT(val.is_initialized());
0055         return *val;
0056     }
0057 
0058     template <typename T>
0059     inline void
0060     match<T>::swap(match& other)
0061     {
0062         std::swap(len, other.len);
0063         std::swap(val, other.val);
0064     }
0065 
0066     inline match<nil_t>::match()
0067     : len(-1) {}
0068 
0069     inline match<nil_t>::match(std::size_t length_)
0070     : len(length_) {}
0071 
0072     inline match<nil_t>::match(std::size_t length_, nil_t)
0073     : len(length_) {}
0074 
0075     inline bool
0076     match<nil_t>::operator!() const
0077     {
0078         return len < 0;
0079     }
0080 
0081     inline bool
0082     match<nil_t>::has_valid_attribute() const
0083     {
0084         return false;
0085     }
0086 
0087     inline std::ptrdiff_t
0088     match<nil_t>::length() const
0089     {
0090         return len;
0091     }
0092 
0093     inline nil_t
0094     match<nil_t>::value() const
0095     {
0096         return nil_t();
0097     }
0098 
0099     inline void
0100     match<nil_t>::value(nil_t) {}
0101 
0102     inline void
0103     match<nil_t>::swap(match<nil_t>& other)
0104     {
0105         std::swap(len, other.len);
0106     }
0107 
0108 BOOST_SPIRIT_CLASSIC_NAMESPACE_END
0109 
0110 }} // namespace boost::spirit
0111 
0112 #endif
0113