| Exiv2

Loading...
Searching...
No Matches
futils.hpp
1// SPDX-License-Identifier: GPL-2.0-or-later
2
3#ifndef FUTILS_HPP_
4#define FUTILS_HPP_
5
6#include "config.h"
7#include "exiv2lib_export.h"
8
9#include <string>
10
11// namespace extensions
12 namespace Exiv2 {
14 enum EnVar { envHTTPPOST = 0, envTIMEOUT = 1 };
16 enum Protocol { pFile = 0, pHttp, pFtp, pHttps, pSftp, pFileUri, pDataUri, pStdin };
17// *********************************************************************
18// free functions
25EXIV2API std::string getEnv(int env_var);
26
34EXIV2API std::string urlencode(const std::string& str);
35
40EXIV2API void urldecode(std::string& str);
41
53EXIV2API int base64encode(const void* data_buf, size_t dataLength, char* result, size_t resultSize);
54
64EXIV2API size_t base64decode(const char* in, char* out, size_t out_size);
65
71EXIV2API Protocol fileProtocol(const std::string& path);
72
84EXIV2API bool fileExists(const std::string& path);
85
90EXIV2API std::string strError();
91
93EXIV2API std::string getProcessPath();
94
103 class Uri {
104 public:
105 // DATA
106 std::string QueryString;
107 std::string Path;
108 std::string Protocol;
109 std::string Host;
110 std::string Port;
111 std::string Username;
112 std::string Password;
113
115 static Uri EXIV2API Parse(const std::string& uri);
116
118 static void EXIV2API Decode(Uri& uri);
119};
120
121} // namespace Exiv2
122
123#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