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

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

Powered by Google App Engine
This is Rietveld 408576698