Use new funcs in other modules

This commit is contained in:
FutureRave 2022-02-27 16:49:12 +00:00
parent 204a752a96
commit 99e3920008
No known key found for this signature in database
GPG Key ID: E883E2BC9657D955
3 changed files with 12 additions and 12 deletions

View File

@ -10,7 +10,7 @@ namespace Utils
if (mimeType)
{
std::wstring wMimeType(mimeType);
return std::string(wMimeType.begin(), wMimeType.end());
return String::Convert(wMimeType);
}
return "application/octet-stream";

View File

@ -396,7 +396,7 @@ namespace Utils
return false;
}
void WebIO::formatPath(std::string &path, bool win)
void WebIO::formatPath(std::string& path, bool win)
{
size_t nPos;
std::string find = "\\";
@ -408,7 +408,7 @@ namespace Utils
replace = "\\";
}
while ((nPos = path.find(find)) != std::wstring::npos)
while ((nPos = path.find(find)) != std::string::npos)
{
path = path.replace(nPos, find.length(), replace);
}
@ -445,7 +445,7 @@ namespace Utils
return (FtpRenameFileA(this->hConnect, directory.data(), newDir.data()) == TRUE); // According to the internetz, this should work
}
bool WebIO::listElements(const std::string& directory, std::vector<std::string> &list, bool files)
bool WebIO::listElements(const std::string& directory, std::vector<std::string>& list, bool files)
{
list.clear();
@ -483,12 +483,12 @@ namespace Utils
return result;
}
bool WebIO::listDirectories(const std::string& directory, std::vector<std::string> &list)
bool WebIO::listDirectories(const std::string& directory, std::vector<std::string>& list)
{
return this->listElements(directory, list, false);
}
bool WebIO::listFiles(const std::string& directory, std::vector<std::string> &list)
bool WebIO::listFiles(const std::string& directory, std::vector<std::string>& list)
{
return this->listElements(directory, list, true);
}
@ -532,7 +532,7 @@ namespace Utils
return result;
}
bool WebIO::downloadFileData(const std::string& file, std::string &data)
bool WebIO::downloadFileData(const std::string& file, std::string& data)
{
data.clear();

View File

@ -51,8 +51,8 @@ namespace Utils
bool deleteDirectory(const std::string& directory);
bool renameDirectory(const std::string& directory, const std::string& newDir);
bool listDirectories(const std::string& directory, std::vector<std::string> &list);
bool listFiles(const std::string& directory, std::vector<std::string> &list);
bool listDirectories(const std::string& directory, std::vector<std::string>& list);
bool listFiles(const std::string& directory, std::vector<std::string>& list);
bool deleteFile(const std::string& file);
bool renameFile(const std::string& file, const std::string& newFile);
@ -60,7 +60,7 @@ namespace Utils
bool downloadFile(const std::string& file, const std::string& localfile);
bool uploadFileData(const std::string& file,const std::string& data);
bool downloadFileData(const std::string& file, std::string &data);
bool downloadFileData(const std::string& file, std::string& data);
void setProgressCallback(Utils::Slot<void(size_t, size_t)> callback);
void cancelDownload() { this->cancel = true; }
@ -104,7 +104,7 @@ namespace Utils
std::string execute(const char* command, const std::string& body, WebIO::Params headers = WebIO::Params(), bool* success = nullptr);
bool listElements(const std::string& directory, std::vector<std::string> &list, bool files);
bool listElements(const std::string& directory, std::vector<std::string>& list, bool files);
void openSession(const std::string& useragent);
void closeSession();
@ -112,6 +112,6 @@ namespace Utils
bool openConnection();
void closeConnection();
void formatPath(std::string &path, bool win); /* if (win == true): / -> \\ */
void formatPath(std::string& path, bool win); /* if (win == true): / -> \\ */
};
}