Cogs.Core
DataFetcherBase.h
1#pragma once
2
3#include "DataFetcherManager.h"
4
5#include "Foundation/Platform/IO.h"
6
7namespace Cogs {
8 ENABLE_ENUM_FLAGS(FileContentsHints);
9}
10
11namespace Cogs::Core {
12 class COGSCORE_DLL_API DataFetcherBase {
13 public:
14 virtual ~DataFetcherBase() = default;
15
21 virtual bool fetchAsync(const std::string& /*fileName*/, const FileContents::Callback& /*callback*/, uint64_t /*offset*/, uint64_t /*size*/, DataFetcherManager::FetchId /*cancellationId*/, FileContentsHints /*hints*/) {
22 return false;
23 }
24
25 virtual void cancelAsyncFetch(DataFetcherManager::FetchId /*cancellationId*/) { }
26
32 virtual FileContents::Ptr fetchSync(const std::string& fileName, uint64_t offset, uint64_t size, FileContentsHints hints) {
33 return IO::readFileSync(fileName, offset, size, hints);
34 }
35 };
36}
virtual bool fetchAsync(const std::string &, const FileContents::Callback &, uint64_t, uint64_t, DataFetcherManager::FetchId, FileContentsHints)
Asynchronously fetches data into memory and forwards it to the provided callback function.
virtual FileContents::Ptr fetchSync(const std::string &fileName, uint64_t offset, uint64_t size, FileContentsHints hints)
Fetches data into memory and returns it as a FileContents object.
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
FileContentsHints
Definition: FileContents.h:11