ZipAutoBuffer.h

Go to the documentation of this file.
00001 
00002 // $RCSfile: ZipAutoBuffer.h,v $
00003 // $Revision: 1.3 $
00004 // $Date: 2006/01/28 20:18:12 $ $Author: Tadeusz Dracz $
00006 // This source file is part of the ZipArchive library source distribution and
00007 // is Copyrighted 2000 - 2006 by Tadeusz Dracz (http://www.artpol-software.com/)
00008 //
00009 // This program is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU General Public License
00011 // as published by the Free Software Foundation; either version 2
00012 // of the License, or (at your option) any later version.
00013 // 
00014 // For the licensing details see the file License.txt
00016 
00023 #if !defined(AFX_ZIPAUTOBUFFER_H__DEC28C20_83FE_11D3_B7C3_EDEC47A8A86C__INCLUDED_)
00024 #define AFX_ZIPAUTOBUFFER_H__DEC28C20_83FE_11D3_B7C3_EDEC47A8A86C__INCLUDED_
00025 
00026 #if _MSC_VER > 1000
00027 #pragma once
00028 #endif // _MSC_VER > 1000
00029 
00030 #include "ZipExport.h"
00034 class ZIP_API CZipAutoBuffer
00035 {
00036 public:
00037  operator char*()
00038  {
00039   return m_pBuffer;
00040  }
00041 #ifndef __BORLANDC__
00042  operator const char*() const  // Borland seems to have problems with this
00043  {
00044   return m_pBuffer;
00045  }
00046 #endif
00047 
00048 
00049 
00050 
00051 
00052  // may produce ambiguity on some compilers
00053 //   operator const char*() const
00054 //    {
00055 //      return m_pBuffer;
00056 //     }
00057  const char* GetBuffer() const {return m_pBuffer;}
00058  char* Allocate(DWORD iSize, bool bZeroMemory = false);
00059  void Release();
00060  DWORD GetSize() const 
00061  {
00062   return m_iSize;
00063  }
00064  bool IsAllocated() const
00065  {
00066   return (m_pBuffer != NULL);
00067  }
00068  CZipAutoBuffer(DWORD iSize, bool bZeroMemory = false);
00069  CZipAutoBuffer();
00070  CZipAutoBuffer(const CZipAutoBuffer& buffer);
00071  virtual ~CZipAutoBuffer();
00072  CZipAutoBuffer& operator=(const CZipAutoBuffer& buffer);
00073 protected:
00074  char* m_pBuffer;
00075  DWORD m_iSize;
00076 };
00077 
00078 #endif // !defined(AFX_ZIPAUTOBUFFER_H__DEC28C20_83FE_11D3_B7C3_EDEC47A8A86C__INCLUDED_)
00079  

ZipArchive Copyright © 2000 - 2006 Tadeusz Dracz . Generated at Fri Apr 7 13:55:23 2006.