Commit 79bb16e2 authored by Ralf Habacker's avatar Ralf Habacker

Fix 'c++ codegenerator creates uncompilable code'.

To fix initialize UmbrelloSettings attribute vectorClassName
with namespace (std::vector) and wrap attribute vectorClassNameInclude
with '<'...'>'.

BUG:377611
FIXED-IN:2.21.80 (KDE Applications 17.03.80)
parent b729cf83
......@@ -50,7 +50,7 @@ CppWriter::CppWriter()
// allows you to specify where the vector variable should be in your code,
// and "%ITEMCLASS%", if needed, where the class of the item is declared.
VECTOR_METHOD_APPEND = QLatin1String("%VARNAME%.push_back(add_object);"); // for std::vector
VECTOR_METHOD_REMOVE = QLatin1String("int i, size = %VARNAME%.size();\nfor (i = 0; i < size; ++i) {\n\t%ITEMCLASS% item = %VARNAME%.at(i);\n\tif(item == remove_object) {\n\t\tvector<%ITEMCLASS%>::iterator it = %VARNAME%.begin() + i;\n\t\t%VARNAME%.erase(it);\n\t\treturn;\n\t}\n }"); // for std::vector
VECTOR_METHOD_REMOVE = QString(QLatin1String("int i, size = %VARNAME%.size();\nfor (i = 0; i < size; ++i) {\n\t%ITEMCLASS% item = %VARNAME%.at(i);\n\tif(item == remove_object) {\n\t\t%1<%ITEMCLASS%>::iterator it = %VARNAME%.begin() + i;\n\t\t%VARNAME%.erase(it);\n\t\treturn;\n\t}\n }")).arg(policyExt()->getVectorClassName()); // for std::vector
VECTOR_METHOD_INIT.clear(); // nothing to be done
/*
VECTOR_METHOD_APPEND = QLatin1String("%VARNAME%.append(&add_object);"); // Qt lib implementation
......
......@@ -479,12 +479,12 @@
<entry name="vectorClassName" type="String">
<label>Vector Class Name</label>
<whatsthis>The name of the vector class</whatsthis>
<default>vector</default>
<default>std::vector</default>
</entry>
<entry name="vectorClassNameInclude" type="String">
<label>Vector Class Name Include </label>
<whatsthis>The name of the vector class to be included</whatsthis>
<default>vector</default>
<default>&lt;vector&gt;</default>
</entry>
<entry name="vectorIncludeIsGlobal" type="Bool">
<label>Vector include is global</label>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment