| 1 | // |
| 2 | // FileStreamFactory.h |
| 3 | // |
| 4 | // Library: Foundation |
| 5 | // Package: URI |
| 6 | // Module: FileStreamFactory |
| 7 | // |
| 8 | // Definition of the FileStreamFactory class. |
| 9 | // |
| 10 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. |
| 11 | // and Contributors. |
| 12 | // |
| 13 | // SPDX-License-Identifier: BSL-1.0 |
| 14 | // |
| 15 | |
| 16 | |
| 17 | #ifndef Foundation_FileStreamFactory_INCLUDED |
| 18 | #define Foundation_FileStreamFactory_INCLUDED |
| 19 | |
| 20 | |
| 21 | #include "Poco/Foundation.h" |
| 22 | #include "Poco/URIStreamFactory.h" |
| 23 | |
| 24 | |
| 25 | namespace Poco { |
| 26 | |
| 27 | |
| 28 | class Path; |
| 29 | |
| 30 | |
| 31 | class Foundation_API FileStreamFactory: public URIStreamFactory |
| 32 | /// An implementation of the URIStreamFactory interface |
| 33 | /// that handles file URIs. |
| 34 | { |
| 35 | public: |
| 36 | FileStreamFactory(); |
| 37 | /// Creates the FileStreamFactory. |
| 38 | |
| 39 | ~FileStreamFactory(); |
| 40 | /// Destroys the FileStreamFactory. |
| 41 | |
| 42 | std::istream* open(const URI& uri); |
| 43 | /// Creates and opens a file stream in binary mode for the given URI. |
| 44 | /// The URI must be either a file URI or a relative URI reference |
| 45 | /// containing a path to a local file. |
| 46 | /// |
| 47 | /// Throws an FileNotFound exception if the file cannot |
| 48 | /// be opened. |
| 49 | |
| 50 | std::istream* open(const Path& path); |
| 51 | /// Creates and opens a file stream in binary mode for the given path. |
| 52 | /// |
| 53 | /// Throws an FileNotFound exception if the file cannot |
| 54 | /// be opened. |
| 55 | }; |
| 56 | |
| 57 | |
| 58 | } // namespace Poco |
| 59 | |
| 60 | |
| 61 | #endif // Foundation_FileStreamFactory_INCLUDED |
| 62 | |