Expose Forwarding* as part of the main interface. (#12)
As part of this, add ForwardingFileSystem.
Fixes #2
diff --git a/lib/file.dart b/lib/file.dart
index 04cb973..cdde9fe 100644
--- a/lib/file.dart
+++ b/lib/file.dart
@@ -4,4 +4,5 @@
/// Core interfaces containing the abstract `FileSystem` interface definition
/// and all associated types used by `FileSystem`.
+export 'src/forwarding.dart';
export 'src/interface.dart';
diff --git a/lib/src/forwarding.dart b/lib/src/forwarding.dart
index fb349f8..a0f46d6 100644
--- a/lib/src/forwarding.dart
+++ b/lib/src/forwarding.dart
@@ -13,5 +13,6 @@
part 'forwarding/forwarding_directory.dart';
part 'forwarding/forwarding_file.dart';
+part 'forwarding/forwarding_file_system.dart';
part 'forwarding/forwarding_file_system_entity.dart';
part 'forwarding/forwarding_link.dart';
diff --git a/lib/src/forwarding/forwarding_directory.dart b/lib/src/forwarding/forwarding_directory.dart
index 40fa714..3c75a02 100644
--- a/lib/src/forwarding/forwarding_directory.dart
+++ b/lib/src/forwarding/forwarding_directory.dart
@@ -4,6 +4,7 @@
part of file.src.forwarding;
+/// A directory that forwards all methods and properties to a delegate.
abstract class ForwardingDirectory
extends ForwardingFileSystemEntity<Directory, io.Directory>
implements Directory {
diff --git a/lib/src/forwarding/forwarding_file.dart b/lib/src/forwarding/forwarding_file.dart
index 9434283..500642d 100644
--- a/lib/src/forwarding/forwarding_file.dart
+++ b/lib/src/forwarding/forwarding_file.dart
@@ -4,6 +4,7 @@
part of file.src.forwarding;
+/// A file that forwards all methods and properties to a delegate.
abstract class ForwardingFile extends ForwardingFileSystemEntity<File, io.File>
implements File {
@override
diff --git a/lib/src/forwarding/forwarding_file_system.dart b/lib/src/forwarding/forwarding_file_system.dart
new file mode 100644
index 0000000..6dd94c1
--- /dev/null
+++ b/lib/src/forwarding/forwarding_file_system.dart
@@ -0,0 +1,62 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+part of file.src.forwarding;
+
+/// A file system that forwards all methods and properties to a delegate.
+abstract class ForwardingFileSystem extends FileSystem {
+ /// The file system to which this file system will forward all activity.
+ @protected
+ final FileSystem delegate;
+
+ /// Creates a new [ForwardingFileSystem] that forwards all methods and
+ /// properties to the specified [delegate].
+ ForwardingFileSystem(this.delegate);
+
+ @override
+ Directory directory(path) => delegate.directory(path);
+
+ @override
+ File file(path) => delegate.file(path);
+
+ @override
+ Link link(path) => delegate.link(path);
+
+ @override
+ String get pathSeparator => delegate.pathSeparator;
+
+ @override
+ Directory get systemTempDirectory => delegate.systemTempDirectory;
+
+ @override
+ Directory get currentDirectory => delegate.currentDirectory;
+
+ @override
+ set currentDirectory(dynamic path) => delegate.currentDirectory = path;
+
+ @override
+ Future<io.FileStat> stat(String path) => delegate.stat(path);
+
+ @override
+ io.FileStat statSync(String path) => delegate.statSync(path);
+
+ @override
+ Future<bool> identical(String path1, String path2) =>
+ delegate.identical(path1, path2);
+
+ @override
+ bool identicalSync(String path1, String path2) =>
+ delegate.identicalSync(path1, path2);
+
+ @override
+ bool get isWatchSupported => delegate.isWatchSupported;
+
+ @override
+ Future<io.FileSystemEntityType> type(String path, {bool followLinks: true}) =>
+ delegate.type(path, followLinks: followLinks);
+
+ @override
+ io.FileSystemEntityType typeSync(String path, {bool followLinks: true}) =>
+ delegate.typeSync(path, followLinks: followLinks);
+}
diff --git a/lib/src/forwarding/forwarding_file_system_entity.dart b/lib/src/forwarding/forwarding_file_system_entity.dart
index bc2ddcb..4385452 100644
--- a/lib/src/forwarding/forwarding_file_system_entity.dart
+++ b/lib/src/forwarding/forwarding_file_system_entity.dart
@@ -4,8 +4,10 @@
part of file.src.forwarding;
+/// A file system entity that forwards all methods and properties to a delegate.
abstract class ForwardingFileSystemEntity<T extends FileSystemEntity,
D extends io.FileSystemEntity> implements FileSystemEntity {
+ /// The entity to which this entity will forward all methods and properties.
@protected
D get delegate;
diff --git a/lib/src/forwarding/forwarding_link.dart b/lib/src/forwarding/forwarding_link.dart
index ff3419a..6fcd81c 100644
--- a/lib/src/forwarding/forwarding_link.dart
+++ b/lib/src/forwarding/forwarding_link.dart
@@ -4,6 +4,7 @@
part of file.src.forwarding;
+/// A link that forwards all methods and properties to a delegate.
abstract class ForwardingLink extends ForwardingFileSystemEntity<Link, io.Link>
implements Link {
@override