diff options
author | lloyd <[email protected]> | 2006-08-23 03:51:17 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-08-23 03:51:17 +0000 |
commit | 38bb757a31100c6370b3f32ad7683d2b3fc0fc0a (patch) | |
tree | d6577e4322fbfa3cd9cf2972577b279bec617d11 /misc/python | |
parent | f92f569b49d5df1b79390ff90e0083ea2a1e7907 (diff) |
Move the code from base.cpp into core.cpp, drop base.cpp
Diffstat (limited to 'misc/python')
-rw-r--r-- | misc/python/src/base.cpp | 31 | ||||
-rw-r--r-- | misc/python/src/core.cpp | 28 |
2 files changed, 24 insertions, 35 deletions
diff --git a/misc/python/src/base.cpp b/misc/python/src/base.cpp deleted file mode 100644 index 33457fe61..000000000 --- a/misc/python/src/base.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/************************************************* -* Wrappers for basic Botan types * -* (C) 2005-2006 Jack Lloyd <[email protected]> * -*************************************************/ - -#include <boost/python.hpp> -using namespace boost::python; - -#include <botan/init.h> -#include <botan/symkey.h> -using namespace Botan; - -void export_basic_types() - { - class_<LibraryInitializer>("LibraryInitializer") - .def(init< optional<std::string> >()); - - class_<OctetString>("OctetString") - .def(init< optional<std::string> >()) - .def("as_string", &OctetString::as_string) - .def("length", &OctetString::length) - .def(self ^= self); - - class_<SymmetricKey, bases<OctetString> >("SymmetricKey") - .def(init< optional<std::string> >()) - .def(init< u32bit >()); - - class_<InitializationVector, bases<OctetString> >("InitializationVector") - .def(init< optional<std::string> >()) - .def(init< u32bit >()); - } diff --git a/misc/python/src/core.cpp b/misc/python/src/core.cpp index 6c8f61c1c..acb46c82e 100644 --- a/misc/python/src/core.cpp +++ b/misc/python/src/core.cpp @@ -1,19 +1,39 @@ /************************************************* * Boost.Python module definition * -* (C) 2005-2006 Jack Lloyd <[email protected]> * +* (C) 1999-2006 The Botan Project * *************************************************/ +#include <botan/init.h> +#include <botan/symkey.h> +using namespace Botan; + #include <boost/python.hpp> -using namespace boost::python; +namespace python = boost::python; -extern void export_basic_types(); extern void export_filters(); extern void export_pipe(); extern void export_x509(); BOOST_PYTHON_MODULE(_botan) { - export_basic_types(); + python::class_<LibraryInitializer>("LibraryInitializer") + .def(python::init< python::optional<std::string> >()); + + python::class_<OctetString>("OctetString") + .def(python::init< python::optional<std::string> >()) + .def("as_string", &OctetString::as_string) + .def("length", &OctetString::length) + .def(python::self ^= python::self); + + python::class_<SymmetricKey, python::bases<OctetString> >("SymmetricKey") + .def(python::init< python::optional<std::string> >()) + .def(python::init< u32bit >()); + + python::class_<InitializationVector, python::bases<OctetString> > + ("InitializationVector") + .def(python::init< python::optional<std::string> >()) + .def(python::init< u32bit >()); + export_filters(); export_pipe(); export_x509(); |