mirror of
https://github.com/panda3d/panda3d.git
synced 2026-05-21 15:20:02 -05:00
interrogate supports wstring
This commit is contained in:
@@ -1826,7 +1826,8 @@ int GetParnetDepth(CPPType *type)
|
||||
int answer = 0;
|
||||
// printf(" %s\n",type->get_local_name().c_str());
|
||||
|
||||
if (TypeManager::is_basic_string_char(type)) {
|
||||
if (TypeManager::is_basic_string_char(type)) {
|
||||
} else if (TypeManager::is_basic_string_wchar(type)) {
|
||||
} else if (TypeManager::is_bool(type)) {
|
||||
} else if (TypeManager::is_unsigned_longlong(type)) {
|
||||
} else if (TypeManager::is_longlong(type)) {
|
||||
@@ -2011,9 +2012,18 @@ void InterfaceMakerPythonNative::write_function_instance(ostream &out, Interface
|
||||
indent(out,indent_level+4)<< "char *" << param_name;
|
||||
format_specifiers += "s";
|
||||
parameter_list += ", &" + param_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
} else if (TypeManager::is_wstring(orig_type)) {
|
||||
indent(out,indent_level+4) << "Py_UNICODE *" << param_name
|
||||
<< "_str; int " << param_name << "_len";
|
||||
format_specifiers += "u#";
|
||||
parameter_list += ", &" + param_name
|
||||
+ "_str, &" + param_name + "_len";
|
||||
pexpr_string = "basic_string<wchar_t>(" +
|
||||
param_name + "_str, " +
|
||||
param_name + "_len)";
|
||||
|
||||
} else {
|
||||
indent(out,indent_level+4) << "char *" << param_name
|
||||
<< "_str; int " << param_name << "_len";
|
||||
format_specifiers += "s#";
|
||||
@@ -2284,6 +2294,11 @@ void InterfaceMakerPythonNative::pack_return_value(ostream &out, int indent_leve
|
||||
indent(out, indent_level)
|
||||
<< "return PyString_FromString(" << return_expr << ");\n";
|
||||
|
||||
} else if (TypeManager::is_wstring(orig_type)) {
|
||||
indent(out, indent_level)
|
||||
<< "return PyUnicode_FromWideChar("
|
||||
<< return_expr << ".data(), (int)" << return_expr << ".length());\n";
|
||||
|
||||
} else {
|
||||
indent(out, indent_level)
|
||||
<< "return PyString_FromStringAndSize("
|
||||
@@ -2669,6 +2684,10 @@ bool InterfaceMakerPythonNative::isCppTypeLegal(CPPType *in_ctype)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(TypeManager::is_basic_string_wchar(type))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(TypeManager::is_simple(type))
|
||||
{
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user