Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
usLDAPProp.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  Library: CppMicroServices
4 
5  Copyright (c) German Cancer Research Center,
6  Division of Medical and Biological Informatics
7 
8  Licensed under the Apache License, Version 2.0 (the "License");
9  you may not use this file except in compliance with the License.
10  You may obtain a copy of the License at
11 
12  http://www.apache.org/licenses/LICENSE-2.0
13 
14  Unless required by applicable law or agreed to in writing, software
15  distributed under the License is distributed on an "AS IS" BASIS,
16  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  See the License for the specific language governing permissions and
18  limitations under the License.
19 
20 =============================================================================*/
21 
22 #ifndef USLDAPPROP_H
23 #define USLDAPPROP_H
24 
25 #include <usCoreConfig.h>
26 #include <usAny.h>
27 
28 #ifdef _MSC_VER
29 #pragma warning(push)
30 #pragma warning(disable:4251)
31 #endif
32 
33 US_BEGIN_NAMESPACE
34 
36 class US_Core_EXPORT LDAPPropExpr
37 {
38 public:
39 
40  explicit LDAPPropExpr(const std::string& expr);
41 
42  LDAPPropExpr& operator!();
43 
44  operator std::string() const;
45 
46  bool IsNull() const;
47 
48 private:
49 
50  LDAPPropExpr& operator=(const LDAPPropExpr&);
51 
52  std::string m_ldapExpr;
53 };
55 
75 class US_Core_EXPORT LDAPProp
76 {
77 public:
78 
84  LDAPProp(const std::string& property);
85 
94  LDAPPropExpr operator==(const std::string& s) const;
95  LDAPPropExpr operator==(const us::Any& s) const;
96  template<class T>
97  LDAPPropExpr operator==(const T& s) const
98  {
99  std::stringstream ss;
100  ss << s;
101  return LDAPPropExpr("(" + m_property + "=" + ss.str() + ")");
102  }
104 
105  operator LDAPPropExpr () const;
106 
112  LDAPPropExpr operator!() const;
113 
132  LDAPPropExpr operator!=(const std::string& s) const;
133  LDAPPropExpr operator!=(const us::Any& s) const;
134  template<class T>
135  LDAPPropExpr operator!=(const T& s) const
136  {
137  std::stringstream ss;
138  ss << s;
139  return operator!=(ss.str());
140  }
142 
151  LDAPPropExpr operator>=(const std::string& s) const;
152  LDAPPropExpr operator>=(const us::Any& s) const;
153  template<class T>
154  LDAPPropExpr operator>=(const T& s) const
155  {
156  std::stringstream ss;
157  ss << s;
158  return operator>=(ss.str());
159  }
161 
170  LDAPPropExpr operator<=(const std::string& s) const;
171  LDAPPropExpr operator<=(const us::Any& s) const;
172  template<class T>
173  LDAPPropExpr operator<=(const T& s) const
174  {
175  std::stringstream ss;
176  ss << s;
177  return operator<=(ss.str());
178  }
180 
189  LDAPPropExpr Approx(const std::string& s) const;
190  LDAPPropExpr Approx(const us::Any& s) const;
191  template<class T>
192  LDAPPropExpr Approx(const T& s) const
193  {
194  std::stringstream ss;
195  ss << s;
196  return Approx(ss.str());
197  }
199 
200 private:
201 
202  LDAPProp& operator=(const LDAPProp&);
203 
204  std::string m_property;
205 };
206 
207 US_END_NAMESPACE
208 
209 #ifdef _MSC_VER
210 #pragma warning(pop)
211 #endif
212 
222 US_Core_EXPORT us::LDAPPropExpr operator&&(const us::LDAPPropExpr& left, const us::LDAPPropExpr& right);
223 
233 US_Core_EXPORT us::LDAPPropExpr operator||(const us::LDAPPropExpr& left, const us::LDAPPropExpr& right);
234 
235 #endif // USLDAPPROP_H
LDAPPropExpr Approx(const T &s) const
Definition: usLDAPProp.h:192
US_Core_EXPORT us::LDAPPropExpr operator&&(const us::LDAPPropExpr &left, const us::LDAPPropExpr &right)
Definition: usLDAPProp.cpp:124
MITKCORE_EXPORT bool operator!=(const InteractionEvent &a, const InteractionEvent &b)
US_Core_EXPORT us::LDAPPropExpr operator||(const us::LDAPPropExpr &left, const us::LDAPPropExpr &right)
Definition: usLDAPProp.cpp:131
LDAPPropExpr operator<=(const T &s) const
Definition: usLDAPProp.h:173
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
LDAPPropExpr operator>=(const T &s) const
Definition: usLDAPProp.h:154
Definition: usAny.h:163
LDAPPropExpr operator!=(const T &s) const
Definition: usLDAPProp.h:135
LDAPPropExpr operator==(const T &s) const
Definition: usLDAPProp.h:97