Py11
v0.2
This is a minimalist Python wrapper for C++11.
|
py dict. More...
#include <py11/_dict.hpp>
Public Member Functions | |
dict ()=default | |
ctor. | |
dict (PyObject *p, bool borrowed=false) | |
create from Py functions. More... | |
dict (std::initializer_list< tuple > l) | |
ctor. More... | |
dict & | operator= (std::initializer_list< tuple > l) |
= {...} More... | |
long | size () const |
'len' as 'size'. More... | |
bool | has (const obj &x) const |
'in' as 'has'. More... | |
const obj | operator[] (const obj &k) const |
get item. More... | |
void | set_item (const obj &k, const obj &value) |
set_item. More... | |
void | del_item (const obj &k) |
del_item. More... | |
list | items () const |
items. More... | |
list | keys () const |
keys. More... | |
list | values () const |
values. More... | |
void | clear () |
clear. More... | |
dict | copy () |
copy. More... | |
void | update (const dict &b) |
update. More... | |
![]() | |
obj (const obj &o) noexcept | |
copy ctor. | |
obj (PyObject *p, bool borrowed=false) noexcept | |
create from Py functions. More... | |
obj (obj &&o) noexcept | |
move ctor. | |
obj (std::initializer_list< obj > l) | |
tuple. | |
~obj () noexcept | |
dtor. | |
void | release () noexcept |
release the contained object | |
PyObject * | transfer () noexcept |
transfer the ownership of inner object. More... | |
bool | operator! () const |
test null. | |
obj (int i) | |
int. | |
obj (long i) | |
long. | |
bool | is_int () const |
is_int. | |
long | as_long () const |
get long from obj More... | |
obj (double v) | |
double ctor. | |
bool | is_float () const |
is_float. | |
double | as_double () const |
as_double from obj. More... | |
obj (const char *s) | |
str. | |
const char * | c_str () const |
c_str(). More... | |
obj | type () const |
py object type. More... | |
bool | is_a (const obj &t) const |
type check More... | |
bool | has_attr (const obj &o) const |
has attr. | |
bool | has_attr (const char *s) const |
has attr. | |
obj | attr (const obj &o) const |
get attr. More... | |
obj | attr (const char *s) const |
get attr. More... | |
obj | a (const char *s) const |
get attr, short form. More... | |
void | set_attr (const obj &a, const obj &v) |
set attr. More... | |
void | set_attr (const char *a, const obj &v) |
set attr. More... | |
void | del_attr (const obj &a) |
del attr. More... | |
void | del_attr (const char *a) |
del attr. More... | |
bool | operator< (const obj &o) const |
< More... | |
obj | repr () const |
repr. More... | |
obj | to_str () const |
str. More... | |
obj | to_unicode () const |
unicode. More... | |
bool | is_callable () const |
test callable. | |
template<typename... argT> | |
obj | operator() (argT &&...a) const |
call using operator. More... | |
obj | call (const obj &args) const |
call with args. More... | |
obj | call (const obj &args, const obj &kw) const |
call with args, and key/value pairs. More... | |
long | size () const |
'len' as 'size'. More... | |
bool | has (const obj &x) const |
'in' as 'has'. More... | |
const obj | operator[] (const obj &o) const |
get item. More... | |
void | set_item (const obj &key, const obj &value) |
set_item. More... | |
void | del_item (const obj &key) |
del_item. More... | |
iter | begin () const |
get the begin iter. More... | |
iter | end () const |
get the end iter. | |
obj | dir () const |
py object dir. More... | |
Py_ssize_t | refcnt () const |
refcnt. | |
PPyObject | p () const |
get inner PyObject. | |
|
inline |
create from Py functions.
in most of cases, need not to inc ref. please read python doc carefully
Definition at line 61 of file _dict.hpp.
References py::obj::p().
|
inline |
|
inline |
|
inline |
'in' as 'has'.
type_err |
Definition at line 121 of file _dict.hpp.
References py::obj::p().
|
inline |
|
inline |
= {...}
val_err |
Definition at line 94 of file _dict.hpp.
References py::obj::p(), and py::obj::release().
get item.
Warning, a new obj will be got! not a reference to the original one!
index_err |
Definition at line 133 of file _dict.hpp.
References py::obj::p().
|
inline |
|
inline |
|
inline |