diff options
| author | manuel <manuel@mausz.at> | 2017-09-02 15:02:54 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2017-09-02 15:02:54 +0200 |
| commit | 0afb1d4d51973cf52973617c92236d851a039d31 (patch) | |
| tree | 300741b800f0e013ba1e709cc46460de6383f2bb /xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h | |
| parent | 86b22151f0758311fd146ff508e7254337414bc1 (diff) | |
| download | kodi-pvr-build-0afb1d4d51973cf52973617c92236d851a039d31.tar.gz kodi-pvr-build-0afb1d4d51973cf52973617c92236d851a039d31.tar.bz2 kodi-pvr-build-0afb1d4d51973cf52973617c92236d851a039d31.zip | |
sync with upstream
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h')
| -rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h | 81 |
1 files changed, 80 insertions, 1 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h index 76210cf..b06770c 100644 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h +++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h | |||
| @@ -110,6 +110,7 @@ extern "C" | |||
| 110 | double (*get_file_download_speed)(void* kodiBase, void* file); | 110 | double (*get_file_download_speed)(void* kodiBase, void* file); |
| 111 | void (*close_file)(void* kodiBase, void* file); | 111 | void (*close_file)(void* kodiBase, void* file); |
| 112 | int (*get_file_chunk_size)(void* kodiBase, void* file); | 112 | int (*get_file_chunk_size)(void* kodiBase, void* file); |
| 113 | char* (*get_property)(void* kodiBase, void* file, int type, const char *name); | ||
| 113 | 114 | ||
| 114 | void* (*curl_create)(void* kodiBase, const char* url); | 115 | void* (*curl_create)(void* kodiBase, const char* url); |
| 115 | bool (*curl_add_option)(void* kodiBase, void* file, int type, const char* name, const char* value); | 116 | bool (*curl_add_option)(void* kodiBase, void* file, int type, const char* name, const char* value); |
| @@ -194,6 +195,25 @@ typedef enum CURLOptiontype | |||
| 194 | } CURLOptiontype; | 195 | } CURLOptiontype; |
| 195 | //------------------------------------------------------------------------------ | 196 | //------------------------------------------------------------------------------ |
| 196 | 197 | ||
| 198 | //============================================================================== | ||
| 199 | /// \ingroup cpp_kodi_vfs_Defs | ||
| 200 | /// @brief Used CURL message types | ||
| 201 | /// | ||
| 202 | typedef enum FilePropertyTypes | ||
| 203 | { | ||
| 204 | /// Get protocol response line | ||
| 205 | ADDON_FILE_PROPERTY_RESPONSE_PROTOCOL, | ||
| 206 | /// Get a response header | ||
| 207 | ADDON_FILE_PROPERTY_RESPONSE_HEADER, | ||
| 208 | /// Get file content type | ||
| 209 | ADDON_FILE_PROPERTY_CONTENT_TYPE, | ||
| 210 | /// Get file content charset | ||
| 211 | ADDON_FILE_PROPERTY_CONTENT_CHARSET, | ||
| 212 | /// Get file mime type | ||
| 213 | ADDON_FILE_PROPERTY_MIME_TYPE | ||
| 214 | } FilePropertyTypes; | ||
| 215 | //------------------------------------------------------------------------------ | ||
| 216 | |||
| 197 | //============================================================================ | 217 | //============================================================================ |
| 198 | /// | 218 | /// |
| 199 | /// \ingroup cpp_kodi_vfs_Defs | 219 | /// \ingroup cpp_kodi_vfs_Defs |
| @@ -310,7 +330,7 @@ namespace vfs | |||
| 310 | // | 330 | // |
| 311 | // @param[in] dirEntry pointer to own class type | 331 | // @param[in] dirEntry pointer to own class type |
| 312 | // | 332 | // |
| 313 | CDirEntry(const VFSDirEntry& dirEntry) : | 333 | explicit CDirEntry(const VFSDirEntry& dirEntry) : |
| 314 | m_label(dirEntry.label ? dirEntry.label : ""), | 334 | m_label(dirEntry.label ? dirEntry.label : ""), |
| 315 | m_path(dirEntry.path ? dirEntry.path : ""), | 335 | m_path(dirEntry.path ? dirEntry.path : ""), |
| 316 | m_folder(dirEntry.folder), | 336 | m_folder(dirEntry.folder), |
| @@ -906,6 +926,37 @@ namespace vfs | |||
| 906 | } | 926 | } |
| 907 | //---------------------------------------------------------------------------- | 927 | //---------------------------------------------------------------------------- |
| 908 | 928 | ||
| 929 | |||
| 930 | //============================================================================ | ||
| 931 | /// | ||
| 932 | /// @ingroup cpp_kodi_vfs | ||
| 933 | /// @brief Remove the slash on given path name | ||
| 934 | /// | ||
| 935 | /// @param[in,out] path The complete path | ||
| 936 | /// | ||
| 937 | /// | ||
| 938 | /// ------------------------------------------------------------------------ | ||
| 939 | /// | ||
| 940 | /// **Example:** | ||
| 941 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 942 | /// #include <kodi/Filesystem.h> | ||
| 943 | /// ... | ||
| 944 | /// std::string dirName = "special://temp/"; | ||
| 945 | /// kodi::vfs::RemoveSlashAtEnd(dirName); | ||
| 946 | /// fprintf(stderr, "Directory name is '%s'\n", dirName.c_str()); | ||
| 947 | /// ~~~~~~~~~~~~~ | ||
| 948 | /// | ||
| 949 | inline void RemoveSlashAtEnd(std::string& path) | ||
| 950 | { | ||
| 951 | if (!path.empty()) | ||
| 952 | { | ||
| 953 | char last = path[path.size() - 1]; | ||
| 954 | if (last == '/' || last == '\\') | ||
| 955 | path.erase(path.size() - 1); | ||
| 956 | } | ||
| 957 | } | ||
| 958 | //---------------------------------------------------------------------------- | ||
| 959 | |||
| 909 | //============================================================================ | 960 | //============================================================================ |
| 910 | /// | 961 | /// |
| 911 | /// @ingroup cpp_kodi_vfs | 962 | /// @ingroup cpp_kodi_vfs |
| @@ -1483,6 +1534,34 @@ namespace vfs | |||
| 1483 | //========================================================================== | 1534 | //========================================================================== |
| 1484 | /// | 1535 | /// |
| 1485 | /// @ingroup cpp_kodi_vfs_CFile | 1536 | /// @ingroup cpp_kodi_vfs_CFile |
| 1537 | /// @brief retrieve a file property | ||
| 1538 | /// | ||
| 1539 | /// @param[in] type The type of the file property to retrieve the value for | ||
| 1540 | /// @param[in] name The name of a named property value (e.g. Header) | ||
| 1541 | /// @return value of requested property, empty on failure / non-existance | ||
| 1542 | /// | ||
| 1543 | const std::string GetProperty(FilePropertyTypes type, const std::string &name) const | ||
| 1544 | { | ||
| 1545 | if (!m_file) | ||
| 1546 | { | ||
| 1547 | kodi::Log(ADDON_LOG_ERROR, "kodi::vfs::CURLCreate(...) needed to call before GetProperty!"); | ||
| 1548 | return ""; | ||
| 1549 | } | ||
| 1550 | char *res(::kodi::addon::CAddonBase::m_interface->toKodi->kodi_filesystem->get_property( | ||
| 1551 | ::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, m_file, type, name.c_str())); | ||
| 1552 | if (res) | ||
| 1553 | { | ||
| 1554 | std::string strReturn(res); | ||
| 1555 | ::kodi::addon::CAddonBase::m_interface->toKodi->free_string(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, res); | ||
| 1556 | return strReturn; | ||
| 1557 | } | ||
| 1558 | return ""; | ||
| 1559 | } | ||
| 1560 | //-------------------------------------------------------------------------- | ||
| 1561 | |||
| 1562 | //========================================================================== | ||
| 1563 | /// | ||
| 1564 | /// @ingroup cpp_kodi_vfs_CFile | ||
| 1486 | /// @brief Get the current download speed of file if loaded from web. | 1565 | /// @brief Get the current download speed of file if loaded from web. |
| 1487 | /// | 1566 | /// |
| 1488 | /// @return The current download speed. | 1567 | /// @return The current download speed. |
