libadblockplus
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
Classes | Public Types | Public Member Functions | List of all members
AdblockPlus::IFileSystem Class Referenceabstract

File system interface. More...

#include <IFileSystem.h>

Classes

struct  StatResult
 Result of a stat operation, i.e. information about a file. More...
 

Public Types

typedef std::vector< uint8_t > IOBuffer
 Type for the buffer used for IO.
 
typedef std::function< void(const
std::string &)> 
Callback
 Default callback type for asynchronous filesystem calls. More...
 
typedef std::function< void(IOBuffer &&)> ReadCallback
 Callback type for the asynchronous Read call. More...
 
typedef std::function< void(const
StatResult &, const
std::string &)> 
StatCallback
 Callback type for the asynchronous Stat call. More...
 

Public Member Functions

virtual void Read (const std::string &fileName, const ReadCallback &doneCallback, const Callback &errorCallback) const =0
 Reads from a file. More...
 
virtual void Write (const std::string &fileName, const IOBuffer &data, const Callback &callback)=0
 Writes to a file. More...
 
virtual void Move (const std::string &fromFileName, const std::string &toFileName, const Callback &callback)=0
 Moves a file (i.e. renames it). More...
 
virtual void Remove (const std::string &fileName, const Callback &callback)=0
 Removes a file. More...
 
virtual void Stat (const std::string &fileName, const StatCallback &callback) const =0
 Retrieves information about a file. More...
 

Detailed Description

File system interface.

Member Typedef Documentation

typedef std::function<void(const std::string&)> AdblockPlus::IFileSystem::Callback

Default callback type for asynchronous filesystem calls.

Parameters
Anerror string. Empty is success.
typedef std::function<void(IOBuffer&&)> AdblockPlus::IFileSystem::ReadCallback

Callback type for the asynchronous Read call.

Parameters
Outputchar array with file content.
typedef std::function<void(const StatResult&, const std::string&)> AdblockPlus::IFileSystem::StatCallback

Callback type for the asynchronous Stat call.

Parameters
theStatResult data.
anerror string. Empty if no error.

Member Function Documentation

virtual void AdblockPlus::IFileSystem::Move ( const std::string &  fromFileName,
const std::string &  toFileName,
const Callback callback 
)
pure virtual

Moves a file (i.e. renames it).

Parameters
fromFileNameCurrent file name.
toFileNameNew file name.
callbackThe function called on completion.
virtual void AdblockPlus::IFileSystem::Read ( const std::string &  fileName,
const ReadCallback doneCallback,
const Callback errorCallback 
) const
pure virtual

Reads from a file.

Parameters
fileNameFile name.
doneCallbackThe function called on completion with the input data. If this function throws then the implementation should call errorCallback.
errorCallbackThe function called if an error occured.
virtual void AdblockPlus::IFileSystem::Remove ( const std::string &  fileName,
const Callback callback 
)
pure virtual

Removes a file.

Parameters
fileNameFile name.
callbackThe function called on completion.
virtual void AdblockPlus::IFileSystem::Stat ( const std::string &  fileName,
const StatCallback callback 
) const
pure virtual

Retrieves information about a file.

Parameters
fileNameFile name.
callbackThe function called on completion.
virtual void AdblockPlus::IFileSystem::Write ( const std::string &  fileName,
const IOBuffer data,
const Callback callback 
)
pure virtual

Writes to a file.

Parameters
fileNameFile name.
dataThe data to write.
callbackThe function called on completion.

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