summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_vfs_utils.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_vfs_utils.hpp')
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_vfs_utils.hpp96
1 files changed, 0 insertions, 96 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_vfs_utils.hpp b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_vfs_utils.hpp
deleted file mode 100644
index cebce7e..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_vfs_utils.hpp
+++ /dev/null
@@ -1,96 +0,0 @@
1/*
2 * Copyright (C) 2015-2016 Team Kodi
3 * http://kodi.tv
4 *
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)
8 * any later version.
9 *
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.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this Program; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 */
20#pragma once
21
22/*!
23 * @file kodi_vfs_utils.hpp - C++ wrappers for Kodi's VFS operations
24 */
25
26#include "libXBMC_addon.h"
27#include "kodi_vfs_types.h"
28
29#include <stdint.h>
30#include <string>
31#include <vector>
32
33namespace ADDON
34{
35 class CVFSDirEntry
36 {
37 public:
38 CVFSDirEntry(const std::string& label = "",
39 const std::string& path = "",
40 bool bFolder = false,
41 int64_t size = -1) :
42 m_label(label),
43 m_path(path),
44 m_bFolder(bFolder),
45 m_size(size)
46 {
47 }
48
49 CVFSDirEntry(const VFSDirEntry& dirEntry) :
50 m_label(dirEntry.label ? dirEntry.label : ""),
51 m_path(dirEntry.path ? dirEntry.path : ""),
52 m_bFolder(dirEntry.folder),
53 m_size(dirEntry.size)
54 {
55 }
56
57 const std::string& Label(void) const { return m_label; }
58 const std::string& Path(void) const { return m_path; }
59 bool IsFolder(void) const { return m_bFolder; }
60 int64_t Size(void) const { return m_size; }
61
62 void SetLabel(const std::string& label) { m_label = label; }
63 void SetPath(const std::string& path) { m_path = path; }
64 void SetFolder(bool bFolder) { m_bFolder = bFolder; }
65 void SetSize(int64_t size) { m_size = size; }
66
67 private:
68 std::string m_label;
69 std::string m_path;
70 bool m_bFolder;
71 int64_t m_size;
72 };
73
74 class VFSUtils
75 {
76 public:
77 static bool GetDirectory(ADDON::CHelper_libXBMC_addon* frontend,
78 const std::string& path,
79 const std::string& mask,
80 std::vector<CVFSDirEntry>& items)
81 {
82 VFSDirEntry* dir_list = nullptr;
83 unsigned int num_items = 0;
84 if (frontend->GetDirectory(path.c_str(), mask.c_str(), &dir_list, &num_items))
85 {
86 for (unsigned int i = 0; i < num_items; i++)
87 items.push_back(CVFSDirEntry(dir_list[i]));
88
89 frontend->FreeDirectory(dir_list, num_items);
90
91 return true;
92 }
93 return false;
94 }
95 };
96}