MPD: storage/StorageInterface.hxx Source File

MPD 0.20.15

StorageInterface.hxx
Go to the documentation of this file.
1 /*
2 * Copyright 2003-2017 The Music Player Daemon Project
3 * http://www.musicpd.org
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef MPD_STORAGE_INTERFACE_HXX
21 #define MPD_STORAGE_INTERFACE_HXX
22
23 #include "check.h"
24 #include "Compiler.h"
25
26 #include <string>
27
28 struct StorageFileInfo;
29 class AllocatedPath;
30
31 class StorageDirectoryReader {
32 public:
33 StorageDirectoryReader() = default;
34 StorageDirectoryReader(const StorageDirectoryReader &) = delete;
35 virtual ~StorageDirectoryReader() {}
36
37 virtual const char *Read() = 0;
38
42 virtual StorageFileInfo GetInfo(bool follow) = 0;
43 };
44
45 class Storage {
46 public:
47 Storage() = default;
48 Storage(const Storage &) = delete;
49 virtual ~Storage() {}
50
54 virtual StorageFileInfo GetInfo(const char *uri_utf8, bool follow) = 0;
55
59 virtual StorageDirectoryReader *OpenDirectory(const char *uri_utf8) = 0;
60
64 gcc_pure
65 virtual std::string MapUTF8(const char *uri_utf8) const noexcept = 0;
66
72 gcc_pure
73 virtual AllocatedPath MapFS(const char *uri_utf8) const noexcept;
74
75 gcc_pure
76 AllocatedPath MapChildFS(const char *uri_utf8,
77 const char *child_utf8) const noexcept;
78
84 gcc_pure
85 virtual const char *MapToRelativeUTF8(const char *uri_utf8) const noexcept = 0;
86 };
87
88 #endif
check.h
Storage::MapFS
virtual gcc_pure AllocatedPath MapFS(const char *uri_utf8) const noexcept
Map the given relative URI to a local file path.
Storage::Storage
Storage()=default
Storage::OpenDirectory
virtual StorageDirectoryReader * OpenDirectory(const char *uri_utf8)=0
Throws #std::runtime_error on error.
StorageDirectoryReader::Read
virtual const char * Read()=0
AllocatedPath
A path name in the native file system character set.
Definition: AllocatedPath.hxx:38
Storage
Definition: StorageInterface.hxx:45
StorageFileInfo
Definition: FileInfo.hxx:28
Storage::MapToRelativeUTF8
virtual gcc_pure const char * MapToRelativeUTF8(const char *uri_utf8) const noexcept=0
Check if the given URI points inside this storage.
Compiler.h
Storage::~Storage
virtual ~Storage()
Definition: StorageInterface.hxx:49
Storage::MapUTF8
virtual gcc_pure std::string MapUTF8(const char *uri_utf8) const noexcept=0
Map the given relative URI to an absolute URI.
StorageDirectoryReader
Definition: StorageInterface.hxx:31
Storage::GetInfo
virtual StorageFileInfo GetInfo(const char *uri_utf8, bool follow)=0
Throws #std::runtime_error on error.
Storage::MapChildFS
gcc_pure AllocatedPath MapChildFS(const char *uri_utf8, const char *child_utf8) const noexcept
StorageDirectoryReader::StorageDirectoryReader
StorageDirectoryReader()=default
StorageDirectoryReader::GetInfo
virtual StorageFileInfo GetInfo(bool follow)=0
Throws #std::runtime_error on error.
gcc_pure
#define gcc_pure
Definition: Compiler.h:116
StorageDirectoryReader::~StorageDirectoryReader
virtual ~StorageDirectoryReader()
Definition: StorageInterface.hxx:35