/usr/include/fox-1.6/FXSettings.h is in libfox-1.6-dev 1.6.50-1+b1.
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 | /********************************************************************************
* *
* S e t t i n g s C l a s s *
* *
*********************************************************************************
* Copyright (C) 1998,2006 by Jeroen van der Zijp. All Rights Reserved. *
*********************************************************************************
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*********************************************************************************
* $Id: FXSettings.h,v 1.33 2006/01/22 17:58:09 fox Exp $ *
********************************************************************************/
#ifndef FXSETTINGS_H
#define FXSETTINGS_H
#ifndef FXDICT_H
#include "FXDict.h"
#endif
namespace FX {
class FXStringDict;
/**
* The Settings class manages a key-value database. This is normally used as
* part of Registry, but can also be used separately in applications that need
* to maintain a key-value database in a file of their own.
* String values can contain any character, and will be escaped when written
* to the file.
*/
class FXAPI FXSettings : public FXDict {
FXDECLARE(FXSettings)
protected:
bool modified;
protected:
virtual void *createData(const void*);
virtual void deleteData(void*);
FXchar* dequote(FXchar* text) const;
FXchar* enquote(FXchar* result,const FXchar* text);
FXStringDict* insert(const FXchar* ky){ return (FXStringDict*)FXDict::insert(ky,NULL); }
FXStringDict* replace(const FXchar* ky,FXStringDict* section){ return (FXStringDict*)FXDict::replace(ky,section,true); }
FXStringDict* remove(const FXchar* ky){ return (FXStringDict*)FXDict::remove(ky); }
public:
/// Construct settings database.
FXSettings();
/// Construct copy of existing database.
FXSettings(const FXSettings& orig);
/// Assignment operator
FXSettings &operator=(const FXSettings& orig);
/// Parse a file containing a settings database.
bool parseFile(const FXString& filename,bool mark);
/// Unparse settings database into given file.
bool unparseFile(const FXString& filename);
/// Obtain the string dictionary for the given section
FXStringDict* data(FXuint pos) const { return (FXStringDict*)FXDict::data(pos); }
/// Find string dictionary for the given section; may be NULL
FXStringDict* find(const FXchar *section) const { return (FXStringDict*)FXDict::find(section); }
/// Read a formatted registry entry, using scanf-style format
FXint readFormatEntry(const FXchar *section,const FXchar *key,const FXchar *fmt,...) FX_SCANF(4,5) ;
/// Read a string registry entry; if no value is found, the default value def is returned
const FXchar *readStringEntry(const FXchar *section,const FXchar *key,const FXchar *def=NULL);
/// Read a integer registry entry; if no value is found, the default value def is returned
FXint readIntEntry(const FXchar *section,const FXchar *key,FXint def=0);
/// Read a unsigned integer registry entry; if no value is found, the default value def is returned
FXuint readUnsignedEntry(const FXchar *section,const FXchar *key,FXuint def=0);
/// Read a double-precision floating point registry entry; if no value is found, the default value def is returned
FXdouble readRealEntry(const FXchar *section,const FXchar *key,FXdouble def=0.0);
/// Read a color value registry entry; if no value is found, the default value def is returned
FXColor readColorEntry(const FXchar *section,const FXchar *key,FXColor def=0);
/// Read a boolean registry entry
FXbool readBoolEntry(const FXchar *section,const FXchar *key,FXbool def=FALSE);
/// Write a formatted registry entry, using printf-style format
FXint writeFormatEntry(const FXchar *section,const FXchar *key,const FXchar *fmt,...) FX_PRINTF(4,5) ;
/// Write a string registry entry
bool writeStringEntry(const FXchar *section,const FXchar *key,const FXchar *val);
/// Write a integer registry entry
bool writeIntEntry(const FXchar *section,const FXchar *key,FXint val);
/// Write a unsigned integer registry entry
bool writeUnsignedEntry(const FXchar *section,const FXchar *key,FXuint val);
/// Write a double-precision floating point registry entry
bool writeRealEntry(const FXchar *section,const FXchar *key,FXdouble val);
/// Write a color value entry
bool writeColorEntry(const FXchar *section,const FXchar *key,FXColor val);
/// Write a boolean value entry
bool writeBoolEntry(const FXchar *section,const FXchar *key,FXbool val);
/// Delete a registry entry
bool deleteEntry(const FXchar *section,const FXchar *key);
/// See if entry exists
bool existingEntry(const FXchar *section,const FXchar *key);
/// Delete section
bool deleteSection(const FXchar *section);
/// See if section exists
bool existingSection(const FXchar *section);
/// Clear all sections
bool clear();
/// Mark as changed
void setModified(bool mdfy=true){ modified=mdfy; }
/// Is it modified
bool isModified() const { return modified; }
/// Cleanup
virtual ~FXSettings();
};
}
#endif
|