Cogs.Core
Public Member Functions | Public Attributes | List of all members
Cogs::Core::IOHandler Struct Reference
Inheritance diagram for Cogs::Core::IOHandler:
Cogs::IIOHandler

Public Member Functions

 IOHandler (Context *context, ResourceStore *store)
 
bool resolveFile (const Cogs::StringView &source, const Cogs::StringView &fileName, std::string &content) override
 Callback method used to resolve include statements in shader code and get the contents to include.
 
bool openFile (const Cogs::StringView &fileName, std::string &content) override
 Callback method used to open files.
 
void pushSearchPaths () override
 
void addSearchPath (const Cogs::StringView &path) override
 
void popSearchPaths () override
 
std::string getPath (FileType type, const std::string &fileName) const
 
bool exists (FileType type, const Cogs::StringView &fileName) override
 
bool writeBinaryFile (FileType type, const Cogs::StringView &fileName, const void *content, size_t contentSize) override
 
bool openBinaryFile (FileType type, const Cogs::StringView &fileName, std::vector< uint8_t > &content) override
 
virtual bool openFile (const StringView &fileName, std::string &content)=0
 Callback method used to open files.
 
virtual bool resolveFile (const StringView &source, const StringView &fileName, std::string &content)=0
 Callback method used to resolve include statements in shader code and get the contents to include.
 
virtual bool exists (FileType type, const StringView &fileName)=0
 
virtual bool writeBinaryFile (FileType type, const StringView &fileName, const void *content, size_t contentSize)=0
 
virtual bool openBinaryFile (FileType type, const StringView &fileName, std::vector< uint8_t > &content)=0
 
virtual void pushSearchPaths ()=0
 
virtual void addSearchPath (const StringView &path)=0
 
virtual void popSearchPaths ()=0
 

Public Attributes

Contextcontext = nullptr
 
ResourceStorestore = nullptr
 

Additional Inherited Members

- Public Types inherited from Cogs::IIOHandler
enum class  FileType { ShaderDump = 0 , ShaderCache , PipelineCache }
 

Detailed Description

Definition at line 181 of file ResourceStore.cpp.

Constructor & Destructor Documentation

◆ IOHandler()

Cogs::Core::IOHandler::IOHandler ( Context context,
ResourceStore store 
)
inline

Definition at line 183 of file ResourceStore.cpp.

Member Function Documentation

◆ addSearchPath()

void Cogs::Core::IOHandler::addSearchPath ( const Cogs::StringView path)
inlineoverridevirtual

Implements Cogs::IIOHandler.

Definition at line 215 of file ResourceStore.cpp.

◆ exists()

bool Cogs::Core::IOHandler::exists ( FileType  type,
const Cogs::StringView fileName 
)
inlineoverridevirtual

Implements Cogs::IIOHandler.

Definition at line 236 of file ResourceStore.cpp.

◆ getPath()

std::string Cogs::Core::IOHandler::getPath ( FileType  type,
const std::string &  fileName 
) const
inline

Definition at line 222 of file ResourceStore.cpp.

◆ openBinaryFile()

bool Cogs::Core::IOHandler::openBinaryFile ( FileType  type,
const Cogs::StringView fileName,
std::vector< uint8_t > &  content 
)
inlineoverridevirtual

Implements Cogs::IIOHandler.

Definition at line 256 of file ResourceStore.cpp.

◆ openFile()

bool Cogs::Core::IOHandler::openFile ( const Cogs::StringView fileName,
std::string &  content 
)
inlineoverridevirtual

Callback method used to open files.

Parameters
fileNameFile name of the file that should be opened.
contentReference to a string that should receive the contents of the file.

Implements Cogs::IIOHandler.

Definition at line 208 of file ResourceStore.cpp.

References resolveFile().

◆ popSearchPaths()

void Cogs::Core::IOHandler::popSearchPaths ( )
inlineoverridevirtual

Implements Cogs::IIOHandler.

Definition at line 220 of file ResourceStore.cpp.

◆ pushSearchPaths()

void Cogs::Core::IOHandler::pushSearchPaths ( )
inlineoverridevirtual

Implements Cogs::IIOHandler.

Definition at line 213 of file ResourceStore.cpp.

◆ resolveFile()

bool Cogs::Core::IOHandler::resolveFile ( const Cogs::StringView source,
const Cogs::StringView fileName,
std::string &  content 
)
inlineoverridevirtual

Callback method used to resolve include statements in shader code and get the contents to include.

Parameters
sourceName of the source being compiled. This can e.g. be used to lookup include files based on the path of the currently compiling file.
fileNameFile name of the file that is being resolved.
contentReference to a string that should receive the contents of the file.

Implements Cogs::IIOHandler.

Definition at line 188 of file ResourceStore.cpp.

References Cogs::Core::ResourceStore::getResourceContents().

Referenced by openFile().

◆ writeBinaryFile()

bool Cogs::Core::IOHandler::writeBinaryFile ( FileType  type,
const Cogs::StringView fileName,
const void *  content,
size_t  contentSize 
)
inlineoverridevirtual

Implements Cogs::IIOHandler.

Definition at line 243 of file ResourceStore.cpp.

Member Data Documentation

◆ context

Context* Cogs::Core::IOHandler::context = nullptr

Definition at line 267 of file ResourceStore.cpp.

◆ store

ResourceStore* Cogs::Core::IOHandler::store = nullptr

Definition at line 268 of file ResourceStore.cpp.


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