MapLibre Native Core
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mbgl::FileSource Class Referenceabstract

#include <file_source.hpp>

Inheritance diagram for mbgl::FileSource:
mbgl::DatabaseFileSource mbgl::OnlineFileSource

Public Types

using Callback = std::function< void(Response)>
 

Public Member Functions

FileSourceoperator= (const FileSource &)=delete
 
virtual ~FileSource ()=default
 
virtual std::unique_ptr< AsyncRequestrequest (const Resource &, Callback)=0
 
virtual void forward (const Resource &, const Response &, std::function< void()>)
 
virtual bool supportsCacheOnlyRequests () const
 
virtual bool canRequest (const Resource &) const =0
 Checks whether a resource could be requested from this file source. More...
 
virtual void pause ()
 
virtual void resume ()
 
virtual void setProperty (const std::string &, const mapbox::base::Value &)
 Generic setter method. More...
 
virtual mapbox::base::Value getProperty (const std::string &) const
 Generic getter method. More...
 
virtual void setResourceTransform (ResourceTransform)
 When supported, sets the modifier of the requested resources. More...
 
virtual void setResourceOptions (ResourceOptions)=0
 
virtual ResourceOptions getResourceOptions ()=0
 
virtual void setClientOptions (ClientOptions)=0
 
virtual ClientOptions getClientOptions ()=0
 

Protected Member Functions

 FileSource ()=default
 

Detailed Description

Definition at line 35 of file file_source.hpp.

Member Typedef Documentation

◆ Callback

using mbgl::FileSource::Callback = std::function<void (Response)>

Definition at line 40 of file file_source.hpp.

Constructor & Destructor Documentation

◆ ~FileSource()

virtual mbgl::FileSource::~FileSource ( )
virtualdefault

◆ FileSource()

mbgl::FileSource::FileSource ( )
protecteddefault

Member Function Documentation

◆ canRequest()

virtual bool mbgl::FileSource::canRequest ( const Resource ) const
pure virtual

Checks whether a resource could be requested from this file source.

Implemented in mbgl::DatabaseFileSource.

◆ forward()

virtual void mbgl::FileSource::forward ( const Resource ,
const Response ,
std::function< void()>   
)
inlinevirtual

Allows to forward response from one source to another. Optionally, callback can be provided to receive notification for forward operation.

Reimplemented in mbgl::DatabaseFileSource.

Definition at line 54 of file file_source.hpp.

◆ getClientOptions()

virtual ClientOptions mbgl::FileSource::getClientOptions ( )
pure virtual

◆ getProperty()

virtual mapbox::base::Value mbgl::FileSource::getProperty ( const std::string &  ) const
inlinevirtual

Generic getter method.

Definition at line 84 of file file_source.hpp.

◆ getResourceOptions()

virtual ResourceOptions mbgl::FileSource::getResourceOptions ( )
pure virtual

◆ operator=()

FileSource& mbgl::FileSource::operator= ( const FileSource )
delete

◆ pause()

virtual void mbgl::FileSource::pause ( )
inlinevirtual

Pause file request activity.

If pause is called then no revalidation or network request activity will occur.

Reimplemented in mbgl::DatabaseFileSource.

Definition at line 71 of file file_source.hpp.

◆ request()

virtual std::unique_ptr<AsyncRequest> mbgl::FileSource::request ( const Resource ,
Callback   
)
pure virtual

Request a resource. The callback will be called asynchronously, in the same thread as the request was made. This thread must have an active RunLoop. The request may be cancelled before completion by releasing the returned AsyncRequest. If the request is cancelled before the callback is executed, the callback will not be executed.

Implemented in mbgl::DatabaseFileSource.

◆ resume()

virtual void mbgl::FileSource::resume ( )
inlinevirtual

Resume file request activity.

Calling resume will unpause the file source and process any tasks that expired while the file source was paused.

Reimplemented in mbgl::DatabaseFileSource.

Definition at line 79 of file file_source.hpp.

◆ setClientOptions()

virtual void mbgl::FileSource::setClientOptions ( ClientOptions  )
pure virtual

◆ setProperty()

virtual void mbgl::FileSource::setProperty ( const std::string &  ,
const mapbox::base::Value &   
)
inlinevirtual

Generic setter method.

Reimplemented in mbgl::DatabaseFileSource.

Definition at line 82 of file file_source.hpp.

◆ setResourceOptions()

virtual void mbgl::FileSource::setResourceOptions ( ResourceOptions  )
pure virtual

◆ setResourceTransform()

virtual void mbgl::FileSource::setResourceTransform ( ResourceTransform  )
inlinevirtual

When supported, sets the modifier of the requested resources.

Definition at line 87 of file file_source.hpp.

◆ supportsCacheOnlyRequests()

virtual bool mbgl::FileSource::supportsCacheOnlyRequests ( ) const
inlinevirtual

When a file source supports consulting a local cache only, it must return true. Cache-only requests are requests that aren't as urgent, but could be useful, e.g. to cover part of the map while loading. The FileSource should only do cheap actions to retrieve the data, e.g. load it from a cache, but not from the internet.

Definition at line 60 of file file_source.hpp.


The documentation for this class was generated from the following file: