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.

62 lines
1.5 KiB

  1. class CGenList
  2. {
  3. public:
  4. CGenList(UINT cbItem) : _hList(NULL), _cbItem(cbItem) {}
  5. ~CGenList() {Empty();}
  6. void *GetPtr(UINT i)
  7. {return(i<GetItemCount() ? DSA_GetItemPtr(_hList, i) : NULL);}
  8. UINT GetItemCount() {return(_hList ? DSA_GetItemCount(_hList) : 0);}
  9. int Add(void *pv, int nInsert);
  10. void Empty() {if (_hList) DSA_Destroy(_hList); _hList=NULL;}
  11. protected:
  12. void Steal(CGenList* pList)
  13. {
  14. Empty();
  15. _cbItem = pList->_cbItem;
  16. _hList = pList->_hList;
  17. pList->_hList = NULL;
  18. }
  19. private:
  20. UINT _cbItem;
  21. HDSA _hList;
  22. } ;
  23. class CViewsList : public CGenList
  24. {
  25. public:
  26. CViewsList() : CGenList(SIZEOF(SFVVIEWSDATA*)), _bGotDef(FALSE) {}
  27. ~CViewsList() {Empty();}
  28. SFVVIEWSDATA* GetPtr(UINT i)
  29. {
  30. SFVVIEWSDATA** ppViewsData = (SFVVIEWSDATA**)CGenList::GetPtr(i);
  31. return(ppViewsData ? *ppViewsData : NULL);
  32. }
  33. int Add(const SFVVIEWSDATA*pView, int nInsert, BOOL bCopy);
  34. int Add(const SFVVIEWSDATA*pView, BOOL bCopy=TRUE) {return Add(pView, DA_LAST, bCopy);}
  35. int Prepend(const SFVVIEWSDATA*pView, BOOL bCopy=TRUE) {return Add(pView, 0, bCopy);}
  36. void SetDef(SHELLVIEWID const *pvid) { _bGotDef=TRUE; _vidDef=*pvid; }
  37. BOOL GetDef(SHELLVIEWID *pvid) { if (_bGotDef) *pvid=_vidDef; return(_bGotDef); }
  38. void Empty();
  39. static SFVVIEWSDATA* CopyData(const SFVVIEWSDATA* pData);
  40. int NextUnique(int nLast);
  41. private:
  42. BOOL _bGotDef;
  43. SHELLVIEWID _vidDef;
  44. } ;