KLDAPCore::Ldif Class
| Header: | #include <ldif.h> |
| CMake: | find_package(KPim6LdapCore REQUIRED)target_link_libraries(mytarget PRIVATE KPim6::LdapCore) |
Public Functions
| QString | attr() const |
| bool | delOldRdn() const |
| KLDAPCore::LdapDN | dn() const |
| void | endLdif() |
| KLDAPCore::Ldif::EntryType | entryType() const |
| bool | isCritical() const |
| bool | isUrl() const |
| uint | lineNumber() const |
| int | modType() const |
| QString | newRdn() const |
| QString | newSuperior() const |
| KLDAPCore::Ldif::ParseValue | nextItem() |
| QString | oid() const |
| KLDAPCore::Ldif::ParseValue | processLine() |
| void | setLdif(const QByteArray &ldif) |
| void | startParsing() |
| QByteArray | value() const |
Static Public Members
| QByteArray | assembleLine(const QString &fieldname, const QByteArray &value, uint linelen = 0, bool url = false) |
| QByteArray | assembleLine(const QString &fieldname, const QString &value, uint linelen = 0, bool url = false) |
| bool | splitControl(const QByteArray &line, QString &oid, bool &critical, QByteArray &value) |
| 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.
Member Function Documentation
[static] QByteArray Ldif::assembleLine(const QString &fieldname, const QByteArray &value, uint linelen = 0, bool url = false)
Assembles fieldname and value into a valid Ldif line, BASE64 encodes the value if necessary and optionally splits into more lines. 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 :< ).
[static] QByteArray Ldif::assembleLine(const QString &fieldname, const QString &value, uint linelen = 0, bool url = false)
This is the same as the above function, the only difference that this accepts QString as the value.
QString Ldif::attr() const
Returns the attribute name.
bool Ldif::delOldRdn() const
Returns if the delete of the old RDN is required.
KLDAPCore::LdapDN Ldif::dn() const
Returns the Distinguished Name of the current entry.
void Ldif::endLdif()
Indicates the end of the Ldif file/stream. Call if nextItem() returned MoreData, but actually you don't have more data.
KLDAPCore::Ldif::EntryType Ldif::entryType() const
Returns the requested LDAP operation extracted from the current entry.
bool Ldif::isCritical() const
Returns the criticality level when modType() returned Control.
bool Ldif::isUrl() const
Returns if val() is an url
uint Ldif::lineNumber() const
Returns the line number which the parser processes.
int Ldif::modType() const
Returns the LDAP modify request type if entryType() returned Entry_Mod.
QString Ldif::newRdn() const
Returns the new Relative Distinguished Name if modType() returned Entry_Modrdn.
QString Ldif::newSuperior() const
Returns the new parent of the entry if modType() returned Entry_Modrdn.
KLDAPCore::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.
QString Ldif::oid() const
Returns the OID when modType() returned Control.
KLDAPCore::Ldif::ParseValue Ldif::processLine()
Process one Ldif line
void Ldif::setLdif(const QByteArray &ldif)
Sets a chunk of Ldif. Call before startParsing(), or if nextItem() returned MoreData. ldif the Ldif chunk to set
[static] bool Ldif::splitControl(const QByteArray &line, QString &oid, bool &critical, QByteArray &value)
Splits a control specification (without the "control:" directive) line is the control directive oid will contain the OID critical will contain the criticality of control value is the control value
[static] bool Ldif::splitLine(const QByteArray &line, QString &fieldname, QByteArray &value)
Splits one line from an Ldif file to attribute and value components. Returns true if value is an URL, false otherwise
void Ldif::startParsing()
Starts the parsing of a new Ldif
QByteArray Ldif::value() const
Returns the attribute value.