Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Unified Diff: mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl

Issue 294833002: Mojo: more idiomatic C++ bindings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix windows bustage Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
index 0a54e1d5a58a0901887af92d6af019ec84ae4d62..af97091a4a88481b3b58c69a562dc490d88b9f4c 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
@@ -14,6 +14,8 @@
#include "mojo/public/cpp/bindings/interface_ptr.h"
#include "mojo/public/cpp/bindings/message_filter.h"
#include "mojo/public/cpp/bindings/no_interface.h"
+#include "mojo/public/cpp/bindings/string.h"
+#include "mojo/public/cpp/bindings/struct_ptr.h"
#include "{{module.path}}-internal.h"
{%- for import in imports %}
#include "{{import.module.path}}.h"
@@ -39,9 +41,22 @@ class {{interface.name}};
typedef mojo::InterfacePtr<{{interface.name}}> {{interface.name}}Ptr;
{% endfor %}
+{#--- Struct Forward Declarations -#}
+{% for struct in structs %}
+class {{struct.name}};
+{% if struct|should_inline %}
+typedef mojo::InlinedStructPtr<{{struct.name}}> {{struct.name}}Ptr;
+{% include "wrapper_class_declaration.tmpl" %}
+{% else %}
+typedef mojo::StructPtr<{{struct.name}}> {{struct.name}}Ptr;
+{% endif %}
+{% endfor %}
+
{#--- Structs #}
{% for struct in structs %}
-{% include "wrapper_class_declaration.tmpl" %}
+{% if not struct|should_inline %}
+{% include "wrapper_class_declaration.tmpl" %}
yzshen1 2014/05/27 22:16:59 Why do line 49 and line 58 need to be in different
+{% endif %}
{%- endfor %}
{#--- Interfaces -#}
@@ -69,19 +84,15 @@ typedef mojo::InterfacePtr<{{interface.name}}> {{interface.name}}Ptr;
{% include "interface_response_validator_declaration.tmpl" %}
{%- endfor %}
+{#--- Struct Serialization Helpers -#}
+{% if structs %}
+{% for struct in structs %}
+{% include "struct_serialization_declaration.tmpl" %}
+{%- endfor %}
+{%- endif %}
+
{%- for namespace in namespaces_as_array|reverse %}
} // namespace {{namespace}}
{%- endfor %}
-{#--- Enum TypeTraits Specializations #}
-{% if enums %}
-namespace mojo {
-namespace internal {
-{% for enum in enums %}
-{% include "enum_traits.tmpl" %}
-{%- endfor %}
-} // namespace internal
-} // namespace mojo
-{%- endif %}
-
#endif // {{header_guard}}

Powered by Google App Engine
This is Rietveld 408576698