Loading...
Searching...
No Matches
futils.hpp
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef FUTILS_HPP_
#define FUTILS_HPP_
#include "config.h"
#include "exiv2lib_export.h"
#include <string>
// namespace extensions
namespace Exiv2 {
enum EnVar { envHTTPPOST = 0, envTIMEOUT = 1 };
enum Protocol { pFile = 0, pHttp, pFtp, pHttps, pSftp, pFileUri, pDataUri, pStdin };
// *********************************************************************
// free functions
EXIV2API std::string getEnv(int env_var);
EXIV2API std::string urlencode(const std::string& str);
EXIV2API void urldecode(std::string& str);
EXIV2API int base64encode(const void* data_buf, size_t dataLength, char* result, size_t resultSize);
EXIV2API size_t base64decode(const char* in, char* out, size_t out_size);
EXIV2API Protocol fileProtocol(const std::string& path);
EXIV2API bool fileExists(const std::string& path);
EXIV2API std::string strError();
EXIV2API std::string getProcessPath();
class Uri {
public:
// DATA
std::string QueryString;
std::string Path;
std::string Protocol;
std::string Host;
std::string Port;
std::string Username;
std::string Password;
static Uri EXIV2API Parse(const std::string& uri);
static void EXIV2API Decode(Uri& uri);
};
} // namespace Exiv2
#endif // #ifndef FUTILS_HPP_
Exiv2::Uri
A container for URL components. It also provides the method to parse a URL to get the protocol,...
Definition futils.hpp:103
Exiv2::Uri::Host
std::string Host
URL host.
Definition futils.hpp:109
Exiv2::Uri::Decode
static void EXIV2API Decode(Uri &uri)
Decode the url components.
Definition futils.cpp:271
Exiv2::Uri::Port
std::string Port
URL port.
Definition futils.hpp:110
Exiv2::Uri::Password
std::string Password
URL password.
Definition futils.hpp:112
Exiv2::Uri::Parse
static Uri EXIV2API Parse(const std::string &uri)
Parse the input URL to the protocol, host, path, username, password.
Definition futils.cpp:279
Exiv2::Uri::Path
std::string Path
URL file path.
Definition futils.hpp:107
Exiv2::Uri::Username
std::string Username
URL username.
Definition futils.hpp:111
Exiv2::Uri::Protocol
std::string Protocol
URL protocol.
Definition futils.hpp:108
Exiv2::Uri::QueryString
std::string QueryString
URL query string.
Definition futils.hpp:106
Exiv2
Class CrwImage to access Canon CRW images. References: The Canon RAW (CRW) File Format by Phil Harv...
Definition asfvideo.hpp:15
Exiv2::urlencode
EXIV2API std::string urlencode(const std::string &str)
Encode the input url.
Definition futils.cpp:98
Exiv2::Protocol
Protocol
the collection of protocols.
Definition futils.hpp:16
Exiv2::base64decode
EXIV2API size_t base64decode(const char *in, char *out, size_t out_size)
Decode base64 data and put the resulting string in out.
Definition futils.cpp:170
Exiv2::EnVar
EnVar
the name of environmental variables.
Definition futils.hpp:14
Exiv2::fileExists
EXIV2API bool fileExists(const std::string &path)
Test if a file exists.
Definition futils.cpp:234
Exiv2::getEnv
EXIV2API std::string getEnv(int env_var)
Return the value of environmental variable.
Definition futils.cpp:79
Exiv2::base64encode
EXIV2API int base64encode(const void *data_buf, size_t dataLength, char *result, size_t resultSize)
Encode in base64 the data in data_buf and put the resulting string in result.
Definition futils.cpp:142
Exiv2::urldecode
EXIV2API void urldecode(std::string &str)
Like urlencode(char* str) but accept the input url in the std::string and modify it.
Definition futils.cpp:116
Exiv2::fileProtocol
EXIV2API Protocol fileProtocol(const std::string &path)
Return the protocol of the path.
Definition futils.cpp:212
Exiv2::getProcessPath
EXIV2API std::string getProcessPath()
Return the path of the current process.
Definition futils.cpp:370
Exiv2::strError
EXIV2API std::string strError()
Return a system error message and the error code (errno). See strerror(3).
Definition futils.cpp:245