~ubuntu-installer/wubi/trunk

« back to all changes in this revision

Viewing changes to src/7z/CPP/7zip/Common/InOutTempBuffer.h

  • Committer: Agostino Russo
  • Date: 2008-12-04 00:37:30 UTC
  • Revision ID: agostino.russo@gmail.com-20081204003730-3o051yp78d6ujckl
* Bumped version to 9.04
* Added required binaries (will be compiled at a later stage)
* Added uninstallation page
* Added BitTorrent source
* Added documentation and licenses
* Connected download managers
* Fixed download status updates
* Added more information to the README
* Made the tasklist thread daemonic so that it does not prevent the
  main application from quitting

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Util/InOutTempBuffer.h
 
2
 
 
3
#ifndef __IN_OUT_TEMP_BUFFER_H
 
4
#define __IN_OUT_TEMP_BUFFER_H
 
5
 
 
6
#include "../../Windows/FileIO.h"
 
7
#include "../../Windows/FileDir.h"
 
8
#include "../../Common/MyCom.h"
 
9
 
 
10
#include "../IStream.h"
 
11
 
 
12
class CInOutTempBuffer
 
13
{
 
14
  NWindows::NFile::NDirectory::CTempFile _tempFile;
 
15
  NWindows::NFile::NIO::COutFile _outFile;
 
16
  NWindows::NFile::NIO::CInFile _inFile;
 
17
  Byte *_buffer;
 
18
  UInt32 _bufferPosition;
 
19
  UInt32 _currentPositionInBuffer;
 
20
  CSysString _tmpFileName;
 
21
  bool _tmpFileCreated;
 
22
 
 
23
  UInt64 _fileSize;
 
24
 
 
25
  bool WriteToFile(const void *data, UInt32 size);
 
26
public:
 
27
  CInOutTempBuffer();
 
28
  ~CInOutTempBuffer();
 
29
  void Create();
 
30
 
 
31
  void InitWriting();
 
32
  bool Write(const void *data, UInt32 size);
 
33
  UInt64 GetDataSize() const { return _fileSize; }
 
34
  bool FlushWrite();
 
35
  bool InitReading();
 
36
  HRESULT WriteToStream(ISequentialOutStream *stream);
 
37
};
 
38
 
 
39
class CSequentialOutTempBufferImp: 
 
40
  public ISequentialOutStream,
 
41
  public CMyUnknownImp
 
42
{
 
43
  CInOutTempBuffer *_buffer;
 
44
public:
 
45
  // CSequentialOutStreamImp(): _size(0) {}
 
46
  // UInt32 _size;
 
47
  void Init(CInOutTempBuffer *buffer)  { _buffer = buffer; }
 
48
  // UInt32 GetSize() const { return _size; }
 
49
 
 
50
  MY_UNKNOWN_IMP
 
51
 
 
52
  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
 
53
};
 
54
 
 
55
#endif