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 #ifndef OCONFITEM_H
00032 #define OCONFITEM_H
00033
00034 #include <qlist.h>
00035 #include <qstring.h>
00036
00037 class OConfItem
00038 {
00039 public:
00040 enum Type { Source, Destination, Option, Arch, Other, NotDefined };
00041
00042 OConfItem( Type type = NotDefined, const QString &name = QString::null,
00043 const QString &value = QString::null, const QString &features = QString::null,
00044 bool active = true );
00045
00046 Type type() { return m_type; }
00047 const QString &name() { return m_name; }
00048 const QString &value() { return m_value; }
00049 const QString &features() { return m_features; }
00050 bool active() { return m_active; }
00051
00052 void setType( Type type ) { m_type = type; }
00053 void setName( const QString &name ) { m_name = name; }
00054 void setValue( const QString &value ) { m_value = value; }
00055 void setFeatures( const QString &features ) { m_features = features; }
00056 void setActive( bool active ) { m_active = active; }
00057
00058 private:
00059 Type m_type;
00060 QString m_name;
00061 QString m_value;
00062 QString m_features;
00063 bool m_active;
00064 };
00065
00066 class OConfItemList : public QList<OConfItem>
00067 {
00068 private:
00069
00070 int compareItems( QCollection::Item item1, QCollection::Item item2 )
00071 {
00072
00073 OConfItem::Type type1 = reinterpret_cast<OConfItem*>(item1)->type();
00074 OConfItem::Type type2 = reinterpret_cast<OConfItem*>(item2)->type();
00075 if ( type1 < type2 )
00076 return -1;
00077 else if ( type1 == type2 )
00078 {
00079 QString name1 = reinterpret_cast<OConfItem*>(item1)->name();
00080 QString name2 = reinterpret_cast<OConfItem*>(item2)->name();
00081 if ( name1 < name2 )
00082 return -1;
00083 else if ( name1 == name2 )
00084 return 0;
00085 else
00086 return 1;
00087 }
00088 else
00089 return 1;
00090 }
00091 };
00092
00093 typedef QListIterator<OConfItem> OConfItemListIterator;
00094
00095 #endif