GM6000 Digital Heater Controller Branch: main
SDX-1330
ObjectApi.h
Go to the documentation of this file.
1
2#ifndef Cpl_Io_File_ObjectApi_h_
3#define Cpl_Io_File_ObjectApi_h_
4/*-----------------------------------------------------------------------------
5* This file is part of the Colony.Core Project. The Colony.Core Project is an
6* open source project with a BSD type of licensing agreement. See the license
7* agreement (license.txt) in the top/ directory or on the Internet at
8* http://integerfox.com/colony.core/license.txt
9*
10* Copyright (c) 2014-2022 John T. Taylor
11*
12* Redistributions of the source code must retain the above copyright notice.
13*----------------------------------------------------------------------------*/
14/** @file */
15
16
17
18///
19namespace Cpl {
20///
21namespace Io {
22///
23namespace File {
24
25
26
27/** This abstract class defines the basic additional functionality,
28 beyond that of a stream, for a file.
29 */
30
32{
33public:
34 /** After a read/write operation this method returns true if
35 the file pointer is at EOF.
36
37 NOTES:
38 - This method is ONLY VALID immediately following a read/write
39 operation!
40 - If the File object has been closed, this method will return true.
41 */
42 virtual bool isEof() = 0;
43
44 /** Returns the length, in bytes, of the file. If there is
45 an error than false is returned.
46 */
47 virtual bool length( unsigned long& length ) = 0;
48
49
50public:
51 /** Returns the current file pointer offset, in bytes, from
52 the top of the file. If there is an error than false is
53 returned.
54 */
55 virtual bool currentPos(unsigned long& currentPos ) = 0;
56
57 /** Adjusts the current pointer offset by the specified delta (in bytes).
58 Returns true if successful, else false (i.e. setting the pointer
59 past/before the file boundaries).
60 */
61 virtual bool setRelativePos( long deltaOffset ) = 0;
62
63 /** Sets the file pointer to the absolute specified offset (in bytes).
64 Returns true if successful, else false (i.e. setting the
65 pointer past the end of the file).
66 */
67 virtual bool setAbsolutePos( unsigned long newoffset ) = 0;
68
69 /** Sets the file pointer to End-Of-File. Returns true if
70 successful, else false if an error occurred.
71 */
72 virtual bool setToEof() = 0;
73
74
75public:
76 /// Virtual destructor
77 virtual ~ObjectApi() {}
78
79};
80
81
82}; // end namespaces
83};
84};
85#endif // end header latch
86
This abstract class defines the basic additional functionality, beyond that of a stream,...
Definition ObjectApi.h:32
virtual bool setRelativePos(long deltaOffset)=0
Adjusts the current pointer offset by the specified delta (in bytes).
virtual bool setAbsolutePos(unsigned long newoffset)=0
Sets the file pointer to the absolute specified offset (in bytes).
virtual bool currentPos(unsigned long &currentPos)=0
Returns the current file pointer offset, in bytes, from the top of the file.
virtual bool length(unsigned long &length)=0
Returns the length, in bytes, of the file.
virtual ~ObjectApi()
Virtual destructor.
Definition ObjectApi.h:77
virtual bool isEof()=0
After a read/write operation this method returns true if the file pointer is at EOF.
virtual bool setToEof()=0
Sets the file pointer to End-Of-File.
The 'Cpl' namespace is the root name space for the Colony.
Definition Api16.h:20