Neo  0.5.0
Developer Documentation
StdFile.h
Go to the documentation of this file.
1 //========================================================================
2 // Copyright (c) 2012 Philipp Geyer <http://nistur.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 
25 
26 #ifndef __STD_FILE_H
27 #define __STD_FILE_H
28 
29 namespace Neo
30 {
31 /* Base File class
32  * exposes standard file I/O functions such as open/close read/write
33  */
34 class NEO_CORE_EXPORT StdFile : public File
35 {
36 private:
37 
38  FILE * m_file;
39 
40 public:
41 
42  StdFile();
43  StdFile(const char * path, const char * mode);
44  ~StdFile();
45 
46  static StdFile * getNew(const char * path, const char * mode);
47 
48  void open(const char * path, const char * mode);
49  int close();
50  size_t read(void* dest, size_t size, size_t count);
51  size_t write(const void * str, size_t size, size_t count);
52  int print(const char * format, ...);
53  int print(const char * format, va_list args);
54  int seek(long offset, int whence);
55  long tell();
56  void rewind();
57 
58  bool isOpen(){ return m_file != 0; }
59  void destroy(void);
60 };
61 }
62 #endif
Definition: File.h:33
Definition: StdFile.h:34
Definition: Color.h:29
bool isOpen()
Definition: StdFile.h:58