ldapurl.h

00001 /*
00002     This file is part of libkabc.
00003     Copyright (c) 2004 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 _K_LDAPURL_H_
00022 #define _K_LDAPURL_H_
00023 
00024 #include <qstring.h>
00025 #include <qstringlist.h>
00026 #include <qmap.h>
00027 
00028 #include <kurl.h>
00029 
00030 namespace KABC {
00031 
00042   class KABC_EXPORT LDAPUrl : public KURL
00043   {
00044   public:
00045 
00046     struct Extension {
00047       QString value;
00048       bool critical;
00049     };
00050     
00051     typedef enum Scope { Base, One, Sub };
00052 
00054     LDAPUrl();
00056     LDAPUrl( const KURL &url );
00057   
00062     const QString& dn() const { return m_dn; };
00064     void setDn( const QString &dn );
00065 
00067     const QStringList &attributes() { return m_attributes; }
00069     void setAttributes( const QStringList &attributes ) 
00070       { m_attributes=attributes; updateQuery(); }
00071 
00073     Scope scope() const { return m_scope; };
00075     void setScope(Scope scope) { m_scope = scope; updateQuery(); }
00076 
00078     const QString &filter() const { return m_filter; }
00080     void setFilter( QString filter ) { m_filter = filter; updateQuery(); }
00081 
00083     bool hasExtension( const QString &key ) const;
00085     Extension extension( const QString &key ) const;
00087     QString extension( const QString &key, bool &critical ) const;
00089     void setExtension( const QString &key, const Extension &ext );
00091     void setExtension( const QString &key, const QString &value, bool critical = false );
00093     void removeExtension( const QString &key );
00095     void updateQuery();
00096     
00097   protected:
00098     void parseQuery();
00099 
00100   private:
00101 
00102     QMap<QString, Extension> m_extensions;
00103     QString m_dn;
00104     QStringList m_attributes;
00105     Scope m_scope;
00106     QString m_filter;
00107   };
00108 }
00109 
00110 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys