diff options
author | Arne Morten Kvarving <cptspiff@gmail.com> | 2016-01-09 20:26:21 +0100 |
---|---|---|
committer | Arne Morten Kvarving <cptspiff@gmail.com> | 2016-01-09 20:26:21 +0100 |
commit | 3f51d46a0f1d2e95e20f834beea3ff49581f0c51 (patch) | |
tree | 6e1411dd17a3e644eb307fadf8de1d7daa9f9ff0 /addons/library.xbmc.addon | |
parent | f8a52f88982c96438a765efe297f1cbad84ef4bb (diff) |
added: addon callback for listing a directory
Diffstat (limited to 'addons/library.xbmc.addon')
-rw-r--r-- | addons/library.xbmc.addon/libXBMC_addon.h | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/addons/library.xbmc.addon/libXBMC_addon.h b/addons/library.xbmc.addon/libXBMC_addon.h index 06f61bab56..fd2fe9dc23 100644 --- a/addons/library.xbmc.addon/libXBMC_addon.h +++ b/addons/library.xbmc.addon/libXBMC_addon.h @@ -27,6 +27,8 @@ #include <stdint.h> #include <stdarg.h> +struct VFSDirEntry; + #ifdef _WIN32 // windows #ifndef _SSIZE_T_DEFINED typedef intptr_t ssize_t; @@ -265,6 +267,14 @@ namespace ADDON dlsym(m_libXBMC_addon, "XBMC_remove_directory"); if (XBMC_remove_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + XBMC_get_directory = (bool (*)(void* HANDLE, void* CB, const char* strPath, const char* mask, VFSDirEntry** items, unsigned int* num_items)) + dlsym(m_libXBMC_addon, "XBMC_get_directory"); + if (XBMC_get_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + + XBMC_free_directory = (void (*)(void* HANDLE, void* CB, VFSDirEntry* items, unsigned int num_items)) + dlsym(m_libXBMC_addon, "XBMC_free_directory"); + if (XBMC_free_directory == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + m_Callbacks = XBMC_register_me(m_Handle); return m_Callbacks != NULL; } @@ -564,6 +574,29 @@ namespace ADDON return XBMC_remove_directory(m_Handle, m_Callbacks, strPath); } + /*! + * @brief Lists a directory. + * @param strPath Path to the directory. + * @param mask File mask + * @param items The directory entries + * @param num_items Number of entries in directory + * @return True if listing was successful, false otherwise. + */ + bool GetDirectory(const char *strPath, const char* mask, VFSDirEntry** items, unsigned int* num_items) + { + return XBMC_get_directory(m_Handle, m_Callbacks, strPath, mask, items, num_items); + } + + /*! + * @brief Free a directory list + * @param items The directory entries + * @param num_items Number of entries in directory + */ + void FreeDirectory(VFSDirEntry* items, unsigned int num_items) + { + return XBMC_free_directory(m_Handle, m_Callbacks, items, num_items); + } + protected: void* (*XBMC_register_me)(void *HANDLE); void (*XBMC_unregister_me)(void *HANDLE, void* CB); @@ -594,7 +627,8 @@ namespace ADDON bool (*XBMC_create_directory)(void *HANDLE, void* CB, const char* strPath); bool (*XBMC_directory_exists)(void *HANDLE, void* CB, const char* strPath); bool (*XBMC_remove_directory)(void *HANDLE, void* CB, const char* strPath); - + bool (*XBMC_get_directory)(void *HANDLE, void* CB, const char* strPath, const char* mask, VFSDirEntry** items, unsigned int* num_items); + void (*XBMC_free_directory)(void *HANDLE, void* CB, VFSDirEntry* items, unsigned int num_items); private: void *m_libXBMC_addon; void *m_Handle; |