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.5 2004/11/11 07:34:50 csoutheren 00031 * Added #include <ptlib.h> 00032 * 00033 * Revision 1.4 2002/09/16 01:08:59 robertj 00034 * Added #define so can select if #pragma interface/implementation is used on 00035 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan. 00036 * 00037 * Revision 1.3 2002/08/05 05:40:45 robertj 00038 * Fixed missing pragma interface/implementation 00039 * 00040 * Revision 1.2 2002/06/27 03:53:35 robertj 00041 * Cleaned up documentation and added Compare() function. 00042 * 00043 * Revision 1.1 2002/06/26 09:01:19 craigs 00044 * Initial version 00045 * 00046 */ 00047 00048 #ifndef _PMEMFILE 00049 #define _PMEMFILE 00050 00051 #ifdef P_USE_PRAGMA 00052 #pragma interface 00053 #endif 00054 00055 #include <ptlib.h> 00056 00059 class PMemoryFile : public PFile 00060 { 00061 PCLASSINFO(PMemoryFile, PFile); 00062 public: 00067 PMemoryFile(); 00068 00071 PMemoryFile( 00072 const PBYTEArray & data 00073 ); 00075 00076 00085 Comparison Compare( 00086 const PObject & obj 00087 ) const; 00089 00090 00104 virtual BOOL Read( 00105 void * buf, 00106 PINDEX len 00107 ); 00108 00118 virtual BOOL Write( 00119 const void * buf, 00120 PINDEX len 00121 ); 00123 00124 00133 off_t GetLength() const; 00134 00141 BOOL SetLength( 00142 off_t len // New length of file. 00143 ); 00144 00155 BOOL SetPosition( 00156 off_t pos, 00157 FilePositionOrigin origin = Start 00158 ); 00159 00166 off_t GetPosition() const; 00168 00169 00174 const PBYTEArray & GetData() const { return data; } 00176 00177 00178 protected: 00179 PBYTEArray data; 00180 off_t position; 00181 }; 00182 00183 00184 #endif // _PMEMFILE 00185 00186 00187 // End of File /////////////////////////////////////////////////////////////// 00188