diff options
Diffstat (limited to 'src/db/update/ExcludeList.hxx')
-rw-r--r-- | src/db/update/ExcludeList.hxx | 47 |
1 files changed, 15 insertions, 32 deletions
diff --git a/src/db/update/ExcludeList.hxx b/src/db/update/ExcludeList.hxx index ef6c4d53e..4952d291a 100644 --- a/src/db/update/ExcludeList.hxx +++ b/src/db/update/ExcludeList.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2014 The Music Player Daemon Project + * Copyright (C) 2003-2015 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -27,51 +27,34 @@ #include "check.h" #include "Compiler.h" +#include "fs/Glob.hxx" +#ifdef HAVE_CLASS_GLOB #include <forward_list> - -#ifdef HAVE_GLIB -#include <glib.h> #endif class Path; class ExcludeList { -#ifdef HAVE_GLIB - class Pattern { - GPatternSpec *pattern; - - public: - Pattern(const char *_pattern) - :pattern(g_pattern_spec_new(_pattern)) {} - - Pattern(Pattern &&other) - :pattern(other.pattern) { - other.pattern = nullptr; - } - - ~Pattern() { - g_pattern_spec_free(pattern); - } + const ExcludeList *const parent; - gcc_pure - bool Check(const char *name_fs) const { - return g_pattern_match_string(pattern, name_fs); - } - }; - - std::forward_list<Pattern> patterns; -#else - // TODO: implement +#ifdef HAVE_CLASS_GLOB + std::forward_list<Glob> patterns; #endif public: + ExcludeList() + :parent(nullptr) {} + + ExcludeList(const ExcludeList &_parent) + :parent(&_parent) {} + gcc_pure bool IsEmpty() const { -#ifdef HAVE_GLIB - return patterns.empty(); +#ifdef HAVE_CLASS_GLOB + return ((parent == nullptr) || parent->IsEmpty()) && patterns.empty(); #else - // TODO: implement + /* not implemented */ return true; #endif } |