1// Boost string_algo library concept.hpp header file ---------------------------//
2
3// Copyright Pavol Droba 2002-2003.
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8
9// See http://www.boost.org/ for updates, documentation, and revision history.
10
11#ifndef BOOST_STRING_CONCEPT_HPP
12#define BOOST_STRING_CONCEPT_HPP
13
14#include <boost/concept_check.hpp>
15#include <boost/range/iterator_range_core.hpp>
16#include <boost/range/begin.hpp>
17#include <boost/range/end.hpp>
18
19/*! \file
20 Defines concepts used in string_algo library
21*/
22
23namespace boost {
24 namespace algorithm {
25
26 //! Finder concept
27 /*!
28 Defines the Finder concept. Finder is a functor which selects
29 an arbitrary part of a string. Search is performed on
30 the range specified by starting and ending iterators.
31
32 Result of the find operation must be convertible to iterator_range.
33 */
34 template<typename FinderT, typename IteratorT>
35 struct FinderConcept
36 {
37 private:
38 typedef iterator_range<IteratorT> range;
39 public:
40 void constraints()
41 {
42 // Operation
43 r=(*pF)(i,i);
44 }
45 private:
46 range r;
47 IteratorT i;
48 FinderT* pF;
49 }; // Finder_concept
50
51
52 //! Formatter concept
53 /*!
54 Defines the Formatter concept. Formatter is a functor, which
55 takes a result from a finder operation and transforms it
56 in a specific way.
57
58 Result must be a container supported by container_traits,
59 or a reference to it.
60 */
61 template<typename FormatterT, typename FinderT, typename IteratorT>
62 struct FormatterConcept
63 {
64 public:
65 void constraints()
66 {
67 // Operation
68 ::boost::begin((*pFo)( (*pF)(i,i) ));
69 ::boost::end((*pFo)( (*pF)(i,i) ));
70 }
71 private:
72 IteratorT i;
73 FinderT* pF;
74 FormatterT *pFo;
75 }; // FormatterConcept;
76
77 } // namespace algorithm
78} // namespace boost
79
80
81
82
83#endif // BOOST_STRING_CONCEPT_HPP
84

source code of include/boost/algorithm/string/concept.hpp