Debian Codegraph @

include/cddb/cddb.h

raw symbols SCIP
1 /* fre:ac - free audio converter
2 * Copyright (C) 2001-2020 Robert Kausch <[email protected]>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation, either version 2 of
7 * the License, or (at your option) any later version.
8 *
9 * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
10 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
11 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */
12
13 #ifndef H_FREAC_CDDB
14 #define H_FREAC_CDDB
15
16 #include <boca.h>
17
18 #include <cddb/cddbinfo.h>
19
20 const Int FREEDB_MODE_HTTP_POST = 0;
21 const Int FREEDB_MODE_HTTP_GET = 1;
22 const Int FREEDB_MODE_CDDBP = 2;
23
24 const Int QUERY_RESULT_ERROR = -1;
25 const Int QUERY_RESULT_NONE = 0;
26 const Int QUERY_RESULT_SINGLE = 1;
27 const Int QUERY_RESULT_MULTIPLE = 2;
28 const Int QUERY_RESULT_FUZZY = 3;
29
30 namespace freac
31 {
32 abstract class CDDB
33 {
34 protected:
35 Array<UnsignedInt32> ids;
36 Array<String> titles;
37 Array<String> categories;
38
39 Bool UpdateEntry(CDDBInfo &);
40
41 static String FormatCDDBEntry(const String &, const String &);
42 static String ParseCDDBEntry(const String &, Int &);
43
44 static String FormatCDDBRecord(const CDDBInfo &);
45 static Bool ParseCDDBRecord(const String &, CDDBInfo &);
46 public:
47 CDDB();
48 virtual ~CDDB();
49
50 virtual Bool ConnectToServer() = 0;
51 virtual Int Query(const String &) = 0;
52 virtual Bool Read(const String &, UnsignedInt32, CDDBInfo &) = 0;
53 virtual Bool Submit(const CDDBInfo &) = 0;
54 virtual Bool CloseConnection() = 0;
55
56 Int GetNumberOfMatches() const { return ids.Length(); }
57 UnsignedInt32 GetNthDiscID(Int n) const { return ids.GetNth(n); }
58 const String &GetNthTitle(Int n) const { return titles.GetNth(n); }
59 const String &GetNthCategory(Int n) const { return categories.GetNth(n); }
60
61 static String DiscIDToString(UnsignedInt32);
62 static UnsignedInt32 StringToDiscID(const String &);
63
64 static UnsignedInt32 DiscIDFromMCDI(const BoCA::MCDI &);
65 static String QueryStringFromMCDI(const BoCA::MCDI &);
66
67 static UnsignedInt32 DiscIDFromOffsets(const String &);
68 static String QueryStringFromOffsets(const String &);
69 };
70 };
71
72 #endif