2 * Copyright (c) 2002 Frodo
3 * Portions Copyright (c) by the authors of ffmpeg and xvid
4 * Copyright (C) 2002-2013 Team XBMC
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with XBMC; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
23 // IFile.h: interface for the IFile class.
25 //////////////////////////////////////////////////////////////////////
27 #if !defined(AFX_IFILE_H__7EE73AC7_36BC_4822_93FF_44F3B0C766F6__INCLUDED_)
28 #define AFX_IFILE_H__7EE73AC7_36BC_4822_93FF_44F3B0C766F6__INCLUDED_
33 #include "PlatformDefs.h" // for __stat64
40 #include "utils/StdString.h"
41 #include "IFileTypes.h"
54 virtual bool Open(const CURL& url) = 0;
55 virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false) { return false; };
56 virtual bool Exists(const CURL& url) = 0;
57 virtual int Stat(const CURL& url, struct __stat64* buffer) = 0;
58 virtual int Stat(struct __stat64* buffer);
59 virtual unsigned int Read(void* lpBuf, int64_t uiBufSize) = 0;
60 virtual int Write(const void* lpBuf, int64_t uiBufSize) { return -1;};
61 virtual bool ReadString(char *szLine, int iLineLength);
62 virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET) = 0;
63 virtual void Close() = 0;
64 virtual int64_t GetPosition() = 0;
65 virtual int64_t GetLength() = 0;
66 virtual void Flush() { }
67 virtual int Truncate(int64_t size) { return -1;};
69 /* Returns the minium size that can be read from input stream. *
70 * For example cdrom access where access could be sector based. *
71 * This will cause file system to buffer read requests, to *
72 * to meet the requirement of CFile. *
73 * It can also be used to indicate a file system is non buffered *
74 * but accepts any read size, have it return the value 1 */
75 virtual int GetChunkSize() {return 0;}
77 virtual bool SkipNext(){return false;}
79 virtual bool Delete(const CURL& url) { return false; }
80 virtual bool Rename(const CURL& url, const CURL& urlnew) { return false; }
81 virtual bool SetHidden(const CURL& url, bool hidden) { return false; }
83 virtual int IoControl(EIoControl request, void* param) { return -1; }
85 virtual CStdString GetContent() { return "application/octet-stream"; }
86 virtual std::string GetContentCharset(void) { return ""; }
89 class CRedirectException
97 CRedirectException(IFile *pNewFileImp, CURL *pNewUrl=NULL);
102 #endif // !defined(AFX_IFILE_H__7EE73AC7_36BC_4822_93FF_44F3B0C766F6__INCLUDED_)