initial implementation
This commit is contained in:
commit
42cd9aedca
7 changed files with 123 additions and 0 deletions
7
src/pywebutil/CMakeLists.txt
Normal file
7
src/pywebutil/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# xo-pywebutil/src/pywebutil/CMakeLists.txt
|
||||
|
||||
set(SELF_LIB pywebutil)
|
||||
set(SELF_SRCS pywebutil.cpp)
|
||||
|
||||
xo_pybind11_library(${SELF_LIB} ${PROJECT_NAME}Targets ${SELF_SRCS})
|
||||
xo_pybind11_dependency(${SELF_LIB} webutil)
|
||||
34
src/pywebutil/pywebutil.cpp
Normal file
34
src/pywebutil/pywebutil.cpp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/* @file pywebutil.cpp */
|
||||
|
||||
#include "pywebutil.hpp"
|
||||
#include "xo/webutil/HttpEndpointDescr.hpp"
|
||||
#include "xo/webutil/StreamEndpointDescr.hpp"
|
||||
#include "xo/pyutil/pyutil.hpp"
|
||||
#include <pybind11/chrono.h>
|
||||
|
||||
namespace xo {
|
||||
//using xo::web::Alist;
|
||||
using xo::web::HttpEndpointDescr;
|
||||
using xo::ref::rp;
|
||||
//using xo::time::utc_nanos;
|
||||
namespace py = pybind11;
|
||||
|
||||
namespace web {
|
||||
PYBIND11_MODULE(PYWEBUTIL_MODULE_NAME(), m) {
|
||||
//PYxxx_IMPORT_MODULE();
|
||||
|
||||
/* module docstring */
|
||||
m.doc() = "pybind11 plugin for xo.web_util";
|
||||
|
||||
py::class_<HttpEndpointDescr>(m, "EndpointDescr")
|
||||
.def_property_readonly("uri_pattern", &HttpEndpointDescr::uri_pattern)
|
||||
.def("__repr__", &HttpEndpointDescr::display_string);
|
||||
|
||||
py::class_<StreamEndpointDescr>(m, "StreamEndpointDescr")
|
||||
.def_property_readonly("uri_pattern", &StreamEndpointDescr::uri_pattern)
|
||||
.def("__repr__", &StreamEndpointDescr::display_string);
|
||||
} /*web*/
|
||||
} /*namespace web*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end pywebutil.cpp */
|
||||
25
src/pywebutil/pywebutil.hpp.in
Normal file
25
src/pywebutil/pywebutil.hpp.in
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/* @file pywebutil.hpp
|
||||
*
|
||||
* automatically generated from src/pywebutil/pywebutil.hpp.in
|
||||
* see src/pywebutil/CMakeLists.txt
|
||||
*/
|
||||
|
||||
/* python requires module name = library name
|
||||
* example:
|
||||
* PYBIND11_MODULE(PYWEBUTIL_MODULE_NAME(), m) { ... }
|
||||
*/
|
||||
#define PYWEBUTIL_MODULE_NAME() @SELF_LIB@
|
||||
|
||||
/* example:
|
||||
* py::module_::import(PYWEBUTIL_MODULE_NAME_STR)
|
||||
*/
|
||||
#define PYWEBUTIL_MODULE_NAME_STR "@SELF_LIB@"
|
||||
|
||||
/* example:
|
||||
* PYWEBUTIL_IMPORT_MODULE()
|
||||
* replaces
|
||||
* py::module_::import("pywebutil")
|
||||
*/
|
||||
#define PYWEBUTIL_IMPORT_MODULE() py::module_::import("@SELF_LIB@")
|
||||
|
||||
/* end pywebutil.hpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue