2012-10-21 06:28:59 +00:00
|
|
|
#pragma once
|
2012-11-15 17:37:56 +00:00
|
|
|
#include <fc/shared_ptr.hpp>
|
2012-11-15 16:55:36 +00:00
|
|
|
#include <fc/iostream.hpp>
|
2012-10-21 06:28:59 +00:00
|
|
|
|
|
|
|
|
namespace fc {
|
2012-11-15 16:55:36 +00:00
|
|
|
class path;
|
|
|
|
|
class ofstream : virtual public ostream {
|
2012-10-21 06:28:59 +00:00
|
|
|
public:
|
|
|
|
|
enum mode { out, binary };
|
|
|
|
|
ofstream();
|
2012-11-15 16:55:36 +00:00
|
|
|
ofstream( const fc::path& file, int m = binary );
|
2012-10-21 06:28:59 +00:00
|
|
|
~ofstream();
|
|
|
|
|
|
2012-11-15 16:55:36 +00:00
|
|
|
void open( const fc::path& file, int m = binary );
|
2012-10-21 06:28:59 +00:00
|
|
|
ofstream& write( const char* buf, size_t len );
|
|
|
|
|
void put( char c );
|
|
|
|
|
void close();
|
|
|
|
|
void flush();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
class impl;
|
2012-11-15 17:37:56 +00:00
|
|
|
fc::shared_ptr<impl> my;
|
2012-10-21 06:28:59 +00:00
|
|
|
};
|
|
|
|
|
|
2012-11-15 16:55:36 +00:00
|
|
|
class ifstream : virtual public istream {
|
2012-10-21 06:28:59 +00:00
|
|
|
public:
|
|
|
|
|
enum mode { in, binary };
|
|
|
|
|
ifstream();
|
2012-11-15 16:55:36 +00:00
|
|
|
ifstream( const fc::path& file, int m );
|
2012-10-21 06:28:59 +00:00
|
|
|
~ifstream();
|
|
|
|
|
|
2012-11-15 16:55:36 +00:00
|
|
|
void open( const fc::path& file, int m );
|
2012-12-02 17:35:05 +00:00
|
|
|
size_t readsome( char* buf, size_t len );
|
2012-10-21 06:28:59 +00:00
|
|
|
ifstream& read( char* buf, size_t len );
|
|
|
|
|
void close();
|
|
|
|
|
bool eof()const;
|
|
|
|
|
private:
|
|
|
|
|
class impl;
|
2012-11-15 17:37:56 +00:00
|
|
|
fc::shared_ptr<impl> my;
|
2012-10-21 06:28:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace fc
|