1 //===---------------------PythonPointer.h ------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef utility_PythonPointer_h_
11 #define utility_PythonPointer_h_
15 #include "lldb/lldb-python.h"
17 namespace lldb_private {
23 typedef PyObject* element_type;
29 PythonPointer(element_type p, bool steal_ref = false) :
37 PythonPointer(const PythonPointer& r, bool steal_ref = false) :
54 return PythonPointer(ptr_,true);
60 return PythonPointer(ptr_, false);
63 element_type get() const {return ptr_;}
65 bool IsNull() { return ptr_ == NULL; }
66 bool IsNone() { return ptr_ == Py_None; }
68 operator PyObject* () { return ptr_; }
73 #endif // utility_PythonPointer_h_