]> git.mxchange.org Git - simgear.git/commitdiff
iostream overloads taking an SGPath
authorJames Turner <zakalawe@mac.com>
Sat, 25 Jun 2016 15:30:24 +0000 (16:30 +0100)
committerRoland Haeder <roland@mxchange.org>
Sat, 13 Aug 2016 08:21:16 +0000 (10:21 +0200)
simgear/misc/sgstream.cxx
simgear/misc/sgstream.hxx

index 44ce90b116500d45aa2725bd43c4541e2ef2f95a..99b19a7a24613c3bdb954736a1cf98cac23878d3 100644 (file)
@@ -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
index 8aa72105d7e69ccca8eebff6c8b669d66ab9238e..e7a4b12ca1c75b6dca7bb06c11b667f3f7799940 100644 (file)
@@ -33,8 +33,9 @@
 
 #include <simgear/compiler.h>
 
-#  include <istream>
-#  include <ostream>
+#include <istream>
+#include <ostream>
+#include <fstream>
 
 #include <string>
 
@@ -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 */