xbmc
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
XFILE::IDirectory Class Referenceabstract

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

#include <IDirectory.h>

Inheritance diagram for XFILE::IDirectory:
Inheritance graph
[legend]
Collaboration diagram for XFILE::IDirectory:
Collaboration graph
[legend]

Public Member Functions

virtual bool GetDirectory (const CURL &url, CFileItemList &items)=0
 Get the items of the directory strPath. More...
 
virtual float GetProgress () const
 Retrieve the progress of the current directory fetch (if possible). More...
 
virtual void CancelDirectory ()
 Cancel the current directory fetch (if possible). More...
 
virtual bool Create (const CURL &url)
 Create the directory. More...
 
virtual bool Exists (const CURL &url)
 Check for directory existence. More...
 
virtual bool Remove (const CURL &url)
 Removes the directory. More...
 
virtual bool RemoveRecursive (const CURL &url)
 Recursively removes the directory. More...
 
virtual bool IsAllowed (const CURL &url) const
 Whether this file should be listed. More...
 
virtual bool AllowAll () const
 Whether to allow all files/folders to be listed. More...
 
virtual DIR_CACHE_TYPE GetCacheType (const CURL &url) const
 How this directory should be cached. More...
 
void SetMask (const std::string &strMask)
 Set a mask of extensions for the files in the directory. More...
 
void SetFlags (int flags)
 Set the flags for this directory handler. More...
 
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. More...
 
virtual bool Resolve (CFileItem &item) const
 Resolves a given item to a playable item. More...
 

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. More...
 
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. More...
 
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. More...
 

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

Member Function Documentation

◆ AllowAll()

virtual bool XFILE::IDirectory::AllowAll ( ) const
inlinevirtual

◆ 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()

virtual bool XFILE::IDirectory::Exists ( const CURL url)
inlinevirtual

◆ GetCacheType()

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

◆ GetDirectory()

virtual bool XFILE::IDirectory::GetDirectory ( const CURL url,
CFileItemList items 
)
pure virtual

◆ 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

◆ Remove()

virtual bool XFILE::IDirectory::Remove ( const CURL url)
inlinevirtual

◆ 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::CPluginDirectory, XFILE::CUPnPDirectory, XFILE::CDVDDirectory, and XFILE::CISO9660Directory.

◆ 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().


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