File indexing completed on 2024-05-12 04:37:33
0001 {% extends "cpp_implementation.cpp" %} 0002 {% load kdev_filters %} 0003 0004 {% block includes %} 0005 {{ block.super }} 0006 #include <QSharedData> 0007 {% endblock includes %} 0008 0009 {% block extra_declarations %} 0010 class {% if namespaces %}{{ namespaces|join:"::" }}::{% endif %}{{ name }}Data : public QSharedData 0011 { 0012 public: 0013 {% for member in members %} 0014 {{ member.type }} {{ member.name }}; 0015 {% endfor %} 0016 }; 0017 0018 0019 {% for method in private_functions %} 0020 0021 {% include "method_definition_cpp.txt" %} 0022 { 0023 {% if method.type %} 0024 return {{ method.default_return_value }}; 0025 {% endif %} 0026 } 0027 0028 {% endfor %} 0029 0030 {% endblock extra_declarations %} 0031 0032 {% block function_definitions %} 0033 0034 {% for method in public_functions %} 0035 {% with method.arguments as arguments %} 0036 0037 {% include "method_definition_cpp.txt" %} 0038 {% if method.isConstructor %} 0039 {% with arguments|first as argFirst %} 0040 {# copy constructor? #} 0041 {% if arguments|length == 1 and argFirst.type == method.name|arg_type %} 0042 : d({{ argFirst.name }}.d) 0043 {% else %} 0044 : d(new {{ name }}Data()) 0045 {% endif %} 0046 {% endwith %} 0047 {% endif %} 0048 { 0049 {% if "operator=" == method.name %} 0050 d = other.d; 0051 return *this; 0052 {% else %} 0053 {% if method.type %}return {{ method.default_return_value }}; 0054 {% endif %} 0055 {% endif %} 0056 } 0057 0058 {% endwith %} 0059 {% endfor %} 0060 0061 {% for method in protected_functions %} 0062 {% with method.arguments as arguments %} 0063 0064 {% include "method_definition_cpp.txt" %} 0065 {% if method.isConstructor %} 0066 {% with arguments|first as argFirst %} 0067 {# copy constructor? #} 0068 {% if arguments|length == 1 and argFirst.type == method.name|arg_type %} 0069 : d({{ argFirst.name }}.d) 0070 {% else %} 0071 : d(new {{ name }}Data()) 0072 {% endif %} 0073 {% endwith %} 0074 {% endif %} 0075 { 0076 {% if method.type %}return {{ method.default_return_value }}; 0077 {% endif %} 0078 } 0079 0080 {% endwith %} 0081 {% endfor %} 0082 0083 {% for property in members %} 0084 0085 0086 {% include "class_property_getter_definition_cpp.txt" %} 0087 { 0088 return d->{{ property.name }}; 0089 } 0090 0091 0092 {% include "class_property_setter_definition_cpp.txt" %} 0093 { 0094 d->{{ property.name }} = {{ property.name }}; 0095 } 0096 0097 {% endfor %} 0098 0099 {% endblock function_definitions %}