OLD | NEW |
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 import 'package:mojo/bindings.dart' as bindings; | 6 import 'package:mojo/bindings.dart' as bindings; |
7 | 7 |
8 const int kOpenFlagRead = 1; | 8 const int kOpenFlagRead = 1; |
9 const int kOpenFlagWrite = 2; | 9 const int kOpenFlagWrite = 2; |
10 const int kOpenFlagCreate = 4; | 10 const int kOpenFlagCreate = 4; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 case internal: | 109 case internal: |
110 return 'Error.internal'; | 110 return 'Error.internal'; |
111 default: | 111 default: |
112 return null; | 112 return null; |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 int toJson() => mojoEnumValue; | 116 int toJson() => mojoEnumValue; |
117 } | 117 } |
118 | 118 |
119 | |
120 | |
121 class Whence extends bindings.MojoEnum { | 119 class Whence extends bindings.MojoEnum { |
122 static const Whence fromCurrent = const Whence._(0); | 120 static const Whence fromCurrent = const Whence._(0); |
123 static const Whence fromStart = const Whence._(1); | 121 static const Whence fromStart = const Whence._(1); |
124 static const Whence fromEnd = const Whence._(2); | 122 static const Whence fromEnd = const Whence._(2); |
125 | 123 |
126 const Whence._(int v) : super(v); | 124 const Whence._(int v) : super(v); |
127 | 125 |
128 static const Map<String, Whence> valuesMap = const { | 126 static const Map<String, Whence> valuesMap = const { |
129 "fromCurrent": fromCurrent, | 127 "fromCurrent": fromCurrent, |
130 "fromStart": fromStart, | 128 "fromStart": fromStart, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 case fromEnd: | 168 case fromEnd: |
171 return 'Whence.fromEnd'; | 169 return 'Whence.fromEnd'; |
172 default: | 170 default: |
173 return null; | 171 return null; |
174 } | 172 } |
175 } | 173 } |
176 | 174 |
177 int toJson() => mojoEnumValue; | 175 int toJson() => mojoEnumValue; |
178 } | 176 } |
179 | 177 |
180 | |
181 | |
182 class FileType extends bindings.MojoEnum { | 178 class FileType extends bindings.MojoEnum { |
183 static const FileType unknown = const FileType._(0); | 179 static const FileType unknown = const FileType._(0); |
184 static const FileType regularFile = const FileType._(1); | 180 static const FileType regularFile = const FileType._(1); |
185 static const FileType directory = const FileType._(2); | 181 static const FileType directory = const FileType._(2); |
186 | 182 |
187 const FileType._(int v) : super(v); | 183 const FileType._(int v) : super(v); |
188 | 184 |
189 static const Map<String, FileType> valuesMap = const { | 185 static const Map<String, FileType> valuesMap = const { |
190 "unknown": unknown, | 186 "unknown": unknown, |
191 "regularFile": regularFile, | 187 "regularFile": regularFile, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 default: | 229 default: |
234 return null; | 230 return null; |
235 } | 231 } |
236 } | 232 } |
237 | 233 |
238 int toJson() => mojoEnumValue; | 234 int toJson() => mojoEnumValue; |
239 } | 235 } |
240 | 236 |
241 | 237 |
242 | 238 |
243 | |
244 | |
245 class Timespec extends bindings.Struct { | 239 class Timespec extends bindings.Struct { |
246 static const List<bindings.StructDataHeader> kVersions = const [ | 240 static const List<bindings.StructDataHeader> kVersions = const [ |
247 const bindings.StructDataHeader(24, 0) | 241 const bindings.StructDataHeader(24, 0) |
248 ]; | 242 ]; |
249 int seconds = 0; | 243 int seconds = 0; |
250 int nanoseconds = 0; | 244 int nanoseconds = 0; |
251 | 245 |
252 Timespec() : super(kVersions.last.size); | 246 Timespec() : super(kVersions.last.size); |
253 | 247 |
254 static Timespec deserialize(bindings.Message message) { | 248 static Timespec deserialize(bindings.Message message) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 315 |
322 Map toJson() { | 316 Map toJson() { |
323 Map map = new Map(); | 317 Map map = new Map(); |
324 map["seconds"] = seconds; | 318 map["seconds"] = seconds; |
325 map["nanoseconds"] = nanoseconds; | 319 map["nanoseconds"] = nanoseconds; |
326 return map; | 320 return map; |
327 } | 321 } |
328 } | 322 } |
329 | 323 |
330 | 324 |
331 | |
332 | |
333 class TimespecOrNow extends bindings.Struct { | 325 class TimespecOrNow extends bindings.Struct { |
334 static const List<bindings.StructDataHeader> kVersions = const [ | 326 static const List<bindings.StructDataHeader> kVersions = const [ |
335 const bindings.StructDataHeader(24, 0) | 327 const bindings.StructDataHeader(24, 0) |
336 ]; | 328 ]; |
337 bool now = false; | 329 bool now = false; |
338 Timespec timespec = null; | 330 Timespec timespec = null; |
339 | 331 |
340 TimespecOrNow() : super(kVersions.last.size); | 332 TimespecOrNow() : super(kVersions.last.size); |
341 | 333 |
342 static TimespecOrNow deserialize(bindings.Message message) { | 334 static TimespecOrNow deserialize(bindings.Message message) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 | 402 |
411 Map toJson() { | 403 Map toJson() { |
412 Map map = new Map(); | 404 Map map = new Map(); |
413 map["now"] = now; | 405 map["now"] = now; |
414 map["timespec"] = timespec; | 406 map["timespec"] = timespec; |
415 return map; | 407 return map; |
416 } | 408 } |
417 } | 409 } |
418 | 410 |
419 | 411 |
420 | |
421 | |
422 class FileInformation extends bindings.Struct { | 412 class FileInformation extends bindings.Struct { |
423 static const List<bindings.StructDataHeader> kVersions = const [ | 413 static const List<bindings.StructDataHeader> kVersions = const [ |
424 const bindings.StructDataHeader(40, 0) | 414 const bindings.StructDataHeader(40, 0) |
425 ]; | 415 ]; |
426 FileType type = null; | 416 FileType type = null; |
427 int size = 0; | 417 int size = 0; |
428 Timespec atime = null; | 418 Timespec atime = null; |
429 Timespec mtime = null; | 419 Timespec mtime = null; |
430 | 420 |
431 FileInformation() : super(kVersions.last.size); | 421 FileInformation() : super(kVersions.last.size); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 Map map = new Map(); | 522 Map map = new Map(); |
533 map["type"] = type; | 523 map["type"] = type; |
534 map["size"] = size; | 524 map["size"] = size; |
535 map["atime"] = atime; | 525 map["atime"] = atime; |
536 map["mtime"] = mtime; | 526 map["mtime"] = mtime; |
537 return map; | 527 return map; |
538 } | 528 } |
539 } | 529 } |
540 | 530 |
541 | 531 |
542 | |
543 | |
544 class DirectoryEntry extends bindings.Struct { | 532 class DirectoryEntry extends bindings.Struct { |
545 static const List<bindings.StructDataHeader> kVersions = const [ | 533 static const List<bindings.StructDataHeader> kVersions = const [ |
546 const bindings.StructDataHeader(24, 0) | 534 const bindings.StructDataHeader(24, 0) |
547 ]; | 535 ]; |
548 FileType type = null; | 536 FileType type = null; |
549 String name = null; | 537 String name = null; |
550 | 538 |
551 DirectoryEntry() : super(kVersions.last.size); | 539 DirectoryEntry() : super(kVersions.last.size); |
552 | 540 |
553 static DirectoryEntry deserialize(bindings.Message message) { | 541 static DirectoryEntry deserialize(bindings.Message message) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 Map toJson() { | 613 Map toJson() { |
626 Map map = new Map(); | 614 Map map = new Map(); |
627 map["type"] = type; | 615 map["type"] = type; |
628 map["name"] = name; | 616 map["name"] = name; |
629 return map; | 617 return map; |
630 } | 618 } |
631 } | 619 } |
632 | 620 |
633 | 621 |
634 | 622 |
635 | |
636 | |
637 | |
OLD | NEW |