libsidplayfp  0.3.5
SidDatabase.h
1 /***************************************************************************
2  SidDatabase.h - songlength database support
3  -------------------
4  begin : Sun Mar 11 2001
5  copyright : (C) 2001 by Simon White
6  email : s_a_white@email.com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef _siddatabase_h_
19 #define _siddatabase_h_
20 
21 #include "sidplayfp/sidconfig.h"
22 #include "sidplayfp/sidtypes.h"
23 
24 class SidTuneMod;
25 class iniParser;
26 
31 class SID_EXTERN SidDatabase
32 {
33 private:
34  static const char *ERR_DATABASE_CORRUPT;
35  static const char *ERR_NO_DATABASE_LOADED;
36  static const char *ERR_NO_SELECTED_SONG;
37  static const char *ERR_MEM_ALLOC;
38  static const char *ERR_UNABLE_TO_LOAD_DATABASE;
39 
40  iniParser *m_parser;
41  const char *errorString;
42 
43  class parseError {};
44 
45  static const char* parseTime(const char* str, long &result);
46 
47 public:
48  SidDatabase ();
49  ~SidDatabase ();
50 
56  int open (const char *filename);
60  void close ();
61 
67  int_least32_t length (SidTuneMod &tune);
74  int_least32_t length (const char *md5, uint_least16_t song);
75 
77  const char * error (void) { return errorString; }
78 };
79 
80 #endif // _siddatabase_h_