KABC::LDIF Class Reference

`#include <ldif.h>`

## 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 QString & | dn () const
const QString & | newRdn () const
const QString & | newSuperior () const
bool | delOldRdn () const
const QString & | attr () const
const QByteArray & | val () const
bool | isUrl () const
bool | critical () const
const QString & | oid () const
uint | lineNo () const

## Static Public Member Functions

static QCString | assembleLine (const QString &fieldname, const QByteArray &value, uint linelen=0, bool url=false)
static QCString | assembleLine (const QString &fieldname, const QCString &value, uint linelen=0, bool url=false)
static QCString | assembleLine (const QString &fieldname, const QString &value, uint linelen=0, bool url=false)
static bool | splitLine (const QCString &line, QString &fieldname, QByteArray &value)
static 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 40 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.

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.

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

const QString& KABC::LDIF::attr | ( |  | ) | const

inline

Returns the attribute name.

Definition at line 144 of file ldif.h.

bool KABC::LDIF::critical | ( |  | ) | const

inline

Returns the criticality level when modType() returned Control.

Definition at line 156 of file ldif.h.

bool KABC::LDIF::delOldRdn | ( |  | ) | const

inline

Returns if the delete of the old RDN is required.

Definition at line 140 of file ldif.h.

const QString& KABC::LDIF::dn | ( |  | ) | const

inline

Returns the Distinguished Name of the current entry.

Definition at line 128 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 344 of file ldif.cpp.

EntryType KABC::LDIF::entryType | ( |  | ) | const

inline

Returns the requested LDAP operation extracted from the current entry.

Definition at line 120 of file ldif.h.

bool KABC::LDIF::isUrl | ( |  | ) | const

inline

Returns if val() is an url.

Definition at line 152 of file ldif.h.

uint KABC::LDIF::lineNo | ( |  | ) | const

inline

Returns the line number which the parser processes.

Definition at line 164 of file ldif.h.

int KABC::LDIF::modType | ( |  | ) | const

inline

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

Definition at line 124 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 132 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 136 of file ldif.h.

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

const QString& KABC::LDIF::oid | ( |  | ) | const

inline

Returns the OID when modType() returned Control.

Definition at line 160 of file ldif.h.

LDIF::ParseVal LDIF::processLine | ( |  | ) |

Process one LDIF line.

Definition at line 197 of file ldif.cpp.

void KABC::LDIF::setLDIF | ( | const QByteArray & | ldif | ) |

inline

Sets a chunk of LDIF.

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

Definition at line 111 of file ldif.h.

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
  oid | will contain the OID
  critical | will contain the criticality of control
  value | is the control value

Definition at line 174 of file ldif.cpp.

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

void LDIF::startParsing | ( |  | ) |

Starts the parsing of a new LDIF.

Definition at line 354 of file ldif.cpp.

const QByteArray& KABC::LDIF::val | ( |  | ) | const

inline

Returns the attribute value.

Definition at line 148 of file ldif.h.

The documentation for this class was generated from the following files:

- ldif.h
- ldif.cpp

KDE Home | KDE Accessibility Home | Description of Access Keys