dn.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
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__
This file is part of the documentation for certmanager/lib Library Version 3.3.2.