kabc Library API Documentation

KABC::LDIF Class Reference

LDIF. More...

#include <ldif.h>

List of all members.

Public Types

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

Public Member Functions

void startParsing ()
ParseVal processLine ()
ParseVal nextItem ()
void setLDIF (const QByteArray &ldif)
void endLDIF ()
EntryType entryType () const
int modType () const
const QStringdn () const
const QStringnewRdn () const
const QStringnewSuperior () const
bool delOldRdn () const
const QStringattr () const
const QByteArrayval () const
bool isUrl () const
bool critical () const
const QStringoid () const
uint lineNo () const

Static Public Member Functions

QCString assembleLine (const QString &fieldname, const QByteArray &value, uint linelen=0, bool url=false)
QCString assembleLine (const QString &fieldname, const QCString &value, uint linelen=0, bool url=false)
QCString assembleLine (const QString &fieldname, const QString &value, uint linelen=0, bool url=false)
bool splitLine (const QCString &line, QString &fieldname, QByteArray &value)
bool splitControl (const QCString &line, QString &oid, bool &critical, 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 38 of file ldif.h.


Member Function Documentation

QCString 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 neccessary and optionally splits into more lines.

Parameters:
fieldname The name of the entry.
value The value of the entry.
linelen Maximum length of the lines in the result.
url If true, encode value as url ( use :< ).
Definition at line 37 of file ldif.cpp.

References KCodecs::base64Encode().

Referenced by assembleLine().

QCString LDIF::assembleLine const QString fieldname,
const QCString value,
uint  linelen = 0,
bool  url = false
[static]
 

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

Definition at line 85 of file ldif.cpp.

References assembleLine().

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

References assembleLine().

bool LDIF::splitLine const QCString 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 104 of file ldif.cpp.

References KCodecs::base64Decode().

Referenced by processLine(), and splitControl().

bool LDIF::splitControl const QCString line,
QString oid,
bool &  critical,
QByteArray value
[static]
 

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

Parameters:
line is the control directive will contain the OID will contain the criticality of control is the control value
Definition at line 167 of file ldif.cpp.

References endl(), kdDebug(), and splitLine().

Referenced by processLine().

void LDIF::startParsing  ) 
 

Starts the parsing of a new LDIF.

Definition at line 346 of file ldif.cpp.

LDIF::ParseVal LDIF::processLine  ) 
 

Process one LDIF line.

Definition at line 190 of file ldif.cpp.

References endl(), kdDebug(), splitControl(), and splitLine().

Referenced by nextItem().

LDIF::ParseVal 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 301 of file ldif.cpp.

References processLine().

void KABC::LDIF::setLDIF const QByteArray ldif  )  [inline]
 

Sets a chunk of LDIF.

Call before startParsing(), or if nextItem() returned MoreData. Definition at line 109 of file ldif.h.

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

EntryType KABC::LDIF::entryType  )  const [inline]
 

Returns the requested LDAP operation extracted from the current entry.

Definition at line 118 of file ldif.h.

int KABC::LDIF::modType  )  const [inline]
 

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

Definition at line 122 of file ldif.h.

const QString& KABC::LDIF::dn  )  const [inline]
 

Returns the Distinguished Name of the current entry.

Definition at line 126 of file ldif.h.

const QString& KABC::LDIF::newRdn  )  const [inline]
 

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

Definition at line 130 of file ldif.h.

const QString& KABC::LDIF::newSuperior  )  const [inline]
 

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

Definition at line 134 of file ldif.h.

bool KABC::LDIF::delOldRdn  )  const [inline]
 

Returns if the delete of the old RDN is required.

Definition at line 138 of file ldif.h.

const QString& KABC::LDIF::attr  )  const [inline]
 

Returns the attribute name.

Definition at line 142 of file ldif.h.

const QByteArray& KABC::LDIF::val  )  const [inline]
 

Returns the attribute value.

Definition at line 146 of file ldif.h.

bool KABC::LDIF::isUrl  )  const [inline]
 

Returns if val() is an url.

Definition at line 150 of file ldif.h.

bool KABC::LDIF::critical  )  const [inline]
 

Returns the criticality level when modType() returned Control.

Definition at line 154 of file ldif.h.

const QString& KABC::LDIF::oid  )  const [inline]
 

Returns the OID when modType() returned Control.

Definition at line 158 of file ldif.h.

uint KABC::LDIF::lineNo  )  const [inline]
 

Returns the line number which the parser processes.

Definition at line 162 of file ldif.h.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kabc Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:44:38 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003