nexuslua
Loading...
Searching...
No Matches
utility.hpp File Reference
#include "nexuslua_export.h"
#include <filesystem>
#include <functional>
#include <string>
Include dependency graph for utility.hpp:

Go to the source code of this file.

Namespaces

namespace  nexuslua
 The nexuslua library is implemented inside this namespace.
namespace  nexuslua::utility
 various helper functions

Enumerations

enum class  nexuslua::DownloadProgress {
  nexuslua::CONNECTING , nexuslua::SENDING_REQUEST , nexuslua::READING_HTTP_RESPONSE , nexuslua::READING_DATA ,
  nexuslua::DOWNLOADING , nexuslua::ERR , nexuslua::ABORTED
}
 used by utils::ReadHttp to call a function to describe the download state, including a string with further information More...

Functions

NEXUSLUA_EXPORT std::string nexuslua::utility::ReadHttp (const std::string &URL, const std::string &outFile="", std::function< void(DownloadProgress, std::string)> progress=nullptr, std::function< bool()> abort=nullptr)
 reads a file from a the given URL (no https)
NEXUSLUA_EXPORT std::string nexuslua::utility::ReadHttp (const std::string &host, const std::string &port, const std::string &path, const std::string &outFile="", std::function< void(DownloadProgress, std::string)> progress=nullptr, std::function< bool()> abort=nullptr)
 reads a file from a the given URL (no https)
NEXUSLUA_EXPORT std::string nexuslua::utility::ReadHttps (const std::string &host, const std::string &port, const std::string &path, const std::string &outFile="", std::function< void(DownloadProgress, std::string)> progress=nullptr, std::function< bool()> abort=nullptr)
 reads a file from a the given URL
NEXUSLUA_EXPORT std::string nexuslua::utility::RemoveWsFromParams (std::string signature)
 removes redundant white spaces from the given function signature
NEXUSLUA_EXPORT void nexuslua::utility::ParseHostPortPath (std::string URL, std::string &host, std::string &port, std::string &path)
 splits up the given URL into the three components host, port and path and sets the reference parameters to these
NEXUSLUA_EXPORT bool nexuslua::utility::Unzip (std::filesystem::path zip_file, std::filesystem::path target_dir)
 unzips the given zip file to the given target dir. Throws std::runtime_error in case of errors.
NEXUSLUA_EXPORT bool nexuslua::utility::Zip (std::filesystem::path source_dir, std::filesystem::path zip_file)
 zips the given target directory to the given output zip file. Throws std::runtime_error in case of errors.