MPD 0.20.6

- Main Page
- Namespaces
- Data Structures
- Files

- File List
- Globals

ExcludeList.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 /*
21 * The .mpdignore backend code.
22 *
23 */
24
25 #ifndef MPD_EXCLUDE_H
26 #define MPD_EXCLUDE_H
27
28 #include "check.h"
29 #include "Compiler.h"
30 #include "fs/Glob.hxx"
31
32 #ifdef HAVE_CLASS_GLOB
33 #include <forward_list>
34 #endif
35
36 class Path;
37
38 class ExcludeList {
39 const ExcludeList *const parent;
40
41 #ifdef HAVE_CLASS_GLOB
42 std::forward_list<Glob> patterns;
43 #endif
44
45 public:
46 ExcludeList()
47 :parent(nullptr) {}
48
49 ExcludeList(const ExcludeList &_parent)
50 :parent(&_parent) {}
51
52 gcc_pure
53 bool IsEmpty() const {
54 #ifdef HAVE_CLASS_GLOB
55 return ((parent == nullptr) || parent->IsEmpty()) && patterns.empty();
56 #else
57 /* not implemented */
58 return true;
59 #endif
60 }
61
65 bool LoadFile(Path path_fs);
66
71 bool Check(Path name_fs) const;
72 };
73
74
75 #endif
check.h
Glob.hxx
ExcludeList::IsEmpty
gcc_pure bool IsEmpty() const
Definition: ExcludeList.hxx:53
Path
A path name in the native file system character set.
Definition: Path.hxx:39
Compiler.h
ExcludeList::ExcludeList
ExcludeList()
Definition: ExcludeList.hxx:46
ExcludeList::ExcludeList
ExcludeList(const ExcludeList &_parent)
Definition: ExcludeList.hxx:49
ExcludeList::Check
bool Check(Path name_fs) const
Checks whether one of the patterns in the .mpdignore file matches the specified file name...
gcc_pure
#define gcc_pure
Definition: Compiler.h:116
ExcludeList
Definition: ExcludeList.hxx:38
ExcludeList::LoadFile
bool LoadFile(Path path_fs)
Loads and parses a .mpdignore file.