00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _INTERFACEREPOSITORY_H
00022 #define _INTERFACEREPOSITORY_H
00023
00024
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 class SCInterfaceRepository
00051 {
00052
00053 public:
00054 SCInterfaceMethod * _firstInterfaceMethod;
00055 SCInterfaceMethod * _lastInterfaceMethod;
00056 int _countInterfaceMethod;
00057
00058 protected:
00059 void AddInterfaceMethodFirst(SCInterfaceMethod* item);
00060 void AddInterfaceMethodLast(SCInterfaceMethod* item);
00061 void AddInterfaceMethodAfter(SCInterfaceMethod* item, SCInterfaceMethod* pos);
00062 void AddInterfaceMethodBefore(SCInterfaceMethod* item, SCInterfaceMethod* pos);
00063 void RemoveInterfaceMethod(SCInterfaceMethod* item);
00064 void ReplaceInterfaceMethod(SCInterfaceMethod* item, SCInterfaceMethod* newItem);
00065
00066 public:
00067 void DeleteAllInterfaceMethod();
00068 SCInterfaceMethod* GetFirstInterfaceMethod() const;
00069 SCInterfaceMethod* GetLastInterfaceMethod() const;
00070 SCInterfaceMethod* GetNextInterfaceMethod(SCInterfaceMethod* pos) const;
00071 SCInterfaceMethod* GetPrevInterfaceMethod(SCInterfaceMethod* pos) const;
00072 int GetInterfaceMethodCount() const;
00073 void MoveInterfaceMethodFirst(SCInterfaceMethod* item);
00074 void MoveInterfaceMethodLast(SCInterfaceMethod* item);
00075 void MoveInterfaceMethodAfter(SCInterfaceMethod* item, SCInterfaceMethod* pos);
00076 void MoveInterfaceMethodBefore(SCInterfaceMethod* item, SCInterfaceMethod* pos);
00077 void SortInterfaceMethod(int (*comp)(SCInterfaceMethod*, SCInterfaceMethod*));
00078
00079 class InterfaceMethodIterator
00080 {
00081 private:
00082 SCInterfaceMethod* _refInterfaceMethod;
00083 SCInterfaceMethod* _prevInterfaceMethod;
00084 SCInterfaceMethod* _nextInterfaceMethod;
00085 const SCInterfaceRepository* _iterInterfaceRepository;
00086
00087 InterfaceMethodIterator* _prev;
00088 InterfaceMethodIterator* _next;
00089
00090 int (SCInterfaceMethod::*_method)() const;
00091
00092 static InterfaceMethodIterator* _first;
00093 static InterfaceMethodIterator* _last;
00094
00095 public:
00096 InterfaceMethodIterator(const SCInterfaceRepository* iterInterfaceRepository,
00097 int (SCInterfaceMethod::*method)() const = 0,
00098 SCInterfaceMethod* refInterfaceMethod = 0);
00099 InterfaceMethodIterator(const SCInterfaceRepository& iterInterfaceRepository,
00100 int (SCInterfaceMethod::*method)() const = 0,
00101 SCInterfaceMethod* refInterfaceMethod = 0);
00102 InterfaceMethodIterator(const InterfaceMethodIterator& iterator,
00103 int (SCInterfaceMethod::*method)() const = 0);
00104 ~InterfaceMethodIterator();
00105
00106 InterfaceMethodIterator& operator= (const InterfaceMethodIterator& iterator)
00107 {
00108 _iterInterfaceRepository = iterator._iterInterfaceRepository;
00109 _refInterfaceMethod = iterator._refInterfaceMethod;
00110 _prevInterfaceMethod = iterator._prevInterfaceMethod;
00111 _nextInterfaceMethod = iterator._nextInterfaceMethod;
00112 _method = iterator._method;
00113 return *this;
00114 }
00115 SCInterfaceMethod* operator++ ()
00116 {
00117 _nextInterfaceMethod = _iterInterfaceRepository->GetNextInterfaceMethod(_nextInterfaceMethod);
00118 if (_method != 0)
00119 {
00120 while (_nextInterfaceMethod && !(_nextInterfaceMethod->*_method)())
00121 _nextInterfaceMethod = _iterInterfaceRepository->GetNextInterfaceMethod(_nextInterfaceMethod);
00122 }
00123 _refInterfaceMethod = _prevInterfaceMethod = _nextInterfaceMethod;
00124 return _refInterfaceMethod;
00125 }
00126 SCInterfaceMethod* operator-- ()
00127 {
00128 _prevInterfaceMethod = _iterInterfaceRepository->GetPrevInterfaceMethod(_prevInterfaceMethod);
00129 if (_method != 0)
00130 {
00131 while (_prevInterfaceMethod && !(_prevInterfaceMethod->*_method)())
00132 _prevInterfaceMethod = _iterInterfaceRepository->GetPrevInterfaceMethod(_prevInterfaceMethod);
00133 }
00134 _refInterfaceMethod = _nextInterfaceMethod = _prevInterfaceMethod;
00135 return _refInterfaceMethod;
00136 }
00137 operator SCInterfaceMethod*() { return _refInterfaceMethod; }
00138 SCInterfaceMethod* operator-> () { return _refInterfaceMethod; }
00139 SCInterfaceMethod* Get() { return _refInterfaceMethod; }
00140 void Reset() { _refInterfaceMethod = _prevInterfaceMethod = _nextInterfaceMethod = (SCInterfaceMethod*)0; }
00141
00142 int IsLast() { return (_iterInterfaceRepository->GetLastInterfaceMethod() == _refInterfaceMethod); }
00143 int IsFirst() { return (_iterInterfaceRepository->GetFirstInterfaceMethod() == _refInterfaceMethod); }
00144
00145 static void Check(SCInterfaceMethod* itemInterfaceMethod);
00146 static void Check(SCInterfaceMethod* itemInterfaceMethod, SCInterfaceMethod* newItemInterfaceMethod);
00147 };
00148
00149
00150
00151
00152
00153 private:
00154
00155 protected:
00156
00157 public:
00158
00159
00160 private:
00161 void ConstructorInclude();
00162 void DestructorInclude();
00163
00164 protected:
00165
00166 public:
00167 SCInterfaceRepository();
00168 virtual ~SCInterfaceRepository();
00169 SCInterfaceMethod* FindInterfaceMethod(const char* methPath);
00170 };
00171
00172 #endif
00173
00174
00175 #ifdef CB_INLINES
00176 #ifndef _INTERFACEREPOSITORY_H_INLINES
00177 #define _INTERFACEREPOSITORY_H_INLINES
00178
00179
00180
00181
00182 #endif
00183 #endif
00184