aboutsummaryrefslogtreecommitdiffstats
path: root/src/directory.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/directory.h')
-rw-r--r--src/directory.h41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/directory.h b/src/directory.h
index b3cd9c8c9..607e812cd 100644
--- a/src/directory.h
+++ b/src/directory.h
@@ -22,6 +22,11 @@
#include "check.h"
#include "util/list.h"
+#include "gcc.h"
+
+#ifdef __cplusplus
+#include "DatabaseVisitor.hxx"
+#endif
#include <glib.h>
#include <stdbool.h>
@@ -51,6 +56,10 @@
struct song;
struct db_visitor;
+#ifdef __cplusplus
+class SongFilter;
+#endif
+
struct directory {
/**
* Pointers to the siblings of this directory within the
@@ -86,8 +95,20 @@ struct directory {
dev_t device;
bool have_stat; /* not needed if ino_t == dev_t == 0 is impossible */
char path[sizeof(long)];
+
+#ifdef __cplusplus
+ /**
+ * Caller must lock #db_mutex.
+ */
+ bool Walk(bool recursive, const SongFilter *match,
+ VisitDirectory visit_directory, VisitSong visit_song,
+ VisitPlaylist visit_playlist,
+ GError **error_r) const;
+#endif
};
+G_BEGIN_DECLS
+
static inline bool
isRootDirectory(const char *name)
{
@@ -97,14 +118,14 @@ isRootDirectory(const char *name)
/**
* Generic constructor for #directory object.
*/
-G_GNUC_MALLOC
+gcc_malloc
struct directory *
directory_new(const char *dirname, struct directory *parent);
/**
* Create a new root #directory object.
*/
-G_GNUC_MALLOC
+gcc_malloc
static inline struct directory *
directory_new_root(void)
{
@@ -153,14 +174,14 @@ directory_is_root(const struct directory *directory)
/**
* Returns the base name of the directory.
*/
-G_GNUC_PURE
+gcc_pure
const char *
directory_get_name(const struct directory *directory);
/**
* Caller must lock the #db_mutex.
*/
-G_GNUC_PURE
+gcc_pure
struct directory *
directory_get_child(const struct directory *directory, const char *name);
@@ -172,7 +193,7 @@ directory_get_child(const struct directory *directory, const char *name);
* @param parent the parent directory the new one will be added to
* @param name_utf8 the UTF-8 encoded name of the new sub directory
*/
-G_GNUC_MALLOC
+gcc_malloc
struct directory *
directory_new_child(struct directory *parent, const char *name_utf8);
@@ -227,7 +248,7 @@ directory_remove_song(struct directory *directory, struct song *song);
*
* Caller must lock the #db_mutex.
*/
-G_GNUC_PURE
+gcc_pure
struct song *
directory_get_song(const struct directory *directory, const char *name_utf8);
@@ -251,12 +272,6 @@ directory_lookup_song(struct directory *directory, const char *uri);
void
directory_sort(struct directory *directory);
-/**
- * Caller must lock #db_mutex.
- */
-bool
-directory_walk(const struct directory *directory, bool recursive,
- const struct db_visitor *visitor, void *ctx,
- GError **error_r);
+G_END_DECLS
#endif