MPD: LocateUri.hxx Source File

MPD 0.20.15

LocateUri.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_LOCATE_URI_HXX
21 #define MPD_LOCATE_URI_HXX
22
23 #include "check.h"
24 #include "Compiler.h"
25 #include "fs/AllocatedPath.hxx"
26
27 #ifdef _WIN32
28 #include <windows.h>
29 /* damn you, windows.h! */
30 #ifdef ABSOLUTE
31 #undef ABSOLUTE
32 #endif
33 #ifdef RELATIVE
34 #undef RELATIVE
35 #endif
36 #endif
37
38 class Client;
39
40 #ifdef ENABLE_DATABASE
41 class Storage;
42 #endif
43
44 struct LocatedUri {
45 enum class Type {
49 ABSOLUTE,
50
54 RELATIVE,
55
59 PATH,
60 } type;
61
62 const char *canonical_uri;
63
67 AllocatedPath path;
68
69 LocatedUri(Type _type, const char *_uri,
70 AllocatedPath &&_path=AllocatedPath::Null())
71 :type(_type), canonical_uri(_uri), path(std::move(_path)) {}
72 };
73
86 LocatedUri
87 LocateUri(const char *uri, const Client *client
88 #ifdef ENABLE_DATABASE
89 , const Storage *storage
90 #endif
91 );
92
93 #endif
check.h
LocatedUri::Type
Type
Definition: LocateUri.hxx:45
AllocatedPath
A path name in the native file system character set.
Definition: AllocatedPath.hxx:38
Storage
Definition: StorageInterface.hxx:45
AllocatedPath::Null
static gcc_const AllocatedPath Null() noexcept
Return a "nulled" instance.
Definition: AllocatedPath.hxx:80
LocatedUri::Type::PATH
A local file.
LocatedUri::type
enum LocatedUri::Type type
LocateUri
LocatedUri LocateUri(const char *uri, const Client *client)
Classify a URI.
LocatedUri::Type::RELATIVE
A relative URI path.
LocatedUri
Definition: LocateUri.hxx:44
Compiler.h
AllocatedPath.hxx
storage
const Storage & storage
Definition: DatabasePlaylist.hxx:31
Client
Definition: Client.hxx:47
LocatedUri::Type::ABSOLUTE
An absolute URI with a supported scheme.
LocatedUri::path
AllocatedPath path
Contains the local file path if type==FILE.
Definition: LocateUri.hxx:67
LocatedUri::canonical_uri
const char * canonical_uri
Definition: LocateUri.hxx:62
LocatedUri::LocatedUri
LocatedUri(Type _type, const char *_uri, AllocatedPath &&_path=AllocatedPath::Null())
Definition: LocateUri.hxx:69
uri
const Storage const char * uri
Definition: DatabasePlaylist.hxx:31