git.fiddlerwoaroof.com
sys_fstream.cc
bc6c3d35
 /* Copyright (C) CJ Affiliate
  *
  * You may use, distribute and modify this code under  the
  * terms of the  GNU General Public License  version 2  or
  * later.
  *
  * You should have received a copy of the license with this
  * file. If not, you will find a copy in the "LICENSE" file
  * at https://github.com/cjdev/dual-control.
  */
 
215ea751
 #include <memory>
 #include <fstream>
af3a4cd4
 #include <iostream>
215ea751
 
 #include "sys_fstream.h"
 
bc6c3d35
 namespace
 {
 class impl : public fstreams_ifc
 {
 public:
af3a4cd4
     pstream open_fstream (const std::string &file_path) const override
bc6c3d35
     {
         return pstream (new std::ifstream (file_path));
     }
d10906ee
     postream open_ofstream (const std::string &file_path,
ee4b4507
                             std::ios_base::openmode mode) const override
d10906ee
     {
         return postream (new std::ofstream (file_path, mode));
af3a4cd4
     }
 
215ea751
 };
 
 }
 
bc6c3d35
 fstreams fstreams::create()
 {
     static fstreams singleton (delegate (new impl));
215ea751
     return singleton;
 }