FileOutputStream.hpp 863 B

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