FileOutputStream.hpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-20
  6. * Changed: 2022-05-16
  7. *
  8. * */
  9. #ifndef LS_STD_FILE_OUTPUT_STREAM_HPP
  10. #define LS_STD_FILE_OUTPUT_STREAM_HPP
  11. #include <ls_std/core/Class.hpp>
  12. #include "File.hpp"
  13. #include <ls_std/core/interface/IWriter.hpp>
  14. #include <fstream>
  15. namespace ls
  16. {
  17. namespace std
  18. {
  19. namespace io
  20. {
  21. class FileOutputStream : public ls::std::core::Class, public ls::std::core::interface::IWriter
  22. {
  23. public:
  24. explicit FileOutputStream(ls::std::io::File &_file);
  25. explicit FileOutputStream(ls::std::io::File &_file, bool _append);
  26. ~FileOutputStream() override;
  27. void close();
  28. bool write(const ls::std::core::type::byte_field &_data) override;
  29. private:
  30. bool append{};
  31. ls::std::io::File file;
  32. ::std::ofstream outputStream{};
  33. void _close();
  34. void _init();
  35. };
  36. }
  37. }
  38. }
  39. #endif