From cfe1c0933fd77ee8eea0dde34f6f06a26952f325 Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 27 Jun 2016 12:29:14 -0500 Subject: [PATCH] Further SG stream APIs --- simgear/misc/sgstream.cxx | 17 ++++++++++++++--- simgear/misc/sgstream.hxx | 14 +++++++++++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/simgear/misc/sgstream.cxx b/simgear/misc/sgstream.cxx index 99b19a7a..01e7ff12 100644 --- a/simgear/misc/sgstream.cxx +++ b/simgear/misc/sgstream.cxx @@ -198,12 +198,23 @@ sg_gzofstream::attach( int fd, ios_openmode io_mode ) sg_ifstream::sg_ifstream(const SGPath& path, ios_openmode io_mode) { std::string ps = path.local8BitStr(); - open(ps.c_str(), io_mode); + std::ifstream::open(ps.c_str(), io_mode); } +void sg_ifstream::open( const SGPath& name, ios_openmode io_mode ) +{ + std::string ps = name.local8BitStr(); + std::ifstream::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 + std::ofstream::open(ps.c_str(), io_mode); +} + +void sg_ofstream::open( const SGPath& name, ios_openmode io_mode ) +{ + std::string ps = name.local8BitStr(); + std::ofstream::open(ps.c_str(), io_mode); +} diff --git a/simgear/misc/sgstream.hxx b/simgear/misc/sgstream.hxx index e7a4b12c..f676b8a0 100644 --- a/simgear/misc/sgstream.hxx +++ b/simgear/misc/sgstream.hxx @@ -93,8 +93,8 @@ public: private: // Not defined! - sg_gzifstream( const sg_gzifstream& ); - void operator= ( const sg_gzifstream& ); + sg_gzifstream( const sg_gzifstream& ); + void operator= ( const sg_gzifstream& ); }; /** @@ -175,14 +175,22 @@ private: class sg_ifstream : public std::ifstream { public: + sg_ifstream() {} + sg_ifstream(const SGPath& path, ios_openmode io_mode = ios_in | ios_binary); + + void open( const SGPath& name, + ios_openmode io_mode = ios_in|ios_binary ); }; class sg_ofstream : public std::ofstream { public: + sg_ofstream() { } sg_ofstream(const SGPath& path, ios_openmode io_mode = ios_out | ios_binary); + + void open( const SGPath& name, + ios_openmode io_mode = ios_out|ios_binary ); }; #endif /* _SGSTREAM_HXX */ -