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.6  2005/11/30 12:47:37  csoutheren
00031  * Removed tabs, reformatted some code, and changed tags for Doxygen
00032  *
00033  * Revision 1.5  2004/11/11 07:34:50  csoutheren
00034  * Added #include <ptlib.h>
00035  *
00036  * Revision 1.4  2002/09/16 01:08:59  robertj
00037  * Added #define so can select if #pragma interface/implementation is used on
00038  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00039  *
00040  * Revision 1.3  2002/08/05 05:40:45  robertj
00041  * Fixed missing pragma interface/implementation
00042  *
00043  * Revision 1.2  2002/06/27 03:53:35  robertj
00044  * Cleaned up documentation and added Compare() function.
00045  *
00046  * Revision 1.1  2002/06/26 09:01:19  craigs
00047  * Initial version
00048  *
00049  */
00050 
00051 #ifndef _PMEMFILE
00052 #define _PMEMFILE
00053 
00054 #ifdef P_USE_PRAGMA
00055 #pragma interface
00056 #endif
00057 
00058 #include <ptlib.h>
00059 
00062 class PMemoryFile : public PFile
00063 {
00064   PCLASSINFO(PMemoryFile, PFile);
00065   public:
00070     PMemoryFile();
00071 
00074     PMemoryFile(
00075       const PBYTEArray & data  
00076     );
00078 
00079 
00088     Comparison Compare(
00089       const PObject & obj   
00090     ) const;
00092 
00093 
00107     virtual BOOL Read(
00108       void * buf,   
00109       PINDEX len    
00110     );
00111 
00121     virtual BOOL Write(
00122       const void * buf, 
00123       PINDEX len        
00124     );
00126 
00127 
00136     off_t GetLength() const;
00137       
00144     BOOL SetLength(
00145       off_t len   
00146     );
00147 
00158     BOOL SetPosition(
00159       off_t pos,                         
00160       FilePositionOrigin origin = Start  
00161     );
00162 
00169     off_t GetPosition() const;
00171 
00172 
00177     const PBYTEArray & GetData() const { return data; }
00179 
00180 
00181   protected:
00182     PBYTEArray data;
00183     off_t position;
00184 };
00185 
00186 
00187 #endif // _PMEMFILE
00188 
00189 
00190 // End of File ///////////////////////////////////////////////////////////////
00191 

Generated on Fri Sep 21 14:40:11 2007 for PWLib by  doxygen 1.5.3