FileOutputStream.hpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-20
  6. * Changed: 2022-07-01
  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. #include <ls_std/os/dynamic_goal.hpp>
  16. namespace ls
  17. {
  18. namespace std
  19. {
  20. namespace io
  21. {
  22. class DYNAMIC_GOAL FileOutputStream : public ls::std::core::Class, public ls::std::core::interface_type::IWriter
  23. {
  24. public:
  25. explicit FileOutputStream(ls::std::io::File &_file);
  26. explicit FileOutputStream(ls::std::io::File &_file, bool _append);
  27. ~FileOutputStream() override;
  28. void close();
  29. bool write(const ls::std::core::type::byte_field &_data) override;
  30. private:
  31. bool append{};
  32. ls::std::io::File file;
  33. ::std::ofstream outputStream{};
  34. void _close();
  35. void _init();
  36. };
  37. }
  38. }
  39. }
  40. #endif