ldif.h
/*
This file is part of libkabc.
Copyright (c) 2004 Szombathelyi Gyorgy <gyurco@freemail.hu>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _K_LDIF_H_
#define _K_LDIF_H_
#include <qstring.h>
#include <qcstring.h>
#include <qmemarray.h>
#include <kdelibs_export.h>
namespace KABC {
class KABC_EXPORT LDIF
{
public:
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 };
LDIF();
virtual ~LDIF();
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 );
void startParsing();
ParseVal processLine();
ParseVal nextItem();
void setLDIF( const QByteArray &ldif ) { mLdif = ldif; mPos = 0; }
void endLDIF();
EntryType entryType() const { return mEntryType; }
int modType() const { return mModType; }
const QString& dn() const { return mDn; }
const QString& newRdn() const { return mNewRdn; }
const QString& newSuperior() const { return mNewSuperior; }
bool delOldRdn() const { return mDelOldRdn; }
const QString& attr() const { return mAttr; }
const QByteArray& val() const { return mVal; }
bool isUrl() const { return mUrl; }
bool critical() const { return mCritical; }
const QString& oid() const { return mOid; }
uint lineNo() const { return mLineNo; }
private:
int mModType;
bool mDelOldRdn, mUrl;
QString mDn,mAttr,mNewRdn,mNewSuperior, mOid;
QByteArray mLdif, mVal;
EntryType mEntryType;
bool mIsNewLine, mIsComment,mCritical;
ParseVal mLastParseVal;
uint mPos,mLineNo;
QCString line;
class LDIFPrivate;
LDIFPrivate *d;
};
}
#endif
KABC::LDIF::dn
const QString & dn() const
Returns the Distinguished Name of the current entry.
Definition: ldif.h:128
KABC::LDIF::delOldRdn
bool delOldRdn() const
Returns if the delete of the old RDN is required.
Definition: ldif.h:140
KABC::LDIF::critical
bool critical() const
Returns the criticality level when modType() returned Control.
Definition: ldif.h:156
KABC::LDIF::isUrl
bool isUrl() const
Returns if val() is an url.
Definition: ldif.h:152
KABC::LDIF::entryType
EntryType entryType() const
Returns the requested LDAP operation extracted from the current entry.
Definition: ldif.h:120
KABC::LDIF
LDIF.
Definition: ldif.h:40
KABC::LDIF::setLDIF
void setLDIF(const QByteArray &ldif)
Sets a chunk of LDIF.
Definition: ldif.h:111
KABC::LDIF::val
const QByteArray & val() const
Returns the attribute value.
Definition: ldif.h:148
KABC::LDIF::lineNo
uint lineNo() const
Returns the line number which the parser processes.
Definition: ldif.h:164
KABC::LDIF::modType
int modType() const
Returns the LDAP modify request type if entryType() returned Entry_Mod.
Definition: ldif.h:124
KABC::LDIF::newSuperior
const QString & newSuperior() const
Returns the new parent of the entry if modType() returned Entry_Modrdn.
Definition: ldif.h:136
KABC::LDIF::attr
const QString & attr() const
Returns the attribute name.
Definition: ldif.h:144
KABC::LDIF::oid
const QString & oid() const
Returns the OID when modType() returned Control.
Definition: ldif.h:160
KABC::LDIF::newRdn
const QString & newRdn() const
Returns the new Relative Distinguished Name if modType() returned Entry_Modrdn.
Definition: ldif.h:132

KDE Home | KDE Accessibility Home | Description of Access Keys