Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __SMESH_File_HXX__
00025 #define __SMESH_File_HXX__
00026
00027 #include "SMESH_SMESH.hxx"
00028
00029 #include <string>
00030 #include <vector>
00031
00032 #ifdef WNT
00033 #include <windows.h>
00034 #else
00035 #include <dlfcn.h>
00036 #endif
00037
00041 class SMESH_EXPORT SMESH_File
00042 {
00043 public:
00044
00045 SMESH_File(const std::string& name, bool open=true);
00046
00047 ~SMESH_File();
00048
00049 std::string getName() const { return _name; }
00050
00051 bool open();
00052
00053 void close();
00054
00055 bool remove();
00056
00057 int size() const;
00058
00059
00060
00061
00062
00063 operator const char*() const { return _pos; }
00064
00065 bool operator++() { return ++_pos < _end; }
00066
00067 void operator +=(int posDelta) { _pos+=posDelta; }
00068
00069 bool eof() const { return _pos >= _end; }
00070
00071 const char* getPos() const { return _pos; }
00072
00073 void setPos(const char* pos);
00074
00075 std::string getLine();
00076
00077 void rewind();
00078
00079 bool getInts(std::vector<int>& ids);
00080
00081 private:
00082
00083 std::string _name;
00084 int _size;
00085 #ifdef WNT
00086 HANDLE _file, _mapObj;
00087 #else
00088 int _file;
00089 #endif
00090 void* _map;
00091 const char* _pos;
00092 const char* _end;
00093 };
00094
00095 #endif