aboutsummaryrefslogtreecommitdiffstats
path: root/src/mapper.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mapper.h')
-rw-r--r--src/mapper.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/mapper.h b/src/mapper.h
index 9f84f96fe..ed4a60b56 100644
--- a/src/mapper.h
+++ b/src/mapper.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2010 The Music Player Daemon Project
+ * Copyright (C) 2003-2011 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -24,6 +24,7 @@
#ifndef MPD_MAPPER_H
#define MPD_MAPPER_H
+#include <glib.h>
#include <stdbool.h>
#define PLAYLIST_FILE_SUFFIX ".m3u"
@@ -35,17 +36,26 @@ void mapper_init(const char *_music_dir, const char *_playlist_dir);
void mapper_finish(void);
+G_GNUC_CONST
+const char *
+mapper_get_music_directory(void);
+
/**
* Returns true if a music directory was configured.
*/
-bool
-mapper_has_music_directory(void);
+G_GNUC_CONST
+static inline bool
+mapper_has_music_directory(void)
+{
+ return mapper_get_music_directory() != NULL;
+}
/**
* If the specified absolute path points inside the music directory,
* this function converts it to a relative path. If not, it returns
* the unmodified string pointer.
*/
+G_GNUC_PURE
const char *
map_to_relative_path(const char *path_utf8);
@@ -54,6 +64,7 @@ map_to_relative_path(const char *path_utf8);
* is basically done by converting the URI to the file system charset
* and prepending the music directory.
*/
+G_GNUC_MALLOC
char *
map_uri_fs(const char *uri);
@@ -63,6 +74,7 @@ map_uri_fs(const char *uri);
* @param directory the directory object
* @return the path in file system encoding, or NULL if mapping failed
*/
+G_GNUC_MALLOC
char *
map_directory_fs(const struct directory *directory);
@@ -74,6 +86,7 @@ map_directory_fs(const struct directory *directory);
* @param name the child's name in UTF-8
* @return the path in file system encoding, or NULL if mapping failed
*/
+G_GNUC_MALLOC
char *
map_directory_child_fs(const struct directory *directory, const char *name);
@@ -84,6 +97,7 @@ map_directory_child_fs(const struct directory *directory, const char *name);
* @param song the song object
* @return the path in file system encoding, or NULL if mapping failed
*/
+G_GNUC_MALLOC
char *
map_song_fs(const struct song *song);
@@ -94,12 +108,14 @@ map_song_fs(const struct song *song);
* @param path_fs a path in file system encoding
* @return the relative path in UTF-8, or NULL if mapping failed
*/
+G_GNUC_MALLOC
char *
map_fs_to_utf8(const char *path_fs);
/**
* Returns the playlist directory.
*/
+G_GNUC_CONST
const char *
map_spl_path(void);
@@ -110,6 +126,7 @@ map_spl_path(void);
*
* @return the path in file system encoding, or NULL if mapping failed
*/
+G_GNUC_PURE
char *
map_spl_utf8_to_fs(const char *name);