From 4e1619d8ee020c7e2e3d659fdc279f832222b893 Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Thu, 21 Mar 2013 11:30:38 +0400 Subject: [PATCH] repaired std::string handling --- modules/python/src2/cv2.cpp | 2 ++ modules/python/src2/gen2.py | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/python/src2/cv2.cpp b/modules/python/src2/cv2.cpp index bbdd5abbe7..59f7f15457 100644 --- a/modules/python/src2/cv2.cpp +++ b/modules/python/src2/cv2.cpp @@ -99,6 +99,8 @@ catch (const cv::Exception &e) \ using namespace cv; typedef cv::softcascade::ChannelFeatureBuilder softcascade_ChannelFeatureBuilder; +typedef std::string string; + typedef std::vector vector_uchar; typedef std::vector vector_int; typedef std::vector vector_float; diff --git a/modules/python/src2/gen2.py b/modules/python/src2/gen2.py index c7aa72544a..8669fbd85f 100755 --- a/modules/python/src2/gen2.py +++ b/modules/python/src2/gen2.py @@ -214,8 +214,7 @@ simple_argtype_mapping = { "int": ("int", "i", "0"), "float": ("float", "f", "0.f"), "double": ("double", "d", "0"), - "c_string": ("char*", "s", '(char*)""'), - "string": ("std::string", "s", None) + "c_string": ("char*", "s", '(char*)""') } def normalize_class_name(name): @@ -571,7 +570,7 @@ class FuncInfo(object): else: code_fcall = "ERRWRAP2( " if v.rettype: - code_decl += " " + simple_argtype_mapping.get(v.rettype, (v.rettype, None, None))[0] + " retval;\n" + code_decl += " " + v.rettype + " retval;\n" code_fcall += "retval = " if ismethod: code_fcall += "_self_->" + self.cname