Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 09:55:53

0001 //  Boost string_algo library concept.hpp header file  ---------------------------//
0002 
0003 //  Copyright Pavol Droba 2002-2003.
0004 //
0005 // Distributed under the Boost Software License, Version 1.0.
0006 //    (See accompanying file LICENSE_1_0.txt or copy at
0007 //          http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 //  See http://www.boost.org/ for updates, documentation, and revision history.
0010 
0011 #ifndef BOOST_STRING_CONCEPT_HPP
0012 #define BOOST_STRING_CONCEPT_HPP
0013 
0014 #include <boost/concept_check.hpp>
0015 #include <boost/range/iterator_range_core.hpp>
0016 #include <boost/range/begin.hpp>
0017 #include <boost/range/end.hpp>
0018 
0019 /*! \file 
0020     Defines concepts used in string_algo library
0021 */
0022 
0023 namespace boost {
0024     namespace algorithm {
0025 
0026         //! Finder concept
0027         /*!
0028             Defines the Finder concept. Finder is a functor which selects
0029             an arbitrary part of a string. Search is performed on
0030             the range specified by starting and ending iterators.
0031 
0032             Result of the find operation must be convertible to iterator_range.
0033         */
0034         template<typename FinderT, typename IteratorT>
0035         struct FinderConcept
0036         {
0037         private:
0038             typedef iterator_range<IteratorT> range;
0039         public:
0040             void constraints()
0041             {
0042                 // Operation
0043                 r=(*pF)(i,i);
0044             }
0045         private:
0046             range r;
0047             IteratorT i;
0048             FinderT* pF;    
0049         }; // Finder_concept
0050 
0051         
0052         //! Formatter concept
0053         /*!
0054             Defines the Formatter concept. Formatter is a functor, which
0055             takes a result from a finder operation and transforms it
0056             in a specific way.
0057 
0058             Result must be a container supported by container_traits, 
0059             or a reference to it.
0060         */
0061         template<typename FormatterT, typename FinderT, typename IteratorT>
0062         struct FormatterConcept
0063         {
0064         public:
0065             void constraints()
0066             {
0067                 // Operation
0068                 ::boost::begin((*pFo)( (*pF)(i,i) ));
0069                 ::boost::end((*pFo)( (*pF)(i,i) ));
0070             }
0071         private:
0072             IteratorT i;
0073             FinderT* pF;
0074             FormatterT *pFo;
0075         }; // FormatterConcept;
0076 
0077     } // namespace algorithm
0078 } // namespace boost
0079 
0080 
0081 
0082 
0083 #endif  // BOOST_STRING_CONCEPT_HPP