chiark / gitweb /
disobedience: don't crash if no password
[disorder] / lib / trackname.h
CommitLineData
460b9539 1/*
2 * This file is part of DisOrder
3 * Copyright (C) 2005, 2006 Richard Kettlewell
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18 * USA
19 */
20
21#ifndef TRACKNAME_H
22#define TRACKNAME_H
23
24const char *find_track_root(const char *track);
25/* find the collection root for @track@ */
26
27const char *track_rootless(const char *track);
28/* return the rootless part of @track@ (typically starting /) */
29
30const char *trackname_part(const char *track,
31 const char *context,
32 const char *part);
33/* compute PART (artist/album/title) for TRACK in CONTEXT (display/sort) */
34
35const char *trackname_transform(const char *type,
36 const char *subject,
37 const char *context);
38/* convert SUBJECT (usually 'track' or 'dir' according to TYPE) for CONTEXT
39 * (display/sort) */
40
41int compare_tracks(const char *sa, const char *sb,
42 const char *da, const char *db,
43 const char *ta, const char *tb);
44/* Compare tracks A and B, with sort/display/track names S?, D? and T? */
45
46int compare_path_raw(const unsigned char *ap, size_t an,
47 const unsigned char *bp, size_t bn);
48/* Comparison function for path names that groups all entries in a directory
49 * together */
50
51/* Convenient wrapper for compare_path_raw */
52static inline int compare_path(const char *ap, const char *bp) {
53 return compare_path_raw((const unsigned char *)ap, strlen(ap),
54 (const unsigned char *)bp, strlen(bp));
55}
56
57#endif /* TRACKNAME_H */
58
59/*
60Local Variables:
61c-basic-offset:2
62comment-column:40
63fill-column:79
64End:
65*/