2 * Copyright (C) 2005-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
21 #include "SpecialProtocolFile.h"
22 #include "SpecialProtocol.h"
27 using namespace XFILE;
29 CSpecialProtocolFile::CSpecialProtocolFile(void)
33 CSpecialProtocolFile::~CSpecialProtocolFile(void)
38 bool CSpecialProtocolFile::Open(const CURL& url)
40 CStdString strFileName=CSpecialProtocol::TranslatePath(url);
42 return m_file.Open(strFileName);
45 bool CSpecialProtocolFile::OpenForWrite(const CURL& url, bool bOverWrite /*=false */)
47 CStdString strFileName=CSpecialProtocol::TranslatePath(url);
49 return m_file.OpenForWrite(strFileName,bOverWrite);
52 bool CSpecialProtocolFile::Delete(const CURL& url)
54 CStdString strFileName=CSpecialProtocol::TranslatePath(url);
56 return m_file.Delete(strFileName);
59 bool CSpecialProtocolFile::Exists(const CURL& url)
61 CStdString strFileName=CSpecialProtocol::TranslatePath(url);
63 return m_file.Exists(strFileName);
66 int CSpecialProtocolFile::Stat(const CURL& url, struct __stat64* buffer)
68 CStdString strFileName=CSpecialProtocol::TranslatePath(url);
70 return m_file.Stat(strFileName, buffer);
73 bool CSpecialProtocolFile::Rename(const CURL& url, const CURL& urlnew)
75 CStdString strFileName=CSpecialProtocol::TranslatePath(url);
76 CStdString strFileName2=CSpecialProtocol::TranslatePath(urlnew);
78 return m_file.Rename(strFileName,strFileName2);
81 int CSpecialProtocolFile::Stat(struct __stat64* buffer)
83 return m_file.Stat(buffer);
86 unsigned int CSpecialProtocolFile::Read(void* lpBuf, int64_t uiBufSize)
88 return m_file.Read(lpBuf, uiBufSize);
91 int CSpecialProtocolFile::Write(const void* lpBuf, int64_t uiBufSize)
93 return m_file.Write(lpBuf,uiBufSize);
96 int64_t CSpecialProtocolFile::Seek(int64_t iFilePosition, int iWhence /*=SEEK_SET*/)
98 return m_file.Seek(iFilePosition, iWhence);
101 void CSpecialProtocolFile::Close()
106 int64_t CSpecialProtocolFile::GetPosition()
108 return m_file.GetPosition();
111 int64_t CSpecialProtocolFile::GetLength()
113 return m_file.GetLength();