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.

49 lines
987 B

  1. //-----------------------------------------------------------------------------
  2. //
  3. // File: smartptr.h
  4. // Copyright (C) 1994-1997 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. //
  8. //
  9. //-----------------------------------------------------------------------------
  10. #ifndef ESPUTIL_SMARTPTR_H
  11. #define ESPUTIL_SMARTPTR_H
  12. template<class T>
  13. class SmartPtr
  14. {
  15. public:
  16. NOTHROW SmartPtr();
  17. NOTHROW SmartPtr(T *);
  18. NOTHROW T & operator*(void) const;
  19. NOTHROW T * operator->(void) const;
  20. NOTHROW T* Extract(void);
  21. NOTHROW T* GetPointer(void);
  22. NOTHROW const T * GetPointer(void) const;
  23. NOTHROW BOOL IsNull(void) const;
  24. void operator=(T *);
  25. operator T* &(void);
  26. NOTHROW ~SmartPtr();
  27. private:
  28. T *m_pObject;
  29. SmartPtr(const SmartPtr<T> &);
  30. void operator=(const SmartPtr<T> &);
  31. //
  32. // This hackery prevents Smart Pointer from being on the heap
  33. //
  34. void operator delete(void *);
  35. };
  36. #include "smartptr.inl"
  37. #endif