Geant4 Cross Reference |
1 // Copyright (C) 2010, Guy Barrand. All rights 1 // Copyright (C) 2010, Guy Barrand. All rights reserved. 2 // See the file tools.license for terms. 2 // See the file tools.license for terms. 3 3 4 #ifndef tools_file_reader 4 #ifndef tools_file_reader 5 #define tools_file_reader 5 #define tools_file_reader 6 6 7 #include <string> 7 #include <string> 8 #include <cstdio> 8 #include <cstdio> 9 9 10 namespace tools { 10 namespace tools { 11 namespace file { 11 namespace file { 12 12 13 class reader { 13 class reader { 14 public: 14 public: 15 virtual ~reader() {} 15 virtual ~reader() {} 16 public: 16 public: 17 virtual bool open(const std::string&) = 0; 17 virtual bool open(const std::string&) = 0; 18 virtual void close() = 0; 18 virtual void close() = 0; 19 virtual bool is_open() const = 0; 19 virtual bool is_open() const = 0; 20 virtual bool read(char*,unsigned int,size_t& 20 virtual bool read(char*,unsigned int,size_t&) = 0; 21 virtual bool get_line(char*,unsigned int) = 21 virtual bool get_line(char*,unsigned int) = 0; 22 virtual bool eof() const = 0; 22 virtual bool eof() const = 0; 23 }; 23 }; 24 24 25 }} 25 }} 26 26 27 #endif 27 #endif