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.

41 lines
1.4 KiB

  1. //---------------------------------------------------------------------------
  2. // ARRAY_P.inl : CPtrArray inline functions
  3. //
  4. // Copyright (c) 1996 Microsoft Corporation, All Rights Reserved
  5. // Developed by Sheridan Software Systems, Inc.
  6. //---------------------------------------------------------------------------
  7. #ifndef __CPTRARRAY_INL__
  8. #define __CPTRARRAY_INL__
  9. inline int CPtrArray::GetSize() const
  10. { return m_nSize; }
  11. inline int CPtrArray::GetUpperBound() const
  12. { return m_nSize-1; }
  13. inline void CPtrArray::RemoveAll()
  14. { SetSize(0); }
  15. inline void* CPtrArray::GetAt(int nIndex) const
  16. { ASSERT_(nIndex >= 0 && nIndex < m_nSize);
  17. return m_pData[nIndex]; }
  18. inline void CPtrArray::SetAt(int nIndex, void* newElement)
  19. { ASSERT_(nIndex >= 0 && nIndex < m_nSize);
  20. m_pData[nIndex] = newElement; }
  21. inline void*& CPtrArray::ElementAt(int nIndex)
  22. { ASSERT_(nIndex >= 0 && nIndex < m_nSize);
  23. return m_pData[nIndex]; }
  24. inline const void** CPtrArray::GetData() const
  25. { return (const void**)m_pData; }
  26. inline void** CPtrArray::GetData()
  27. { return (void**)m_pData; }
  28. inline int CPtrArray::Add(void* newElement)
  29. { int nIndex = m_nSize;
  30. SetAtGrow(nIndex, newElement);
  31. return nIndex; }
  32. inline void* CPtrArray::operator[](int nIndex) const
  33. { return GetAt(nIndex); }
  34. inline void*& CPtrArray::operator[](int nIndex)
  35. { return ElementAt(nIndex); }
  36. #endif // __CPTRARRAY_INL__