|
CCF
|
Functions | |
| bool | exists (const std::string &file) |
| Checks if a path exists. | |
| std::vector< uint8_t > | slurp (const std::string &file, bool optional=false) |
| Tries to read a file as byte vector. | |
| std::string | slurp_string (const std::string &file, bool optional=false) |
| Tries to read a file as string. | |
| std::optional< std::string > | try_slurp_string (const std::string &file) |
| nlohmann::json | slurp_json (const std::string &file, bool optional=false) |
| Tries to read a file as JSON. | |
| void | dump (const std::vector< uint8_t > &data, const std::string &file) |
| Writes the content of a vector to a file. | |
| void | dump (const std::string &data, const std::string &file) |
| Writes the content of a string to a file. | |
| void | rename (const fs::path &src, const fs::path &dst) |
| void files::dump | ( | const std::string & | data, |
| const std::string & | file | ||
| ) |
Writes the content of a string to a file.
| data | string to write |
| file | the path |
| void files::dump | ( | const std::vector< uint8_t > & | data, |
| const std::string & | file | ||
| ) |
Writes the content of a vector to a file.
| data | vector to write |
| file | the path |
| bool files::exists | ( | const std::string & | file | ) |
Checks if a path exists.
| file | file to check |
| void files::rename | ( | const fs::path & | src, |
| const fs::path & | dst | ||
| ) |
| std::vector< uint8_t > files::slurp | ( | const std::string & | file, |
| bool | optional = false |
||
| ) |
Tries to read a file as byte vector.
| file | the path |
| optional | determines behaviour in the case where the file does not exist. If true, an empty vector is returned. If false, the process exits |
| nlohmann::json files::slurp_json | ( | const std::string & | file, |
| bool | optional = false |
||
| ) |
Tries to read a file as JSON.
| file | the path |
| optional | determines behaviour in the case where the file does not exist. If true, an empty JSON object is returned. If false, the process exits |
| std::string files::slurp_string | ( | const std::string & | file, |
| bool | optional = false |
||
| ) |
Tries to read a file as string.
| file | the path |
| optional | determines behaviour in the case where the file does not exist. If true, an empty vector is returned. If false, the process exits |
| std::optional< std::string > files::try_slurp_string | ( | const std::string & | file | ) |