MPD 0.17~git
src/locate.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2003-2011 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 "gcc.h"
00024 
00025 #include <stdint.h>
00026 #include <stdbool.h>
00027 
00028 #define LOCATE_TAG_FILE_TYPE    TAG_NUM_OF_ITEM_TYPES+10
00029 #define LOCATE_TAG_ANY_TYPE     TAG_NUM_OF_ITEM_TYPES+20
00030 
00031 struct song;
00032 
00033 /* struct used for search, find, list queries */
00034 struct locate_item {
00035         int8_t tag;
00036         /* what we are looking for */
00037         char *needle;
00038 };
00039 
00043 struct locate_item_list {
00045         unsigned length;
00046 
00048         struct locate_item items[1];
00049 };
00050 
00051 int
00052 locate_parse_type(const char *str);
00053 
00058 struct locate_item_list *
00059 locate_item_list_new(unsigned length);
00060 
00061 /* return number of items or -1 on error */
00062 gcc_nonnull(1)
00063 struct locate_item_list *
00064 locate_item_list_parse(char *argv[], int argc);
00065 
00070 gcc_nonnull(1)
00071 struct locate_item_list *
00072 locate_item_list_casefold(const struct locate_item_list *list);
00073 
00074 gcc_nonnull(1)
00075 void
00076 locate_item_list_free(struct locate_item_list *list);
00077 
00078 gcc_nonnull(1)
00079 void
00080 locate_item_free(struct locate_item *item);
00081 
00082 gcc_nonnull(1,2)
00083 bool
00084 locate_song_search(const struct song *song,
00085                    const struct locate_item_list *criteria);
00086 
00087 gcc_nonnull(1,2)
00088 bool
00089 locate_song_match(const struct song *song,
00090                    const struct locate_item_list *criteria);
00091 
00092 #endif