mpd/src/db/Selection.hxx

60 lines
1.2 KiB
C++
Raw Normal View History

// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright The Music Player Daemon Project
2011-09-10 18:48:10 +02:00
#ifndef MPD_DATABASE_SELECTION_HXX
#define MPD_DATABASE_SELECTION_HXX
2011-09-10 18:48:10 +02:00
#include "protocol/RangeArg.hxx"
2023-03-06 15:17:41 +01:00
#include "tag/Type.hxx"
2011-09-10 18:48:10 +02:00
2013-10-29 20:33:20 +01:00
#include <string>
2011-09-10 18:48:10 +02:00
2012-08-29 19:27:03 +02:00
class SongFilter;
struct LightSong;
struct DatabaseSelection {
2011-09-10 18:48:10 +02:00
/**
* The base URI of the search (UTF-8). Must not begin or end
2013-10-29 20:33:20 +01:00
* with a slash. An empty string searches the whole database.
2011-09-10 18:48:10 +02:00
*/
2013-10-29 20:33:20 +01:00
std::string uri;
2011-09-10 18:48:10 +02:00
const SongFilter *filter;
RangeArg window = RangeArg::All();
/**
* Sort the result by the given tag. #TAG_NUM_OF_ITEM_TYPES
* means don't sort. #SORT_TAG_LAST_MODIFIED sorts by
* "Last-Modified" (not technically a tag).
*/
TagType sort = TAG_NUM_OF_ITEM_TYPES;
/**
* If #sort is set, this flag can reverse the sort order.
*/
bool descending = false;
2011-09-10 18:48:10 +02:00
/**
* Recursively search all sub directories?
*/
bool recursive;
DatabaseSelection(const char *_uri, bool _recursive,
2018-09-02 10:43:18 +02:00
const SongFilter *_filter=nullptr) noexcept;
2012-08-29 20:03:37 +02:00
2021-10-13 11:28:04 +02:00
[[gnu::pure]]
bool IsFiltered() const noexcept;
/**
* Does this selection contain constraints other than "base"?
*/
2021-10-13 11:28:04 +02:00
[[gnu::pure]]
bool HasOtherThanBase() const noexcept;
2021-10-13 11:28:04 +02:00
[[gnu::pure]]
bool Match(const LightSong &song) const noexcept;
};
2011-09-10 18:48:10 +02:00
#endif