From d9dcaf300708f656ac5a9b8bd7ea1ceb8858e193 Mon Sep 17 00:00:00 2001 From: "SND\\kernelnet_cp" Date: Thu, 6 Nov 2014 12:10:44 +0000 Subject: [PATCH] [0.3.x] added : numVariant.isInteger method git-svn-id: https://pykd.svn.codeplex.com/svn@89228 9b283d60-5439-405e-af05-b73fd8c4d996 --- pykd/pymod.cpp | 3 +++ pykd/pytypeinfo.h | 2 ++ pykd/variant.h | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp index c548ed2..131550c 100644 --- a/pykd/pymod.cpp +++ b/pykd/pymod.cpp @@ -477,6 +477,7 @@ BOOST_PYTHON_MODULE( pykd ) .def( "__int__", &NumVariantAdaptor::int_ ) .def( "__index__", &NumVariantAdaptor::long_ ) .def( "__hash__", &NumVariantAdaptor::long_ ) + .def( "isInteger", &NumVariantAdaptor::isInteger ) ; NumVariantAdaptor::registerNumConvertion(); @@ -649,6 +650,8 @@ BOOST_PYTHON_MODULE( pykd ) .add_static_property( "Char", &BaseTypesEnum::getChar ) .add_static_property( "WChar", &BaseTypesEnum::getWChar ) .add_static_property( "VoidPtr", &BaseTypesEnum::getVoidPtr ) + .add_static_property( "Float", &BaseTypesEnum::getFloat ) + .add_static_property( "Double", &BaseTypesEnum::getDouble ) ; diff --git a/pykd/pytypeinfo.h b/pykd/pytypeinfo.h index 5852cc2..df07bf1 100644 --- a/pykd/pytypeinfo.h +++ b/pykd/pytypeinfo.h @@ -225,6 +225,8 @@ struct BaseTypesEnum { static kdlib::TypeInfoPtr getChar() { return pykd::getTypeInfoByName(L"Char"); } static kdlib::TypeInfoPtr getWChar() { return pykd::getTypeInfoByName(L"WChar"); } static kdlib::TypeInfoPtr getVoidPtr() { return pykd::getTypeInfoByName(L"Void*"); } + static kdlib::TypeInfoPtr getFloat() { return pykd::getTypeInfoByName(L"Float"); } + static kdlib::TypeInfoPtr getDouble() { return pykd::getTypeInfoByName(L"Double"); } }; } // end namespace pykd diff --git a/pykd/variant.h b/pykd/variant.h index 9a25b0c..d1f66e1 100644 --- a/pykd/variant.h +++ b/pykd/variant.h @@ -226,6 +226,11 @@ public: return v.asHex(); } + static bool isInteger(kdlib::NumBehavior& var) { + kdlib::NumVariant v = var; + return v.isInteger(); + } + static void registerNumConvertion() { python::converter::registry::push_back( &numConvertible, &numConstruct, python::type_id() ); python::converter::registry::push_back( &numConvertible, &numConstruct, python::type_id() );