-// OutBuffer.h\r
-\r
-#ifndef __OUTBUFFER_H\r
-#define __OUTBUFFER_H\r
-\r
-#include "../IStream.h"\r
-#include "../../Common/MyCom.h"\r
-\r
-#ifndef _NO_EXCEPTIONS\r
-struct COutBufferException\r
-{\r
- HRESULT ErrorCode;\r
- COutBufferException(HRESULT errorCode): ErrorCode(errorCode) {}\r
-};\r
-#endif\r
-\r
-class COutBuffer\r
-{\r
-protected:\r
- Byte *_buffer;\r
- UInt32 _pos;\r
- UInt32 _limitPos;\r
- UInt32 _streamPos;\r
- UInt32 _bufferSize;\r
- CMyComPtr<ISequentialOutStream> _stream;\r
- UInt64 _processedSize;\r
- Byte *_buffer2;\r
- bool _overDict;\r
-\r
- HRESULT FlushPart();\r
- void FlushWithCheck();\r
-public:\r
- #ifdef _NO_EXCEPTIONS\r
- HRESULT ErrorCode;\r
- #endif\r
-\r
- COutBuffer(): _buffer(0), _pos(0), _stream(0), _buffer2(0) {}\r
- ~COutBuffer() { Free(); }\r
- \r
- bool Create(UInt32 bufferSize);\r
- void Free();\r
-\r
- void SetMemStream(Byte *buffer) { _buffer2 = buffer; }\r
- void SetStream(ISequentialOutStream *stream);\r
- void Init();\r
- HRESULT Flush();\r
- void ReleaseStream() { _stream.Release(); }\r
-\r
- void WriteByte(Byte b)\r
- {\r
- _buffer[_pos++] = b;\r
- if(_pos == _limitPos)\r
- FlushWithCheck();\r
- }\r
- void WriteBytes(const void *data, size_t size)\r
- {\r
- for (size_t i = 0; i < size; i++)\r
- WriteByte(((const Byte *)data)[i]);\r
- }\r
-\r
- UInt64 GetProcessedSize() const;\r
-};\r
-\r
-#endif\r
+// OutBuffer.h
+
+#ifndef __OUTBUFFER_H
+#define __OUTBUFFER_H
+
+#include "../IStream.h"
+#include "../../Common/MyCom.h"
+
+#ifndef _NO_EXCEPTIONS
+struct COutBufferException
+{
+ HRESULT ErrorCode;
+ COutBufferException(HRESULT errorCode): ErrorCode(errorCode) {}
+};
+#endif
+
+class COutBuffer
+{
+protected:
+ Byte *_buffer;
+ UInt32 _pos;
+ UInt32 _limitPos;
+ UInt32 _streamPos;
+ UInt32 _bufferSize;
+ CMyComPtr<ISequentialOutStream> _stream;
+ UInt64 _processedSize;
+ Byte *_buffer2;
+ bool _overDict;
+
+ HRESULT FlushPart();
+ void FlushWithCheck();
+public:
+ #ifdef _NO_EXCEPTIONS
+ HRESULT ErrorCode;
+ #endif
+
+ COutBuffer(): _buffer(0), _pos(0), _stream(0), _buffer2(0) {}
+ ~COutBuffer() { Free(); }
+
+ bool Create(UInt32 bufferSize);
+ void Free();
+
+ void SetMemStream(Byte *buffer) { _buffer2 = buffer; }
+ void SetStream(ISequentialOutStream *stream);
+ void Init();
+ HRESULT Flush();
+ void ReleaseStream() { _stream.Release(); }
+
+ void WriteByte(Byte b)
+ {
+ _buffer[_pos++] = b;
+ if(_pos == _limitPos)
+ FlushWithCheck();
+ }
+ void WriteBytes(const void *data, size_t size)
+ {
+ for (size_t i = 0; i < size; i++)
+ WriteByte(((const Byte *)data)[i]);
+ }
+
+ UInt64 GetProcessedSize() const;
+};
+
+#endif