24#ifndef __SMESH_File_HXX__
25#define __SMESH_File_HXX__
45 SMESH_File(
const std::string& name,
bool openForReading=
true);
49 std::string
getName()
const {
return _name; }
51 const std::string&
error()
const {
return _error; }
69 operator const char*()
const {
return _pos; }
73 void operator +=(
int posDelta) { _pos+=posDelta; }
75 bool eof()
const {
return _pos >= _end; }
77 const char*
end()
const {
return _end; }
79 const char*
getPos()
const {
return _pos; }
81 void setPos(
const char* pos);
83 std::string getLine();
87 bool getInts(std::vector<int>& ids);
93 bool openForWriting();
96 bool write(
const T* values,
size_t nbTValues )
98 return writeRaw((
const void*) values, nbTValues *
sizeof(T));
101 template <
typename T>
104 return writeRaw((
const void*) & value,
sizeof(T));
107 bool writeRaw(
const void* data,
size_t size);
115 HANDLE _file, _mapObj;
#define SMESHUtils_EXPORT
Definition: SMESH_Utils.hxx:37
High level util for effective file reading and other file operations.
Definition: SMESH_File.hxx:42
std::string _error
Definition: SMESH_File.hxx:113
const char * _end
position after file end
Definition: SMESH_File.hxx:121
const char * _pos
current position
Definition: SMESH_File.hxx:120
const char * end() const
Definition: SMESH_File.hxx:77
std::string getName() const
Definition: SMESH_File.hxx:49
bool operator++()
Definition: SMESH_File.hxx:71
bool write(const T &value)
Definition: SMESH_File.hxx:102
bool eof() const
Definition: SMESH_File.hxx:75
const char * getPos() const
Definition: SMESH_File.hxx:79
const std::string & error() const
Definition: SMESH_File.hxx:51
long _size
file size
Definition: SMESH_File.hxx:112
int _file
Definition: SMESH_File.hxx:117
bool write(const T *values, size_t nbTValues)
Definition: SMESH_File.hxx:96
void * _map
Definition: SMESH_File.hxx:119
std::string _name
file name
Definition: SMESH_File.hxx:111
bool exists(const std::string &fileName)
Definition: MED_Factory.cxx:73