more advanced parsing
This commit is contained in:
@@ -75,7 +75,7 @@ std::string get_application_home_path() {
|
||||
|
||||
std::map<std::string, std::string> get_params_from_string(std::string parametersString) {
|
||||
parametersString = boost::regex_replace(parametersString, boost::regex("%26"), "&");
|
||||
parametersString = boost::regex_replace(parametersString, boost::regex("%3D"), "=");
|
||||
parametersString = boost::regex_replace(parametersString, boost::regex("%3[Dd]"), "=");
|
||||
|
||||
std::vector<std::string> parameters = split(parametersString, "&");
|
||||
|
||||
@@ -352,15 +352,13 @@ void generate_qr_code(std::string data) {
|
||||
#endif // ifdef BUILD_OFD_BINARYEYE_SCAN
|
||||
|
||||
#ifdef BUILD_EMAIL_MODE
|
||||
std::vector<std::string> read_file(std::string path) {
|
||||
std::ifstream stream(path);
|
||||
std::vector<std::string> lines;
|
||||
std::string buffer;
|
||||
while(getline(stream, buffer)) {
|
||||
lines.push_back(buffer);
|
||||
}
|
||||
stream.close();
|
||||
return lines;
|
||||
std::string read_file(std::string &path) {
|
||||
std::ifstream ifile(path, std::ios::in | std::ios::binary);
|
||||
const unsigned int size = std::filesystem::file_size(path);
|
||||
std::string content(size, '\0');
|
||||
ifile.read(content.data(), size);
|
||||
ifile.close();
|
||||
return content;
|
||||
}
|
||||
#endif // ifdef BUILD_EMAIL_MODE
|
||||
|
||||
|
||||
@@ -50,6 +50,6 @@ std::string get_local_ip_address();
|
||||
|
||||
void fetch_and_download_modules();
|
||||
#ifdef BUILD_EMAIL_MODE
|
||||
std::vector<std::string> read_file(std::string path);
|
||||
std::string read_file(std::string &path);
|
||||
#endif
|
||||
#endif // UTILS_H
|
||||
|
||||
Reference in New Issue
Block a user