blob: 5e54499fe49d5b8c9c6fe0b6904bfb3412bf1366 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive Library Open Source distribution
// and is Copyrighted 2000 - 2022 by Artpol Software - Tadeusz Dracz
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// For the licensing details refer to the License.txt file.
//
// Web Site: https://www.artpol-software.com
////////////////////////////////////////////////////////////////////////////////
/**
* \file ZipAutoBuffer.h
* Includes the CZipAutoBuffer class.
*
*/
#if !defined(ZIPARCHIVE_ZIPAUTOBUFFER_DOT_H)
#define ZIPARCHIVE_ZIPAUTOBUFFER_DOT_H
#if _MSC_VER > 1000
#pragma once
#endif
#include "ZipExport.h"
/**
A smart buffer freeing its contents on destruction.
*/
class ZIP_API CZipAutoBuffer
{
public:
operator char*()
{
return m_pBuffer;
}
#if !defined (__BORLANDC__) || (__BORLANDC__ > 0x560) // The actual version may be different.
operator const char*() const
{
return m_pBuffer;
}
#endif
const char* GetBuffer() const {return m_pBuffer;}
char* Allocate(DWORD iSize, bool bZeroMemory = false);
void Release();
DWORD GetSize() const
{
return m_iSize;
}
bool IsAllocated() const
{
return (m_pBuffer != NULL);
}
CZipAutoBuffer(DWORD iSize, bool bZeroMemory = false);
CZipAutoBuffer();
CZipAutoBuffer(const CZipAutoBuffer& buffer);
virtual ~CZipAutoBuffer();
CZipAutoBuffer& operator=(const CZipAutoBuffer& buffer);
protected:
char* m_pBuffer;
DWORD m_iSize;
};
#endif // !defined(ZIPARCHIVE_ZIPAUTOBUFFER_DOT_H)
|