1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : SMESH_File.hxx
21 // Created : Wed Mar 10 10:33:04 2010
22 // Author : Edward AGAPOV (eap)
24 #ifndef __SMESH_File_HXX__
25 #define __SMESH_File_HXX__
27 #include "SMESH_Utils.hxx"
39 * \brief High level util for effective file reading and other file operations
41 class SMESHUtils_EXPORT SMESH_File
45 SMESH_File(const std::string& name, bool open=true);
49 std::string getName() const { return _name; }
59 // ------------------------
60 // Access to file contents
61 // ------------------------
63 operator const char*() const { return _pos; }
65 bool operator++() { return ++_pos < _end; }
67 void operator +=(int posDelta) { _pos+=posDelta; }
69 bool eof() const { return _pos >= _end; }
71 const char* getPos() const { return _pos; }
73 void setPos(const char* pos);
75 std::string getLine();
79 bool getInts(std::vector<int>& ids);
83 std::string _name; //!< file name
84 int _size; //!< file size
86 HANDLE _file, _mapObj;
91 const char* _pos; //!< current position
92 const char* _end; //!< position after file end