3
* Purpose: General Purpose File Class
6
--------------------------------------------------------------------------------
8
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
10
CxFile (c) 11/May/2002 Davide Pizzolato - www.xdp.it
11
CxFile version 2.00 23/Aug/2002
13
Special thanks to Chris Shearer Cooper for new features, enhancements and bugfixes
15
Covered code is provided under this license on an "as is" basis, without warranty
16
of any kind, either expressed or implied, including, without limitation, warranties
17
that the covered code is free of defects, merchantable, fit for a particular purpose
18
or non-infringing. The entire risk as to the quality and performance of the covered
19
code is with you. Should any covered code prove defective in any respect, you (not
20
the initial developer or any other contributor) assume the cost of any necessary
21
servicing, repair or correction. This disclaimer of warranty constitutes an essential
22
part of this license. No use of any covered code is authorized hereunder except under
25
Permission is hereby granted to use, copy, modify, and distribute this
26
source code, or portions hereof, for any purpose, including commercial applications,
27
freely and without fee, subject to the following restrictions:
29
1. The origin of this software must not be misrepresented; you must not
30
claim that you wrote the original software. If you use this software
31
in a product, an acknowledgment in the product documentation would be
32
appreciated but is not required.
34
2. Altered source versions must be plainly marked as such, and must not be
35
misrepresented as being the original software.
37
3. This notice may not be removed or altered from any source distribution.
38
--------------------------------------------------------------------------------
40
#if !defined(__xfile_h)
56
virtual ~CxFile() { };
58
virtual bool Close() = 0;
59
virtual size_t Read(void *buffer, size_t size, size_t count) = 0;
60
virtual size_t Write(const void *buffer, size_t size, size_t count) = 0;
61
virtual bool Seek(long offset, int origin) = 0;
62
virtual long Tell() = 0;
63
virtual long Size() = 0;
64
virtual bool Flush() = 0;
65
virtual bool Eof() = 0;
66
virtual long Error() = 0;
67
virtual bool PutC(unsigned char c)
69
// Default implementation
70
size_t nWrote = Write(&c, 1, 1);
71
return (bool)(nWrote == 1);
73
virtual long GetC() = 0;