certmanager/lib Library API Documentation

dn.h

00001 /* 00002 dn.h 00003 00004 This file is part of libkleopatra, the KDE keymanagement library 00005 Copyright (c) 2004 Klarälvdalens Datakonsult AB 00006 00007 Libkleopatra is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU General Public License as 00009 published by the Free Software Foundation; either version 2 of the 00010 License, or (at your option) any later version. 00011 00012 Libkleopatra is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program; if not, write to the Free Software 00019 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 00021 In addition, as a special exception, the copyright holders give 00022 permission to link the code of this program with any edition of 00023 the Qt library by Trolltech AS, Norway (or with modified versions 00024 of Qt that use the same license as Qt), and distribute linked 00025 combinations including the two. You must obey the GNU General 00026 Public License in all respects for all of the code used other than 00027 Qt. If you modify this file, you may extend this exception to 00028 your version of the file, but you are not obligated to do so. If 00029 you do not wish to do so, delete this exception statement from 00030 your version. 00031 */ 00032 00033 #ifndef __KLEO_DN_H__ 00034 #define __KLEO_DN_H__ 00035 00036 #include <qstring.h> 00037 #include <qvaluevector.h> 00038 00039 class QStringList; 00040 class QWidget; 00041 00042 namespace Kleo { 00043 class DNAttributeOrderConfigWidget; 00044 } 00045 00046 namespace Kleo { 00047 00051 class DNAttributeMapper { 00052 DNAttributeMapper(); 00053 ~DNAttributeMapper(); 00054 public: 00055 static const DNAttributeMapper * instance(); 00056 00057 QString name2label( const QString & s ) const; 00058 QStringList names() const; 00059 00060 const QStringList & attributeOrder() const; 00061 00062 void setAttributeOrder( const QStringList & order ); 00063 00064 DNAttributeOrderConfigWidget * configWidget( QWidget * parent=0, const char * name=0 ) const; 00065 00066 private: 00067 class Private; 00068 Private * d; 00069 static DNAttributeMapper * mSelf; 00070 }; 00071 00075 class DN { 00076 public: 00077 class Attribute; 00078 typedef QValueVector<Attribute> AttributeList; 00079 typedef AttributeList::const_iterator const_iterator; 00080 00081 DN(); 00082 DN( const QString & dn ); 00083 DN( const char * utf8DN ); 00084 DN( const DN & other ); 00085 ~DN(); 00086 00087 const DN & operator=( const DN & other ); 00088 00091 QString prettyDN() const; 00093 QString dn() const; 00094 00095 QString operator[]( const QString & attr ) const; 00096 00097 void append( const Attribute & attr ); 00098 00099 const_iterator begin() const; 00100 const_iterator end() const; 00101 00102 private: 00103 void detach(); 00104 private: 00105 class Private; 00106 Private * d; 00107 }; 00108 00109 class DN::Attribute { 00110 public: 00111 typedef DN::AttributeList List; 00112 00113 Attribute( const QString & name=QString::null, const QString & value=QString::null ) 00114 : mName( name.upper() ), mValue( value ) {} 00115 Attribute( const Attribute & other ) 00116 : mName( other.name() ), mValue( other.value() ) {} 00117 00118 const Attribute & operator=( const Attribute & other ) { 00119 if ( this != &other ) { 00120 mName = other.name(); 00121 mValue = other.value(); 00122 } 00123 return *this; 00124 } 00125 00126 const QString & name() const { return mName; } 00127 const QString & value() const { return mValue; } 00128 00129 void setValue( const QString & value ) { mValue = value; } 00130 00131 private: 00132 QString mName; 00133 QString mValue; 00134 }; 00135 00136 } 00137 00138 #endif // __KLEO_DN_H__
KDE Logo
This file is part of the documentation for certmanager/lib Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Oct 21 19:46:26 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003