Commit e6a8f69f authored by Wouter's avatar Wouter

Add wrapped string "const char*" constructor

Makes the usage easier; double implicit conversion (const char* ->
QString -> AbstractWrapper<QString> ) doesn't work.
parent 36ea24af
......@@ -26,6 +26,20 @@ public:
*/
{{ class.className }}({{ class.wrappedType.signature }} value{% if class.defaultValue %} = {{ class.defaultValue }}{% endif %});
{% comment %}
Extra const char* constructor for strings, using const char* (compiler's wont do double implicit conversions
from const char* -> QString -> This type.
{% endcomment %}
{% ifequal class.sourceType "string" %}
/**
* Create a new {{ class.className }} instance.
*
* The value will be set to @p value, if that is valid.
* @param value The value to apply.
*/
{{ class.className }}(const char* value);
{% endifequal %}
/**
* Create a new {{ class.className }} instance from a variant.
*
......
......@@ -18,6 +18,19 @@
{
}
{% comment %}
Extra const char* constructor for strings, using const char* (compiler's wont do double implicit conversions
from const char* -> QString -> This type.
{% endcomment %}
{% ifequal class.sourceType "string" %}
{{ class.fullName }}::{{ class.className }}(const char* value)
: {% for base in class.inheritance %}{% if not forloop.first %}, {% endif %}{{ base.type.fullName }}()
{% empty %}AbstractWrapper<{{ class.wrappedType.type.className }}>(value)
{% endfor %}
{
}
{% endifequal %}
{{ class.fullName }} {{ class.fullName }}::fromVariant(const QVariant &value)
{
{% switch class.sourceType %}
......
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