libkdepim Library API Documentation

ldif.h

00001 /*
00002     This file is part of libkabc.
00003     Copyright (c) 2004 Szombathelyi Gyorgy <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., 59 Temple Place - Suite 330,
00018     Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef _KPIM_LDIF_H_
00022 #define _KPIM_LDIF_H_
00023 
00024 #include <qstring.h>
00025 #include <qcstring.h>
00026 #include <qmemarray.h>
00027 
00028 namespace KPIM {
00029 
00038   class LDIF 
00039   {
00040   public:
00041 
00042     typedef enum ParseVal{ None, NewEntry, EndEntry, Item, Control, Err, MoreData };
00043     typedef enum EntryType{ Entry_None, Entry_Add, Entry_Del, Entry_Mod, Entry_Modrdn };
00044     typedef enum ModType{ Mod_None, Mod_Add, Mod_Replace, Mod_Del };
00045     LDIF();
00046     virtual ~LDIF();
00047     
00056     static QCString assembleLine( const QString &fieldname, 
00057       const QByteArray &value, uint linelen=0, bool url=false );
00062     static QCString assembleLine( const QString &fieldname, 
00063       const QCString &value, uint linelen=0, bool url=false );
00068     static QCString assembleLine( const QString &fieldname, 
00069       const QString &value, uint linelen=0, bool url=false );
00070       
00075     static bool splitLine( const QCString &line, QString &fieldname, QByteArray &value );
00083     static bool splitControl( const QCString &line, QString &oid, bool &critical,
00084       QByteArray &value );
00088     void startParsing();
00092     ParseVal processLine();
00104     ParseVal nextItem();
00109     void setLDIF( const QByteArray &ldif ) { mLdif = ldif; mPos = 0; };
00114     void endLDIF();
00118     EntryType entryType() const { return mEntryType; }
00122     int modType() const { return mModType; }
00126     const QString& dn() const { return mDn; }
00130     const QString& newRdn() const { return mNewRdn; }
00134     const QString& newSuperior() const { return mNewSuperior; }
00138     bool delOldRdn() const { return mDelOldRdn; }
00142     const QString& attr() const { return mAttr; }
00146     const QByteArray& val() const { return mVal; }
00150     bool isUrl() const { return mUrl; }
00154     bool critical() const { return mCritical; }
00158     const QString& oid() const { return mOid; }
00162     uint lineNo() const { return mLineNo; }
00163   private:
00164     int mModType;
00165     bool mDelOldRdn, mUrl;
00166     QString mDn,mAttr,mNewRdn,mNewSuperior, mOid;
00167     QByteArray mLdif, mVal;
00168     EntryType mEntryType;
00169     
00170     bool mIsNewLine, mIsComment,mCritical;
00171     ParseVal mLastParseVal;
00172     uint mPos,mLineNo;  
00173     QCString line;
00174         
00175     class LDIFPrivate;
00176     LDIFPrivate *d;
00177   };
00178 }
00179 
00180 #endif
KDE Logo
This file is part of the documentation for libkdepim Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Apr 4 04:46:33 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003