Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.1 KiB

  1. //
  2. // cuiarray.h
  3. // = array object in CUILib =
  4. //
  5. #ifndef CUIARRAY_H
  6. #define CUIARRAY_H
  7. //
  8. // CUIFObjectArrayBase
  9. // = base class of object array =
  10. //
  11. class CUIFObjectArrayBase
  12. {
  13. public:
  14. CUIFObjectArrayBase( void );
  15. virtual ~CUIFObjectArrayBase( void );
  16. BOOL Add( void *pv );
  17. BOOL Remove( void *pv );
  18. int GetCount( void );
  19. int Find( void *pv );
  20. void *Get( int i );
  21. void *GetFirst( void );
  22. void *GetLast( void );
  23. private:
  24. void **m_pBuffer;
  25. int m_nBuffer;
  26. int m_nObject;
  27. BOOL EnsureBuffer( int iSize );
  28. };
  29. //
  30. // CUIFObjectArray
  31. // = object array =
  32. //
  33. template<class T>
  34. class CUIFObjectArray : public CUIFObjectArrayBase
  35. {
  36. public:
  37. CUIFObjectArray( void ) : CUIFObjectArrayBase()
  38. {
  39. }
  40. virtual ~CUIFObjectArray( void )
  41. {
  42. }
  43. T *Get( int i )
  44. {
  45. return (T*)CUIFObjectArrayBase::Get( i );
  46. }
  47. T *GetFirst( void )
  48. {
  49. return (T*)CUIFObjectArrayBase::GetFirst();
  50. }
  51. T *GetLast( void )
  52. {
  53. return (T*)CUIFObjectArrayBase::GetLast();
  54. }
  55. };
  56. #endif /* CUIARRAY_H */