SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
FtpUtils.h
Go to the documentation of this file.
1 /**
2  * \file FtpUtils.h
3  * \authors Marcus Hudritsch, Michael Göttlicher
4  * \date May 2019
5  * \copyright http://opensource.org/licenses/GPL-3.0
6  * \remarks Please use clangformat to format the code. See more code style on
7  * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style
8 */
9 
10 #ifndef CPLVRLAB_FTPUTILS_H
11 #define CPLVRLAB_FTPUTILS_H
12 
13 #ifndef __EMSCRIPTEN__
14 
15 # include <string>
16 # include <vector>
17 
18 class ftplib;
19 
20 using namespace std;
21 
22 //! FtpUtils provides networking functionality via the FTP protocol
23 namespace FtpUtils
24 {
25 bool uploadFileLatestVersion(const string& fileDir,
26  const string& fileName,
27  const string& ftpHost,
28  const string& ftpUser,
29  const string& ftpPwd,
30  const string& ftpDir,
31  string& errorMsg);
32 
33 bool downloadFileLatestVersion(const string& fileDir,
34  const string& fileName,
35  const string& ftpHost,
36  const string& ftpUser,
37  const string& ftpPwd,
38  const string& ftpDir,
39  string& errorMsg);
40 
41 bool uploadFile(const string& fileDir,
42  const string& fileName,
43  const string& ftpHost,
44  const string& ftpUser,
45  const string& ftpPwd,
46  const string& ftpDir,
47  string& errorMsg);
48 
49 bool downloadFile(const string& fileDir,
50  const string& fileName,
51  const string& ftpHost,
52  const string& ftpUser,
53  const string& ftpPwd,
54  const string& ftpDir,
55  string& errorMsg);
56 
57 bool downloadAllFilesFromDir(const string& fileDir,
58  const string& ftpHost,
59  const string& ftpUser,
60  const string& ftpPwd,
61  const string& ftpDir,
62  const string& searchFileTag,
63  string& errorMsg);
64 
65 bool getAllFileNamesWithTag(ftplib& ftp,
66  const string& localDir,
67  const string& searchFileTag,
68  vector<string>& retrievedFileNames,
69  string& errorMsg);
70 
71 string getLatestFilename(ftplib& ftp,
72  const string& fileDir,
73  const string& fileName);
74 
75 int getVersionInFilename(const string& filename);
76 };
77 
78 #endif
79 
80 #endif
FtpUtils provides networking functionality via the FTP protocol.
Definition: FtpUtils.cpp:21
bool getAllFileNamesWithTag(ftplib &ftp, const string &localDir, const string &searchFileTag, vector< string > &retrievedFileNames, string &errorMsg)
Get a list of all filenames with given search file tag in remote directory.
Definition: FtpUtils.cpp:422
string getLatestFilename(ftplib &ftp, const string &fileDir, const string &fileName)
Returns the latest fileName of the same fullPathAndFilename.
Definition: FtpUtils.cpp:513
bool uploadFile(const string &fileDir, const string &fileName, const string &ftpHost, const string &ftpUser, const string &ftpPwd, const string &ftpDir, string &errorMsg)
Uploads file to the ftp server.
Definition: FtpUtils.cpp:198
bool downloadAllFilesFromDir(const string &fileDir, const string &ftpHost, const string &ftpUser, const string &ftpPwd, const string &ftpDir, const string &searchFileTag, string &errorMsg)
Definition: FtpUtils.cpp:342
bool downloadFile(const string &fileDir, const string &fileName, const string &ftpHost, const string &ftpUser, const string &ftpPwd, const string &ftpDir, string &errorMsg)
Download file from the ftp server.
Definition: FtpUtils.cpp:267
int getVersionInFilename(const string &filename)
Returns the version number at the end of the fileName.
Definition: FtpUtils.cpp:564
bool uploadFileLatestVersion(const string &fileDir, const string &fileName, const string &ftpHost, const string &ftpUser, const string &ftpPwd, const string &ftpDir, string &errorMsg)
Uploads the file to the ftp server. Checks if the filename already exists and adds a version number.
Definition: FtpUtils.cpp:34
bool downloadFileLatestVersion(const string &fileDir, const string &fileName, const string &ftpHost, const string &ftpUser, const string &ftpPwd, const string &ftpDir, string &errorMsg)
Download the file from the ftp server which has the latest version and store it as fileName locally.
Definition: FtpUtils.cpp:121
void errorMsg(const char *tag, const char *msg, const int line, const char *file)
Platform independent error message output.
Definition: Utils.cpp:1168