Debian Codegraph @

lib/linux/lnxdatabase.h

raw symbols SCIP
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 * Application Database for Linux version
21 *
22 * $NoKeywords: $
23 */
24
25 #ifndef LINUXDATABASE
26 #define LINUXDATABASE
27
28 #include <stdio.h>
29 #include <stdlib.h>
30
31 class CRegistry;
32
33 #include "Macros.h"
34 #include "appdatabase.h"
35
36 /* oeLnxAppDatabase
37 to get info about the application from a managed database (or a custom info file)
38 */
39
40 class oeLnxAppDatabase : public oeAppDatabase {
41
42 protected:
43 CRegistry *database;
44
45 public:
46 oeLnxAppDatabase();
47 oeLnxAppDatabase(oeLnxAppDatabase *parent);
48 virtual ~oeLnxAppDatabase();
49 CRegistry *GetSystemRegistry();
50
51 // creates an empty classification or structure where you can store information
52 virtual bool create_record(const char *pathname);
53
54 // set current database focus to a particular record
55 virtual bool lookup_record(const char *pathname);
56
57 // read either an integer or string from the current record
58 virtual bool read(const char *label, char *entry, int *entrylen);
59 virtual bool read(const char *label, void *entry, int wordsize); // read a variable-size int
60 virtual bool read(const char *label, bool *entry);
61
62 // write either an integer or string to a record.
63 virtual bool write(const char *label, const char *entry, int entrylen);
64 virtual bool write(const char *label, int entry);
65
66 // get the current user's name.
67 virtual void get_user_name(char *buffer, size_t *size);
68 };
69
70 // Handy macro to read an int without having to specify the wordsize
71 #define read_int(label, varp) read(label, varp, sizeof(*varp))
72
73 // Macro to write a string
74 #define write_string(label, varp) write(label, varp, strlen(varp))
75
76 #endif