KLDAPCore::Ldif

Search for usage in LXR

#include <ldif.h>

Public Types

using EntryType
 
using ModType
 
using ParseValue
 

Public Member Functions

 Ldif (const Ldif &that)
 
QString attr () const
 
bool delOldRdn () const
 
LdapDN dn () const
 
void endLdif ()
 
EntryType entryType () const
 
bool isCritical () const
 
bool isUrl () const
 
uint lineNumber () const
 
int modType () const
 
QString newRdn () const
 
QString newSuperior () const
 
ParseValue nextItem ()
 
QString oid () const
 
Ldifoperator= (const Ldif &that)
 
ParseValue processLine ()
 
void setLdif (const QByteArray &ldif)
 
void startParsing ()
 
QByteArray value () const
 

Static Public Member Functions

static QByteArray assembleLine (const QString &fieldname, const QByteArray &value, uint linelen=0, bool url=false)
 
static QByteArray assembleLine (const QString &fieldname, const QString &value, uint linelen=0, bool url=false)
 
static bool splitControl (const QByteArray &line, QString &oid, bool &critical, QByteArray &value)
 
static bool splitLine (const QByteArray &line, QString &fieldname, QByteArray &value)
 

Detailed Description

Ldif.

Ldif implements an RFC 2849 compliant Ldif parser. Ldif files are used to represent directory information on LDAP-based servers, or to describe a set of changes which are to be applied to a directory.

Definition at line 28 of file ldif.h.

Member Typedef Documentation

◆ EntryType

using KLDAPCore::Ldif::EntryType
Initial value:
enum {
Entry_None,
Entry_Add,
Entry_Del,
Entry_Mod,
Entry_Modrdn
}

Definition at line 41 of file ldif.h.

◆ ModType

using KLDAPCore::Ldif::ModType
Initial value:
enum {
Mod_None,
Mod_Add,
Mod_Replace,
Mod_Del
}

Definition at line 49 of file ldif.h.

◆ ParseValue

using KLDAPCore::Ldif::ParseValue
Initial value:
enum {
None,
NewEntry,
EndEntry,
Control,
Err,
MoreData
}

Definition at line 31 of file ldif.h.

Constructor & Destructor Documentation

◆ Ldif() [1/2]

Ldif::Ldif ( )

Definition at line 30 of file ldif.cpp.

◆ Ldif() [2/2]

Ldif::Ldif ( const Ldif & that)

Definition at line 36 of file ldif.cpp.

Member Function Documentation

◆ assembleLine() [1/2]

QByteArray Ldif::assembleLine ( const QString & fieldname,
const QByteArray & value,
uint linelen = 0,
bool url = false )
staticnodiscard

Assembles fieldname and value into a valid Ldif line, BASE64 encodes the value if necessary and optionally splits into more lines.

Parameters
fieldnameThe name of the entry.
valueThe value of the entry.
linelenMaximum length of the lines in the result.
urlIf true, encode value as url ( use :< ).

Definition at line 57 of file ldif.cpp.

◆ assembleLine() [2/2]

QByteArray Ldif::assembleLine ( const QString & fieldname,
const QString & value,
uint linelen = 0,
bool url = false )
staticnodiscard

This is the same as the above function, the only difference that this accepts QString as the value.

Definition at line 103 of file ldif.cpp.

◆ attr()

QString Ldif::attr ( ) const
nodiscard

Returns the attribute name.

Definition at line 401 of file ldif.cpp.

◆ delOldRdn()

bool Ldif::delOldRdn ( ) const
nodiscard

Returns if the delete of the old RDN is required.

Definition at line 396 of file ldif.cpp.

◆ dn()

LdapDN Ldif::dn ( ) const
nodiscard

Returns the Distinguished Name of the current entry.

Definition at line 381 of file ldif.cpp.

◆ endLdif()

void Ldif::endLdif ( )

Indicates the end of the Ldif file/stream.

Call if nextItem() returned MoreData, but actually you don't have more data.

Definition at line 343 of file ldif.cpp.

◆ entryType()

Ldif::EntryType Ldif::entryType ( ) const
nodiscard

Returns the requested LDAP operation extracted from the current entry.

Definition at line 371 of file ldif.cpp.

◆ isCritical()

bool Ldif::isCritical ( ) const
nodiscard

Returns the criticality level when modType() returned Control.

Definition at line 416 of file ldif.cpp.

◆ isUrl()

bool Ldif::isUrl ( ) const
nodiscard

Returns if val() is an url.

Definition at line 411 of file ldif.cpp.

◆ lineNumber()

uint Ldif::lineNumber ( ) const
nodiscard

Returns the line number which the parser processes.

Definition at line 426 of file ldif.cpp.

◆ modType()

int Ldif::modType ( ) const
nodiscard

Returns the LDAP modify request type if entryType() returned Entry_Mod.

Definition at line 376 of file ldif.cpp.

◆ newRdn()

QString Ldif::newRdn ( ) const
nodiscard

Returns the new Relative Distinguished Name if modType() returned Entry_Modrdn.

Definition at line 386 of file ldif.cpp.

◆ newSuperior()

QString Ldif::newSuperior ( ) const
nodiscard

Returns the new parent of the entry if modType() returned Entry_Modrdn.

Definition at line 391 of file ldif.cpp.

◆ nextItem()

Ldif::ParseValue Ldif::nextItem ( )
nodiscard

Process the Ldif until a complete item can be returned.

Returns
NewEntry if a new DN encountered, Item if a new item returned, Err if the Ldif contains error, EndEntry if the parser reached the end of the current entry and MoreData if the parser encountered the end of the current chunk of the Ldif.

If you want to finish the parsing after receiving MoreData, then call endLdif(), so the parser can safely flush the current entry.

Definition at line 303 of file ldif.cpp.

◆ oid()

QString Ldif::oid ( ) const
nodiscard

Returns the OID when modType() returned Control.

Definition at line 421 of file ldif.cpp.

◆ operator=()

Ldif & Ldif::operator= ( const Ldif & that)

Definition at line 44 of file ldif.cpp.

◆ processLine()

Ldif::ParseValue Ldif::processLine ( )
nodiscard

Process one Ldif line.

Definition at line 177 of file ldif.cpp.

◆ setLdif()

void Ldif::setLdif ( const QByteArray & ldif)

Sets a chunk of Ldif.

Call before startParsing(), or if nextItem() returned MoreData.

Parameters
ldifthe Ldif chunk to set

Definition at line 365 of file ldif.cpp.

◆ splitControl()

bool Ldif::splitControl ( const QByteArray & line,
QString & oid,
bool & critical,
QByteArray & value )
static

Splits a control specification (without the "control:" directive)

Parameters
lineis the control directive
oidwill contain the OID
criticalwill contain the criticality of control
valueis the control value

Definition at line 155 of file ldif.cpp.

◆ splitLine()

bool Ldif::splitLine ( const QByteArray & line,
QString & fieldname,
QByteArray & value )
staticnodiscard

Splits one line from an Ldif file to attribute and value components.

Returns
true if value is an URL, false otherwise

Definition at line 108 of file ldif.cpp.

◆ startParsing()

void Ldif::startParsing ( )

Starts the parsing of a new Ldif.

Definition at line 350 of file ldif.cpp.

◆ value()

QByteArray Ldif::value ( ) const
nodiscard

Returns the attribute value.

Definition at line 406 of file ldif.cpp.


The documentation for this class was generated from the following files:
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.