Cbeam
|
#include <cbeam/error/runtime_error.hpp>
#include <cbeam/random/generators.hpp>
#include <filesystem>
#include <fstream>
#include <string>
Go to the source code of this file.
Namespaces | |
namespace | cbeam |
The root namespace for the Cbeam library. This namespace unifies cross-platform utilities for concurrency, memory management, file handling, logging, serialization, and more. Its purpose is to provide a cohesive collection of modern C++ components that address common system-level and application-level tasks, while promoting thread-safety, interprocess communication, and stable resource handling across varied platform APIs. | |
namespace | cbeam::filesystem |
Facilitates file I/O, path normalization, and directory operations in a cross-platform manner. Its classes and functions simplify reading, writing, creating, or deleting files and directories, handling discrepancies in path formats, symbolic links, and OS-specific peculiarities. | |
Functions | |
std::string | cbeam::filesystem::read_file (std::filesystem::path file_path) |
Reads the given file as std::string. Throws cbeam::error::runtime_error in case of errors. | |
void | cbeam::filesystem::write_file (const std::filesystem::path &file_path, const std::string &content) |
Creates or overwrites the given file with the given content. Throws cbeam::error::runtime_error in case of errors. | |
void | cbeam::filesystem::touch (const std::filesystem::path &p) |
create a file under the given path, if it does not exist yet; otherwise, the file content is left unchanges, but its modification time is updated, analogous to bash touch | |
std::filesystem::path | cbeam::filesystem::unique_temp_file (const std::string &extension={}) |
std::filesystem::path | cbeam::filesystem::unique_temp_dir () |
get unique and non-existing temp directory | |
std::filesystem::path | cbeam::filesystem::create_unique_temp_file (const std::string &extension={}) |
std::filesystem::path | cbeam::filesystem::create_unique_temp_dir () |
create unique temp directory, analogous to bash mktemp -d | |