diff options
author | Lauro Neto <lauro.neto@openbossa.org> | 2010-02-23 12:45:14 -0300 |
---|---|---|
committer | Lauro Neto <lauro.neto@openbossa.org> | 2010-02-23 20:10:28 -0300 |
commit | 506a97bad2ab5cf9b09f735a59f9dcea68bbd276 (patch) | |
tree | 8b3a216259607c8f789a68db7163c529daf8e0d3 /cppgenerator.cpp | |
parent | 742eba6e0898f08c5ca04c1eb8292fc3d7b60a43 (diff) |
Adding default value for enum/flag constructor
Diffstat (limited to 'cppgenerator.cpp')
-rw-r--r-- | cppgenerator.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cppgenerator.cpp b/cppgenerator.cpp index 7ef7a4b09..ddf347581 100644 --- a/cppgenerator.cpp +++ b/cppgenerator.cpp @@ -2271,8 +2271,8 @@ void CppGenerator::writeFlagsNewMethod(QTextStream& s, const FlagsTypeEntry* cpp s << '{' << endl; s << INDENT << "if (!PyType_IsSubtype(type, &" << cpythonName << "_Type))" << endl; s << INDENT << INDENT << "return 0;" << endl << endl; - s << INDENT << "int item_value;" << endl; - s << INDENT << "if (!PyArg_ParseTuple(args, \"i:__new__\", &item_value))" << endl; + s << INDENT << "int item_value = 0;" << endl; + s << INDENT << "if (!PyArg_ParseTuple(args, \"|i:__new__\", &item_value))" << endl; { Indentation indent(INDENT); s << INDENT << "return 0;" << endl; @@ -2292,8 +2292,8 @@ void CppGenerator::writeEnumNewMethod(QTextStream& s, const AbstractMetaEnum* cp s << "static PyObject*" << endl; s << cpythonName << "_New(PyTypeObject* type, PyObject* args, PyObject* kwds)" << endl; s << '{' << endl; - s << INDENT << "int item_value;" << endl; - s << INDENT << "if (!PyArg_ParseTuple(args, \"i:__new__\", &item_value))" << endl; + s << INDENT << "int item_value = 0;" << endl; + s << INDENT << "if (!PyArg_ParseTuple(args, \"|i:__new__\", &item_value))" << endl; { Indentation indent(INDENT); s << INDENT << "return 0;" << endl; |