Commit 082d7664 authored by Pascal Noisette's avatar Pascal Noisette

comptatibilité windows (sauf grosses traces)

parent 85528226
......@@ -34,6 +34,8 @@ public:
*/
virtual const int get_size_loaded() const = 0;
};
#endif // PARSER_HPP
......@@ -51,6 +51,7 @@ public:
* \return the size already loaded of the file by the parser
*/
const int get_size_loaded() const;
};
#endif // PARSERPAJE_HPP
......
......@@ -5,6 +5,8 @@ using namespace std;
int TokenSource::_cursor = 0;
#ifndef WIN32
off_t TokenSource::_filesize = 1;
#else
std::ifstream TokenSource::_file;
#endif
TokenSource::TokenSource(){
......@@ -200,9 +202,19 @@ std::string *TokenSource::read_token() {
const int TokenSource::get_size_loaded() {
#ifdef WIN32
return _file.tellg()/_filesize;
if (_file == NULL)
return 1;
if (!_file.is_open())
return 2;
if (_file.bad())
return 3;
return _file.tellg();
#else
//std::cerr<<(int)((_cursor*100.0)/_filesize)<<"%"<<endl;
return (_cursor*100)/_filesize;
return (_cursor*100.0)/_filesize;
#endif
}
......@@ -41,7 +41,7 @@ private:
#ifdef WIN32
int _buffer_size;
std::ifstream _file;
static std::ifstream _file;
#else
static off_t _filesize;
int _fd;
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment