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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/mojo/files/types.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 types_mojom; 5 library types_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 const int kOpenFlagRead = 1; 13 const int kOpenFlagRead = 1;
12 const int kOpenFlagWrite = 2; 14 const int kOpenFlagWrite = 2;
13 const int kOpenFlagCreate = 4; 15 const int kOpenFlagCreate = 4;
14 const int kOpenFlagExclusive = 8; 16 const int kOpenFlagExclusive = 8;
15 const int kOpenFlagAppend = 16; 17 const int kOpenFlagAppend = 16;
16 const int kOpenFlagTruncate = 32; 18 const int kOpenFlagTruncate = 32;
17 const int kDeleteFlagFileOnly = 1; 19 const int kDeleteFlagFileOnly = 1;
18 const int kDeleteFlagDirectoryOnly = 2; 20 const int kDeleteFlagDirectoryOnly = 2;
19 const int kDeleteFlagRecursive = 4; 21 const int kDeleteFlagRecursive = 4;
20 22
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 case outOfRange: 106 case outOfRange:
105 return 'Error.outOfRange'; 107 return 'Error.outOfRange';
106 case unimplemented: 108 case unimplemented:
107 return 'Error.unimplemented'; 109 return 'Error.unimplemented';
108 case closed: 110 case closed:
109 return 'Error.closed'; 111 return 'Error.closed';
110 case unavailable: 112 case unavailable:
111 return 'Error.unavailable'; 113 return 'Error.unavailable';
112 case internal: 114 case internal:
113 return 'Error.internal'; 115 return 'Error.internal';
116 default:
117 return null;
114 } 118 }
115 } 119 }
116 120
117 int toJson() => mojoEnumValue; 121 int toJson() => mojoEnumValue;
118 } 122 }
119 123
124
125
120 class Whence extends bindings.MojoEnum { 126 class Whence extends bindings.MojoEnum {
121 static const Whence fromCurrent = const Whence._(0); 127 static const Whence fromCurrent = const Whence._(0);
122 static const Whence fromStart = const Whence._(1); 128 static const Whence fromStart = const Whence._(1);
123 static const Whence fromEnd = const Whence._(2); 129 static const Whence fromEnd = const Whence._(2);
124 130
125 const Whence._(int v) : super(v); 131 const Whence._(int v) : super(v);
126 132
127 static const Map<String, Whence> valuesMap = const { 133 static const Map<String, Whence> valuesMap = const {
128 "fromCurrent": fromCurrent, 134 "fromCurrent": fromCurrent,
129 "fromStart": fromStart, 135 "fromStart": fromStart,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 167 }
162 168
163 String toString() { 169 String toString() {
164 switch(this) { 170 switch(this) {
165 case fromCurrent: 171 case fromCurrent:
166 return 'Whence.fromCurrent'; 172 return 'Whence.fromCurrent';
167 case fromStart: 173 case fromStart:
168 return 'Whence.fromStart'; 174 return 'Whence.fromStart';
169 case fromEnd: 175 case fromEnd:
170 return 'Whence.fromEnd'; 176 return 'Whence.fromEnd';
177 default:
178 return null;
171 } 179 }
172 } 180 }
173 181
174 int toJson() => mojoEnumValue; 182 int toJson() => mojoEnumValue;
175 } 183 }
176 184
185
186
177 class FileType extends bindings.MojoEnum { 187 class FileType extends bindings.MojoEnum {
178 static const FileType unknown = const FileType._(0); 188 static const FileType unknown = const FileType._(0);
179 static const FileType regularFile = const FileType._(1); 189 static const FileType regularFile = const FileType._(1);
180 static const FileType directory = const FileType._(2); 190 static const FileType directory = const FileType._(2);
181 191
182 const FileType._(int v) : super(v); 192 const FileType._(int v) : super(v);
183 193
184 static const Map<String, FileType> valuesMap = const { 194 static const Map<String, FileType> valuesMap = const {
185 "unknown": unknown, 195 "unknown": unknown,
186 "regularFile": regularFile, 196 "regularFile": regularFile,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 228 }
219 229
220 String toString() { 230 String toString() {
221 switch(this) { 231 switch(this) {
222 case unknown: 232 case unknown:
223 return 'FileType.unknown'; 233 return 'FileType.unknown';
224 case regularFile: 234 case regularFile:
225 return 'FileType.regularFile'; 235 return 'FileType.regularFile';
226 case directory: 236 case directory:
227 return 'FileType.directory'; 237 return 'FileType.directory';
238 default:
239 return null;
228 } 240 }
229 } 241 }
230 242
231 int toJson() => mojoEnumValue; 243 int toJson() => mojoEnumValue;
232 } 244 }
233 245
234 246
235 247
248
249
236 class Timespec extends bindings.Struct { 250 class Timespec extends bindings.Struct {
237 static const List<bindings.StructDataHeader> kVersions = const [ 251 static const List<bindings.StructDataHeader> kVersions = const [
238 const bindings.StructDataHeader(24, 0) 252 const bindings.StructDataHeader(24, 0)
239 ]; 253 ];
240 int seconds = 0; 254 int seconds = 0;
241 int nanoseconds = 0; 255 int nanoseconds = 0;
242 256
243 Timespec() : super(kVersions.last.size); 257 Timespec() : super(kVersions.last.size);
244 258
245 static Timespec deserialize(bindings.Message message) { 259 static Timespec deserialize(bindings.Message message) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 316
303 Map toJson() { 317 Map toJson() {
304 Map map = new Map(); 318 Map map = new Map();
305 map["seconds"] = seconds; 319 map["seconds"] = seconds;
306 map["nanoseconds"] = nanoseconds; 320 map["nanoseconds"] = nanoseconds;
307 return map; 321 return map;
308 } 322 }
309 } 323 }
310 324
311 325
326
327
312 class TimespecOrNow extends bindings.Struct { 328 class TimespecOrNow extends bindings.Struct {
313 static const List<bindings.StructDataHeader> kVersions = const [ 329 static const List<bindings.StructDataHeader> kVersions = const [
314 const bindings.StructDataHeader(24, 0) 330 const bindings.StructDataHeader(24, 0)
315 ]; 331 ];
316 bool now = false; 332 bool now = false;
317 Timespec timespec = null; 333 Timespec timespec = null;
318 334
319 TimespecOrNow() : super(kVersions.last.size); 335 TimespecOrNow() : super(kVersions.last.size);
320 336
321 static TimespecOrNow deserialize(bindings.Message message) { 337 static TimespecOrNow deserialize(bindings.Message message) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 395
380 Map toJson() { 396 Map toJson() {
381 Map map = new Map(); 397 Map map = new Map();
382 map["now"] = now; 398 map["now"] = now;
383 map["timespec"] = timespec; 399 map["timespec"] = timespec;
384 return map; 400 return map;
385 } 401 }
386 } 402 }
387 403
388 404
405
406
389 class FileInformation extends bindings.Struct { 407 class FileInformation extends bindings.Struct {
390 static const List<bindings.StructDataHeader> kVersions = const [ 408 static const List<bindings.StructDataHeader> kVersions = const [
391 const bindings.StructDataHeader(40, 0) 409 const bindings.StructDataHeader(40, 0)
392 ]; 410 ];
393 FileType type = null; 411 FileType type = null;
394 int size = 0; 412 int size = 0;
395 Timespec atime = null; 413 Timespec atime = null;
396 Timespec mtime = null; 414 Timespec mtime = null;
397 415
398 FileInformation() : super(kVersions.last.size); 416 FileInformation() : super(kVersions.last.size);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 Map map = new Map(); 497 Map map = new Map();
480 map["type"] = type; 498 map["type"] = type;
481 map["size"] = size; 499 map["size"] = size;
482 map["atime"] = atime; 500 map["atime"] = atime;
483 map["mtime"] = mtime; 501 map["mtime"] = mtime;
484 return map; 502 return map;
485 } 503 }
486 } 504 }
487 505
488 506
507
508
489 class DirectoryEntry extends bindings.Struct { 509 class DirectoryEntry extends bindings.Struct {
490 static const List<bindings.StructDataHeader> kVersions = const [ 510 static const List<bindings.StructDataHeader> kVersions = const [
491 const bindings.StructDataHeader(24, 0) 511 const bindings.StructDataHeader(24, 0)
492 ]; 512 ];
493 FileType type = null; 513 FileType type = null;
494 String name = null; 514 String name = null;
495 515
496 DirectoryEntry() : super(kVersions.last.size); 516 DirectoryEntry() : super(kVersions.last.size);
497 517
498 static DirectoryEntry deserialize(bindings.Message message) { 518 static DirectoryEntry deserialize(bindings.Message message) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 579
560 Map toJson() { 580 Map toJson() {
561 Map map = new Map(); 581 Map map = new Map();
562 map["type"] = type; 582 map["type"] = type;
563 map["name"] = name; 583 map["name"] = name;
564 return map; 584 return map;
565 } 585 }
566 } 586 }
567 587
568 588
589
590
591
592
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698