/usr/include/wx-3.0/wx/wxPython/i_files/_config.i is in python-wxgtk3.0-dev 3.0.2.0+dfsg-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | /////////////////////////////////////////////////////////////////////////////
// Name: _config.i
// Purpose: SWIG interface for wxConfig, wxFileConfig, etc.
//
// Author: Robin Dunn
//
// Created: 25-Nov-1998
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
%{
%}
//---------------------------------------------------------------------------
%{
static PyObject* __EnumerationHelper(bool flag, wxString& str, long index) {
wxPyBlock_t blocked = wxPyBeginBlockThreads();
PyObject* ret = PyTuple_New(3);
if (ret) {
PyTuple_SET_ITEM(ret, 0, PyInt_FromLong(flag));
PyTuple_SET_ITEM(ret, 1, wx2PyString(str));
PyTuple_SET_ITEM(ret, 2, PyInt_FromLong(index));
}
wxPyEndBlockThreads(blocked);
return ret;
}
%}
enum
{
wxCONFIG_USE_LOCAL_FILE,
wxCONFIG_USE_GLOBAL_FILE,
wxCONFIG_USE_RELATIVE_PATH,
wxCONFIG_USE_NO_ESCAPE_CHARACTERS,
wxCONFIG_USE_SUBDIR
};
MustHaveApp(wxConfigBase::Get);
MustHaveApp(wxConfigBase::Create);
DocStr(wxConfigBase,
"wx.ConfigBase class defines the basic interface of all config
classes. It can not be used by itself (it is an abstract base class)
and you will always use one of its derivations: wx.Config or
wx.FileConfig.
wx.ConfigBase organizes the items in a tree-like structure, modeled
after the Unix/Dos filesystem. There are groups that act like
directories and entries, key/value pairs that act like files. There
is always one current group given by the current path. As in the file
system case, to specify a key in the config class you must use a path
to it. Config classes also support the notion of the current group,
which makes it possible to use relative paths.
Keys are pairs \"key_name = value\" where value may be of string,
integer floating point or boolean, you can not store binary data
without first encoding it as a string. For performance reasons items
should be kept small, no more than a couple kilobytes.
", "");
class wxConfigBase {
public:
// wxConfigBase(const wxString& appName = wxPyEmptyString, **** An ABC
// const wxString& vendorName = wxPyEmptyString,
// const wxString& localFilename = wxPyEmptyString,
// const wxString& globalFilename = wxPyEmptyString,
// long style = 0);
~wxConfigBase();
enum EntryType
{
Type_Unknown,
Type_String,
Type_Boolean,
Type_Integer, // use Read(long *)
Type_Float // use Read(double *)
};
%disownarg( wxConfigBase *config );
DocDeclStr(
static wxConfigBase *, Set(wxConfigBase *config),
"Sets the global config object (the one returned by Get) and returns a
reference to the previous global config object.", "");
%cleardisown( wxConfigBase *config );
DocDeclStr(
static wxConfigBase *, Get(bool createOnDemand = true),
"Returns the current global config object, creating one if neccessary.", "");
DocDeclStr(
static wxConfigBase *, Create(),
"Create and return a new global config object. This function will
create the \"best\" implementation of wx.Config available for the
current platform.", "");
DocDeclStr(
static void , DontCreateOnDemand(),
"Should Get() try to create a new log object if there isn't a current
one?", "");
DocDeclStr(
virtual void , SetPath(const wxString& path),
"Set current path: if the first character is '/', it's the absolute
path, otherwise it's a relative path. '..' is supported. If the
strPath doesn't exist it is created.", "");
DocDeclStr(
virtual const wxString& , GetPath() const,
"Retrieve the current path (always as absolute path)", "");
%extend {
DocAStr(GetFirstGroup,
"GetFirstGroup() -> (more, value, index)",
"Allows enumerating the subgroups in a config object. Returns a tuple
containing a flag indicating there are more items, the name of the
current item, and an index to pass to GetNextGroup to fetch the next
item.", "");
PyObject* GetFirstGroup() {
bool cont;
long index = 0;
wxString value;
cont = self->GetFirstGroup(value, index);
return __EnumerationHelper(cont, value, index);
}
DocAStr(GetNextGroup,
"GetNextGroup(long index) -> (more, value, index)",
"Allows enumerating the subgroups in a config object. Returns a tuple
containing a flag indicating there are more items, the name of the
current item, and an index to pass to GetNextGroup to fetch the next
item.", "");
PyObject* GetNextGroup(long index) {
bool cont;
wxString value;
cont = self->GetNextGroup(value, index);
return __EnumerationHelper(cont, value, index);
}
DocAStr(GetFirstEntry,
"GetFirstEntry() -> (more, value, index)",
"Allows enumerating the entries in the current group in a config
object. Returns a tuple containing a flag indicating there are more
items, the name of the current item, and an index to pass to
GetNextGroup to fetch the next item.", "");
PyObject* GetFirstEntry() {
bool cont;
long index = 0;
wxString value;
cont = self->GetFirstEntry(value, index);
return __EnumerationHelper(cont, value, index);
}
DocAStr(GetNextEntry,
"GetNextEntry(long index) -> (more, value, index)",
"Allows enumerating the entries in the current group in a config
object. Returns a tuple containing a flag indicating there are more
items, the name of the current item, and an index to pass to
GetNextGroup to fetch the next item.", "");
PyObject* GetNextEntry(long index) {
bool cont;
wxString value;
cont = self->GetNextEntry(value, index);
return __EnumerationHelper(cont, value, index);
}
}
DocDeclStr(
virtual size_t , GetNumberOfEntries(bool recursive = false) const,
"Get the number of entries in the current group, with or without its
subgroups.", "");
DocDeclStr(
virtual size_t , GetNumberOfGroups(bool recursive = false) const,
"Get the number of subgroups in the current group, with or without its
subgroups.", "");
DocDeclStr(
virtual bool , HasGroup(const wxString& name) const,
"Returns True if the group by this name exists", "");
DocDeclStr(
virtual bool , HasEntry(const wxString& name) const,
"Returns True if the entry by this name exists", "");
DocDeclStr(
bool , Exists(const wxString& name) const,
"Returns True if either a group or an entry with a given name exists", "");
// get the entry type
DocDeclStr(
virtual EntryType , GetEntryType(const wxString& name) const,
"Get the type of the entry. Returns one of the wx.Config.Type_XXX values.", "");
DocDeclStr(
wxString , Read(const wxString& key, const wxString& defaultVal = wxPyEmptyString),
"Returns the value of key if it exists, defaultVal otherwise.", "");
%extend {
DocStr(ReadInt,
"Returns the value of key if it exists, defaultVal otherwise.", "");
long ReadInt(const wxString& key, long defaultVal = 0) {
long rv;
self->Read(key, &rv, defaultVal);
return rv;
}
DocStr(ReadFloat,
"Returns the value of key if it exists, defaultVal otherwise.", "");
double ReadFloat(const wxString& key, double defaultVal = 0.0) {
double rv;
self->Read(key, &rv, defaultVal);
return rv;
}
DocStr(ReadBool,
"Returns the value of key if it exists, defaultVal otherwise.", "");
bool ReadBool(const wxString& key, bool defaultVal = false) {
bool rv;
self->Read(key, &rv, defaultVal);
return rv;
}
}
// TODO: ReadBinary and WriteBinary
// write the value (return True on success)
DocDeclStr(
bool , Write(const wxString& key, const wxString& value),
"write the value (return True on success)", "");
DocDeclStrName(
bool, Write(const wxString& key, long value),
"write the value (return True on success)", "",
WriteInt);
DocDeclStrName(
bool, Write(const wxString& key, double value),
"write the value (return True on success)", "",
WriteFloat);
DocDeclStrName(
bool, Write(const wxString& key, bool value),
"write the value (return True on success)", "",
WriteBool);
DocDeclStr(
virtual bool , Flush(bool currentOnly = false),
"permanently writes all changes", "");
DocDeclStr(
virtual bool , RenameEntry(const wxString& oldName,
const wxString& newName),
"Rename an entry. Returns False on failure (probably because the new
name is already taken by an existing entry)", "");
DocDeclStr(
virtual bool , RenameGroup(const wxString& oldName,
const wxString& newName),
"Rename a group. Returns False on failure (probably because the new
name is already taken by an existing entry)", "");
// deletes the specified entry and the group it belongs to if
// it was the last key in it and the second parameter is True
DocDeclStr(
virtual bool , DeleteEntry(const wxString& key,
bool deleteGroupIfEmpty = true),
"Deletes the specified entry and the group it belongs to if it was the
last key in it and the second parameter is True", "");
DocDeclStr(
virtual bool , DeleteGroup(const wxString& key),
"Delete the group (with all subgroups)", "");
DocDeclStr(
virtual bool , DeleteAll(),
"Delete the whole underlying object (disk file, registry key, ...)
primarly intended for use by deinstallation routine.", "");
DocDeclStr(
void , SetExpandEnvVars(bool doIt = true),
"We can automatically expand environment variables in the config
entries this option is on by default, you can turn it on/off at any
time)", "");
DocDeclStr(
bool , IsExpandingEnvVars() const,
"Are we currently expanding environment variables?", "");
DocDeclStr(
void , SetRecordDefaults(bool doIt = true),
"Set whether the config objec should record default values.", "");
DocDeclStr(
bool , IsRecordingDefaults() const,
"Are we currently recording default values?", "");
DocDeclStr(
wxString , ExpandEnvVars(const wxString& str) const,
"Expand any environment variables in str and return the result", "");
DocDeclStr(
wxString , GetAppName() const,
"", "");
DocDeclStr(
wxString , GetVendorName() const,
"", "");
DocDeclStr(
void , SetAppName(const wxString& appName),
"", "");
DocDeclStr(
void , SetVendorName(const wxString& vendorName),
"", "");
DocDeclStr(
void , SetStyle(long style),
"", "");
DocDeclStr(
long , GetStyle() const,
"", "");
%property(AppName, GetAppName, SetAppName, doc="See `GetAppName` and `SetAppName`");
%property(EntryType, GetEntryType, doc="See `GetEntryType`");
%property(FirstEntry, GetFirstEntry, doc="See `GetFirstEntry`");
%property(FirstGroup, GetFirstGroup, doc="See `GetFirstGroup`");
%property(NextEntry, GetNextEntry, doc="See `GetNextEntry`");
%property(NextGroup, GetNextGroup, doc="See `GetNextGroup`");
%property(NumberOfEntries, GetNumberOfEntries, doc="See `GetNumberOfEntries`");
%property(NumberOfGroups, GetNumberOfGroups, doc="See `GetNumberOfGroups`");
%property(Path, GetPath, SetPath, doc="See `GetPath` and `SetPath`");
%property(Style, GetStyle, SetStyle, doc="See `GetStyle` and `SetStyle`");
%property(VendorName, GetVendorName, SetVendorName, doc="See `GetVendorName` and `SetVendorName`");
};
//---------------------------------------------------------------------------
DocStr(wxConfig,
"This ConfigBase-derived class will use the registry on Windows,
and will be a wx.FileConfig on other platforms.", "");
class wxConfig : public wxConfigBase {
public:
DocCtorStr(
wxConfig(const wxString& appName = wxPyEmptyString,
const wxString& vendorName = wxPyEmptyString,
const wxString& localFilename = wxPyEmptyString,
const wxString& globalFilename = wxPyEmptyString,
long style = wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_GLOBAL_FILE),
"", "");
~wxConfig();
};
DocStr(wxFileConfig,
"This config class will use a file for storage on all platforms.", "");
class wxFileConfig : public wxConfigBase {
public:
DocCtorStr(
wxFileConfig(const wxString& appName = wxPyEmptyString,
const wxString& vendorName = wxPyEmptyString,
const wxString& localFilename = wxPyEmptyString,
const wxString& globalFilename = wxPyEmptyString,
long style = wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_GLOBAL_FILE),
"", "");
~wxFileConfig();
static wxString GetGlobalFileName(const wxString& szFile);
static wxString GetLocalFileName(const wxString& szFile, int style = 0);
};
//---------------------------------------------------------------------------
DocStr(wxConfigPathChanger,
"A handy little class which changes current path to the path of given
entry and restores it in the destructoir: so if you declare a local
variable of this type, you work in the entry directory and the path is
automatically restored when the function returns.", "");
class wxConfigPathChanger
{
public:
DocCtorStr(
wxConfigPathChanger(const wxConfigBase *config, const wxString& entry),
"", "");
~wxConfigPathChanger();
DocDeclStr(
const wxString& , Name() const,
"Get the key name", "");
};
//---------------------------------------------------------------------------
DocDeclStr(
wxString , wxExpandEnvVars(const wxString &sz),
"Replace environment variables ($SOMETHING) with their values. The
format is $VARNAME or ${VARNAME} where VARNAME contains alphanumeric
characters and '_' only. '$' must be escaped ('\$') in order to be
taken literally.", "");
//---------------------------------------------------------------------------
|