| 1 | /* fre:ac - free audio converter |
| 2 | * Copyright (C) 2001-2019 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_CACHE |
| 14 | #define H_FREAC_CDDB_CACHE |
| 15 | |
| 16 | #include <cddb/cddb.h> |
| 17 | |
| 18 | namespace freac |
| 19 | { |
| 20 | class CDDBCache |
| 21 | { |
| 22 | private: |
| 23 | /* Singleton class, therefore private constructor/destructor |
| 24 | */ |
| 25 | static CDDBCache *instance; |
| 26 | |
| 27 | CDDBCache(); |
| 28 | ~CDDBCache(); |
| 29 | |
| 30 | Array<CDDBInfo> infoCache; |
| 31 | public: |
| 32 | const CDDBInfo &GetCacheEntry(const String &); |
| 33 | Bool AddCacheEntry(const CDDBInfo &); |
| 34 | |
| 35 | Int GetNOfEntries() const { return infoCache.Length(); } |
| 36 | const CDDBInfo &GetNthEntry(Int n) const { return infoCache.GetNth(n); } |
| 37 | |
| 38 | Int RemoveNthEntry(Int); |
| 39 | |
| 40 | /* Returns a new or existing instance of CDDBCache |
| 41 | */ |
| 42 | static CDDBCache *Get(); |
| 43 | |
| 44 | /* Destroys an existing instance of CDDBCache |
| 45 | */ |
| 46 | static Void Free(); |
| 47 | }; |
| 48 | }; |
| 49 | |
| 50 | #endif |