Cogs.Foundation
Loading...
Searching...
No Matches
Typedefs | Functions
Cogs::IO Namespace Reference

Typedefs

using RecursiveDirIterator = fs::recursive_directory_iterator
 
using DirectoryEntry = fs::directory_entry
 
using FileTimeType = fs::file_time_type
 

Functions

COGSFOUNDATION_API void readFileAsync (const std::string &fileName, const FileContents::Callback &callback, uint64_t offset=0, uint64_t size=0, FileContentsHints hints=FileContentsHints::None)
 
COGSFOUNDATION_API FileContents::Ptr readFileSync (const std::string &fileName, uint64_t offset=0, uint64_t size=0, FileContentsHints hints=FileContentsHints::None)
 
COGSFOUNDATION_API bool readTextFile (std::string &content, const std::string &fileName)
 
COGSFOUNDATION_API void autoExpandEnvironmentVariables (std::string &text)
 
COGSFOUNDATION_API std::string expandEnvironmentVariables (const std::string &input)
 
COGSFOUNDATION_API std::string expandEnvironmentVariable (const std::string &name)
 
COGSFOUNDATION_API char pathSeparator ()
 
COGSFOUNDATION_API bool exists (std::string_view path)
 
COGSFOUNDATION_API bool isFile (std::string_view path)
 
COGSFOUNDATION_API bool isDirectory (std::string_view path)
 
COGSFOUNDATION_API std::string absolute (std::string_view path)
 
COGSFOUNDATION_API std::string canonical (std::string_view path)
 
COGSFOUNDATION_API bool remove (std::string_view path)
 
COGSFOUNDATION_API std::string combine (std::string_view path, std::string_view extensionPath)
 Combine the two paths with a directory separator.
 
COGSFOUNDATION_API std::string expandPath (std::string_view fileName)
 
COGSFOUNDATION_API std::string parentPath (std::string_view str)
 
COGSFOUNDATION_API std::string relativePath (std::string_view str)
 
COGSFOUNDATION_API std::string relativePath (std::string_view str, std::string_view base)
 
COGSFOUNDATION_API std::string getPathToExe ()
 
COGSFOUNDATION_API std::string getPathRelativeToDll (const std::string &fileName, void *handle)
 
COGSFOUNDATION_API std::string getTempPath ()
 
COGSFOUNDATION_API std::string getAppDataPath ()
 
COGSFOUNDATION_API std::string getOrgLocalDataPath ()
 
COGSFOUNDATION_API bool isAbsolute (std::string_view str)
 
COGSFOUNDATION_API bool isRelative (std::string_view str)
 
COGSFOUNDATION_API std::string fileName (std::string_view str)
 
COGSFOUNDATION_API std::string extension (std::string_view str)
 
COGSFOUNDATION_API std::string stem (std::string_view str)
 
COGSFOUNDATION_API void replaceAll (std::string &str, std::string_view from, std::string_view to)
 
COGSFOUNDATION_API FileTimeType getFileTime (std::string_view path)
 
COGSFOUNDATION_API uint64_t getFileSize (std::string_view path)
 
COGSFOUNDATION_API bool writeBinaryFile (const std::string &fileName, const void *content, size_t contentSize)
 
COGSFOUNDATION_API bool createDirectories (std::string_view fileName)
 
COGSFOUNDATION_API RecursiveDirIterator directoryIterator (std::string_view directory)
 
COGSFOUNDATION_API std::string getPath (const DirectoryEntry &entry)
 
COGSFOUNDATION_API bool copyFile (std::string_view src, std::string_view dest)
 
COGSFOUNDATION_API void backupFile (const std::string &path, int max)
 
COGSFOUNDATION_API FileHandle::Ptr openFile (std::string_view path, FileHandle::OpenMode openMode, FileHandle::AccessMode accessMode)
 
COGSFOUNDATION_API void closeFile (const FileHandle::Ptr &handle)
 
COGSFOUNDATION_API size_t fileSize (const FileHandle::Ptr &handle)
 
COGSFOUNDATION_API void * mapFile (const FileHandle::Ptr &handle, FileHandle::ProtectionMode protectionMode, size_t offset, size_t size)
 
COGSFOUNDATION_API void unmapFile (const FileHandle::Ptr &handle)
 

Typedef Documentation

◆ DirectoryEntry

using Cogs::IO::DirectoryEntry = typedef fs::directory_entry

◆ FileTimeType

using Cogs::IO::FileTimeType = typedef fs::file_time_type

◆ RecursiveDirIterator

using Cogs::IO::RecursiveDirIterator = typedef fs::recursive_directory_iterator

Function Documentation

◆ absolute()

std::string Cogs::IO::absolute ( std::string_view  path)

◆ autoExpandEnvironmentVariables()

void Cogs::IO::autoExpandEnvironmentVariables ( std::string &  text)

◆ backupFile()

void Cogs::IO::backupFile ( const std::string &  path,
int  max 
)

◆ canonical()

std::string Cogs::IO::canonical ( std::string_view  path)

◆ closeFile()

void Cogs::IO::closeFile ( const FileHandle::Ptr handle)

◆ combine()

std::string Cogs::IO::combine ( std::string_view  path,
std::string_view  extensionPath 
)

Combine the two paths with a directory separator.

References replaceAll().

◆ copyFile()

bool Cogs::IO::copyFile ( std::string_view  src,
std::string_view  dest 
)

References LOG_ERROR, and StringViewFormat.

◆ createDirectories()

bool Cogs::IO::createDirectories ( std::string_view  fileName)

◆ directoryIterator()

Cogs::IO::RecursiveDirIterator Cogs::IO::directoryIterator ( std::string_view  directory)

◆ exists()

bool Cogs::IO::exists ( std::string_view  path)

◆ expandEnvironmentVariable()

std::string Cogs::IO::expandEnvironmentVariable ( const std::string &  name)

◆ expandEnvironmentVariables()

std::string Cogs::IO::expandEnvironmentVariables ( const std::string &  input)

◆ expandPath()

std::string Cogs::IO::expandPath ( std::string_view  fileName)

◆ extension()

std::string Cogs::IO::extension ( std::string_view  str)

Referenced by stem().

◆ fileName()

std::string Cogs::IO::fileName ( std::string_view  str)

Referenced by stem().

◆ fileSize()

size_t Cogs::IO::fileSize ( const FileHandle::Ptr handle)

◆ getAppDataPath()

std::string Cogs::IO::getAppDataPath ( )

◆ getFileSize()

uint64_t Cogs::IO::getFileSize ( std::string_view  path)

◆ getFileTime()

Cogs::IO::FileTimeType Cogs::IO::getFileTime ( std::string_view  path)

Referenced by Cogs::Item::Item().

◆ getOrgLocalDataPath()

std::string Cogs::IO::getOrgLocalDataPath ( )

◆ getPath()

std::string Cogs::IO::getPath ( const DirectoryEntry entry)

◆ getPathRelativeToDll()

std::string Cogs::IO::getPathRelativeToDll ( const std::string &  fileName,
void *  handle 
)

◆ getPathToExe()

std::string Cogs::IO::getPathToExe ( )

◆ getTempPath()

std::string Cogs::IO::getTempPath ( )

◆ isAbsolute()

bool Cogs::IO::isAbsolute ( std::string_view  str)

◆ isDirectory()

bool Cogs::IO::isDirectory ( std::string_view  path)

◆ isFile()

bool Cogs::IO::isFile ( std::string_view  path)

◆ isRelative()

bool Cogs::IO::isRelative ( std::string_view  str)

◆ mapFile()

void * Cogs::IO::mapFile ( const FileHandle::Ptr handle,
FileHandle::ProtectionMode  protectionMode,
size_t  offset,
size_t  size 
)

◆ openFile()

Cogs::FileHandle::Ptr Cogs::IO::openFile ( std::string_view  path,
FileHandle::OpenMode  openMode,
FileHandle::AccessMode  accessMode 
)

◆ parentPath()

std::string Cogs::IO::parentPath ( std::string_view  str)

References replaceAll().

◆ pathSeparator()

char Cogs::IO::pathSeparator ( )

◆ readFileAsync()

void Cogs::IO::readFileAsync ( const std::string &  fileName,
const FileContents::Callback callback,
uint64_t  offset = 0,
uint64_t  size = 0,
FileContentsHints  hints = FileContentsHints::None 
)

◆ readFileSync()

Cogs::FileContents::Ptr Cogs::IO::readFileSync ( const std::string &  fileName,
uint64_t  offset = 0,
uint64_t  size = 0,
FileContentsHints  hints = FileContentsHints::None 
)

◆ readTextFile()

bool Cogs::IO::readTextFile ( std::string &  content,
const std::string &  fileName 
)

◆ relativePath() [1/2]

std::string Cogs::IO::relativePath ( std::string_view  str)

◆ relativePath() [2/2]

std::string Cogs::IO::relativePath ( std::string_view  str,
std::string_view  base 
)

◆ remove()

bool Cogs::IO::remove ( std::string_view  path)

◆ replaceAll()

void Cogs::IO::replaceAll ( std::string &  str,
std::string_view  from,
std::string_view  to 
)

Referenced by combine(), and parentPath().

◆ stem()

std::string Cogs::IO::stem ( std::string_view  str)

References extension(), and fileName().

◆ unmapFile()

void Cogs::IO::unmapFile ( const FileHandle::Ptr handle)

◆ writeBinaryFile()

bool Cogs::IO::writeBinaryFile ( const std::string &  fileName,
const void *  content,
size_t  contentSize 
)