My Project
Loading...
Searching...
No Matches
PythonCastStatic< PythonObject::sequence_tag > Class Reference

Template specialization for getting handling sequence. More...

Public Member Functions

 PythonCastStatic (leftv value)
 
 PythonCastStatic (void *value)
 
 PythonCastStatic (leftv value)
 
- Public Member Functions inherited from PythonObject
 PythonObject ()
 
 PythonObject (ptr_type ptr)
 
ptr_type check_context (ptr_type ptr) const
 
self operator() (int op) const
 Unary operations.
 
self operator() (int op, const self &arg) const
 Binary and n-ary operations.
 
self operator() (int op, const self &arg1, const self &arg2) const
 Ternary operations.
 
self operator[] (const self &idx) const
 Get item.
 
self operator[] (long idx) const
 
 operator const ptr_type () const
 Get actual PyObject*.
 
char * repr () const
 Get representative as C-style string.
 
char * str () const
 Extract C-style string.
 
Py_ssize_t size () const
 
BOOLEAN assign_to (leftv result)
 
void import_as (const char *name) const
 
int compare (int op, const self &arg) const
 
self attr (const self &arg) const
 
self del_attr (const self &arg) const
 

Private Types

typedef PythonCastStatic self
 

Private Member Functions

size_t size (leftv iter, size_t distance=0) const
 
void append_to (leftv iter) const
 
ptr_type get (ptr_type value)
 
ptr_type get (long value)
 
ptr_type get (int value)
 
ptr_type get (const char *value)
 
ptr_type get (char *value)
 
ptr_type get (intvec *value)
 
ptr_type get (lists value)
 

Additional Inherited Members

- Public Types inherited from PythonObject
typedef PyObject * ptr_type
 
- Protected Member Functions inherited from PythonObject
self args2list (const self &args) const
 
BOOLEAN handle_exception () const
 
void append_iter (self iterator)
 
int py_opid (int op) const
 

Detailed Description

Template specialization for getting handling sequence.

Definition at line 390 of file pyobject.cc.

Member Typedef Documentation

◆ self

Definition at line 305 of file pyobject.cc.

Constructor & Destructor Documentation

◆ PythonCastStatic() [1/3]

Definition at line 395 of file pyobject.cc.

395 :
This template class does conversion of Singular objects to python objects on compile-time.
Definition pyobject.cc:304
Py_ssize_t size() const
Definition pyobject.cc:187

◆ PythonCastStatic() [2/3]

Definition at line 308 of file pyobject.cc.

308 :
309 PythonObject(get(reinterpret_cast<CastType>(value))) {}

◆ PythonCastStatic() [3/3]

Definition at line 311 of file pyobject.cc.

311 :
312 PythonObject(get(reinterpret_cast<CastType>(value->Data()))) {}

Member Function Documentation

◆ append_to()

void PythonCastStatic< PythonObject::sequence_tag >::append_to ( leftv iter) const
inlineprivate

Definition at line 406 of file pyobject.cc.

407 {
408 for(size_t idx = 0; iter != NULL; iter = iter->next)
410 }

◆ get() [1/7]

ptr_type PythonCastStatic< PythonObject::sequence_tag >::get ( char * value)
inlineprivate

Definition at line 319 of file pyobject.cc.

319{ return get(const_cast<const char*>(value)); }

◆ get() [2/7]

ptr_type PythonCastStatic< PythonObject::sequence_tag >::get ( const char * value)
inlineprivate

Definition at line 318 of file pyobject.cc.

318{ return PyString_FromString(value); }

◆ get() [3/7]

ptr_type PythonCastStatic< PythonObject::sequence_tag >::get ( int value)
inlineprivate

Definition at line 317 of file pyobject.cc.

317{ return PyInt_FromLong((long)value); }

◆ get() [4/7]

Definition at line 320 of file pyobject.cc.

327{
329 for (int idx = 0; idx < value->length(); ++idx)
331
332 return pylist;
333}
ptr_type get(ptr_type value)
Definition pyobject.cc:315
PyObject * ptr_type
Definition pyobject.cc:112

◆ get() [5/7]

Definition at line 321 of file pyobject.cc.

380{
382 for (int i = 0; i <= value->nr; ++i)
384
385 return pylist;
386}

◆ get() [6/7]

ptr_type PythonCastStatic< PythonObject::sequence_tag >::get ( long value)
inlineprivate

Definition at line 316 of file pyobject.cc.

316{ return PyInt_FromLong(value); }

◆ get() [7/7]

Definition at line 315 of file pyobject.cc.

315{ return value; }

◆ size()

size_t PythonCastStatic< PythonObject::sequence_tag >::size ( leftv iter,
size_t distance = 0 ) const
inlineprivate

Definition at line 400 of file pyobject.cc.

401 {
402 if (iter) { do { ++distance; } while((iter = iter->next)); };
403 return distance;
404 }

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