LLDB mainline
lldb_private::python::PythonObject Class Reference

#include <PythonDataObjects.h>

Inheritance diagram for lldb_private::python::PythonObject:
[legend]

Public Member Functions

 PythonObject ()=default
 PythonObject (PyRefType type, PyObject *py_obj)
 PythonObject (const PythonObject &rhs)
 PythonObject (PythonObject &&rhs)
 ~PythonObject ()
void Reset ()
void Dump (Stream &strm) const
PyObject * get () const
PyObject * release ()
PythonObjectoperator= (PythonObject other)
PyObjectType GetObjectType () const
PythonString Repr () const
PythonString Str () const
PythonObject ResolveName (llvm::StringRef name) const
template<typename T>
ResolveName (llvm::StringRef name) const
bool HasAttribute (llvm::StringRef attribute) const
PythonObject GetAttributeValue (llvm::StringRef attribute) const
bool IsNone () const
bool IsValid () const
bool IsAllocated () const
 operator bool () const
template<typename T>
AsType () const
StructuredData::ObjectSP CreateStructuredObject () const
template<typename... T>
llvm::Expected< PythonObjectCallMethod (const char *name, const T &... t) const
template<typename... T>
llvm::Expected< PythonObjectCall (const T &... t) const
llvm::Expected< PythonObjectGetAttribute (const llvm::Twine &name) const
llvm::Expected< PythonObjectGetType () const
llvm::Expected< boolIsTrue ()
llvm::Expected< long long > AsLongLong () const
llvm::Expected< unsigned long long > AsUnsignedLongLong () const
llvm::Expected< unsigned long long > AsModuloUnsignedLongLong () const
llvm::Expected< boolIsInstance (const PythonObject &cls)

Static Public Member Functions

static PythonObject ResolveNameWithDictionary (llvm::StringRef name, const PythonDictionary &dict)
template<typename T>
static T ResolveNameWithDictionary (llvm::StringRef name, const PythonDictionary &dict)

Protected Attributes

PyObject * m_py_obj = nullptr

Detailed Description

Definition at line 222 of file PythonDataObjects.h.

Constructor & Destructor Documentation

◆ PythonObject() [1/4]

◆ PythonObject() [2/4]

lldb_private::python::PythonObject::PythonObject ( PyRefType type,
PyObject * py_obj )
inline

Definition at line 226 of file PythonDataObjects.h.

References lldb_private::python::Borrowed, and m_py_obj.

◆ PythonObject() [3/4]

lldb_private::python::PythonObject::PythonObject ( const PythonObject & rhs)
inline

Definition at line 236 of file PythonDataObjects.h.

References lldb_private::python::Borrowed, m_py_obj, and PythonObject().

◆ PythonObject() [4/4]

lldb_private::python::PythonObject::PythonObject ( PythonObject && rhs)
inline

Definition at line 239 of file PythonDataObjects.h.

References m_py_obj, and PythonObject().

◆ ~PythonObject()

lldb_private::python::PythonObject::~PythonObject ( )
inline

Definition at line 244 of file PythonDataObjects.h.

References Reset().

Member Function Documentation

◆ AsLongLong()

Expected< long long > PythonObject::AsLongLong ( ) const

◆ AsModuloUnsignedLongLong()

Expected< unsigned long long > PythonObject::AsModuloUnsignedLongLong ( ) const

◆ AsType()

template<typename T>
T lldb_private::python::PythonObject::AsType ( ) const
inline

Definition at line 297 of file PythonDataObjects.h.

References lldb_private::python::Borrowed, and m_py_obj.

Referenced by ResolveName(), and ResolveNameWithDictionary().

◆ AsUnsignedLongLong()

◆ Call()

template<typename... T>
llvm::Expected< PythonObject > lldb_private::python::PythonObject::Call ( const T &... t) const
inline

◆ CallMethod()

template<typename... T>
llvm::Expected< PythonObject > lldb_private::python::PythonObject::CallMethod ( const char * name,
const T &... t ) const
inline

◆ CreateStructuredObject()

◆ Dump()

void PythonObject::Dump ( Stream & strm) const

Definition at line 117 of file PythonDataObjects.cpp.

References m_py_obj.

◆ get()

PyObject * lldb_private::python::PythonObject::get ( ) const
inline

Definition at line 250 of file PythonDataObjects.h.

References m_py_obj.

Referenced by lldb_private::python::PythonList::AppendItem(), lldb_private::ScriptedPythonInterface::ExtractValueFromPythonObject(), GetAttributeValue(), lldb_private::python::PythonDictionary::GetItem(), HasAttribute(), lldb_private::python::PythonDictionary::HasKey(), lldb_private::python::PythonScript::Init(), IsInstance(), lldb_private::python::PythonCallable::operator()(), lldb_private::python::PythonCallable::operator()(), lldb_private::ScriptedPythonInterface::ReverseTransform(), lldb_private::python::runStringMultiLine(), lldb_private::python::runStringOneLine(), ScriptedPythonInterface::ExtractValueFromPythonObject< lldb::BreakpointSP >(), ScriptedPythonInterface::ExtractValueFromPythonObject< lldb::DataExtractorSP >(), ScriptedPythonInterface::ExtractValueFromPythonObject< lldb::StackFrameListSP >(), ScriptedPythonInterface::ExtractValueFromPythonObject< lldb::StackFrameSP >(), ScriptedPythonInterface::ExtractValueFromPythonObject< lldb::StreamSP >(), ScriptedPythonInterface::ExtractValueFromPythonObject< lldb::ThreadSP >(), ScriptedPythonInterface::ExtractValueFromPythonObject< lldb::ValueObjectListSP >(), ScriptedPythonInterface::ExtractValueFromPythonObject< lldb::ValueObjectSP >(), ScriptedPythonInterface::ExtractValueFromPythonObject< StructuredData::ArraySP >(), lldb_private::python::PythonDictionary::SetItem(), lldb_private::python::PythonList::SetItemAtIndex(), and lldb_private::python::PythonTuple::SetItemAtIndex().

◆ GetAttribute()

llvm::Expected< PythonObject > lldb_private::python::PythonObject::GetAttribute ( const llvm::Twine & name) const
inline

◆ GetAttributeValue()

PythonObject PythonObject::GetAttributeValue ( llvm::StringRef attribute) const

◆ GetObjectType()

◆ GetType()

llvm::Expected< PythonObject > lldb_private::python::PythonObject::GetType ( ) const
inline

◆ HasAttribute()

bool PythonObject::HasAttribute ( llvm::StringRef attribute) const

Definition at line 234 of file PythonDataObjects.cpp.

References get(), IsValid(), and m_py_obj.

Referenced by lldb_private::python::PythonCallable::Check().

◆ IsAllocated()

◆ IsInstance()

llvm::Expected< bool > lldb_private::python::PythonObject::IsInstance ( const PythonObject & cls)
inline

◆ IsNone()

bool lldb_private::python::PythonObject::IsNone ( ) const
inline

Definition at line 289 of file PythonDataObjects.h.

References m_py_obj.

Referenced by IsAllocated(), and operator bool().

◆ IsTrue()

llvm::Expected< bool > lldb_private::python::PythonObject::IsTrue ( )
inline

◆ IsValid()

bool lldb_private::python::PythonObject::IsValid ( ) const
inline

Definition at line 291 of file PythonDataObjects.h.

References m_py_obj.

Referenced by lldb_private::python::PythonList::AppendItem(), lldb_private::python::PythonString::AsUTF8(), lldb_private::python::PythonFile::ConvertToFile(), lldb_private::python::PythonFile::ConvertToFileForcingUseOfScriptingIOMethods(), lldb_private::python::PythonModule::Get(), lldb_private::python::PythonCallable::GetArgInfo(), GetAttributeValue(), lldb_private::python::PythonByteArray::GetBytes(), lldb_private::python::PythonBytes::GetBytes(), lldb_private::python::PythonModule::GetDictionary(), lldb_private::python::PythonDictionary::GetItem(), lldb_private::python::PythonList::GetItemAtIndex(), lldb_private::python::PythonTuple::GetItemAtIndex(), lldb_private::python::PythonDictionary::GetKeys(), lldb_private::python::PythonByteArray::GetSize(), lldb_private::python::PythonBytes::GetSize(), lldb_private::python::PythonDictionary::GetSize(), lldb_private::python::PythonList::GetSize(), lldb_private::python::PythonString::GetSize(), lldb_private::python::PythonTuple::GetSize(), HasAttribute(), lldb_private::python::PythonDictionary::HasKey(), IsAllocated(), IsInstance(), operator bool(), lldb_private::python::PythonTuple::PythonTuple(), lldb_private::python::PythonTuple::PythonTuple(), lldb_private::ScriptedPythonInterface::ReverseTransform(), lldb_private::python::runStringMultiLine(), lldb_private::python::runStringOneLine(), lldb_private::python::PythonDictionary::SetItem(), lldb_private::python::PythonList::SetItemAtIndex(), and lldb_private::python::PythonTuple::SetItemAtIndex().

◆ operator bool()

lldb_private::python::PythonObject::operator bool ( ) const
inlineexplicit

Definition at line 295 of file PythonDataObjects.h.

References IsNone(), and IsValid().

◆ operator=()

PythonObject & lldb_private::python::PythonObject::operator= ( PythonObject other)
inline

◆ release()

PyObject * lldb_private::python::PythonObject::release ( )
inline

Definition at line 252 of file PythonDataObjects.h.

References m_py_obj.

Referenced by lldb_private::python::PythonCallable::Check().

◆ Repr()

PythonString PythonObject::Repr ( ) const

Definition at line 172 of file PythonDataObjects.cpp.

References m_py_obj, and lldb_private::python::Owned.

◆ Reset()

void PythonObject::Reset ( )

◆ ResolveName() [1/2]

PythonObject PythonObject::ResolveName ( llvm::StringRef name) const

◆ ResolveName() [2/2]

template<typename T>
T lldb_private::python::PythonObject::ResolveName ( llvm::StringRef name) const
inline

Definition at line 281 of file PythonDataObjects.h.

References AsType(), and ResolveName().

◆ ResolveNameWithDictionary() [1/2]

PythonObject PythonObject::ResolveNameWithDictionary ( llvm::StringRef name,
const PythonDictionary & dict )
static

◆ ResolveNameWithDictionary() [2/2]

template<typename T>
T lldb_private::python::PythonObject::ResolveNameWithDictionary ( llvm::StringRef name,
const PythonDictionary & dict )
inlinestatic

Definition at line 274 of file PythonDataObjects.h.

References AsType(), and ResolveNameWithDictionary().

◆ Str()

PythonString PythonObject::Str ( ) const

Member Data Documentation

◆ m_py_obj

PyObject* lldb_private::python::PythonObject::m_py_obj = nullptr
protected

Definition at line 371 of file PythonDataObjects.h.

Referenced by lldb_private::python::PythonList::AppendItem(), AsLongLong(), AsModuloUnsignedLongLong(), AsType(), AsUnsignedLongLong(), lldb_private::python::PythonString::AsUTF8(), Call(), CallMethod(), lldb_private::python::PythonFile::ConvertToFile(), lldb_private::python::PythonFile::ConvertToFileForcingUseOfScriptingIOMethods(), CreateStructuredObject(), lldb_private::python::PythonBytes::CreateStructuredString(), Dump(), lldb_private::python::PythonModule::Get(), get(), GetAttribute(), GetAttributeValue(), lldb_private::python::PythonByteArray::GetBytes(), lldb_private::python::PythonBytes::GetBytes(), lldb_private::python::PythonModule::GetDictionary(), lldb_private::python::PythonDictionary::GetItem(), lldb_private::python::PythonList::GetItemAtIndex(), lldb_private::python::PythonTuple::GetItemAtIndex(), lldb_private::python::PythonDictionary::GetKeys(), GetObjectType(), lldb_private::python::PythonByteArray::GetSize(), lldb_private::python::PythonBytes::GetSize(), lldb_private::python::PythonDictionary::GetSize(), lldb_private::python::PythonList::GetSize(), lldb_private::python::PythonString::GetSize(), lldb_private::python::PythonTuple::GetSize(), GetType(), lldb_private::python::PythonBoolean::GetValue(), HasAttribute(), lldb_private::python::PythonDictionary::HasKey(), IsInstance(), IsNone(), IsTrue(), IsValid(), lldb_private::python::PythonCallable::operator()(), lldb_private::python::PythonCallable::operator()(), lldb_private::python::PythonCallable::operator()(), operator=(), PythonObject(), PythonObject(), PythonObject(), lldb_private::python::PythonTuple::PythonTuple(), lldb_private::python::PythonTuple::PythonTuple(), release(), Repr(), Reset(), lldb_private::python::PythonDictionary::SetItem(), lldb_private::python::PythonList::SetItemAtIndex(), lldb_private::python::PythonTuple::SetItemAtIndex(), and Str().


The documentation for this class was generated from the following files: