Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

templates: Omit setter stubs for read-only properties #99

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codegen_glibmm/templates/stub.cpp.templ
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void {{ class_name_with_namespace }}::{{ signal.name }}_emitter(
}

{% endfor %}
{% for prop in interface.properties %}
{% for prop in interface.properties if prop.writable %}

bool {{ class_name_with_namespace }}::{{ prop.name }}_set({{ prop.cpptype_in }} value)
{
Expand Down
4 changes: 3 additions & 1 deletion codegen_glibmm/templates/stub.h.templ
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public:

class MethodInvocation;

{% for prop in interface.properties %}
{% for prop in interface.properties if prop.writable %}
bool {{ prop.name }}_set({{ prop.cpptype_in }} value);
{% endfor %}
protected:
Expand All @@ -44,12 +44,14 @@ protected:
{% endfor %}
{% for prop in interface.properties %}

{% if prop.writable %}
/* Handle the setting of a property
* This method will be called as a result of a call to <PropName>_set
* and should implement the actual setting of the property value.
* Should return true on success and false otherwise.
*/
virtual bool {{ prop.name }}_setHandler({{ prop.cpptype_in }} value) = 0;
{% endif %}
virtual {{ prop.cpptype_out }} {{ prop.name }}_get() = 0;
{% endfor %}
{% for signal in interface.signals %}
Expand Down