1 /**
2 *  Copyright Mikael H�gdahl - triyana@users.sourceforge.net
3 *
4 *  This source is distributed under the terms of the Q Public License version 1.0,
5 *  created by Trolltech (www.trolltech.com).
6 */
7 
8 #ifndef Set_h
9 #define Set_h
10 
11 #include <MHString.h>
12 #include <MHVector.h>
13 
14 
15 
16 /**
17 *  Set stores all names of security lists.
18 */
19 class Set : public MH {
20 public:
21     enum {
22                             SET_LEN = 20,
23     };
24 
Set()25                             Set (){;}
Set(const Set & x)26                             Set (const Set& x) : MH() {aID = x.aID; aSet   = x.aSet; IsChanged (((Set&)x).IsChanged());}
Set(int id,const char * pSet)27                             Set (int id, const char* pSet) {SetID (id); SetSet (pSet);}
28 
29     Set&                    operator=(const Set&);
30     bool                    operator==(const Set& x) {return aSet == x.aSet;}
31     bool                    operator!=(const Set& x) {return aSet != x.aSet;}
32     bool                    operator>(const Set& x) {return aSet > x.aSet;}
33     bool                    operator<(const Set& x) {return aSet < x.aSet;}
34 
Compare(const MH * o,int type)35     int                     Compare (const MH* o, int type){return strcasecmp (aSet(), ((Set*)o)->GetSet()->Get());}
36     static void             Export (MHVector* ve, FILE* file);
GetID()37     int                     GetID () {return aID;}
GetSet()38     MHString*               GetSet () {return &aSet;}
39     static void             Load (MHVector* ve);
40     static void             Save (MHVector* ve);
SetID(int i)41     void                    SetID (int i) {aID = i;}
SetSet(const char * s)42     void                    SetSet (const char* s) {aSet = CHECK_STRING(s); aSet.Shrink(SET_LEN);}
43 
44 private:
45     int                     aID;
46     MHString                aSet;
47 };
48 
49 #endif
50