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: 21788 $
00030  * $Author: rjongbloed $
00031  * $Date: 2008-12-11 23:42:13 -0600 (Thu, 11 Dec 2008) $
00032  */
00033 
00034 #ifndef PTLIB_PMEMFILE_H
00035 #define PTLIB_PMEMFILE_H
00036 
00037 #ifdef P_USE_PRAGMA
00038 #pragma interface
00039 #endif
00040 
00041 
00044 class PMemoryFile : public PFile
00045 {
00046   PCLASSINFO(PMemoryFile, PFile);
00047   public:
00052     PMemoryFile();
00053 
00056     PMemoryFile(
00057       const PBYTEArray & data  
00058     );
00060 
00061 
00070     Comparison Compare(
00071       const PObject & obj   
00072     ) const;
00074 
00075 
00089     virtual PBoolean Read(
00090       void * buf,   
00091       PINDEX len    
00092     );
00093 
00103     virtual PBoolean Write(
00104       const void * buf, 
00105       PINDEX len        
00106     );
00108 
00109 
00118     off_t GetLength() const;
00119       
00126     PBoolean SetLength(
00127       off_t len   
00128     );
00129 
00140     PBoolean SetPosition(
00141       off_t pos,                         
00142       FilePositionOrigin origin = Start  
00143     );
00144 
00151     off_t GetPosition() const;
00153 
00154 
00159     const PBYTEArray & GetData() const { return data; }
00161 
00162 
00163   protected:
00164     PBYTEArray data;
00165     off_t position;
00166 };
00167 
00168 
00169 #endif // PTLIB_PMEMFILE_H
00170 
00171 
00172 // End of File ///////////////////////////////////////////////////////////////

Generated on Thu May 27 01:36:48 2010 for PTLib by  doxygen 1.4.7