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  * $Revision: 20385 $
00030  * $Author: rjongbloed $
00031  * $Date: 2008-06-04 10:40:38 +0000 (Wed, 04 Jun 2008) $
00032  */
00033 
00034 #ifndef _PMEMFILE
00035 #define _PMEMFILE
00036 
00037 #ifdef P_USE_PRAGMA
00038 #pragma interface
00039 #endif
00040 
00041 #ifndef _PTLIB_H
00042 #include <ptlib.h>
00043 #endif
00044 
00047 class PMemoryFile : public PFile
00048 {
00049   PCLASSINFO(PMemoryFile, PFile);
00050   public:
00055     PMemoryFile();
00056 
00059     PMemoryFile(
00060       const PBYTEArray & data  
00061     );
00063 
00064 
00073     Comparison Compare(
00074       const PObject & obj   
00075     ) const;
00077 
00078 
00092     virtual PBoolean Read(
00093       void * buf,   
00094       PINDEX len    
00095     );
00096 
00106     virtual PBoolean Write(
00107       const void * buf, 
00108       PINDEX len        
00109     );
00111 
00112 
00121     off_t GetLength() const;
00122       
00129     PBoolean SetLength(
00130       off_t len   
00131     );
00132 
00143     PBoolean SetPosition(
00144       off_t pos,                         
00145       FilePositionOrigin origin = Start  
00146     );
00147 
00154     off_t GetPosition() const;
00156 
00157 
00162     const PBYTEArray & GetData() const { return data; }
00164 
00165 
00166   protected:
00167     PBYTEArray data;
00168     off_t position;
00169 };
00170 
00171 
00172 #endif // _PMEMFILE
00173 
00174 
00175 // End of File ///////////////////////////////////////////////////////////////
00176 

Generated on Mon Feb 23 01:57:54 2009 for PTLib by  doxygen 1.5.1