yast2-core
ycpless.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | |
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
8 | |
9 | core system |
10 | (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12 
13  File: ycpless.h
14 
15  Authors: Mathias Kettner <kettner@suse.de>
16  Arvin Schnell <aschnell@suse.de>
17  Maintainer: Thomas Roelz <tom@suse.de>
18 
19 /-*/
20 // -*- c++ -*-
21 
22 #ifndef ycpless_h
23 #define ycpless_h
24 
25 #include "YCPValue.h"
26 
27 
28 /*
29  * Global comparison functor usable as generic ordering operator for
30  * STL-containers and as predicate for STL-algorithms.
31  *
32  * Compares two YCPValues and returns true if the first value is less than the
33  * second one, false otherwise. Optionally the comparison is locale aware.
34  */
35 class ycp_less : public std::binary_function<YCPValue, YCPValue, bool>
36 {
37 
38 public:
39 
41 
42  bool operator()(const YCPValue& x, const YCPValue& y) const
43  {
44  return x->compare(y, respect_locale) == YO_LESS;
45  }
46 
47 private:
48 
49  const bool respect_locale;
50 
51 };
52 
53 
54 /*
55  * Global comparison functor usable as predicate for STL-algorithms.
56  *
57  * Compares two YCPValues and returns true if they are equal, false otherwise.
58  * Optionally the comparison is locale aware.
59  */
60 class ycp_equal_to : public std::binary_function<YCPValue, YCPValue, bool>
61 {
62 
63 public:
64 
66 
67  bool operator()(const YCPValue& x, const YCPValue& y) const
68  {
69  return x->compare(y, respect_locale) == YO_EQUAL;
70  }
71 
72 private:
73 
74  const bool respect_locale;
75 
76 };
77 
78 
79 /*
80  * Global comparison functor usable as predicate for STL-algorithms.
81  *
82  * Compares two YCPValues and returns true if they are not equal, false
83  * otherwise. Optionally the comparison is locale aware.
84  */
85 class ycp_not_equal_to : public std::binary_function<YCPValue, YCPValue, bool>
86 {
87 
88 public:
89 
91 
92  bool operator()(const YCPValue& x, const YCPValue& y) const
93  {
94  return x->compare(y, respect_locale) != YO_EQUAL;
95  }
96 
97 private:
98 
99  const bool respect_locale;
100 
101 };
102 
103 
104 #endif // ycpless_h
ycp_equal_to(bool respect_locale=false)
Definition: ycpless.h:65
ycp_less(bool respect_locale=false)
Definition: ycpless.h:40
Definition: ycpless.h:85
Definition: ycpless.h:60
const bool respect_locale
Definition: ycpless.h:74
Definition: ycpless.h:35
bool operator()(const YCPValue &x, const YCPValue &y) const
Definition: ycpless.h:67
Definition: YCPValue.h:59
bool operator()(const YCPValue &x, const YCPValue &y) const
Definition: ycpless.h:42
Definition: YCPValue.h:58
const bool respect_locale
Definition: ycpless.h:49
Wrapper for YCPValueRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPValueRep with the arrow operator. See YCPValueRep.
Definition: YCPValue.h:275
bool operator()(const YCPValue &x, const YCPValue &y) const
Definition: ycpless.h:92
const bool respect_locale
Definition: ycpless.h:99
ycp_not_equal_to(bool respect_locale=false)
Definition: ycpless.h:90

Generated on a sunny day for yast2-core by doxygen 1.8.6