| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 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 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/lib/appdatabase.h $ |
| 21 | * $Revision: 6 $ |
| 22 | * $Date: 5/13/99 5:04p $ |
| 23 | * $Author: Ardussi $ |
| 24 | * |
| 25 | * Application Database |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/lib/appdatabase.h $ |
| 28 | * |
| 29 | * 6 5/13/99 5:04p Ardussi |
| 30 | * changes for compiling on the Mac |
| 31 | * |
| 32 | * 5 5/10/99 10:53p Ardussi |
| 33 | * changes to compile on Mac |
| 34 | * |
| 35 | * 4 4/15/99 1:44a Jeff |
| 36 | * changes for linux compile |
| 37 | * |
| 38 | * 3 7/24/97 3:06p Matt |
| 39 | * Added functions to read & write bools & variable-length integers, and |
| 40 | * fixed a few small bugs. |
| 41 | * |
| 42 | * 2 6/11/97 1:09p Samir |
| 43 | * Virtual destructors. |
| 44 | * |
| 45 | * 1 6/10/97 4:55p Samir |
| 46 | * Old osDatabase code merged into AppDatabase. |
| 47 | * |
| 48 | * $NoKeywords: $ |
| 49 | */ |
| 50 | |
| 51 | #ifndef APPDATABASEcxx . . $ `lib/appdatabase.h:52:9`! |
| 52 | #define APPDATABASEcxx . . $ `lib/appdatabase.h:52:9`! |
| 53 | |
| 54 | #include "pstypes.h"cxx . . $ `<file>/lib/pstypes.h`/ |
| 55 | |
| 56 | /* oeAppDatabase |
| 57 | to get info about the application from a managed database (or a custom info file) |
| 58 | Again, this class should be the parent of a platform specific class like osWinDatabase, for instance. |
| 59 | */ |
| 60 | |
| 61 | class oeAppDatabasecxx . . $ oeAppDatabase# { |
| 62 | public: |
| 63 | oeAppDatabasecxx . . $ oeAppDatabase#oeAppDatabase(49f6e7a06ebc5aa8).(){}; |
| 64 | |
| 65 | // you can also create a reference to a current database. this is good if |
| 66 | // you have a hierachical database. |
| 67 | oeAppDatabasecxx . . $ oeAppDatabase#oeAppDatabase(a7d922957cec79ef).(oeAppDatabasecxx . . $ oeAppDatabase# *parent){}; |
| 68 | virtual ~cxx . . $ oeAppDatabase#`~oeAppDatabase`(ced63f7c635d850d).oeAppDatabasecxx . . $ oeAppDatabase#(){}; |
| 69 | |
| 70 | // creates an empty classification or structure where you can store information |
| 71 | virtual bool create_recordcxx . . $ oeAppDatabase#create_record(c5f7da30cbc0f4e9).(const char *pathname) = 0; |
| 72 | |
| 73 | // set current database focus to a particular record |
| 74 | virtual bool lookup_recordcxx . . $ oeAppDatabase#lookup_record(c5f7da30cbc0f4e9).(const char *pathname) = 0; |
| 75 | |
| 76 | // read either an integer or string from the current record |
| 77 | virtual bool readcxx . . $ oeAppDatabase#read(3bcbb53201fcdcb8).(const char *label, char *entry, int *entrylen) = 0; |
| 78 | virtual bool readcxx . . $ oeAppDatabase#read(340cb0a925eda13d).(const char *label, void *entry, int wordsize) = 0; // read an variable-sized integer |
| 79 | virtual bool readcxx . . $ oeAppDatabase#read(c1ce79fc3dc965f1).(const char *label, bool *entry) = 0; |
| 80 | |
| 81 | // write either an integer or string to a record. |
| 82 | virtual bool writecxx . . $ oeAppDatabase#write(f827cee075336303).(const char *label, const char *entry, int entrylen) = 0; |
| 83 | virtual bool writecxx . . $ oeAppDatabase#write(2551bed5d6fc04f6).(const char *label, int entry) = 0; |
| 84 | |
| 85 | // get the current user's name. |
| 86 | virtual void get_user_namecxx . . $ oeAppDatabase#get_user_name(5edd826d049e7804).(char *buffer, size_t *size) = 0; |
| 87 | }; |
| 88 | |
| 89 | // JCA: moved these from the Win32Database |
| 90 | |
| 91 | // Handy macro to read an int without having to specify the wordsize |
| 92 | #define read_intcxx . . $ `lib/appdatabase.h:92:9`!(label, varp) read(label, varp, sizeof(*varp)) |
| 93 | |
| 94 | // Macro to write a string |
| 95 | #define write_stringcxx . . $ `lib/appdatabase.h:95:9`!(label, varp) write(label, varp, strlen(varp)) |
| 96 | |
| 97 | /* This section includes the platform-specific header files |
| 98 | Add a platform to this list once implemented: |
| 99 | |
| 100 | Win32 Samir Win32Database.h 06/97 |
| 101 | */ |
| 102 | |
| 103 | #if defined(DX_APP) |
| 104 | #include "win\win32database.h" |
| 105 | #else |
| 106 | #include "linux/lnxdatabase.h"cxx . . $ `<file>/lib/linux/lnxdatabase.h`/ |
| 107 | #endif |
| 108 | |
| 109 | #endif |