]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Boost.Geometry (aka GGL, Generic Geometry Library) |
2 | // | |
3 | // Copyright (c) 2010-2013 Barend Gehrels, Amsterdam, the Netherlands. | |
4 | // Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland. | |
5 | // Use, modification and distribution is subject to the Boost Software License, | |
6 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
7 | // http://www.boost.org/LICENSE_1_0.txt) | |
8 | // | |
9 | // | |
10 | #ifndef PARAMETER_PREDICATES_HPP | |
11 | #define PARAMETER_PREDICATES_HPP | |
12 | ||
13 | ||
14 | #include <string> | |
15 | ||
16 | #include <doxygen_elements.hpp> | |
17 | ||
18 | ||
19 | // Predicate for std::find_if | |
20 | struct par_by_name | |
21 | { | |
22 | par_by_name(std::string const& n) | |
23 | : m_name(n) | |
24 | {} | |
25 | ||
26 | inline bool operator()(parameter const& p) | |
27 | { | |
28 | return p.name == m_name; | |
29 | } | |
30 | private : | |
31 | std::string m_name; | |
32 | }; | |
33 | ||
34 | ||
35 | // Predicate for std::find_if | |
36 | struct par_by_type | |
37 | { | |
38 | par_by_type(std::string const& n) | |
39 | : m_type(n) | |
40 | {} | |
41 | ||
42 | inline bool operator()(parameter const& p) | |
43 | { | |
44 | return p.type == m_type; | |
45 | } | |
46 | private : | |
47 | std::string m_type; | |
48 | }; | |
49 | ||
50 | ||
51 | template <typename Element> | |
52 | struct sort_on_line | |
53 | { | |
54 | inline bool operator()(Element const& left, Element const& right) | |
55 | { | |
56 | return left.line < right.line; | |
57 | } | |
58 | }; | |
59 | ||
60 | ||
61 | #endif // PARAMETER_PREDICATES_HPP |