Elaztek Developer Hub
Blamite Game Engine - Strings  00307.01.26.21.0804.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 
39  STRINGS_API int CreateNewFile(std::string filename, std::string file_contents);
40 
53  STRINGS_API int CreateFileFromResource(HMODULE module_handle, std::string filename, int res_id, const char* res_type);
54 
66  STRINGS_API int CreateFileFromHTMLResource(HMODULE module_handle, std::string filename, int res_id);
67 
76  STRINGS_API int CreateFileFromPNGResource(HMODULE module_handle, std::string filename, int res_id);
77 
86  STRINGS_API void ValidatePath(std::string path);
87 
92 
98  STRINGS_API std::string GetApplicationDir();
99 
109  STRINGS_API bool ReadBinaryFile(std::string path, void* data, int64_t* size);
110 
119  STRINGS_API std::vector<std::string> GetFileContentsAsLines(std::string path);
120 
128  STRINGS_API std::string GetFileContentsAsString(std::string path);
129 
138  STRINGS_API std::vector<std::string> GetFileList(std::string path);
139 
148  STRINGS_API std::vector<std::string> GetDirectoryList(std::string path);
149  }
150  }
151 }
BlamStrings::Utils::IO::GetApplicationDir
STRINGS_API std::string GetApplicationDir()
Retrieves the application's working directory.
Definition: io.cpp:119
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:197
BlamStrings
Namespace for Blamite's shared C++ library.
Definition: hooks.h:22
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:182
BlamStrings::Utils::IO::CreateNewFile
STRINGS_API int CreateNewFile(std::string filename, std::string file_contents)
Creates a file with the specified contents.
Definition: io.cpp:27
BlamStrings::Utils::IO::GetFileContentsAsString
STRINGS_API std::string GetFileContentsAsString(std::string path)
Reads a file as a string.
Definition: io.cpp:142
BlamStrings::Utils::IO::FileExists
STRINGS_API bool FileExists(std::string name)
Checks if the specified file exists.
Definition: io.cpp:11
BlamStrings::Utils::IO::OpenGameDirectory
STRINGS_API void OpenGameDirectory()
Opens the engine's game directory in Windows Explorer.
Definition: io.cpp:112
BlamStrings::Utils::IO::CreateFileFromResource
STRINGS_API int 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:38
BlamStrings::Utils::IO::ValidatePath
STRINGS_API void ValidatePath(std::string path)
Validates that the specified path exists.
Definition: io.cpp:96
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:158
BlamStrings::Utils::IO::CreateFileFromHTMLResource
STRINGS_API int 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:59
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:126
STRINGS_API
#define STRINGS_API
Definition: io.h:8
BlamStrings::Utils::IO::CreateFileFromPNGResource
STRINGS_API int 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:72