DART  6.7.3
dart::common::ResourceRetriever Class Referenceabstract

ResourceRetriever provides methods for testing for the existance of and accessing the content of a resource specified by URI. More...

#include <ResourceRetriever.hpp>

Inheritance diagram for dart::common::ResourceRetriever:
dart::common::LocalResourceRetriever dart::utils::CompositeResourceRetriever dart::utils::DartResourceRetriever dart::utils::PackageResourceRetriever

Public Member Functions

virtual ~ResourceRetriever ()=default
 
virtual bool exists (const Uri &_uri)=0
 Returns whether the resource specified by a URI exists. More...
 
virtual ResourcePtr retrieve (const Uri &_uri)=0
 Returns the resource specified by a URI or nullptr on failure. More...
 
virtual std::string readAll (const Uri &uri)
 Reads all data from the resource of uri, and returns it as a string. More...
 
virtual std::string getFilePath (const Uri &uri)
 Returns absolute file path to uri; an empty string if unavailable. More...
 

Detailed Description

ResourceRetriever provides methods for testing for the existance of and accessing the content of a resource specified by URI.

Constructor & Destructor Documentation

◆ ~ResourceRetriever()

virtual dart::common::ResourceRetriever::~ResourceRetriever ( )
virtualdefault

Member Function Documentation

◆ exists()

virtual bool dart::common::ResourceRetriever::exists ( const Uri _uri)
pure virtual

◆ getFilePath()

std::string dart::common::ResourceRetriever::getFilePath ( const Uri uri)
virtual

Returns absolute file path to uri; an empty string if unavailable.

This base class returns an empty string by default.

Reimplemented in dart::common::LocalResourceRetriever, dart::utils::PackageResourceRetriever, dart::utils::DartResourceRetriever, and dart::utils::CompositeResourceRetriever.

◆ readAll()

std::string dart::common::ResourceRetriever::readAll ( const Uri uri)
virtual

Reads all data from the resource of uri, and returns it as a string.

Parameters
[in]uriURI to the resource to be retrieved.
Returns
The string retrieved from the resource.
Exceptions
std::runtime_errorwhen failed to read sucessfully.

◆ retrieve()

virtual ResourcePtr dart::common::ResourceRetriever::retrieve ( const Uri _uri)
pure virtual