1 /** 2 * @file 3 * database.h 4 **/ 5 6 #pragma once 7 8 #include <list> 9 #include <vector> 10 11 using std::vector; 12 13 #ifdef DB_NDBM 14 extern "C" { 15 # include <ndbm.h> 16 } 17 #elif defined(DB_DBH) 18 extern "C" { 19 # define DB_DBM_HSEARCH 1 20 # include <db.h> 21 } 22 #elif defined(USE_SQLITE_DBM) 23 # include "sqldbm.h" 24 #else 25 # error DBM interfaces unavailable! 26 #endif 27 28 #define DPTR_COERCE char * 29 30 void databaseSystemInit(); 31 void databaseSystemShutdown(); 32 33 typedef bool (*db_find_filter)(string key, string body); 34 35 string getQuoteString(const string &key); 36 string getLongDescription(const string &key); 37 38 vector<string> getLongDescKeysByRegex(const string ®ex, 39 db_find_filter filter = nullptr); 40 vector<string> getLongDescBodiesByRegex(const string ®ex, 41 db_find_filter filter = nullptr); 42 43 string getGameStartDescription(const string &key); 44 45 string getShoutString(const string &monst, const string &suffix = ""); 46 string getSpeakString(const string &key); 47 string getRandNameString(const string &itemtype, const string &suffix = ""); 48 string getHelpString(const string &topic); 49 string getMiscString(const string &misc, const string &suffix = ""); 50 string getHintString(const string &key); 51 52 vector<string> getAllFAQKeys(); 53 string getFAQ_Question(const string &key); 54 string getFAQ_Answer(const string &question); 55