MPD

src/locate.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2003-2010 The Music Player Daemon Project
00003  * http://www.musicpd.org
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License along
00016  * with this program; if not, write to the Free Software Foundation, Inc.,
00017  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00018  */
00019 
00020 #ifndef MPD_LOCATE_H
00021 #define MPD_LOCATE_H
00022 
00023 #include <stdint.h>
00024 #include <stdbool.h>
00025 
00026 #define LOCATE_TAG_FILE_TYPE    TAG_NUM_OF_ITEM_TYPES+10
00027 #define LOCATE_TAG_ANY_TYPE     TAG_NUM_OF_ITEM_TYPES+20
00028 
00029 struct song;
00030 
00031 /* struct used for search, find, list queries */
00032 struct locate_item {
00033         int8_t tag;
00034         /* what we are looking for */
00035         char *needle;
00036 };
00037 
00041 struct locate_item_list {
00043         unsigned length;
00044 
00046         struct locate_item items[1];
00047 };
00048 
00049 int
00050 locate_parse_type(const char *str);
00051 
00052 /* returns NULL if not a known type */
00053 struct locate_item *
00054 locate_item_new(const char *type_string, const char *needle);
00055 
00060 struct locate_item_list *
00061 locate_item_list_new(unsigned length);
00062 
00063 /* return number of items or -1 on error */
00064 struct locate_item_list *
00065 locate_item_list_parse(char *argv[], int argc);
00066 
00071 struct locate_item_list *
00072 locate_item_list_casefold(const struct locate_item_list *list);
00073 
00074 void
00075 locate_item_list_free(struct locate_item_list *list);
00076 
00077 void
00078 locate_item_free(struct locate_item *item);
00079 
00080 bool
00081 locate_song_search(const struct song *song,
00082                    const struct locate_item_list *criteria);
00083 
00084 bool
00085 locate_song_match(const struct song *song,
00086                    const struct locate_item_list *criteria);
00087 
00088 #endif