From: James Turner Date: Sat, 25 Jun 2016 15:30:24 +0000 (+0100) Subject: iostream overloads taking an SGPath X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5bad570c1f3c565ca0ae4c9171a58216ee8ffd50;p=simgear.git iostream overloads taking an SGPath --- diff --git a/simgear/misc/sgstream.cxx b/simgear/misc/sgstream.cxx index 44ce90b1..99b19a7a 100644 --- a/simgear/misc/sgstream.cxx +++ b/simgear/misc/sgstream.cxx @@ -193,3 +193,17 @@ sg_gzofstream::attach( int fd, ios_openmode io_mode ) { gzbuf.attach( fd, io_mode ); } + + +sg_ifstream::sg_ifstream(const SGPath& path, ios_openmode io_mode) +{ + std::string ps = path.local8BitStr(); + open(ps.c_str(), io_mode); +} + + +sg_ofstream::sg_ofstream(const SGPath& path, ios_openmode io_mode) +{ + std::string ps = path.local8BitStr(); + open(ps.c_str(), io_mode); +} \ No newline at end of file diff --git a/simgear/misc/sgstream.hxx b/simgear/misc/sgstream.hxx index 8aa72105..e7a4b12c 100644 --- a/simgear/misc/sgstream.hxx +++ b/simgear/misc/sgstream.hxx @@ -33,8 +33,9 @@ #include -# include -# include +#include +#include +#include #include @@ -171,5 +172,17 @@ private: void operator= ( const sg_gzofstream& ); }; +class sg_ifstream : public std::ifstream +{ +public: + sg_ifstream(const SGPath& path, ios_openmode io_mode = ios_in | ios_binary); +}; + +class sg_ofstream : public std::ofstream +{ +public: + sg_ofstream(const SGPath& path, ios_openmode io_mode = ios_out | ios_binary); +}; + #endif /* _SGSTREAM_HXX */