FileOutputStream.hpp 840 B

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