chiark / gitweb /
Doxygen-clean
[disorder] / lib / trackname.h
CommitLineData
460b9539 1/*
2 * This file is part of DisOrder
5aff007d 3 * Copyright (C) 2005-2008 Richard Kettlewell
460b9539 4 *
e7eb3a27 5 * This program is free software: you can redistribute it and/or modify
460b9539 6 * it under the terms of the GNU General Public License as published by
e7eb3a27 7 * the Free Software Foundation, either version 3 of the License, or
460b9539 8 * (at your option) any later version.
e7eb3a27
RK
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
460b9539 15 * You should have received a copy of the GNU General Public License
e7eb3a27 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
460b9539 17 */
18
19#ifndef TRACKNAME_H
20#define TRACKNAME_H
21
d1694464 22const struct collection *find_track_collection(const char *track);
23/* find the collection for @track@ */
24
460b9539 25const char *find_track_root(const char *track);
26/* find the collection root for @track@ */
27
28const char *track_rootless(const char *track);
29/* return the rootless part of @track@ (typically starting /) */
30
31const char *trackname_part(const char *track,
32 const char *context,
33 const char *part);
34/* compute PART (artist/album/title) for TRACK in CONTEXT (display/sort) */
35
36const char *trackname_transform(const char *type,
37 const char *subject,
38 const char *context);
39/* convert SUBJECT (usually 'track' or 'dir' according to TYPE) for CONTEXT
40 * (display/sort) */
41
42int compare_tracks(const char *sa, const char *sb,
43 const char *da, const char *db,
44 const char *ta, const char *tb);
45/* Compare tracks A and B, with sort/display/track names S?, D? and T? */
46
47int compare_path_raw(const unsigned char *ap, size_t an,
48 const unsigned char *bp, size_t bn);
49/* Comparison function for path names that groups all entries in a directory
50 * together */
51
52/* Convenient wrapper for compare_path_raw */
53static inline int compare_path(const char *ap, const char *bp) {
54 return compare_path_raw((const unsigned char *)ap, strlen(ap),
55 (const unsigned char *)bp, strlen(bp));
56}
57
2fadbbc6
RK
58/** @brief Entry in a list of tracks or directories */
59struct tracksort_data {
60 /** @brief Track name */
61 const char *track;
62 /** @brief Sort key */
63 const char *sort;
64 /** @brief Display key */
65 const char *display;
2fadbbc6
RK
66};
67
68struct tracksort_data *tracksort_init(int nvec,
69 char **vec,
70 const char *type);
71
460b9539 72#endif /* TRACKNAME_H */
73
74/*
75Local Variables:
76c-basic-offset:2
77comment-column:40
78fill-column:79
79End:
80*/