35 virtual std::unique_ptr<std::istream>
open( std::string
const& url ) = 0;
40 virtual std::optional<std::string>
read( std::string
const& url ) {
41 auto is =
open( url );
42 if ( !is || !is->good() )
return std::nullopt;
43 return std::string{ std::istreambuf_iterator<char>{ *is }, std::istreambuf_iterator<char>{} };
47 virtual const std::vector<std::string>&
protocols()
const = 0;
Abstract interface for a service or tool implementing a read access to files.
virtual std::optional< std::string > read(std::string const &url)
Find the URL and returns an optional<string> to the content of the file the URL is pointing to.
virtual std::unique_ptr< std::istream > open(std::string const &url)=0
Find the URL and returns a unique_ptr to an input stream interface of an object that can be used to r...
DeclareInterfaceID(IFileAccess, 3, 1)
InterfaceID.
virtual const std::vector< std::string > & protocols() const =0
Protocols supported by the instance.
Definition of the basic interface.