ManaPlus
files.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2013-2019 The ManaPlus Developers
4  * Copyright (C) 2019-2021 Andrei Karas
5  *
6  * This file is part of The ManaPlus Client.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef UTILS_FILES_H
23 #define UTILS_FILES_H
24 
25 #include "utils/stringvector.h"
26 
27 #include "localconsts.h"
28 
29 namespace Files
30 {
31 #ifdef ANDROID
32  void extractLocale();
33 #endif // ANDROID
34 
35 #if defined(ANDROID) || defined(__native_client__)
36  typedef void (*CopyFileCallbackPtr) (int cnt);
37 
38  void setCopyCallBack(CopyFileCallbackPtr callback);
39 
40  void copyVirtFsFile(const std::string &restrict inFile,
41  const std::string &restrict outFile);
42 
43  void copyVirtFsDir(const std::string &restrict inDir,
44  const std::string &restrict outDir);
45 
46 #endif // ANDROID __native_client__
47 
48  int renameFile(const std::string &restrict pFrom,
49  const std::string &restrict pTo);
50 
51  int copyFile(const std::string &restrict pFrom,
52  const std::string &restrict pTo);
53 
54  bool existsLocal(const std::string &path);
55 
56  bool loadTextFileLocal(const std::string &fileName,
57  StringVect &lines);
58 
59  void saveTextFile(const std::string &path,
60  const std::string &restrict name,
61  const std::string &restrict text);
62 
63  void deleteFilesInDirectory(std::string path);
64 
65  void enumFiles(StringVect &files,
66  std::string path,
67  const bool skipSymlinks);
68 } // namespace Files
69 
70 #endif // UTILS_FILES_H
#define restrict
Definition: localconsts.h:165
Definition: files.h:30
bool loadTextFileLocal(const std::string &fileName, StringVect &lines)
Definition: files.cpp:229
int renameFile(const std::string &pFrom, const std::string &pTo)
Definition: files.cpp:134
int copyFile(const std::string &pFrom, const std::string &pTo)
Definition: files.cpp:176
void deleteFilesInDirectory(std::string path)
Definition: files.cpp:272
void enumFiles(StringVect &files, std::string path, const bool skipSymlinks)
Definition: files.cpp:290
bool existsLocal(const std::string &path)
Definition: files.cpp:209
void saveTextFile(const std::string &path, const std::string &name, const std::string &text)
Definition: files.cpp:250
std::vector< std::string > StringVect
Definition: stringvector.h:29
std::string fileName
Definition: testmain.cpp:39