Elaztek Developer Hub
Blamite Game Engine - Strings  00326.06.27.21.0407.blamite
A library containing general purpose utilities and classes for use in multiple projects.
io.h
Go to the documentation of this file.
1 #include <string>
2 #include <vector>
3 #include <Windows.h>
4 
5 #ifdef STRINGS_EXPORTS
6 #define STRINGS_API __declspec(dllexport)
7 #else
8 #define STRINGS_API __declspec(dllimport)
9 #endif
10 
11 namespace BlamStrings
12 {
13  namespace Utils
14  {
18  namespace IO
19  {
27  STRINGS_API bool FileExists(std::string name);
28 
37  STRINGS_API bool IsFile(std::string path);
38 
47  STRINGS_API bool IsDirectory(std::string path);
48 
57  STRINGS_API bool CreateNewFile(std::string filename, std::string file_contents);
58 
71  STRINGS_API bool CreateFileFromResource(HMODULE module_handle, std::string filename, int res_id, const char* res_type);
72 
84  STRINGS_API bool CreateFileFromHTMLResource(HMODULE module_handle, std::string filename, int res_id);
85 
96  STRINGS_API bool CreateFileFromPNGResource(HMODULE module_handle, std::string filename, int res_id);
97 
106  STRINGS_API void ValidatePath(std::string path);
107 
112 
118  STRINGS_API std::string GetApplicationDir();
119 
129  STRINGS_API bool ReadBinaryFile(std::string path, void* data, int64_t* size);
130 
139  STRINGS_API std::vector<std::string> GetFileContentsAsLines(std::string path);
140 
148  STRINGS_API std::string GetFileContentsAsString(std::string path);
149 
158  STRINGS_API std::vector<std::string> GetFileList(std::string path);
159 
168  STRINGS_API std::vector<std::string> GetDirectoryList(std::string path);
169 
180  STRINGS_API std::string NormalizePath(std::string path);
181 
192  STRINGS_API std::string GetFileName(std::string path);
193 
204  STRINGS_API std::string GetFileExtension(std::string path);
205 
220  STRINGS_API std::string GetContainingFolder(std::string path);
221 
229  STRINGS_API std::string GetEngineDataRoot();
230 
234  STRINGS_API void ExploreDirectory(std::string path);
235  }
236  }
237 }
BlamStrings::Utils::IO::GetApplicationDir
STRINGS_API std::string GetApplicationDir()
Retrieves the application's working directory.
Definition: io.cpp:185
BlamStrings::Utils::IO::GetDirectoryList
STRINGS_API std::vector< std::string > GetDirectoryList(std::string path)
Retrieves the list of all folders in the root of a given directory.
Definition: io.cpp:276
BlamStrings
Namespace for Blamite's shared C++ library.
Definition: hooks.h:22
BlamStrings::Utils::IO::GetFileExtension
STRINGS_API std::string GetFileExtension(std::string path)
Retrieves the extension of a file.
Definition: io.cpp:344
BlamStrings::Utils::IO::CreateFileFromHTMLResource
STRINGS_API bool CreateFileFromHTMLResource(HMODULE module_handle, std::string filename, int res_id)
Creates a file with the contents pulled from the specified application HTML resource.
Definition: io.cpp:117
BlamStrings::Utils::IO::CreateNewFile
STRINGS_API bool CreateNewFile(std::string filename, std::string file_contents)
Creates a file with the specified contents, or overwrites an existing file if it already exists.
Definition: io.cpp:76
BlamStrings::Utils::IO::CreateFileFromPNGResource
STRINGS_API bool CreateFileFromPNGResource(HMODULE module_handle, std::string filename, int res_id)
Creates a file with the contents pulled from the specified application PNG resource.
Definition: io.cpp:138
BlamStrings::Utils::IO::GetEngineDataRoot
STRINGS_API std::string GetEngineDataRoot()
Retrieves the root folder for all game engine and editing kit user data files.
Definition: io.cpp:381
BlamStrings::Utils::IO::GetFileList
STRINGS_API std::vector< std::string > GetFileList(std::string path)
Retrieves the list of all files in a given directory.
Definition: io.cpp:248
BlamStrings::Utils::IO::IsDirectory
STRINGS_API bool IsDirectory(std::string path)
Checks if a given path refers to a directory.
Definition: io.cpp:59
BlamStrings::Utils::IO::GetFileName
STRINGS_API std::string GetFileName(std::string path)
Retrieves the name of the file or folder that a given path refers to.
Definition: io.cpp:321
BlamStrings::Utils::IO::GetFileContentsAsString
STRINGS_API std::string GetFileContentsAsString(std::string path)
Reads a file as a string.
Definition: io.cpp:208
BlamStrings::Utils::IO::NormalizePath
STRINGS_API std::string NormalizePath(std::string path)
Normalizes a path string.
Definition: io.cpp:304
BlamStrings::Utils::IO::IsFile
STRINGS_API bool IsFile(std::string path)
Checks if a given path refers to a regular file.
Definition: io.cpp:42
BlamStrings::Utils::IO::FileExists
STRINGS_API bool FileExists(std::string name)
Checks if the specified file or directory exists.
Definition: io.cpp:26
BlamStrings::Utils::IO::OpenGameDirectory
STRINGS_API void OpenGameDirectory()
Opens the engine's game directory in Windows Explorer.
Definition: io.cpp:178
BlamStrings::Utils::IO::CreateFileFromResource
STRINGS_API bool CreateFileFromResource(HMODULE module_handle, std::string filename, int res_id, const char *res_type)
Creates a file with the contents pulled from the specified application resource.
Definition: io.cpp:94
BlamStrings::Utils::IO::GetContainingFolder
STRINGS_API std::string GetContainingFolder(std::string path)
Retrieves the containing folder of a given file or directory.
Definition: io.cpp:360
BlamStrings::Utils::IO::ValidatePath
STRINGS_API void ValidatePath(std::string path)
Validates that the specified path exists.
Definition: io.cpp:162
BlamStrings::Utils::IO::ReadBinaryFile
STRINGS_API bool ReadBinaryFile(std::string path, void *data, int64_t *size)
Reads a file as raw binary data.
Definition: io.cpp:224
BlamStrings::Utils::IO::GetFileContentsAsLines
STRINGS_API std::vector< std::string > GetFileContentsAsLines(std::string path)
Reads a file as a list of strings.
Definition: io.cpp:192
STRINGS_API
#define STRINGS_API
Definition: io.h:8
BlamStrings::Utils::IO::ExploreDirectory
STRINGS_API void ExploreDirectory(std::string path)
Opens a directory within the system file explorer.
Definition: io.cpp:394