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 <tqstring.h> 00025 #include <tqstringlist.h> 00026 #include <tqmap.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 TQString value; 00048 bool critical; 00049 }; 00050 00051 enum Scope { Base, One, Sub }; 00052 00054 LDAPUrl(); 00056 LDAPUrl( const KURL &url ); 00057 00062 const TQString& dn() const { return m_dn; } 00064 void setDn( const TQString &dn ); 00065 00067 const TQStringList &attributes() { return m_attributes; } 00069 void setAttributes( const TQStringList &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 TQString &filter() const { return m_filter; } 00080 void setFilter( TQString filter ) { m_filter = filter; updateQuery(); } 00081 00083 bool hasExtension( const TQString &key ) const; 00085 Extension extension( const TQString &key ) const; 00087 TQString extension( const TQString &key, bool &critical ) const; 00089 void setExtension( const TQString &key, const Extension &ext ); 00091 void setExtension( const TQString &key, const TQString &value, bool critical = false ); 00093 void removeExtension( const TQString &key ); 00095 void updateQuery(); 00096 00097 protected: 00098 void parseQuery(); 00099 00100 private: 00101 00102 TQMap<TQString, Extension> m_extensions; 00103 TQString m_dn; 00104 TQStringList m_attributes; 00105 Scope m_scope; 00106 TQString m_filter; 00107 }; 00108 } 00109 00110 #endif