| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library descriptor.descriptor; | 5 library descriptor.descriptor; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import '../utils.dart'; | 9 import '../utils.dart'; |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 /// described by [this]. Returns a [Future] that completes to `null` if the | 28 /// described by [this]. Returns a [Future] that completes to `null` if the |
| 29 /// entry is valid, or throws an error if it failed. | 29 /// entry is valid, or throws an error if it failed. |
| 30 /// | 30 /// |
| 31 /// [parent] defaults to [defaultRoot]. | 31 /// [parent] defaults to [defaultRoot]. |
| 32 Future validate([String parent]); | 32 Future validate([String parent]); |
| 33 | 33 |
| 34 /// An unscheduled version of [validate]. This is useful if validation errors | 34 /// An unscheduled version of [validate]. This is useful if validation errors |
| 35 /// need to be caught, since otherwise they'd be registered by the schedule. | 35 /// need to be caught, since otherwise they'd be registered by the schedule. |
| 36 Future validateNow([String parent]); | 36 Future validateNow([String parent]); |
| 37 | 37 |
| 38 /// Returns a detailed tree-style description of [this]. |
| 39 String describe(); |
| 40 } |
| 41 |
| 42 /// An interface for descriptors that can load the contents of sub-descriptors. |
| 43 abstract class LoadableDescriptor extends Descriptor { |
| 38 /// Treats [this] as an in-memory filesystem and returns a stream of the | 44 /// Treats [this] as an in-memory filesystem and returns a stream of the |
| 39 /// contents of the child entry located at [path]. This only works if [this] | 45 /// contents of the child entry located at [path]. This only works if [this] |
| 40 /// is a directory entry. This operation is not [schedule]d. | 46 /// is a directory entry. This operation is not [schedule]d. |
| 41 /// | 47 /// |
| 42 /// This method uses POSIX paths regardless of the underlying operating | 48 /// This method uses POSIX paths regardless of the underlying operating |
| 43 /// system. | 49 /// system. |
| 44 /// | 50 /// |
| 45 /// All errors in loading the file will be passed through the returned | 51 /// All errors in loading the file will be passed through the returned |
| 46 /// [Stream]. | 52 /// [Stream]. |
| 47 Stream<List<int>> load(String pathToLoad) => errorStream("Can't load " | 53 Stream<List<int>> load(String pathToLoad); |
| 48 "'$pathToLoad' from within '$name': not a directory."); | 54 } |
| 49 | 55 |
| 56 /// An interface for descriptors whose contents can be read. |
| 57 abstract class ReadableDescriptor extends Descriptor { |
| 50 /// Returns the contents of [this] as a stream. This only works if [this] is a | 58 /// Returns the contents of [this] as a stream. This only works if [this] is a |
| 51 /// file entry. This operation is not [schedule]d. | 59 /// file entry. This operation is not [schedule]d. |
| 52 /// | 60 /// |
| 53 /// All errors in loading the file will be passed through the returned | 61 /// All errors in loading the file will be passed through the returned |
| 54 /// [Stream]. | 62 /// [Stream]. |
| 55 Stream<List<int>> read(); | 63 Stream<List<int>> read(); |
| 56 | |
| 57 /// Returns a detailed tree-style description of [this]. | |
| 58 String describe(); | |
| 59 } | 64 } |
| OLD | NEW |