memfile.h

Go to the documentation of this file.
00001 /*
00002  * memfile.h
00003  *
00004  * WAV file I/O channel class.
00005  *
00006  * Portable Windows Library
00007  *
00008  * Copyright (c) 2002 Equivalence Pty. Ltd.
00009  *
00010  * The contents of this file are subject to the Mozilla Public License
00011  * Version 1.0 (the "License"); you may not use this file except in
00012  * compliance with the License. You may obtain a copy of the License at
00013  * http://www.mozilla.org/MPL/
00014  *
00015  * Software distributed under the License is distributed on an "AS IS"
00016  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00017  * the License for the specific language governing rights and limitations
00018  * under the License.
00019  *
00020  * The Original Code is Portable Windows Library.
00021  *
00022  * The Initial Developer of the Original Code is
00023  * Equivalence Pty Ltd
00024  *
00025  * All Rights Reserved.
00026  *
00027  * Contributor(s): ______________________________________.
00028  *
00029  * $Log: memfile.h,v $
00030  * Revision 1.7  2007/04/18 23:49:50  csoutheren
00031  * Add usage of precompiled headers
00032  *
00033  * Revision 1.6  2005/11/30 12:47:37  csoutheren
00034  * Removed tabs, reformatted some code, and changed tags for Doxygen
00035  *
00036  * Revision 1.5  2004/11/11 07:34:50  csoutheren
00037  * Added #include <ptlib.h>
00038  *
00039  * Revision 1.4  2002/09/16 01:08:59  robertj
00040  * Added #define so can select if #pragma interface/implementation is used on
00041  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00042  *
00043  * Revision 1.3  2002/08/05 05:40:45  robertj
00044  * Fixed missing pragma interface/implementation
00045  *
00046  * Revision 1.2  2002/06/27 03:53:35  robertj
00047  * Cleaned up documentation and added Compare() function.
00048  *
00049  * Revision 1.1  2002/06/26 09:01:19  craigs
00050  * Initial version
00051  *
00052  */
00053 
00054 #ifndef _PMEMFILE
00055 #define _PMEMFILE
00056 
00057 #ifdef P_USE_PRAGMA
00058 #pragma interface
00059 #endif
00060 
00061 #ifndef _PTLIB_H
00062 #include <ptlib.h>
00063 #endif
00064 
00067 class PMemoryFile : public PFile
00068 {
00069   PCLASSINFO(PMemoryFile, PFile);
00070   public:
00075     PMemoryFile();
00076 
00079     PMemoryFile(
00080       const PBYTEArray & data  
00081     );
00083 
00084 
00093     Comparison Compare(
00094       const PObject & obj   
00095     ) const;
00097 
00098 
00112     virtual BOOL Read(
00113       void * buf,   
00114       PINDEX len    
00115     );
00116 
00126     virtual BOOL Write(
00127       const void * buf, 
00128       PINDEX len        
00129     );
00131 
00132 
00141     off_t GetLength() const;
00142       
00149     BOOL SetLength(
00150       off_t len   
00151     );
00152 
00163     BOOL SetPosition(
00164       off_t pos,                         
00165       FilePositionOrigin origin = Start  
00166     );
00167 
00174     off_t GetPosition() const;
00176 
00177 
00182     const PBYTEArray & GetData() const { return data; }
00184 
00185 
00186   protected:
00187     PBYTEArray data;
00188     off_t position;
00189 };
00190 
00191 
00192 #endif // _PMEMFILE
00193 
00194 
00195 // End of File ///////////////////////////////////////////////////////////////
00196 

Generated on Fri Mar 7 06:25:02 2008 for PTLib by  doxygen 1.5.1