mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0032565: Foundation Classes, OSD_FileSystem - expose interface for registering global protocols
Added methods OSD_FileSystem::AddDefaultProtocol()/::RemoveDefaultProtocol() and fixed misleading description of OSD_FileSystemSelector::AddProtocol().
This commit is contained in:
parent
8a17a8bb45
commit
36d21f1a1a
@ -54,6 +54,26 @@ const Handle(OSD_FileSystem)& OSD_FileSystem::DefaultFileSystem()
|
|||||||
return aDefSystem;
|
return aDefSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : AddDefaultProtocol
|
||||||
|
// purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void OSD_FileSystem::AddDefaultProtocol (const Handle(OSD_FileSystem)& theFileSystem, bool theIsPreferred)
|
||||||
|
{
|
||||||
|
Handle(OSD_FileSystemSelector) aFileSelector = Handle(OSD_FileSystemSelector)::DownCast (DefaultFileSystem());
|
||||||
|
aFileSelector->AddProtocol (theFileSystem, theIsPreferred);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : RemoveDefaultProtocol
|
||||||
|
// purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void OSD_FileSystem::RemoveDefaultProtocol (const Handle(OSD_FileSystem)& theFileSystem)
|
||||||
|
{
|
||||||
|
Handle(OSD_FileSystemSelector) aFileSelector = Handle(OSD_FileSystemSelector)::DownCast (DefaultFileSystem());
|
||||||
|
aFileSelector->RemoveProtocol (theFileSystem);
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : openIStream
|
// function : openIStream
|
||||||
// purpose :
|
// purpose :
|
||||||
|
@ -24,9 +24,18 @@ class OSD_FileSystem : public Standard_Transient
|
|||||||
DEFINE_STANDARD_RTTIEXT(OSD_FileSystem, Standard_Transient)
|
DEFINE_STANDARD_RTTIEXT(OSD_FileSystem, Standard_Transient)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Returns a global file system, which a selector between registered file systems.
|
//! Returns a global file system, which a selector between registered file systems (OSD_FileSystemSelector).
|
||||||
Standard_EXPORT static const Handle(OSD_FileSystem)& DefaultFileSystem();
|
Standard_EXPORT static const Handle(OSD_FileSystem)& DefaultFileSystem();
|
||||||
|
|
||||||
|
//! Registers file system within the global file system selector returned by OSD_FileSystem::DefaultFileSystem().
|
||||||
|
//! Note that registering protocols is not thread-safe operation and expected to be done once at application startup.
|
||||||
|
//! @param[in] theFileSystem file system to register
|
||||||
|
//! @param[in] theIsPreferred add to the beginning of the list when TRUE, or add to the end otherwise
|
||||||
|
Standard_EXPORT static void AddDefaultProtocol (const Handle(OSD_FileSystem)& theFileSystem, bool theIsPreferred = false);
|
||||||
|
|
||||||
|
//! Unregisters file system within the global file system selector returned by OSD_FileSystem::DefaultFileSystem().
|
||||||
|
Standard_EXPORT static void RemoveDefaultProtocol (const Handle(OSD_FileSystem)& theFileSystem);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Returns TRUE if URL defines a supported protocol.
|
//! Returns TRUE if URL defines a supported protocol.
|
||||||
|
@ -27,12 +27,12 @@ public:
|
|||||||
//! Constructor.
|
//! Constructor.
|
||||||
OSD_FileSystemSelector() {}
|
OSD_FileSystemSelector() {}
|
||||||
|
|
||||||
//! Registers file system within the global file system selector returned by OSD_FileSystem::DefaultFileSystem().
|
//! Registers file system within this selector.
|
||||||
//! @param theFileSystem [in] file system to register
|
//! @param theFileSystem [in] file system to register
|
||||||
//! @param theIsPreferred [in] add to the beginning of the list when TRUE, or add to the end otherwise
|
//! @param theIsPreferred [in] add to the beginning of the list when TRUE, or add to the end otherwise
|
||||||
Standard_EXPORT void AddProtocol (const Handle(OSD_FileSystem)& theFileSystem, bool theIsPreferred = false);
|
Standard_EXPORT void AddProtocol (const Handle(OSD_FileSystem)& theFileSystem, bool theIsPreferred = false);
|
||||||
|
|
||||||
//! Unregisters file system within the global file system selector returned by OSD_FileSystem::DefaultFileSystem().
|
//! Unregisters file system within this selector.
|
||||||
Standard_EXPORT void RemoveProtocol (const Handle(OSD_FileSystem)& theFileSystem);
|
Standard_EXPORT void RemoveProtocol (const Handle(OSD_FileSystem)& theFileSystem);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user