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.

50 lines
1.1 KiB

  1. //
  2. // StrArray.h
  3. //
  4. // A very simple string array implementation, intended to be small
  5. // rather than scalable or particularly fast.
  6. //
  7. // History:
  8. //
  9. // 10/05/1999 KenSh Created
  10. //
  11. #pragma once
  12. #ifndef _AFX
  13. class CStringArray
  14. {
  15. public:
  16. CStringArray();
  17. ~CStringArray();
  18. inline int GetSize() const
  19. { return m_cStrings; }
  20. inline int GetUpperBound() const
  21. { return m_cStrings - 1; }
  22. inline LPCTSTR GetAt(int nIndex) const
  23. { return m_prgpStrings[nIndex]; }
  24. inline LPTSTR& ElementAt(int nIndex)
  25. { return m_prgpStrings[nIndex]; }
  26. inline LPTSTR& operator[](int nIndex)
  27. { return ElementAt(nIndex); }
  28. inline LPCTSTR operator[](int nIndex) const
  29. { return GetAt(nIndex); }
  30. inline void SetItemData(int nIndex, DWORD dwItemData)
  31. { m_prgItemData[nIndex] = dwItemData; }
  32. inline DWORD GetItemData(int nIndex) const
  33. { return m_prgItemData[nIndex]; }
  34. void RemoveAll();
  35. int Add(LPCTSTR pszNewElement);
  36. void RemoveAt(int nIndex);
  37. protected:
  38. int m_cStrings;
  39. LPTSTR* m_prgpStrings;
  40. DWORD* m_prgItemData;
  41. };
  42. #endif // !_AFX