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