00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KLDAP_LDIF_H
00022 #define KLDAP_LDIF_H
00023
00024 #include <QtCore/QString>
00025 #include <QtCore/QByteArray>
00026
00027 #include "ldapdn.h"
00028 #include "kldap_export.h"
00029
00030 namespace KLDAP {
00031
00040 class KLDAP_EXPORT Ldif
00041 {
00042 public:
00043
00044 typedef enum {
00045 None, NewEntry, EndEntry, Item, Control, Err, MoreData
00046 } ParseValue;
00047
00048 typedef enum {
00049 Entry_None, Entry_Add, Entry_Del, Entry_Mod, Entry_Modrdn
00050 } EntryType;
00051
00052 typedef enum {
00053 Mod_None, Mod_Add, Mod_Replace, Mod_Del
00054 } ModType;
00055
00056 Ldif();
00057
00058 Ldif( const Ldif &that );
00059 Ldif &operator=( const Ldif &that );
00060
00061 virtual ~Ldif();
00062
00071 static QByteArray assembleLine( const QString &fieldname,
00072 const QByteArray &value, uint linelen=0,
00073 bool url=false );
00078 static QByteArray assembleLine( const QString &fieldname,
00079 const QString &value, uint linelen=0,
00080 bool url=false );
00081
00086 static bool splitLine( const QByteArray &line, QString &fieldname,
00087 QByteArray &value );
00088
00096 static bool splitControl( const QByteArray &line, QString &oid,
00097 bool &critical, QByteArray &value );
00098
00102 void startParsing();
00103
00107 ParseValue processLine();
00108
00119 ParseValue nextItem();
00120
00125 void setLdif( const QByteArray &ldif );
00126
00131 void endLdif();
00132
00136 EntryType entryType() const;
00137
00141 int modType() const;
00142
00146 LdapDN dn() const;
00147
00152 QString newRdn() const;
00153
00157 QString newSuperior() const;
00158
00162 bool delOldRdn() const;
00163
00167 QString attr() const;
00168
00172 QByteArray value() const;
00173
00177 bool isUrl() const;
00178
00182 bool isCritical() const;
00183
00187 QString oid() const;
00188
00192 uint lineNumber() const;
00193
00194 private:
00195 class LdifPrivate;
00196 LdifPrivate *const d;
00197 };
00198
00199 }
00200
00201 #endif