knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
knowrob::py::python_str_to_string_view Struct Reference

#include <string_view.h>

Static Public Member Functions

static void * convertible (PyObject *obj_ptr)
 
static void construct (PyObject *obj_ptr, boost::python::converter::rvalue_from_python_stage1_data *data)
 
static void * convertible (PyObject *obj_ptr)
 
static void construct (PyObject *obj_ptr, boost::python::converter::rvalue_from_python_stage1_data *data)
 

Detailed Description

Definition at line 18 of file string_view.h.

Member Function Documentation

◆ construct() [1/2]

static void knowrob::py::python_str_to_string_view::construct ( PyObject *  obj_ptr,
boost::python::converter::rvalue_from_python_stage1_data *  data 
)
inlinestatic

Definition at line 24 of file string_view.h.

24  {
25  const char *value = PyUnicode_AsUTF8(obj_ptr);
26  if (value == nullptr) boost::python::throw_error_already_set();
27  void *storage = ((boost::python::converter::rvalue_from_python_storage<std::string_view> *) data)->storage.bytes;
28  new(storage) std::string_view(value);
29  data->convertible = storage;
30  }

◆ construct() [2/2]

static void knowrob::py::python_str_to_string_view::construct ( PyObject *  obj_ptr,
boost::python::converter::rvalue_from_python_stage1_data *  data 
)
inlinestatic

Definition at line 24 of file string_view.h.

24  {
25  const char *value = PyUnicode_AsUTF8(obj_ptr);
26  if (value == nullptr) boost::python::throw_error_already_set();
27  void *storage = ((boost::python::converter::rvalue_from_python_storage<std::string_view> *) data)->storage.bytes;
28  new(storage) std::string_view(value);
29  data->convertible = storage;
30  }

◆ convertible() [1/2]

static void* knowrob::py::python_str_to_string_view::convertible ( PyObject *  obj_ptr)
inlinestatic

Definition at line 19 of file string_view.h.

19  {
20  if (!PyUnicode_Check(obj_ptr)) return 0;
21  return obj_ptr;
22  }

◆ convertible() [2/2]

static void* knowrob::py::python_str_to_string_view::convertible ( PyObject *  obj_ptr)
inlinestatic

Definition at line 19 of file string_view.h.

19  {
20  if (!PyUnicode_Check(obj_ptr)) return 0;
21  return obj_ptr;
22  }

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