MPD 0.20.6

- Main Page
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Data Structures | Public Member Functions
CompositeStorage Class Referencefinal

A Storage implementation that combines multiple other Storage instances in one virtual tree. More...

`#include <CompositeStorage.hxx>`

Inheritance diagram for CompositeStorage:
[legend]
Collaboration diagram for CompositeStorage:
[legend]

## Public Member Functions
| CompositeStorage ()
virtual | ~CompositeStorage ()
gcc_pure gcc_nonnull_all Storage * | GetMount (const char *uri)
| Get the Storage at the specified mount point. More...
template<typename T >
void | VisitMounts (T t) const
| Call the given function for each mounted storage, including the root storage. More...
void | Mount (const char *uri, Storage *storage)
bool | Unmount (const char *uri)
StorageFileInfo | GetInfo (const char *uri, bool follow) override
| Throws #std::runtime_error on error. More...
StorageDirectoryReader * | OpenDirectory (const char *uri) override
| Throws #std::runtime_error on error. More...
std::string | MapUTF8 (const char *uri) const override
| Map the given relative URI to an absolute URI. More...
AllocatedPath | MapFS (const char *uri) const override
| Map the given relative URI to a local file path. More...
const char * | MapToRelativeUTF8 (const char *uri) const override
| Check if the given URI points inside this storage. More...
Public Member Functions inherited from Storage
| Storage ()=default
| Storage (const Storage &)=delete
virtual | ~Storage ()
gcc_pure AllocatedPath | MapChildFS (const char *uri_utf8, const char *child_utf8) const

## Detailed Description

A Storage implementation that combines multiple other Storage instances in one virtual tree.

It is used to "mount" new Storage instances into the storage tree.

This class is thread-safe: mounts may be added and removed at any time in any thread.

Definition at line 39 of file CompositeStorage.hxx.

## Constructor & Destructor Documentation

CompositeStorage::CompositeStorage | ( |  | ) |

virtual CompositeStorage::~CompositeStorage | ( |  | ) |
| virtual

## Member Function Documentation

StorageFileInfo CompositeStorage::GetInfo | ( | const char * | uri_utf8,
|  | bool | follow
| ) |  |
| override virtual

Throws #std::runtime_error on error.

Implements Storage.

gcc_pure gcc_nonnull_all Storage* CompositeStorage::GetMount | ( | const char * | uri | ) |

Get the Storage at the specified mount point.

Returns nullptr if the given URI is not a mount point.

The returned pointer is unprotected. No other thread is allowed to unmount the given mount point while the return value is being used.

AllocatedPath CompositeStorage::MapFS | ( | const char * | uri_utf8 | ) | const
| override virtual

Map the given relative URI to a local file path.

Returns AllocatedPath::Null() on error or if this storage does not support local files.

Reimplemented from Storage.

const char* CompositeStorage::MapToRelativeUTF8 | ( | const char * | uri_utf8 | ) | const
| override virtual

Check if the given URI points inside this storage.

If yes, then it returns a relative URI (pointing inside the given string); if not, returns nullptr.

Implements Storage.

std::string CompositeStorage::MapUTF8 | ( | const char * | uri_utf8 | ) | const
| override virtual

Map the given relative URI to an absolute URI.

Implements Storage.

void CompositeStorage::Mount | ( | const char * | uri,
|  | Storage * | storage
| ) |  |

StorageDirectoryReader* CompositeStorage::OpenDirectory | ( | const char * | uri_utf8 | ) |
| override virtual

Throws #std::runtime_error on error.

Implements Storage.

bool CompositeStorage::Unmount | ( | const char * | uri | ) |

template<typename T >

void CompositeStorage::VisitMounts | ( | T | t | ) | const
| inline

Call the given function for each mounted storage, including the root storage.

Passes mount point URI and the a const Storage reference to the function.

Definition at line 112 of file CompositeStorage.hxx.

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

- storage/CompositeStorage.hxx