ldif.h
00001 /* 00002 This file is part of libkldap. 00003 Copyright (c) 2004-2006 Szombathelyi György <gyurco@freemail.hu> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 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