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

Side by Side Diff: mojo/public/bindings/generators/cpp_struct.template

Issue 52973003: mojo: break struct headers into headers and source (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add constant for header size Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright $year The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef $header_guard
6 #define $header_guard
7
8 #include "mojo/public/bindings/lib/bindings.h"
9
10 namespace $namespace {
11
12 #pragma pack(push, 1)
13
14 class $classname {
15 public:
16 static $classname* New(mojo::Buffer* buf) {
17 return new (buf->Allocate(sizeof($classname))) $classname();
18 }
19
20 $setters
21
22 $getters
23
24 private:
25 friend class mojo::internal::ObjectTraits<$classname>;
26
27 $classname() {
28 header_.num_bytes = sizeof(*this);
29 header_.num_fields = $num_fields;
30 }
31 ~$classname(); // NOT IMPLEMENTED
32
33 mojo::internal::StructHeader _header_;
34 $fields
35 };
36
37 MOJO_COMPILE_ASSERT(sizeof($classname) == $size, bad_sizeof_$classname);
38
39 #pragma pack(pop)
40
41 } // namespace $namespace
42
43 #endif // $header_guard
OLDNEW
« no previous file with comments | « mojo/public/bindings/generators/cpp_interface.template ('k') | mojo/public/bindings/generators/module_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698