summaryrefslogtreecommitdiff
path: root/include/tgbot/tools/FileTools.h
blob: 0c3a8380d1aa47de882317488f84148ee1fdf1df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef TGBOT_FILETOOLS_H
#define TGBOT_FILETOOLS_H

#include "tgbot/export.h"

#include <string>

/**
 * @ingroup tools
 */
namespace FileTools {

/**
 * Reads whole file to string.
 * @param filePath Path to a file
 * @throws exception of type std::ifstream::failure if reading fails
 * @return string with file contents
 */
TGBOT_API
std::string read(const std::string& filePath);

/**
 * Save file to disk.
 * @param filePath Path to a file
 * @throws exception of type std::ifstream::failure if writing fails
*/
TGBOT_API
void write(const std::string& content, const std::string& filePath);

}


#endif //TGBOT_FILETOOLS_H