gz-cpp-util 1.3
A c++20 library containing various utilities
file_io.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "string/utility.hpp"
4
5#include <map>
6#include <unordered_map>
7#include <vector>
8
9
10namespace gz {
11
19 template<typename Hash, typename Pred>
20 void writeKeyValueFile(const std::string& filepath, const std::unordered_map<std::string, std::string, Hash, Pred>& content);
21
22 template<typename T>
23 concept ReadKeyValueFileImplemented =
24 std::same_as<T, std::vector<std::pair<std::string, std::string>>> ||
25 std::same_as<T, std::map<std::string, std::string>> ||
26 std::same_as<T, std::unordered_map<std::string, std::string>> ;
27
33 template<ReadKeyValueFileImplemented T>
34 [[nodiscard]] T readKeyValueFile(const std::string& filepath, bool removeSpaces=false);
35
36
41 [[nodiscard]] std::vector<char> readBinaryFile(const std::string& filepath);
42}
43
Contains utility for strings.