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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/mojo/net_address.mojom.dart

Issue 1539673003: Generate Mojom Types in Dart (Take 2) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: All Short Names use unsafe GetElementForName Created 4 years, 11 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 net_address_mojom; 5 library net_address_mojom;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:mojo/bindings.dart' as bindings; 9 import 'package:mojo/bindings.dart' as bindings;
10 import 'package:mojo/core.dart' as core; 10 import 'package:mojo/core.dart' as core;
11 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types;
11 12
12 class NetAddressFamily extends bindings.MojoEnum { 13 class NetAddressFamily extends bindings.MojoEnum {
13 static const NetAddressFamily unspecified = const NetAddressFamily._(0); 14 static const NetAddressFamily unspecified = const NetAddressFamily._(0);
14 static const NetAddressFamily ipv4 = const NetAddressFamily._(1); 15 static const NetAddressFamily ipv4 = const NetAddressFamily._(1);
15 static const NetAddressFamily ipv6 = const NetAddressFamily._(2); 16 static const NetAddressFamily ipv6 = const NetAddressFamily._(2);
16 17
17 const NetAddressFamily._(int v) : super(v); 18 const NetAddressFamily._(int v) : super(v);
18 19
19 static const Map<String, NetAddressFamily> valuesMap = const { 20 static const Map<String, NetAddressFamily> valuesMap = const {
20 "unspecified": unspecified, 21 "unspecified": unspecified,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 54 }
54 55
55 String toString() { 56 String toString() {
56 switch(this) { 57 switch(this) {
57 case unspecified: 58 case unspecified:
58 return 'NetAddressFamily.unspecified'; 59 return 'NetAddressFamily.unspecified';
59 case ipv4: 60 case ipv4:
60 return 'NetAddressFamily.ipv4'; 61 return 'NetAddressFamily.ipv4';
61 case ipv6: 62 case ipv6:
62 return 'NetAddressFamily.ipv6'; 63 return 'NetAddressFamily.ipv6';
64 default:
65 return null;
63 } 66 }
64 } 67 }
65 68
66 int toJson() => mojoEnumValue; 69 int toJson() => mojoEnumValue;
67 } 70 }
68 71
69 72
70 73
74
75
71 class NetAddressIPv4 extends bindings.Struct { 76 class NetAddressIPv4 extends bindings.Struct {
72 static const List<bindings.StructDataHeader> kVersions = const [ 77 static const List<bindings.StructDataHeader> kVersions = const [
73 const bindings.StructDataHeader(24, 0) 78 const bindings.StructDataHeader(24, 0)
74 ]; 79 ];
75 int port = 0; 80 int port = 0;
76 List<int> addr = null; 81 List<int> addr = null;
77 82
78 NetAddressIPv4() : super(kVersions.last.size); 83 NetAddressIPv4() : super(kVersions.last.size);
79 84
80 static NetAddressIPv4 deserialize(bindings.Message message) { 85 static NetAddressIPv4 deserialize(bindings.Message message) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 142
138 Map toJson() { 143 Map toJson() {
139 Map map = new Map(); 144 Map map = new Map();
140 map["port"] = port; 145 map["port"] = port;
141 map["addr"] = addr; 146 map["addr"] = addr;
142 return map; 147 return map;
143 } 148 }
144 } 149 }
145 150
146 151
152
153
147 class NetAddressIPv6 extends bindings.Struct { 154 class NetAddressIPv6 extends bindings.Struct {
148 static const List<bindings.StructDataHeader> kVersions = const [ 155 static const List<bindings.StructDataHeader> kVersions = const [
149 const bindings.StructDataHeader(24, 0) 156 const bindings.StructDataHeader(24, 0)
150 ]; 157 ];
151 int port = 0; 158 int port = 0;
152 List<int> addr = null; 159 List<int> addr = null;
153 160
154 NetAddressIPv6() : super(kVersions.last.size); 161 NetAddressIPv6() : super(kVersions.last.size);
155 162
156 static NetAddressIPv6 deserialize(bindings.Message message) { 163 static NetAddressIPv6 deserialize(bindings.Message message) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 220
214 Map toJson() { 221 Map toJson() {
215 Map map = new Map(); 222 Map map = new Map();
216 map["port"] = port; 223 map["port"] = port;
217 map["addr"] = addr; 224 map["addr"] = addr;
218 return map; 225 return map;
219 } 226 }
220 } 227 }
221 228
222 229
230
231
223 class NetAddress extends bindings.Struct { 232 class NetAddress extends bindings.Struct {
224 static const List<bindings.StructDataHeader> kVersions = const [ 233 static const List<bindings.StructDataHeader> kVersions = const [
225 const bindings.StructDataHeader(32, 0) 234 const bindings.StructDataHeader(32, 0)
226 ]; 235 ];
227 NetAddressFamily family = new NetAddressFamily(0); 236 NetAddressFamily family = new NetAddressFamily(0);
228 NetAddressIPv4 ipv4 = null; 237 NetAddressIPv4 ipv4 = null;
229 NetAddressIPv6 ipv6 = null; 238 NetAddressIPv6 ipv6 = null;
230 239
231 NetAddress() : super(kVersions.last.size); 240 NetAddress() : super(kVersions.last.size);
232 241
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 Map toJson() { 313 Map toJson() {
305 Map map = new Map(); 314 Map map = new Map();
306 map["family"] = family; 315 map["family"] = family;
307 map["ipv4"] = ipv4; 316 map["ipv4"] = ipv4;
308 map["ipv6"] = ipv6; 317 map["ipv6"] = ipv6;
309 return map; 318 return map;
310 } 319 }
311 } 320 }
312 321
313 322
323
324
325
326
327
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698