swift
directplayutils.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2016 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_SIMPLUGIN_FS9_DIRECTPLAYUTILS_H
7 #define SWIFT_SIMPLUGIN_FS9_DIRECTPLAYUTILS_H
8 
9 namespace swift::simplugin::fs9
10 {
12  template <class T>
13  void SafeRelease(T *&pT)
14  {
15  if (pT) { pT->Release(); }
16  pT = nullptr;
17  }
18 
20  template <class T>
21  void SafeDelete(T *&pT)
22  {
23  delete pT;
24  pT = nullptr;
25  }
26 
28  template <class T>
29  void SafeDeleteArray(T *&pT)
30  {
31  delete[] pT;
32  pT = nullptr;
33  }
34 } // namespace swift::simplugin::fs9
35 
36 #endif // SWIFT_SIMPLUGIN_FS9_DIRECTPLAYUTILS_H
void SafeDeleteArray(T *&pT)
Safely delete an allocated array.
void SafeRelease(T *&pT)
Safely release a COM allocated object.
void SafeDelete(T *&pT)
Safely delete an allocated pointer.