certmanager/lib
dn.h00001
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 <tqstring.h>
00037 #include <tqvaluevector.h>
00038 #include <kdepimmacros.h>
00039
00040 class TQStringList;
00041 class TQWidget;
00042
00043 namespace Kleo {
00044 class DNAttributeOrderConfigWidget;
00045 }
00046
00047 namespace Kleo {
00048
00052 class KDE_EXPORT DNAttributeMapper {
00053 DNAttributeMapper();
00054 ~DNAttributeMapper();
00055 public:
00056 static const DNAttributeMapper * instance();
00057
00058 TQString name2label( const TQString & s ) const;
00059 TQStringList names() const;
00060
00061 const TQStringList & attributeOrder() const;
00062
00063 void setAttributeOrder( const TQStringList & order );
00064
00065 DNAttributeOrderConfigWidget * configWidget( TQWidget * parent=0, const char * name=0 ) const;
00066
00067 private:
00068 class Private;
00069 Private * d;
00070 static DNAttributeMapper * mSelf;
00071 };
00072
00076 class KDE_EXPORT DN {
00077 public:
00078 class Attribute;
00079 typedef TQValueVector<Attribute> AttributeList;
00080 typedef AttributeList::const_iterator const_iterator;
00081
00082 DN();
00083 DN( const TQString & dn );
00084 DN( const char * utf8DN );
00085 DN( const DN & other );
00086 ~DN();
00087
00088 const DN & operator=( const DN & other );
00089
00091 static TQString escape( const TQString & value );
00092
00095 TQString prettyDN() const;
00097 TQString dn() const;
00098
00099 TQString operator[]( const TQString & attr ) const;
00100
00101 void append( const Attribute & attr );
00102
00103 const_iterator begin() const;
00104 const_iterator end() const;
00105
00106 private:
00107 void detach();
00108 private:
00109 class Private;
00110 Private * d;
00111 };
00112
00113 class KDE_EXPORT DN::Attribute {
00114 public:
00115 typedef DN::AttributeList List;
00116
00117 Attribute( const TQString & name=TQString(), const TQString & value=TQString() )
00118 : mName( name.upper() ), mValue( value ) {}
00119 Attribute( const Attribute & other )
00120 : mName( other.name() ), mValue( other.value() ) {}
00121
00122 const Attribute & operator=( const Attribute & other ) {
00123 if ( this != &other ) {
00124 mName = other.name();
00125 mValue = other.value();
00126 }
00127 return *this;
00128 }
00129
00130 const TQString & name() const { return mName; }
00131 const TQString & value() const { return mValue; }
00132
00133 void setValue( const TQString & value ) { mValue = value; }
00134
00135 private:
00136 TQString mName;
00137 TQString mValue;
00138 };
00139
00140 }
00141
00142 #endif // __KLEO_DN_H__
|