diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:55:28 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:55:28 +0000 |
commit | e81d9d49145e432d917eea3a70d2ae74dcad1d89 (patch) | |
tree | 9ed5e1a91f242e2cb5911577356e487a55c01b78 /include/lldb/Utility/PythonPointer.h | |
parent | 85d8ef8f1f0e0e063a8571944302be2d2026f823 (diff) |
Notes
Diffstat (limited to 'include/lldb/Utility/PythonPointer.h')
-rw-r--r-- | include/lldb/Utility/PythonPointer.h | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/include/lldb/Utility/PythonPointer.h b/include/lldb/Utility/PythonPointer.h deleted file mode 100644 index fe90670fd2e1..000000000000 --- a/include/lldb/Utility/PythonPointer.h +++ /dev/null @@ -1,73 +0,0 @@ -//===---------------------PythonPointer.h ------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef utility_PythonPointer_h_ -#define utility_PythonPointer_h_ - -#include <algorithm> - -#include "lldb/lldb-python.h" - -namespace lldb_private { - -template<class T> -class PythonPointer -{ -public: - typedef PyObject* element_type; -private: - element_type* ptr_; - bool my_ref; -public: - - PythonPointer(element_type p, bool steal_ref = false) : - ptr_(p), - my_ref(!steal_ref) - { - if (my_ref) - Py_INCREF(ptr_); - } - - PythonPointer(const PythonPointer& r, bool steal_ref = false) : - ptr_(r.ptr_), - my_ref(!steal_ref) - { - if (my_ref) - Py_INCREF(ptr_); - } - - ~PythonPointer() - { - if (my_ref) - Py_XDECREF(ptr_); - } - - PythonPointer - StealReference() - { - return PythonPointer(ptr_,true); - } - - PythonPointer - DuplicateReference() - { - return PythonPointer(ptr_, false); - } - - element_type get() const {return ptr_;} - - bool IsNull() { return ptr_ == NULL; } - bool IsNone() { return ptr_ == Py_None; } - - operator PyObject* () { return ptr_; } -}; - -} // namespace lldb - -#endif // utility_PythonPointer_h_ |