peerplays-fc/include/fc/fstream.hpp

43 lines
988 B
C++
Raw Normal View History

#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>
namespace fc {
2012-11-15 16:55:36 +00:00
class path;
class ofstream : virtual public ostream {
public:
enum mode { out, binary };
ofstream();
2012-11-15 16:55:36 +00:00
ofstream( const fc::path& file, int m = binary );
~ofstream();
2012-11-15 16:55:36 +00:00
void open( const fc::path& file, int m = binary );
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-11-15 16:55:36 +00:00
class ifstream : virtual public istream {
public:
enum mode { in, binary };
ifstream();
2012-11-15 16:55:36 +00:00
ifstream( const fc::path& file, int m );
~ifstream();
2012-11-15 16:55:36 +00:00
void open( const fc::path& file, int m );
size_t readsome( char* buf, size_t len );
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;
};
} // namespace fc