C++ main module for emicrom Package  1.0
CORE_File.h
Go to the documentation of this file.
1 #ifndef CORE_File_H
2 #define CORE_File_H
3 
4 
5 #include "CORE_Object.h"
6 
7 
14 
15 class CORE_File : public CORE_Object { // class
17 
18  // ATTRIBUTES
19 
20 public:
21 
24  static const tString PATH_SEPARATOR;
25 
26 private:
27 
29 
30  //length of the file
32 
34 
35  // ASSOCIATIONS
36 
37 
38  // METHODS
39 
40 
41 protected:
42  // CONSTRUCTORS
45  CORE_File();
46 
47 
48 
49 
50  // DESTRUCTORS
54  virtual ~CORE_File(void);
55 
56 
57 public:
58 
59 
60 
61  // SET
62 
67  static tString getExtension(const tString& fileName);
68 
73  static void setExtension(const tString& ext,tString& fileName);
74 
78  inline tString getExtension() const {
79  return mExtension;
80  }
84  inline void setExtension(const tString& ext) {
85  mExtension=ext;
86  }
87 
88 
91  inline const tULInt& getLength() const {
92  return mLength;
93  }
94 protected:
98  inline void setLength(const tULInt& l) {
99  mLength=l;
100  }
101 
102 public:
107  virtual tBoolean open(const tString& fn) {
108 
109 
110  //set the extension of the file
112 
113  mIsClosed=false;
114 
115  return true;
116  }
117 
121  virtual tBoolean isEndOfFile() const=0;
122 
125  virtual void close() {
126  mIsClosed=true;
127  setExtension("");
128  setLength(0);
129  }
130 
134  inline const tBoolean& isClosed() const {
135  return mIsClosed;
136  }
137 
142  static inline tBoolean isAbsolutePath(const tString& path) {
143  return (path.find(PATH_SEPARATOR)==0);
144  }
145 
146 public:
150  virtual tULInt getCurrentIndex() const=0;
151 
156  virtual tBoolean moveTo(const tULInt& index)=0;
157 
162  virtual tBoolean translate(const tLInt& dx)=0;
163 
164 
165 
166 
167 
168 };
169 
170 #endif
void setExtension(const tString &ext)
set the extension
Definition: CORE_File.h:84
static const tString PATH_SEPARATOR
path separator depending on system
Definition: CORE_File.h:24
static void setExtension(const tString &ext, tString &fileName)
set the extension of the file
Definition: CORE_File.cpp:30
void setLength(const tULInt &l)
set the length of the file
Definition: CORE_File.h:98
tString getExtension() const
get the extension
Definition: CORE_File.h:78
const tBoolean & isClosed() const
return true if the file is closed @ return true if the file is closed
Definition: CORE_File.h:134
this class describes a file
Definition: CORE_File.h:15
DEFINE_SPTR(CORE_File)
virtual tBoolean translate(const tLInt &dx)=0
translate the current index position of the file
#define tBoolean
Definition: types.h:139
CORE_File()
build a CORE_File
Definition: CORE_File.cpp:12
#define tLInt
Definition: types.h:42
virtual void close()
close the file
Definition: CORE_File.h:125
tULInt mLength
Definition: CORE_File.h:31
virtual tBoolean isEndOfFile() const =0
test if the cursor is at the end of file
#define tULInt
Definition: types.h:39
static tBoolean isAbsolutePath(const tString &path)
return tre if the path is absolute path
Definition: CORE_File.h:142
virtual ~CORE_File(void)
destroy a CORE_File
Definition: CORE_File.cpp:17
SP_OBJECT(CORE_File)
tBoolean mIsClosed
Definition: CORE_File.h:33
abstract base class for most classes.
Definition: CORE_Object.h:53
#define tString
Definition: types.h:135
virtual tULInt getCurrentIndex() const =0
get the current index of the file
virtual tBoolean open(const tString &fn)
open the file
Definition: CORE_File.h:107
tString mExtension
Definition: CORE_File.h:28
const tULInt & getLength() const
get the length of the file
Definition: CORE_File.h:91
virtual tBoolean moveTo(const tULInt &index)=0
move the current index position of the file to index