|
| 1 | +/* |
| 2 | + * Copyright 2023, Fabio Tomat <f.t.public@gmail.com> |
| 3 | + * All rights reserved. Distributed under the terms of the MIT license. |
| 4 | + */ |
| 5 | +#include <pybind11/pybind11.h> |
| 6 | +#include <pybind11/stl.h> |
| 7 | +#include <pybind11/iostream.h> |
| 8 | +#include <pybind11/operators.h> |
| 9 | + |
| 10 | +#include <sys/stat.h> |
| 11 | + |
| 12 | +namespace py = pybind11; |
| 13 | + |
| 14 | +void expose_stat(py::module &m) { |
| 15 | + py::class_<struct stat>(m, "stat") |
| 16 | + .def(py::init<>()) |
| 17 | + .def_readwrite("st_dev", &stat::st_dev) |
| 18 | + .def_readwrite("st_ino", &stat::st_ino) |
| 19 | + .def_readwrite("st_mode", &stat::st_mode) |
| 20 | + .def_readwrite("st_nlink", &stat::st_nlink) |
| 21 | + .def_readwrite("st_uid", &stat::st_uid) |
| 22 | + .def_readwrite("st_gid", &stat::st_gid) |
| 23 | + .def_readwrite("st_size", &stat::st_size) |
| 24 | + .def_readwrite("st_rdev", &stat::st_rdev) |
| 25 | + .def_readwrite("st_blksize", &stat::st_blksize) |
| 26 | + .def_readwrite("st_atim", &stat::st_atim) |
| 27 | + .def_readwrite("st_mtim", &stat::st_mtim) |
| 28 | + .def_readwrite("st_ctim", &stat::st_ctim) |
| 29 | + .def_readwrite("st_crtim", &stat::st_crtim) |
| 30 | + .def_readwrite("st_type", &stat::st_type) |
| 31 | + .def_readwrite("st_blocks", &stat::st_blocks); |
| 32 | +} |
| 33 | +PYBIND11_MODULE(stat, m) { |
| 34 | + expose_stat(m); |
| 35 | +} |
0 commit comments