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 #if defined (__APPLE__)
16 #include <Python/Python.h>
21 namespace lldb_private {
27 typedef PyObject* element_type;
33 PythonPointer(element_type p, bool steal_ref = false) :
41 PythonPointer(const PythonPointer& r, bool steal_ref = false) :
58 return PythonPointer(ptr_,true);
64 return PythonPointer(ptr_, false);
67 element_type get() const {return ptr_;}
69 bool IsNull() { return ptr_ == NULL; }
70 bool IsNone() { return ptr_ == Py_None; }
72 operator PyObject* () { return ptr_; }
77 #endif // utility_PythonPointer_h_