/* Copyright 2017 - 2021 R. Thomas * Copyright 2017 - 2021 Quarkslab * Copyright 2017 - 2021 K. Nakagawa * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "pyPE.hpp" #include "LIEF/PE/hash.hpp" #include "LIEF/PE/resources/ResourceAccelerator.hpp" namespace LIEF { namespace PE { template using getter_t = T (ResourceAccelerator::*)(void) const; template using setter_t = void (ResourceAccelerator::*)(T); template<> void create(py::module& m) { py::class_(m, "ResourceAccelerator") .def_property_readonly("flags", static_cast>(&ResourceAccelerator::flags), "Describes keyboard accelerator characteristics. ") .def_property_readonly("ansi", static_cast>(&ResourceAccelerator::ansi), "An ANSI character value or a virtual-key code that identifies the accelerator key.") .def_property_readonly("id", static_cast>(&ResourceAccelerator::id), "An identifier for the keyboard accelerator.") .def_property_readonly("padding", static_cast>(&ResourceAccelerator::padding), "The number of bytes inserted to ensure that the structure is aligned on a DWORD boundary.") .def("__eq__", &ResourceAccelerator::operator==) .def("__ne__", &ResourceAccelerator::operator!=) .def("__hash__", [] (const ResourceAccelerator& acc) { return Hash::hash(acc); }) .def("__str__", [] (const ResourceAccelerator& acc) { std::ostringstream stream; stream << acc; return stream.str(); }); } } }