archive.cpp 792 B

12345678910111213141516171819202122232425262728293031323334
  1. ///////////////////////////////////////////////////////////////////////////////////////
  2. /// \file archive.cpp
  3. /// \brief Classes to make (de)serializing to/from streams convenient
  4. ///
  5. /// $Date: 2012-09-20 15:22:28 +0200 (Thu, 20 Sep 2012) $
  6. ///
  7. ///////////////////////////////////////////////////////////////////////////////////////
  8. #include "config.h"
  9. #include "archive.h"
  10. ArchiveInStream::ArchiveInStream(std::istream& strm)
  11. : in(strm) {
  12. }
  13. bool ArchiveInStream::save() const {
  14. return false;
  15. }
  16. void ArchiveInStream::transfer(char* s, std::streamsize n) {
  17. in.read(s, n);
  18. }
  19. ArchiveOutStream::ArchiveOutStream(std::ostream& strm)
  20. : out(strm) {
  21. }
  22. bool ArchiveOutStream::save() const {
  23. return true;
  24. }
  25. void ArchiveOutStream::transfer(char* s, std::streamsize n) {
  26. out.write(s, n);
  27. }