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

Public Member Functions

bool openFile (const StringView &fileName, std::string &content) override
 Callback method used to open files.
 
bool resolveFile (const StringView &source, const StringView &fileName, std::string &content) override
 Callback method used to resolve include statements in shader code and get the contents to include.
 
bool exists (FileType type, const StringView &fileName) override
 
bool writeBinaryFile (FileType type, const StringView &fileName, const void *content, size_t contentSize) override
 
bool openBinaryFile (FileType type, const StringView &fileName, std::vector< uint8_t > &content) override
 
void pushSearchPaths () override
 
void addSearchPath (const StringView &path) override
 
void popSearchPaths () 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
 

Private Attributes

std::vector< std::string > searchPaths
 
std::vector< std::string > pushedSearchPaths
 

Additional Inherited Members

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

Detailed Description

Definition at line 7 of file DefaultIOHandler.h.

Member Function Documentation

◆ addSearchPath()

void Cogs::DefaultIOHandler::addSearchPath ( const StringView path)
overridevirtual

Implements Cogs::IIOHandler.

Definition at line 84 of file DefaultIOHandler.cpp.

◆ exists()

bool Cogs::DefaultIOHandler::exists ( FileType  type,
const StringView fileName 
)
overridevirtual

Implements Cogs::IIOHandler.

Definition at line 99 of file DefaultIOHandler.cpp.

◆ openBinaryFile()

bool Cogs::DefaultIOHandler::openBinaryFile ( FileType  type,
const StringView fileName,
std::vector< uint8_t > &  content 
)
overridevirtual

Implements Cogs::IIOHandler.

Definition at line 136 of file DefaultIOHandler.cpp.

◆ openFile()

bool Cogs::DefaultIOHandler::openFile ( const StringView fileName,
std::string &  content 
)
overridevirtual

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 44 of file DefaultIOHandler.cpp.

References resolveFile().

◆ popSearchPaths()

void Cogs::DefaultIOHandler::popSearchPaths ( )
overridevirtual

Implements Cogs::IIOHandler.

Definition at line 94 of file DefaultIOHandler.cpp.

◆ pushSearchPaths()

void Cogs::DefaultIOHandler::pushSearchPaths ( )
overridevirtual

Implements Cogs::IIOHandler.

Definition at line 89 of file DefaultIOHandler.cpp.

◆ resolveFile()

bool Cogs::DefaultIOHandler::resolveFile ( const StringView source,
const StringView fileName,
std::string &  content 
)
overridevirtual

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 49 of file DefaultIOHandler.cpp.

Referenced by openFile().

◆ writeBinaryFile()

bool Cogs::DefaultIOHandler::writeBinaryFile ( FileType  type,
const StringView fileName,
const void *  content,
size_t  contentSize 
)
overridevirtual

Implements Cogs::IIOHandler.

Definition at line 112 of file DefaultIOHandler.cpp.

Member Data Documentation

◆ pushedSearchPaths

std::vector<std::string> Cogs::DefaultIOHandler::pushedSearchPaths
private

Definition at line 29 of file DefaultIOHandler.h.

◆ searchPaths

std::vector<std::string> Cogs::DefaultIOHandler::searchPaths
private
Initial value:
= {
"", "../Data/", "../Data/Shaders/"
}

Definition at line 22 of file DefaultIOHandler.h.


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