MPD

src/dirvec.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_DIRVEC_H
00021 #define MPD_DIRVEC_H
00022 
00023 #include <stddef.h>
00024 
00025 struct dirvec {
00026         struct directory **base;
00027         size_t nr;
00028 };
00029 
00030 void dirvec_init(void);
00031 
00032 void dirvec_deinit(void);
00033 
00034 void dirvec_sort(struct dirvec *dv);
00035 
00036 struct directory *dirvec_find(const struct dirvec *dv, const char *path);
00037 
00038 int dirvec_delete(struct dirvec *dv, struct directory *del);
00039 
00040 void dirvec_add(struct dirvec *dv, struct directory *add);
00041 
00042 static inline void
00043 dirvec_clear(struct dirvec *dv)
00044 {
00045         dv->nr = 0;
00046 }
00047 
00048 void dirvec_destroy(struct dirvec *dv);
00049 
00050 int dirvec_for_each(const struct dirvec *dv,
00051                     int (*fn)(struct directory *, void *), void *arg);
00052 
00053 #endif /* DIRVEC_H */