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

Side by Side Diff: mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/rect.mojom.dart

Issue 1539673003: Generate Mojom Types in Dart (Take 2) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Merge with master Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 library rect_mojom; 5 library rect_mojom;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection';
8 9
9 import 'package:mojo/bindings.dart' as bindings; 10 import 'package:mojo/bindings.dart' as bindings;
10 import 'package:mojo/core.dart' as core; 11 import 'package:mojo/core.dart' as core;
12 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types;
11 13
12 14
13 15
16
14 class Rect extends bindings.Struct { 17 class Rect extends bindings.Struct {
15 static const List<bindings.StructDataHeader> kVersions = const [ 18 static const List<bindings.StructDataHeader> kVersions = const [
16 const bindings.StructDataHeader(24, 0) 19 const bindings.StructDataHeader(24, 0)
17 ]; 20 ];
18 int x = 0; 21 int x = 0;
19 int y = 0; 22 int y = 0;
20 int width = 0; 23 int width = 0;
21 int height = 0; 24 int height = 0;
22 25
23 Rect() : super(kVersions.last.size); 26 Rect() : super(kVersions.last.size);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 Map toJson() { 100 Map toJson() {
98 Map map = new Map(); 101 Map map = new Map();
99 map["x"] = x; 102 map["x"] = x;
100 map["y"] = y; 103 map["y"] = y;
101 map["width"] = width; 104 map["width"] = width;
102 map["height"] = height; 105 map["height"] = height;
103 return map; 106 return map;
104 } 107 }
105 } 108 }
106 109
110 mojom_types.MojomStruct _rectRect() {
111 return new mojom_types.MojomStruct()
112 ..declData = (new mojom_types.DeclarationData()
113 ..shortName = 'Rect'
114 ..fullIdentifier = 'mojo.test.Rect')
115 ..fields = <mojom_types.StructField>[
116 new mojom_types.StructField()
117 ..declData = (new mojom_types.DeclarationData()
118 ..shortName = 'X')
119 ..type = (new mojom_types.Type()
120 ..simpleType = mojom_types.SimpleType.int32),
121 new mojom_types.StructField()
122 ..declData = (new mojom_types.DeclarationData()
123 ..shortName = 'Y')
124 ..type = (new mojom_types.Type()
125 ..simpleType = mojom_types.SimpleType.int32),
126 new mojom_types.StructField()
127 ..declData = (new mojom_types.DeclarationData()
128 ..shortName = 'Width')
129 ..type = (new mojom_types.Type()
130 ..simpleType = mojom_types.SimpleType.int32),
131 new mojom_types.StructField()
132 ..declData = (new mojom_types.DeclarationData()
133 ..shortName = 'Height')
134 ..type = (new mojom_types.Type()
135 ..simpleType = mojom_types.SimpleType.int32),];
136 }
107 137
138
139
140 Map<String, mojom_types.UserDefinedType> _initDescriptions() {
141 var map = new HashMap<String, mojom_types.UserDefinedType>();
142 map["rect_Rect__"] =
143 new mojom_types.UserDefinedType()
144 ..structType = _rectRect();
145 return map;
146 }
147
148 var _mojomDesc;
149 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() {
150 if (_mojomDesc == null) {
151 _mojomDesc = _initDescriptions();
152 }
153 return _mojomDesc;
154 }
155
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698