1 /* 2 Copyright (C) 2015-2021, Dirk Krause 3 SPDX-License-Identifier: BSD-3-Clause 4 */ 5 6 /* 7 WARNING: This file was generated by the dkct program (see 8 http://dktools.sourceforge.net/ for details). 9 Changes you make here will be lost if dkct is run again! 10 You should modify the original source and run dkct on it. 11 Original source: dk4wxpref.cpt 12 */ 13 14 #ifndef DK4WXPREF_H_INCLUDED 15 /** Avoid multiple inclusions. */ 16 #define DK4WXPREF_H_INCLUDED 1 17 18 19 /** @file dk4wxpref.h Preferences as wxChar strings. 20 */ 21 22 #ifndef DK4CONF_H_INCLUDED 23 #if DK4_BUILDING_DKTOOLS4 24 #include "dk4conf.h" 25 #else 26 #include <dktools-4/dk4conf.h> 27 #endif 28 #endif 29 30 #ifndef DK4TYPES_H_INCLUDED 31 #if DK4_BUILDING_DKTOOLS4 32 #include <libdk4base/dk4types.h> 33 #else 34 #include <dktools-4/dk4types.h> 35 #endif 36 #endif 37 38 #ifndef DK4CONST_H_INCLUDED 39 #if DK4_BUILDING_DKTOOLS4 40 #include <libdk4base/dk4const.h> 41 #else 42 #include <dktools-4/dk4const.h> 43 #endif 44 #endif 45 46 #ifndef DK4ERROR_H_INCLUDED 47 #if DK4_BUILDING_DKTOOLS4 48 #include <libdk4base/dk4error.h> 49 #else 50 #include <dktools-4/dk4error.h> 51 #endif 52 #endif 53 54 #ifndef DK4STO_H_INCLUDED 55 #if DK4_BUILDING_DKTOOLS4 56 #include <libdk4c/dk4sto.h> 57 #else 58 #include <dktools-4/dk4sto.h> 59 #endif 60 #endif 61 62 #ifndef DK4STRM_H_INCLUDED 63 #if DK4_BUILDING_DKTOOLS4 64 #include <libdk4c/dk4strm.h> 65 #else 66 #include <dktools-4/dk4strm.h> 67 #endif 68 #endif 69 70 #ifndef DK4STRMR_H_INCLUDED 71 #if DK4_BUILDING_DKTOOLS4 72 #include <libdk4c/dk4strmr.h> 73 #else 74 #include <dktools-4/dk4strmr.h> 75 #endif 76 #endif 77 78 79 #ifndef WX_WXPREC_H_INCLUDED 80 #include <wx/wxprec.h> 81 #define WX_WXPREC_H_INCLUDED 1 82 #endif 83 #ifdef __BORLANDC__ 84 #pragma hdrstop 85 #endif 86 #ifndef WX_PRECOMP 87 #if DK4_HAVE_WX_CHARTYPE_H 88 #ifndef WX_CHARTYPE_H_INCLUDED 89 #include <wx/chartype.h> 90 #define WX_CHARTYPE_H_INCLUDED 1 91 #endif 92 #else 93 #if DK4_HAVE_WX_WXCHAR_H 94 #ifndef WX_WXCHAR_H_INCLUDED 95 #include <wx/wxchar.h> 96 #define WX_WXCHAR_H_INCLUDED 1 97 #endif 98 #else 99 #ifndef WX_WX_H_INCLUDED 100 #include <wx/wx.h> 101 #define WX_WX_H_INCLUDED 102 #endif 103 #endif 104 #endif 105 #endif 106 107 108 /** Preferences data. 109 */ 110 typedef struct { 111 wxChar *name; /**< Name. */ 112 wxChar *value; /**< Value. */ 113 } dk4_wx_pref_t; 114 115 116 117 #ifdef __cplusplus 118 extern "C" { 119 #endif 120 121 /** Create preferences structure, allocate memory. 122 @param name Preference name. 123 @param value Preference value. 124 @param erp Error report, may be NULL. 125 @return Pointer to new preferences object on success, NULL on error. 126 127 Error codes: 128 - DK4_E_INVALID_ARGUMENTS<br> 129 if name or value is NULL, 130 - DK4_E_MEMORY_ALLOCATION_FAILED<br> 131 if a memory allocation failed due to insufficient memory. 132 */ 133 dk4_wx_pref_t * 134 dk4wxpref_open(const wxChar *name, const wxChar *value, dk4_er_t *erp); 135 136 /** Destroy preference structure, release memory. 137 @param ptr Preference structure to destroy. 138 */ 139 void 140 dk4wxpref_close(dk4_wx_pref_t *ptr); 141 142 /** Comparison function. 143 @param l Left pointer. 144 @param r Right pointer. 145 @param cr Comparison criteria: 146 0=structure/structure, 147 1=structure/name. 148 @return Comparison result. 149 */ 150 int 151 dk4wxpref_compare(const void *l, const void *r, int cr); 152 153 /** Add dk4pref.conf file for one pass. 154 @param spref Preferences storage. 155 @param ipref Iterator for preferences storage. 156 @param nameApp Application name. 157 @param nameGrp Application group name. 158 @param nameLog Users login name. 159 @param nameHost Host name. 160 @param language Language. 161 @param region Region. 162 @param dirHome Users home directory. 163 @param dirEtc System configuration directory. 164 @param dirShare Data file directory. 165 @param encWx Encoding for wxChar strings. 166 @param encDk Encoding for dkChar strings. 167 @param encFile Expected encoding for files. 168 @param pn Pass number. 169 */ 170 void 171 dk4wxpref_one_pass( 172 dk4_sto_t *spref, 173 dk4_sto_it_t *ipref, 174 const dkChar *nameApp, 175 const dkChar *nameGrp, 176 const dkChar *nameLog, 177 const dkChar *nameHost, 178 const dkChar *language, 179 const dkChar *region, 180 const dkChar *dirHome, 181 const dkChar *dirEtc, 182 const dkChar *dirShare, 183 int encWx, 184 int encDk, 185 int encFile, 186 int pn 187 ); 188 189 #ifdef __cplusplus 190 } 191 #endif 192 193 194 195 196 #endif 197