11 #include "addons/binary-addons/AddonDll.h" 12 #include "addons/binary-addons/AddonInstanceHandler.h" 13 #include "addons/kodi-dev-kit/include/kodi/addon-instance/VFS.h" 14 #include "filesystem/IDirectory.h" 15 #include "filesystem/IFile.h" 16 #include "filesystem/IFileDirectory.h" 25 typedef std::shared_ptr<CVFSEntry> VFSEntryPtr;
33 const std::vector<VFSEntryPtr> GetAddonInstances();
34 VFSEntryPtr GetAddonInstance(
const std::string& strId);
37 void Update(
const std::string&
id);
39 bool IsInUse(
const std::string&
id)
override;
41 CCriticalSection m_critSection;
42 std::vector<VFSEntryPtr> m_addonsInstances;
68 explicit CVFSEntry(
const AddonInfoPtr& addonInfo);
72 void* Open(
const CURL& url);
73 void* OpenForWrite(
const CURL& url,
bool bOverWrite);
74 bool Exists(
const CURL& url);
75 int Stat(
const CURL& url,
struct __stat64* buffer);
76 ssize_t Read(
void* ctx,
void* lpBuf,
size_t uiBufSize);
77 ssize_t Write(
void* ctx,
const void* lpBuf,
size_t uiBufSize);
78 int64_t Seek(
void* ctx, int64_t iFilePosition,
int iWhence = SEEK_SET);
79 int Truncate(
void* ctx, int64_t size);
80 void Close(
void* ctx);
81 int64_t GetPosition(
void* ctx);
82 int64_t GetLength(
void* ctx);
83 int GetChunkSize(
void* ctx);
84 int IoControl(
void* ctx, XFILE::EIoControl request,
void* param);
85 bool Delete(
const CURL& url);
86 bool Rename(
const CURL& url,
const CURL& url2);
89 bool DirectoryExists(
const CURL& url);
90 bool RemoveDirectory(
const CURL& url);
91 bool CreateDirectory(
const CURL& url);
97 const std::string& GetProtocols()
const {
return m_protocols; }
98 const std::string& GetExtensions()
const {
return m_extensions; }
99 bool HasFiles()
const {
return m_files; }
100 bool HasDirectories()
const {
return m_directories; }
101 bool HasFileDirectories()
const {
return m_filedirectories; }
102 const std::string& GetZeroconfType()
const {
return m_zeroconf; }
103 const ProtocolInfo& GetProtocolInfo()
const {
return m_protocolInfo; }
130 bool Open(
const CURL& url)
override;
136 bool OpenForWrite(
const CURL& url,
bool bOverWrite)
override;
140 bool Exists(
const CURL& url)
override;
146 int Stat(
const CURL& url,
struct __stat64* buffer)
override;
152 ssize_t Read(
void* lpBuf,
size_t uiBufSize)
override;
158 ssize_t Write(
const void* lpBuf,
size_t uiBufSize)
override;
164 int64_t Seek(int64_t iFilePosition,
int whence = SEEK_SET)
override;
168 int Truncate(int64_t size)
override;
171 void Close()
override;
174 int64_t GetPosition()
override;
177 int64_t GetLength()
override;
180 int GetChunkSize()
override;
183 int IoControl(XFILE::EIoControl request,
void* param)
override;
187 bool Delete(
const CURL& url)
override;
192 bool Rename(
const CURL& url,
const CURL& url2)
override;
219 bool Exists(
const CURL& url)
override;
223 bool Remove(
const CURL& url)
override;
227 bool Create(
const CURL& url)
override;
230 static bool DoGetKeyboardInput(
void* context,
const char* heading,
231 char** input,
bool hidden_input);
234 bool GetKeyboardInput2(
const char* heading,
char** input,
bool hidden_input);
237 static void DoSetErrorDialog(
void* ctx,
const char* heading,
238 const char* line1,
const char* line2,
242 void SetErrorDialog2(
const char* heading,
const char* line1,
243 const char* line2,
const char* line3);
246 static void DoRequireAuthentication(
void* ctx,
const char* url);
249 void RequireAuthentication2(
const CURL& url);
275 return m_addon->ContainsFiles(url, m_items);
std::string m_protocols
Protocols for VFS entry.
Definition: VFSEntry.h:105
bool m_directories
VFS entry can list directories.
Definition: VFSEntry.h:109
Interface to the directory on a file system.
Definition: IDirectory.h:50
bool m_filedirectories
VFS entry contains file directories.
Definition: VFSEntry.h:110
std::string type
URL type for protocol.
Definition: VFSEntry.h:59
Wrapper equpping a CVFSEntry with an IFileDirectory interface.
Definition: VFSEntry.h:257
A virtual filesystem entry add-on.
Definition: VFSEntry.h:46
int defaultPort
Default port to use for protocol.
Definition: VFSEntry.h:58
Represents a list of files.
Definition: FileItem.h:713
bool Exists(const CURL &url) override
Check if directory exists.
Definition: VFSEntry.h:289
int label
String ID to use as label in dialog.
Definition: VFSEntry.h:60
bool GetDirectory(const CURL &url, CFileItemList &items) override
Return directory listing.
Definition: VFSEntry.cpp:706
CVFSEntryIFileDirectoryWrapper(VFSEntryPtr ptr)
The constructor initializes the reference to the wrapped CVFSEntry.
Definition: VFSEntry.h:263
CFileItemList m_items
Internal list of items, used for cache purposes.
Definition: VFSEntry.h:308
bool supportPort
Protocol supports port customization.
Definition: VFSEntry.h:55
bool supportPassword
Protocol supports passwords.
Definition: VFSEntry.h:54
bool Exists(const CURL &url) override
Check if directory exists.
Definition: VFSEntry.cpp:691
A structure encapsulating properties of supplied protocol.
Definition: VFSEntry.h:50
Definition: AddonInstanceHandler.h:33
Wrapper equipping a CVFSEntry with an IFile interface.
Definition: VFSEntry.h:117
std::string m_extensions
Extensions for VFS entry.
Definition: VFSEntry.h:106
VFSEntryPtr m_addon
Pointer to wrapper CVFSEntry.
Definition: VFSEntry.h:251
ProtocolInfo m_protocolInfo
Info about protocol for network dialog.
Definition: VFSEntry.h:111
bool supportWrite
Protocol supports write operations.
Definition: VFSEntry.h:57
bool Remove(const CURL &url) override
Delete directory.
Definition: VFSEntry.h:296
Definition: AddonEvents.h:18
bool m_files
Vfs entry can read files.
Definition: VFSEntry.h:108
VFSEntryPtr m_addon
Pointer to wrapped CVFSEntry.
Definition: VFSEntry.h:195
bool supportUsername
Protocol uses logins.
Definition: VFSEntry.h:53
std::string m_zeroconf
Zero conf announce string for VFS protocol.
Definition: VFSEntry.h:107
bool GetDirectory(const CURL &url, CFileItemList &items) override
Return directory listing.
Definition: VFSEntry.h:282
Wrapper equpping a CVFSEntry with an IDirectory interface.
Definition: VFSEntry.h:201
Definition: IFileDirectory.h:15
bool Remove(const CURL &url) override
Delete directory.
Definition: VFSEntry.cpp:696
void * m_context
Opaque add-on specific context for opened file.
Definition: VFSEntry.h:194
bool supportBrowsing
Protocol supports server browsing.
Definition: VFSEntry.h:56
bool supportPath
Protocol has path in addition to server name.
Definition: VFSEntry.h:52
Definition: VFSEntry.h:27
bool Create(const CURL &url) override
Create directory.
Definition: VFSEntry.h:303
bool ContainsFiles(const CURL &url) override
Check if the given file should be treated as a directory.
Definition: VFSEntry.h:273
bool Create(const CURL &url) override
Create directory.
Definition: VFSEntry.cpp:701