Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
XFILE::IDirectory Class Referenceabstract

Interface to the directory on a file system. More...

#include <IDirectory.h>

Inheritance diagram for XFILE::IDirectory:
ADDON::CVFSEntryIDirectoryWrapper XFILE::CAddonsDirectory XFILE::CAndroidAppDirectory XFILE::CBlurayDirectory XFILE::CCDDADirectory XFILE::CDAVDirectory XFILE::CEventsDirectory XFILE::CFTPDirectory XFILE::CFavouritesDirectory XFILE::CHTTPDirectory XFILE::CLibraryDirectory XFILE::CMultiPathDirectory XFILE::CMusicDatabaseDirectory XFILE::CMusicSearchDirectory XFILE::CNFSDirectory XFILE::COverrideDirectory XFILE::CPVRDirectory XFILE::CPlaylistDirectory XFILE::CPluginDirectory XFILE::CPosixDirectory XFILE::CSMBDirectory XFILE::CSourcesDirectory XFILE::CStackDirectory XFILE::CUPnPDirectory XFILE::CVideoDatabaseDirectory XFILE::CVirtualDirectory XFILE::CWin32Directory XFILE::CWin32SMBDirectory XFILE::CWinLibraryDirectory XFILE::CZeroconfDirectory XFILE::IFileDirectory

Public Member Functions

 IDirectory ()
 
virtual ~IDirectory (void)
 
virtual bool GetDirectory (const CURL &url, CFileItemList &items)=0
 Get the items of the directory strPath.
 
virtual float GetProgress () const
 Retrieve the progress of the current directory fetch (if possible).
 
virtual void CancelDirectory ()
 Cancel the current directory fetch (if possible).
 
virtual bool Create (const CURL &url)
 Create the directory.
 
virtual bool Exists (const CURL &url)
 Check for directory existence.
 
virtual bool Remove (const CURL &url)
 Removes the directory.
 
virtual bool RemoveRecursive (const CURL &url)
 Recursively removes the directory.
 
virtual bool IsAllowed (const CURL &url) const
 Whether this file should be listed.
 
virtual bool AllowAll () const
 Whether to allow all files/folders to be listed.
 
virtual DIR_CACHE_TYPE GetCacheType (const CURL &url) const
 How this directory should be cached.
 
void SetMask (const std::string &strMask)
 Set a mask of extensions for the files in the directory.
 
void SetFlags (int flags)
 Set the flags for this directory handler.
 
bool ProcessRequirements ()
 Process additional requirements before the directory fetch is performed. Some directory fetches may require authentication, keyboard input etc. The IDirectory subclass should call GetKeyboardInput, SetErrorDialog or RequireAuthentication and then return false from the GetDirectory method. CDirectory will then prompt for input from the user, before re-calling the GetDirectory method.
 
virtual bool Resolve (CFileItem &item) const
 Resolves a given item to a playable item.
 

Static Public Member Functions

static void RegisterProfileManager (const CProfileManager &profileManager)
 
static void UnregisterProfileManager ()
 

Protected Member Functions

bool GetKeyboardInput (const CVariant &heading, std::string &input, bool hiddenInput=false)
 Prompt the user for some keyboard input Call this method from the GetDirectory method to retrieve additional input from the user. If this function returns false then no input has been received, and the GetDirectory call should return false.
 
void SetErrorDialog (const CVariant &heading, const CVariant &line1, const CVariant &line2=0, const CVariant &line3=0)
 Show an error dialog on failure of GetDirectory call Call this method from the GetDirectory method to set an error message to be shown to the user.
 
void RequireAuthentication (const CURL &url)
 Prompt the user for authentication of a URL. Call this method from the GetDirectory method when authentication is required from the user, before returning false from the GetDirectory call. The user will be prompted for authentication, and GetDirectory will be re-called.
 

Protected Attributes

std::string m_strFileMask
 Holds the file mask specified by SetMask()
 
int m_flags
 Directory flags - see DIR_FLAG.
 
CVariant m_requirements
 

Static Protected Attributes

static const CProfileManagerm_profileManager = nullptr
 

Detailed Description

Interface to the directory on a file system.

This Interface is retrieved from CDirectoryFactory and can be used to access the directories on a filesystem.

See also
CDirectoryFactory

Constructor & Destructor Documentation

◆ IDirectory()

IDirectory::IDirectory ( )

◆ ~IDirectory()

IDirectory::~IDirectory ( void )
virtualdefault

Member Function Documentation

◆ AllowAll()

◆ CancelDirectory()

virtual void XFILE::IDirectory::CancelDirectory ( )
inlinevirtual

Cancel the current directory fetch (if possible).

See also
GetDirectory

Reimplemented in XFILE::CPluginDirectory, and XFILE::CVirtualDirectory.

◆ Create()

virtual bool XFILE::IDirectory::Create ( const CURL & url)
inlinevirtual

◆ Exists()

◆ GetCacheType()

virtual DIR_CACHE_TYPE XFILE::IDirectory::GetCacheType ( const CURL & url) const
inlinevirtual

◆ GetDirectory()

◆ GetKeyboardInput()

bool IDirectory::GetKeyboardInput ( const CVariant & heading,
std::string & input,
bool hiddenInput = false )
protected

Prompt the user for some keyboard input Call this method from the GetDirectory method to retrieve additional input from the user. If this function returns false then no input has been received, and the GetDirectory call should return false.

Parameters
headingan integer or string heading for the keyboard dialog
input[out] the returned input (if available).
Returns
true if keyboard input has been received. False if it hasn't.
See also
ProcessRequirements

◆ GetProgress()

virtual float XFILE::IDirectory::GetProgress ( ) const
inlinevirtual

Retrieve the progress of the current directory fetch (if possible).

Returns
the progress as a float in the range 0..100.
See also
GetDirectory, CancelDirectory

Reimplemented in XFILE::CPluginDirectory.

◆ IsAllowed()

bool IDirectory::IsAllowed ( const CURL & url) const
virtual

Whether this file should be listed.

Test if file have an allowed extension, as specified with SetMask()

Parameters
urlFile to test.
Returns
Returns true if the file should be listed
Parameters
strFileFile to test
Returns
true if file is allowed
Note
If extension is ".ifo", filename format must be "vide_ts.ifo" or "vts_##_0.ifo". If extension is ".dat", filename format must be "AVSEQ##(#).DAT", "ITEM###(#).DAT" or "MUSIC##(#).DAT".

Reimplemented in XFILE::CAudioBookFileDirectory.

◆ ProcessRequirements()

bool IDirectory::ProcessRequirements ( )

Process additional requirements before the directory fetch is performed. Some directory fetches may require authentication, keyboard input etc. The IDirectory subclass should call GetKeyboardInput, SetErrorDialog or RequireAuthentication and then return false from the GetDirectory method. CDirectory will then prompt for input from the user, before re-calling the GetDirectory method.

See also
GetKeyboardInput, SetErrorDialog, RequireAuthentication

◆ RegisterProfileManager()

void IDirectory::RegisterProfileManager ( const CProfileManager & profileManager)
static

◆ Remove()

◆ RemoveRecursive()

virtual bool XFILE::IDirectory::RemoveRecursive ( const CURL & url)
inlinevirtual

Recursively removes the directory.

Parameters
urlDirectory to remove.
Returns
Returns false if not successful

Reimplemented in XFILE::CPosixDirectory, and XFILE::CWin32Directory.

◆ RequireAuthentication()

void IDirectory::RequireAuthentication ( const CURL & url)
protected

Prompt the user for authentication of a URL. Call this method from the GetDirectory method when authentication is required from the user, before returning false from the GetDirectory call. The user will be prompted for authentication, and GetDirectory will be re-called.

Parameters
urlthe URL to authenticate.
See also
ProcessRequirements

◆ Resolve()

virtual bool XFILE::IDirectory::Resolve ( CFileItem & item) const
inlinevirtual

Resolves a given item to a playable item.

Note
Some directories (e.g. dvd, bluray, plugins etc) need to be translated/resolved to the actual playback url
Parameters
itemThe item being manipulated (which the path points to a vfs protocol implementation)
Returns
true if the item was resolved, false if it failed to resolve

Reimplemented in XFILE::CDVDDirectory, XFILE::CISO9660Directory, XFILE::CPluginDirectory, and XFILE::CUPnPDirectory.

◆ SetErrorDialog()

void IDirectory::SetErrorDialog ( const CVariant & heading,
const CVariant & line1,
const CVariant & line2 = 0,
const CVariant & line3 = 0 )
protected

Show an error dialog on failure of GetDirectory call Call this method from the GetDirectory method to set an error message to be shown to the user.

Parameters
headingan integer or string heading for the error dialog.
line1the first line to be displayed (integer or string).
line2the first line to be displayed (integer or string).
line3the first line to be displayed (integer or string).
See also
ProcessRequirements

◆ SetFlags()

void IDirectory::SetFlags ( int flags)

Set the flags for this directory handler.

Parameters
flags-
See also
XFILE::DIR_FLAG for a description.

◆ SetMask()

void IDirectory::SetMask ( const std::string & strMask)

Set a mask of extensions for the files in the directory.

Parameters
strMaskMask of file extensions that are allowed.

The mask has to look like the following:

.m4a|.flac|.aac|

So only *.m4a, *.flac, *.aac files will be retrieved with GetDirectory().

◆ UnregisterProfileManager()

void IDirectory::UnregisterProfileManager ( )
static

Member Data Documentation

◆ m_flags

int XFILE::IDirectory::m_flags
protected

Directory flags - see DIR_FLAG.

◆ m_profileManager

const CProfileManager * IDirectory::m_profileManager = nullptr
staticprotected

◆ m_requirements

CVariant XFILE::IDirectory::m_requirements
protected

◆ m_strFileMask

std::string XFILE::IDirectory::m_strFileMask
protected

Holds the file mask specified by SetMask()


The documentation for this class was generated from the following files: