• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

KLDAP Library

  • KLDAP
  • Ldif
Public Types | Public Member Functions | Static Public Member Functions | List of all members
KLDAP::Ldif Class Reference

#include <ldif.h>

Public Types

enum  EntryType {
  Entry_None, Entry_Add, Entry_Del, Entry_Mod,
  Entry_Modrdn
}
 
enum  ModType { Mod_None, Mod_Add, Mod_Replace, Mod_Del }
 
enum  ParseValue {
  None, NewEntry, EndEntry, Item,
  Control, Err, MoreData
}
 

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
 
Ldif & operator= (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 40 of file ldif.h.

Member Function Documentation

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

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 71 of file ldif.cpp.

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

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

Definition at line 121 of file ldif.cpp.

QString Ldif::attr ( ) const

Returns the attribute name.

Definition at line 423 of file ldif.cpp.

bool Ldif::delOldRdn ( ) const

Returns if the delete of the old RDN is required.

Definition at line 418 of file ldif.cpp.

LdapDN Ldif::dn ( ) const

Returns the Distinguished Name of the current entry.

Definition at line 403 of file ldif.cpp.

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 365 of file ldif.cpp.

Ldif::EntryType Ldif::entryType ( ) const

Returns the requested LDAP operation extracted from the current entry.

Definition at line 393 of file ldif.cpp.

bool Ldif::isCritical ( ) const

Returns the criticality level when modType() returned Control.

Definition at line 438 of file ldif.cpp.

bool Ldif::isUrl ( ) const

Returns if val() is an url.

Definition at line 433 of file ldif.cpp.

uint Ldif::lineNumber ( ) const

Returns the line number which the parser processes.

Definition at line 448 of file ldif.cpp.

int Ldif::modType ( ) const

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

Definition at line 398 of file ldif.cpp.

QString Ldif::newRdn ( ) const

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

Definition at line 408 of file ldif.cpp.

QString Ldif::newSuperior ( ) const

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

Definition at line 413 of file ldif.cpp.

Ldif::ParseValue Ldif::nextItem ( )

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 325 of file ldif.cpp.

QString Ldif::oid ( ) const

Returns the OID when modType() returned Control.

Definition at line 443 of file ldif.cpp.

Ldif::ParseValue Ldif::processLine ( )

Process one Ldif line.

Definition at line 198 of file ldif.cpp.

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 387 of file ldif.cpp.

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 175 of file ldif.cpp.

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

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

Returns
true if value is an URL, false otherwise

Definition at line 127 of file ldif.cpp.

void Ldif::startParsing ( )

Starts the parsing of a new Ldif.

Definition at line 372 of file ldif.cpp.

QByteArray Ldif::value ( ) const

Returns the attribute value.

Definition at line 428 of file ldif.cpp.


The documentation for this class was generated from the following files:
  • ldif.h
  • ldif.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:37:58 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KLDAP Library

Skip menu "KLDAP Library"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal