| 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/linux/registry.h $ |
| 21 | * $Revision: 1.2 $ |
| 22 | * $Date: 2004/02/09 04:14:51 $ |
| 23 | * $Author: kevinb $ |
| 24 | * |
| 25 | * Linux registry header |
| 26 | * |
| 27 | * $Log: registry.h,v $ |
| 28 | * Revision 1.2 2004/02/09 04:14:51 kevinb |
| 29 | * Added newlines to all headers to reduce number of warnings printed |
| 30 | * |
| 31 | * Made some small changes to get everything compiling. |
| 32 | * |
| 33 | * All Ready to merge the 1.5 tree. |
| 34 | * |
| 35 | * Revision 1.1.1.1 2000/04/18 00:00:39 icculus |
| 36 | * initial checkin |
| 37 | * |
| 38 | * |
| 39 | * 4 7/14/99 9:09p Jeff |
| 40 | * added comment header |
| 41 | * |
| 42 | * $NoKeywords: $ |
| 43 | */ |
| 44 | |
| 45 | #ifndef __REGISTRY_H_ |
| 46 | #define __REGISTRY_H_ |
| 47 | |
| 48 | #define MAX_RECORD_NAME 256 |
| 49 | #define REGT_STRING 0 |
| 50 | #define REGT_DWORD 1 |
| 51 | |
| 52 | #include <stdio.h> |
| 53 | |
| 54 | struct tRecord { |
| 55 | char name[MAX_RECORD_NAME]; |
| 56 | char type; |
| 57 | void *data; |
| 58 | tRecord *next; |
| 59 | }; |
| 60 | |
| 61 | struct tKey { |
| 62 | char name[MAX_RECORD_NAME]; |
| 63 | tKey *next; |
| 64 | tRecord *records; |
| 65 | }; |
| 66 | |
| 67 | class CRegistry { |
| 68 | public: |
| 69 | CRegistry(const char *name); |
| 70 | ~CRegistry(); |
| 71 | void Export(); |
| 72 | bool Import(); |
| 73 | void CreateKey(const char *name); |
| 74 | bool LookupKey(const char *name); |
| 75 | bool CreateRecord(const char *name, char type, void *data); |
| 76 | tRecord *LookupRecord(const char *record, void *data); |
| 77 | int GetDataSize(const char *record); |
| 78 | void GetSystemName(char *name); |
| 79 | void SetSystemName(const char *name); |
| 80 | |
| 81 | private: |
| 82 | void Destroy(void); |
| 83 | void DestroyKey(tKey *key); |
| 84 | void DestroyRecord(tRecord *record); |
| 85 | void ExportKey(tKey *key, FILE *file); |
| 86 | void ExportRecord(tRecord *record, FILE *file); |
| 87 | char name[MAX_RECORD_NAME]; |
| 88 | tKey *root; |
| 89 | tKey *currentkey; |
| 90 | }; |
| 91 | |
| 92 | #endif |