Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
usLDAPProp.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef USLDAPPROP_H
14 #define USLDAPPROP_H
15 
16 #include <usGlobalConfig.h>
18 #include <usAny.h>
19 
20 namespace us {
21 
23 class MITKCPPMICROSERVICES_EXPORT LDAPPropExpr
24 {
25 public:
26 
27  explicit LDAPPropExpr(const std::string& expr);
28  LDAPPropExpr(const LDAPPropExpr&) = default;
29 
30  LDAPPropExpr& operator!();
31 
32  operator std::string() const;
33 
34  bool IsNull() const;
35 
36 private:
37 
38  LDAPPropExpr& operator=(const LDAPPropExpr&);
39 
40  std::string m_ldapExpr;
41 };
43 
64 {
65 public:
66 
72  LDAPProp(const std::string& property);
73 
82  LDAPPropExpr operator==(const std::string& s) const;
83  LDAPPropExpr operator==(const us::Any& s) const;
84  template<class T>
85  LDAPPropExpr operator==(const T& s) const
86  {
87  std::stringstream ss;
88  ss << s;
89  return LDAPPropExpr("(" + m_property + "=" + ss.str() + ")");
90  }
92 
94  operator LDAPPropExpr () const;
95 
101  LDAPPropExpr operator!() const;
102 
121  LDAPPropExpr operator!=(const std::string& s) const;
122  LDAPPropExpr operator!=(const us::Any& s) const;
123  template<class T>
124  LDAPPropExpr operator!=(const T& s) const
125  {
126  std::stringstream ss;
127  ss << s;
128  return operator!=(ss.str());
129  }
131 
140  LDAPPropExpr operator>=(const std::string& s) const;
141  LDAPPropExpr operator>=(const us::Any& s) const;
142  template<class T>
143  LDAPPropExpr operator>=(const T& s) const
144  {
145  std::stringstream ss;
146  ss << s;
147  return operator>=(ss.str());
148  }
150 
159  LDAPPropExpr operator<=(const std::string& s) const;
160  LDAPPropExpr operator<=(const us::Any& s) const;
161  template<class T>
162  LDAPPropExpr operator<=(const T& s) const
163  {
164  std::stringstream ss;
165  ss << s;
166  return operator<=(ss.str());
167  }
169 
178  LDAPPropExpr Approx(const std::string& s) const;
179  LDAPPropExpr Approx(const us::Any& s) const;
180  template<class T>
181  LDAPPropExpr Approx(const T& s) const
182  {
183  std::stringstream ss;
184  ss << s;
185  return Approx(ss.str());
186  }
188 
189 private:
190 
191  LDAPProp& operator=(const LDAPProp&);
192 
193  std::string m_property;
194 };
195 
196 }
197 
207 MITKCPPMICROSERVICES_EXPORT us::LDAPPropExpr operator&&(const us::LDAPPropExpr& left, const us::LDAPPropExpr& right);
208 
218 MITKCPPMICROSERVICES_EXPORT us::LDAPPropExpr operator||(const us::LDAPPropExpr& left, const us::LDAPPropExpr& right);
219 
220 #endif // USLDAPPROP_H
#define MITKCPPMICROSERVICES_EXPORT
An Any class represents a general type and is capable of storing any type, supporting type-safe extra...
Definition: usAny.h:145
A fluent API for creating LDAP filter strings.
Definition: usLDAPProp.h:64
LDAPPropExpr operator>=(const std::string &s) const
LDAP greater or equal '>='.
LDAPPropExpr Approx(const us::Any &s) const
LDAP approximation '~='.
LDAPPropExpr operator<=(const us::Any &s) const
LDAP less or equal '<='.
LDAPPropExpr operator!=(const std::string &s) const
Convenience operator for LDAP inequality.
LDAPPropExpr Approx(const std::string &s) const
LDAP approximation '~='.
LDAPPropExpr operator<=(const std::string &s) const
LDAP less or equal '<='.
LDAPPropExpr operator!=(const us::Any &s) const
Convenience operator for LDAP inequality.
LDAPPropExpr operator>=(const us::Any &s) const
LDAP greater or equal '>='.
LDAPPropExpr operator!=(const T &s) const
Convenience operator for LDAP inequality.
Definition: usLDAPProp.h:124
LDAPPropExpr operator<=(const T &s) const
LDAP less or equal '<='.
Definition: usLDAPProp.h:162
LDAPPropExpr operator!() const
States the absence of the LDAP property.
LDAPPropExpr operator==(const T &s) const
LDAP equality '='.
Definition: usLDAPProp.h:85
LDAPPropExpr operator==(const std::string &s) const
LDAP equality '='.
LDAPProp(const std::string &property)
Create a LDAPProp instance for the named LDAP property.
LDAPPropExpr operator>=(const T &s) const
LDAP greater or equal '>='.
Definition: usLDAPProp.h:143
LDAPPropExpr operator==(const us::Any &s) const
LDAP equality '='.
LDAPPropExpr Approx(const T &s) const
LDAP approximation '~='.
Definition: usLDAPProp.h:181
MITKCPPMICROSERVICES_EXPORT us::LDAPPropExpr operator&&(const us::LDAPPropExpr &left, const us::LDAPPropExpr &right)
LDAP logical and '&'.
MITKCPPMICROSERVICES_EXPORT us::LDAPPropExpr operator||(const us::LDAPPropExpr &left, const us::LDAPPropExpr &right)
LDAP logical or '|'.
MITKCORE_EXPORT bool operator!=(const InteractionEvent &a, const InteractionEvent &b)