libnick 2024.12.0
A cross-platform base for native Nickvision applications.
Loading...
Searching...
No Matches
codehelpers.h
Go to the documentation of this file.
1
23#ifndef CODEHELPERS_H
24#define CODEHELPERS_H
25
26#include <cstddef>
27#include <filesystem>
28#include <string>
29#include <vector>
30
32{
37 std::string getLastSystemError();
43 std::vector<std::byte> readFileBytes(const std::filesystem::path& path);
49 template<typename T>
50 const T& unmove(T&& t)
51 {
52 return t;
53 }
61 bool writeFileBytes(const std::filesystem::path& path, const std::vector<std::byte>& bytes, bool overwrite = true);
62}
63
64#endif //CODEHELPERS_H
Definition codehelpers.h:32
const T & unmove(T &&t)
Unmoves a value.
Definition codehelpers.h:50
std::string getLastSystemError()
Get the last system api call error message.
bool writeFileBytes(const std::filesystem::path &path, const std::vector< std::byte > &bytes, bool overwrite=true)
Writes a vector of bytes to a file.
std::vector< std::byte > readFileBytes(const std::filesystem::path &path)
Reads a file as a vector of bytes.