-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c6ba581
commit f901016
Showing
9 changed files
with
285 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "local_storage.hpp" | ||
|
||
|
||
std::string load_from_file(const std::filesystem::path &filename) { | ||
std::ifstream ifs(filename); | ||
|
||
std::string content((std::istreambuf_iterator<char>(ifs)), | ||
(std::istreambuf_iterator<char>())); | ||
|
||
ifs.close(); | ||
return content; | ||
} | ||
|
||
void dump_to_file(const std::filesystem::path &filename, const std::string &content) { | ||
|
||
std::filesystem::create_directories(filename.parent_path()); | ||
|
||
std::ofstream ofs(filename); | ||
ofs << content; | ||
ofs.close(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
#include <fstream> | ||
#include <filesystem> | ||
|
||
std::string load_from_file(const std::filesystem::path &filename); | ||
|
||
void dump_to_file(const std::filesystem::path &filename, const std::string &content); |
Oops, something went wrong.