diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2008-06-08 11:04:43 +0200 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2008-06-08 11:04:43 +0200 |
| commit | 16f738ecee689c6feb2acb7e4ef4d9bb4144ae7d (patch) | |
| tree | 3d22f54f7298f81b18ed66d05a62fa8bfab359ab /zip/ZipArchive/ZipAutoBuffer.h | |
| download | tuxcmd-modules-release-0.6.36-dev.tar.xz | |
Initial commitv0.6.36release-0.6.36-dev
Diffstat (limited to 'zip/ZipArchive/ZipAutoBuffer.h')
| -rw-r--r-- | zip/ZipArchive/ZipAutoBuffer.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/zip/ZipArchive/ZipAutoBuffer.h b/zip/ZipArchive/ZipAutoBuffer.h new file mode 100644 index 0000000..6aaa37c --- /dev/null +++ b/zip/ZipArchive/ZipAutoBuffer.h @@ -0,0 +1,67 @@ +////////////////////////////////////////////////////////////////////////////////
+// This source file is part of the ZipArchive library source distribution and
+// is Copyrighted 2000 - 2007 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: http://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)
+
|
