summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_vfs_dll.h
blob: 30741a6789c0f62759e3b1d12853e27c8d7138c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
 *      Copyright (C) 2013 Arne Morten Kvarving
 *
 *  This Program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *
 *  This Program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with XBMC; see the file COPYING.  If not, see
 *  <http://www.gnu.org/licenses/>.
 *
 */
#pragma once

#include <stdint.h>
#include "xbmc_addon_dll.h"
#include "kodi_vfs_types.h"

extern "C"
{
  //! \copydoc KodiToAddonFuncTable_VFSEntry::Open
  void* Open(VFSURL* url);

  //! \copydoc KodiToAddonFuncTable_VFSEntry::OpenForWrite
  void* OpenForWrite(VFSURL* url, bool bOverWrite);

  //! \copydoc KodiToAddonFuncTable_VFSEntry::Read
  ssize_t Read(void* context, void* buffer, size_t size);

  //! \copydoc KodiToAddonFuncTable_VFSEntry::Write
  ssize_t Write(void* context, const void* buffer, size_t size);

  //! \copydoc KodiToAddonFuncTable_VFSEntry::Seek
  int64_t Seek(void* context, int64_t position, int whence);

  //! \copydoc KodiToAddonFuncTable_VFSEntry::Truncate
  int Truncate(void* context, int64_t size);

  //! \copydoc KodiToAddonFuncTable_VFSEntry::GetLength
  int64_t GetLength(void* context);

  //! \copydoc KodiToAddonFuncTable_VFSEntry::GetPosition
  int64_t GetPosition(void* context);

  //! \copydoc KodiToAddonFuncTable_VFSEntry::GetChunkSize
  int GetChunkSize(void* context);

  //! \copydoc KodiToAddonFuncTable_VFSEntry::IoControl
  int IoControl(void* context, XFILE::EIoControl request, void* param);

  //! \copydoc KodiToAddonFuncTable_VFSEntry::Stat
  int Stat(VFSURL* url, struct __stat64* buffer);

  //! \copydoc KodiToAddonFuncTable_VFSEntry::Close
  bool Close(void* context);

  //! \copydoc KodiToAddonFuncTable_VFSEntry::Exists
  bool Exists(VFSURL* url);

  //! \copydoc KodiToAddonFuncTable_VFSEntry::ContainsFiles
  void* ContainsFiles(VFSURL* url, VFSDirEntry** entries, int* num_entries,
                      char* rootpath);

  //! \copydoc KodiToAddonFuncTable_VFSEntry::ClearOutIdle
  void ClearOutIdle();

  //! \copydoc KodiToAddonFuncTable_VFSEntry::DisconnectAll
  void DisconnectAll();

  //! \copydoc KodiToAddonFuncTable_VFSEntry::DirectoryExists
  bool DirectoryExists(VFSURL* url);

  //! \copydoc KodiToAddonFuncTable_VFSEntry::RemoveDirectory
  bool RemoveDirectory(VFSURL* url);

  //! \copydoc KodiToAddonFuncTable_VFSEntry::CreateDirectory
  bool CreateDirectory(VFSURL* url);

  //! \copydoc KodiToAddonFuncTable_VFSEntry::GetDirectory
  void* GetDirectory(VFSURL* url, VFSDirEntry** entries, int* num_entries,
                     VFSCallbacks* callbacks);

  //! \copydoc KodiToAddonFuncTable_VFSEntry::FreeDirectory
  void FreeDirectory(void* ctx);

  //! \copydoc KodiToAddonFuncTable_VFSEntry::Delete
  bool Delete(VFSURL* url);

  //! \copydoc KodiToAddonFuncTable_VFSEntry::Rename
  bool Rename(VFSURL* url, VFSURL* url2);

  //! \brief Function to export the above structure to Kodi
  void __declspec(dllexport) get_addon(void* ptr)
  {
    AddonInstance_VFSEntry* vfs = static_cast<AddonInstance_VFSEntry*>(ptr);
    vfs->toAddon.Open = Open;
    vfs->toAddon.OpenForWrite = OpenForWrite;
    vfs->toAddon.Read = Read;
    vfs->toAddon.Write = Write;
    vfs->toAddon.Seek = Seek;
    vfs->toAddon.GetLength = GetLength;
    vfs->toAddon.GetPosition = GetPosition;
    vfs->toAddon.IoControl = IoControl;
    vfs->toAddon.Stat = Stat;
    vfs->toAddon.Close = Close;
    vfs->toAddon.Exists = Exists;
    vfs->toAddon.ClearOutIdle = ClearOutIdle;
    vfs->toAddon.DisconnectAll = DisconnectAll;
    vfs->toAddon.DirectoryExists = DirectoryExists;
    vfs->toAddon.GetDirectory = GetDirectory;
    vfs->toAddon.FreeDirectory = FreeDirectory;
    vfs->toAddon.Truncate = Truncate;
    vfs->toAddon.Delete = Delete;
    vfs->toAddon.Rename = Rename;
    vfs->toAddon.RemoveDirectory = RemoveDirectory;
    vfs->toAddon.CreateDirectory = CreateDirectory;
    vfs->toAddon.ContainsFiles = ContainsFiles;
    vfs->toAddon.GetChunkSize = GetChunkSize;
  };
};