MfcFileStream.cpp
上传用户:kx_jwh
上传日期:2021-09-03
资源大小:76k
文件大小:2k
源码类别:

STL

开发平台:

Visual C++

  1. /* vim: set tabstop=4 : */
  2. #if defined(_MSC_VER)
  3. #include "MfcFileStream.h"
  4. #include "byte_io_impl.h"
  5. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  6. # pragma warning(push)
  7. # pragma warning(disable: 4267)
  8. #endif
  9. namespace febird {
  10. size_t MfcFileStream::read(void* vbuf, size_t length)
  11. {
  12. return m_fp->Read(vbuf, length);
  13. }
  14. size_t MfcFileStream::write(const void* vbuf, size_t length)
  15. {
  16. TRY
  17. m_fp->Write(vbuf, length);
  18. CATCH(CException, e)
  19. throw OutOfSpaceException("MfcFileStream::Write");
  20. END_CATCH
  21. return length;
  22. }
  23. bool MfcFileStream::seek(stream_offset_t offset, int origin)
  24. {
  25. TRY
  26. m_fp->Seek(offset, origin);
  27. CATCH(CException, e)
  28. throw OutOfSpaceException("MfcFileStream::Write");
  29. END_CATCH
  30. return true;
  31. }
  32. void MfcFileStream::flush()
  33. {
  34. m_fp->Flush();
  35. }
  36. FEBIRD_GEN_ensureRead (MfcFileStream::)
  37. FEBIRD_GEN_ensureWrite(MfcFileStream::)
  38. FEBIRD_GEN_getByte(MfcFileStream::)
  39. FEBIRD_GEN_readByte(MfcFileStream::)
  40. FEBIRD_GEN_writeByte(MfcFileStream::)
  41. size_t MfcArchiveStream::read(void* vbuf, size_t length)
  42. {
  43. return m_fp->Read(vbuf, length);
  44. }
  45. size_t MfcArchiveStream::write(const void* vbuf, size_t length)
  46. {
  47. TRY
  48. m_fp->Write(vbuf, length);
  49. CATCH(CException, e)
  50. throw OutOfSpaceException("MfcFileStream::Write");
  51. END_CATCH
  52. return length;
  53. }
  54. void MfcArchiveStream::flush() { m_fp->Flush(); }
  55. FEBIRD_GEN_ensureRead (MfcArchiveStream::)
  56. FEBIRD_GEN_ensureWrite(MfcArchiveStream::)
  57. FEBIRD_GEN_getByte(MfcArchiveStream::)
  58. FEBIRD_GEN_readByte(MfcArchiveStream::)
  59. FEBIRD_GEN_writeByte(MfcArchiveStream::)
  60. }
  61. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  62. # pragma warning(pop)
  63. #endif
  64. #endif