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 
68 
69  LocatedUri(Type _type, const char *_uri,
71  :type(_type), canonical_uri(_uri), path(std::move(_path)) {}
72 };
73 
87 LocateUri(const char *uri, const Client *client
88 #ifdef ENABLE_DATABASE
89  , const Storage *storage
90 #endif
91  );
92 
93 #endif
A path name in the native file system character set.
static gcc_const AllocatedPath Null() noexcept
Return a "nulled" instance.
enum LocatedUri::Type type
LocatedUri LocateUri(const char *uri, const Client *client)
Classify a URI.
A relative URI path.
const Storage & storage
An absolute URI with a supported scheme.
AllocatedPath path
Contains the local file path if type==FILE.
Definition: LocateUri.hxx:67
const char * canonical_uri
Definition: LocateUri.hxx:62
LocatedUri(Type _type, const char *_uri, AllocatedPath &&_path=AllocatedPath::Null())
Definition: LocateUri.hxx:69
const Storage const char * uri