KLdap

ldapcontrol.h
1/*
2 This file is part of libkldap.
3 SPDX-FileCopyrightText: 2004-2006 Szombathelyi György <gyurco@freemail.hu>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#pragma once
9
10#include <QList>
11#include <QSharedDataPointer>
12#include <QString>
13class LdapControlPrivate;
14
15#include "kldap_core_export.h"
16
17// clazy:excludeall=copyable-polymorphic
18
19namespace KLDAPCore
20{
21class LdapControl;
22using LdapControls = QList<LdapControl>;
23
24/**
25 @brief
26 This class represents an LDAP Control
27*/
28class KLDAP_CORE_EXPORT LdapControl
29{
30public:
31 /**
32 * Creates an empty control.
33 */
35 /**
36 * Creates a control with the given OID, value and criticality.
37 */
38 LdapControl(const QString &oid, const QByteArray &value, bool critical = false);
39
40 LdapControl(const LdapControl &that);
41 LdapControl &operator=(const LdapControl &that);
42 /**
43 * Destroys the control object.
44 */
46 /**
47 * Sets the control's OID, value and criticality.
48 */
49 void setControl(const QString &oid, const QByteArray &value, bool critical = false);
50 /**
51 * Sets the control's OID.
52 */
53 void setOid(const QString &oid);
54 /**
55 * Sets the control's value.
56 */
57 void setValue(const QByteArray &value);
58 /**
59 * Sets the control's criticality.
60 */
61 void setCritical(bool critical);
62 /**
63 * Returns the control's OID.
64 */
65 [[nodiscard]] QString oid() const;
66 /**
67 * Returns the control's value.
68 */
69 [[nodiscard]] QByteArray value() const;
70 /**
71 * Returns the control's criticality.
72 */
73 [[nodiscard]] bool critical() const;
74
75 /**
76 * Parses a paging results control, which the server returned.
77 * Puts the server's cookie into @p cookie, and returns the estimated
78 * result set size. If the OID is not the page control's OID, or the
79 * value cannot be decoded, returns -1.
80 * @param cookie the cookie to hold server's cookie
81 */
82 [[nodiscard]] int parsePageControl(QByteArray &cookie) const;
83 /**
84 * Creates a paging search control.
85 */
86 [[nodiscard]] static LdapControl createPageControl(int pagesize, const QByteArray &cookie = QByteArray());
87
88 /**
89 * Inserts a unique control against a list of controls.
90 * If the control already exists in the list is is updated, otherwise
91 * it is appended to the list.
92 * @param list the current list of controls
93 * @param ctrl the control to insert
94 * @since 4.4
95 */
96 static void insert(LdapControls &list, const LdapControl &ctrl);
97
98private:
100};
101}
This class represents an LDAP Control.
Definition ldapcontrol.h:29
~LdapControl()
Destroys the control object.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:34:09 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.