PTLib
Version 2.10.4
|
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: 26949 $ 00030 * $Author: rjongbloed $ 00031 * $Date: 2012-02-07 20:27:07 -0600 (Tue, 07 Feb 2012) $ 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 ); 00059 00062 ~PMemoryFile(); 00064 00065 00074 Comparison Compare( 00075 const PObject & obj 00076 ) const; 00078 00079 00093 virtual PBoolean Open( 00094 OpenMode mode = ReadWrite, // Mode in which to open the file. 00095 int opts = ModeDefault // Options for open operation. 00096 ); 00097 00108 virtual PBoolean Open( 00109 const PFilePath & name, // Name of file to open. 00110 OpenMode mode = ReadWrite, // Mode in which to open the file. 00111 int opts = ModeDefault // <code>OpenOptions</code> enum# for open operation. 00112 ); 00113 00118 virtual PBoolean Close(); 00119 00131 virtual PBoolean Read( 00132 void * buf, 00133 PINDEX len 00134 ); 00135 00145 virtual PBoolean Write( 00146 const void * buf, 00147 PINDEX len 00148 ); 00150 00151 00160 virtual off_t GetLength() const; 00161 00168 virtual PBoolean SetLength( 00169 off_t len 00170 ); 00171 00182 virtual PBoolean SetPosition( 00183 off_t pos, 00184 FilePositionOrigin origin = Start 00185 ); 00186 00193 virtual off_t GetPosition() const; 00195 00196 00201 const PBYTEArray & GetData() const { return m_data; } 00203 00204 00205 protected: 00206 PBYTEArray m_data; 00207 off_t m_position; 00208 }; 00209 00210 00211 #endif // PTLIB_PMEMFILE_H 00212 00213 00214 // End of File ///////////////////////////////////////////////////////////////