Neo  0.5.0
Developer Documentation
FileTools.h
Go to the documentation of this file.
1 //========================================================================
2 // Copyright (c) 2003-2011 Anael Seghezzi <www.maratis3d.com>
3 //
4 // This software is provided 'as-is', without any express or implied
5 // warranty. In no event will the authors be held liable for any damages
6 // arising from the use of this software.
7 //
8 // Permission is granted to anyone to use this software for any purpose,
9 // including commercial applications, and to alter it and redistribute it
10 // freely, subject to the following restrictions:
11 //
12 // 1. The origin of this software must not be misrepresented; you must not
13 // claim that you wrote the original software. If you use this software
14 // in a product, an acknowledgment in the product documentation would
15 // be appreciated but is not required.
16 //
17 // 2. Altered source versions must be plainly marked as such, and must not
18 // be misrepresented as being the original software.
19 //
20 // 3. This notice may not be removed or altered from any source
21 // distribution.
22 //
23 //========================================================================
24 // jan 2012, FILE wrapper by Philipp Geyer <http://nistur.com>
25 
26 
27 #ifndef _FILE_TOOLS_H
28 #define _FILE_TOOLS_H
29 
32 
33 // general file and directory tools
34 NEO_CORE_EXPORT bool copyFile(const char * inFilename, const char * outFilename);
35 NEO_CORE_EXPORT bool createDirectory(const char * filename, bool recursive = false);
36 NEO_CORE_EXPORT bool isDirectory(const char * filename);
37 NEO_CORE_EXPORT bool isEmptyDirectory(const char * filename);
38 NEO_CORE_EXPORT bool clearDirectory(const char * filename);
39 NEO_CORE_EXPORT bool removeDirectory(const char * filename);
40 NEO_CORE_EXPORT bool isFileExist(const char * filename);
41 NEO_CORE_EXPORT bool copyDirectory(const char * inFilename, const char * outFilename);
42 NEO_CORE_EXPORT bool readDirectory(const char * filename, vector<string> * files, bool hiddenFiles = false, bool recursive = false);
43 NEO_CORE_EXPORT void copyDirFiles(const char* src, const char* dest, const char* filter);
44 
45 namespace Neo
46 {
47 // file wrapper
48 NEO_CORE_EXPORT void M_registerFileOpenHook(FileOpenHook * hook);
49 NEO_CORE_EXPORT FileOpenHook * M_getFileOpenHook();
50 
54 NEO_CORE_EXPORT File* M_fopen(const char * path, const char* mode);
55 
58 NEO_CORE_EXPORT int M_fclose(File * stream);
59 
69 NEO_CORE_EXPORT size_t M_fread(void * dest, size_t size, size_t count, File * stream);
70 
79 NEO_CORE_EXPORT size_t M_fwrite(const void * str, size_t size, size_t count, File * stream);
80 
87 NEO_CORE_EXPORT int M_fprintf(File * stream, const char * format, ...);
88 
97 NEO_CORE_EXPORT int M_fseek(File * stream, long offset, int whence);
98 
102 NEO_CORE_EXPORT long M_ftell(File * stream);
103 
106 NEO_CORE_EXPORT void M_rewind(File * stream);
107 }
108 #endif
NEO_CORE_EXPORT size_t M_fwrite(const void *str, size_t size, size_t count, File *stream)
NEO_CORE_EXPORT bool copyFile(const char *inFilename, const char *outFilename)
NEO_CORE_EXPORT File * M_fopen(const char *path, const char *mode)
NEO_CORE_EXPORT bool clearDirectory(const char *filename)
NEO_CORE_EXPORT int M_fseek(File *stream, long offset, int whence)
NEO_CORE_EXPORT void M_rewind(File *stream)
NEO_CORE_EXPORT size_t M_fread(void *dest, size_t size, size_t count, File *stream)
NEO_CORE_EXPORT bool isFileExist(const char *filename)
NEO_CORE_EXPORT int M_fclose(File *stream)
NEO_CORE_EXPORT bool isEmptyDirectory(const char *filename)
NEO_CORE_EXPORT long M_ftell(File *stream)
NEO_CORE_EXPORT bool isDirectory(const char *filename)
NEO_CORE_EXPORT bool copyDirectory(const char *inFilename, const char *outFilename)
NEO_CORE_EXPORT bool removeDirectory(const char *filename)
NEO_CORE_EXPORT bool createDirectory(const char *filename, bool recursive=false)
NEO_CORE_EXPORT void copyDirFiles(const char *src, const char *dest, const char *filter)
NEO_CORE_EXPORT int M_fprintf(File *stream, const char *format,...)
NEO_CORE_EXPORT bool readDirectory(const char *filename, vector< string > *files, bool hiddenFiles=false, bool recursive=false)
NEO_CORE_EXPORT void M_registerFileOpenHook(FileOpenHook *hook)
NEO_CORE_EXPORT FileOpenHook * M_getFileOpenHook()
Definition: Color.h:29