| 40 | namespace python { |
| 41 | |
| 42 | void Resource(py::module& m) |
| 43 | { |
| 44 | ::py::class_<dart::common::Resource, std::shared_ptr<dart::common::Resource>>( |
| 45 | m, "Resource") |
| 46 | .def("getSize", &common::Resource::getSize) |
| 47 | .def("tell", &common::Resource::tell) |
| 48 | .def( |
| 49 | "seek", |
| 50 | &common::Resource::seek, |
| 51 | ::py::arg("offset"), |
| 52 | ::py::arg("origin")) |
| 53 | .def( |
| 54 | "read", |
| 55 | &common::Resource::read, |
| 56 | ::py::arg("buffer"), |
| 57 | ::py::arg("size"), |
| 58 | ::py::arg("count")) |
| 59 | .def("readAll", &common::Resource::readAll); |
| 60 | |
| 61 | ::py::class_< |
| 62 | dart::common::LocalResource, |
| 63 | dart::common::Resource, |
| 64 | std::shared_ptr<dart::common::LocalResource>>(m, "LocalResource") |
| 65 | .def(::py::init<const std::string&>(), ::py::arg("path")) |
| 66 | .def("isGood", &common::LocalResource::isGood); |
| 67 | } |
| 68 | |
| 69 | } // namespace python |
| 70 | } // namespace dart |