libadblockplus
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
Classes | Public Types | Public Member Functions | Protected Attributes | List of all members
AdblockPlus::Platform Class Reference

AdblockPlus platform is the main component providing access to other modules. More...

#include <Platform.h>

Classes

struct  CreationParameters
 Platform creation parameters. More...
 

Public Types

typedef std::function< void(const
FilterEngine &)> 
OnFilterEngineCreatedCallback
 Callback type invoked when FilterEngine is created.
 
typedef std::function< void(ITimer &)> WithTimerCallback
 
typedef std::function< void(IFileSystem &)> WithFileSystemCallback
 
typedef std::function< void(IWebRequest &)> WithWebRequestCallback
 
typedef std::function< void(LogSystem &)> WithLogSystemCallback
 

Public Member Functions

 Platform (CreationParameters &&creationParameters=CreationParameters())
 Platform constructor. More...
 
void SetUpJsEngine (const AppInfo &appInfo=AppInfo(), std::unique_ptr< IV8IsolateProvider > isolate=nullptr)
 Ensures that JsEngine is constructed. More...
 
JsEngineGetJsEngine ()
 Retrieves the JsEngine instance. More...
 
void CreateFilterEngineAsync (const FilterEngine::CreationParameters &parameters=FilterEngine::CreationParameters(), const OnFilterEngineCreatedCallback &onCreated=OnFilterEngineCreatedCallback())
 Ensures that FilterEngine is constructed. More...
 
FilterEngineGetFilterEngine ()
 Synchronous equivalent of CreateFilterEngineAsync. More...
 
virtual void WithTimer (const WithTimerCallback &)
 
virtual void WithFileSystem (const WithFileSystemCallback &)
 
virtual void WithWebRequest (const WithWebRequestCallback &)
 
virtual void WithLogSystem (const WithLogSystemCallback &)
 

Protected Attributes

LogSystemPtr logSystem
 
TimerPtr timer
 
FileSystemPtr fileSystem
 
WebRequestPtr webRequest
 

Detailed Description

AdblockPlus platform is the main component providing access to other modules.

It manages the functionality modules, e.g. JsEngine and FilterEngine as well as allows to correctly work with asynchronous functionality.

Constructor & Destructor Documentation

AdblockPlus::Platform::Platform ( CreationParameters &&  creationParameters = CreationParameters())
explicit

Platform constructor.

When a parameter value is nullptr the corresponding default implementation is chosen.

Member Function Documentation

void AdblockPlus::Platform::CreateFilterEngineAsync ( const FilterEngine::CreationParameters parameters = FilterEngine::CreationParameters(),
const OnFilterEngineCreatedCallback onCreated = OnFilterEngineCreatedCallback() 
)

Ensures that FilterEngine is constructed.

Only the first call is effective.

Parameters
parametersoptional creation parameters.
onCreatedA callback which is called when FilterEngine is ready for use.
FilterEngine& AdblockPlus::Platform::GetFilterEngine ( )

Synchronous equivalent of CreateFilterEngineAsync.

Internally it blocks and waits for finishing of certain asynchronous operations, please ensure that provided implementation does not lead to a dead lock.

JsEngine& AdblockPlus::Platform::GetJsEngine ( )

Retrieves the JsEngine instance.

It calls SetUpJsEngine if JsEngine is not initialized yet.

void AdblockPlus::Platform::SetUpJsEngine ( const AppInfo appInfo = AppInfo(),
std::unique_ptr< IV8IsolateProvider isolate = nullptr 
)

Ensures that JsEngine is constructed.

If JsEngine is already present then the parameters are ignored.

Parameters
appInfoInformation about the app,
isolateA provider of v8::Isolate, if the value is nullptr then a default implementation is used.

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