1 /* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar)
2 * Understanding is not required. Only obedience.
4 * This program is free software. It comes without any warranty, to
5 * the extent permitted by applicable law. You can redistribute it
6 * and/or modify it under the terms of the Do What The Fuck You Want
7 * To Public License, Version 2, as published by Sam Hocevar. See
8 * http://sam.zoy.org/wtfpl/COPYING for more details.
17 #include <QKeySequence>
20 #include <QStringList>
23 #include "k8ascii85.h"
37 Integer
=2, //32-bit signed integer
44 K8SDB (const QString
&aPathName
, CreateMode cMode
=OpenExisting
);
47 inline bool isOpen () const { return mIsOpen
; }
48 inline const QString
&pathname () const { return mFileName
; }
51 * TypeOverwrite: overwrite existing keys with different type in set()?
54 inline bool typeOverwrite () const { return mTypeOverwrite
; }
55 inline void setTypeOverwrite (bool tover
) { mTypeOverwrite
= tover
; }
57 bool remove (const QString
&name
);
59 * remove all keys with names starting from 'name'
61 bool removeAll (const QString
&name
);
62 bool hasKey (const QString
&name
) const;
63 Type
type (const QString
&name
) const; // returns Invalid if there is no such key
65 bool set (const QString
&name
, bool v
);
66 inline bool setBool (const QString
&name
, bool v
) { return set(name
, v
); }
67 bool set (const QString
&name
, qint32 v
);
68 inline bool setInt (const QString
&name
, qint32 v
) { return set(name
, v
); }
69 bool set (const QString
&name
, const QString
&v
);
70 inline bool set (const QString
&name
, const char *v
) { return set(name
, QString(v
)); }
71 bool set (const QString
&name
, const QKeySequence
&v
);
72 bool set (const QString
&name
, const QByteArray
&v
);
73 bool set (const QString
&name
, Type type
, const QString
&v
);
75 bool toBool (const QString
&name
, bool *ok
=0);
76 qint32
toInt (const QString
&name
, bool *ok
=0);
77 QString
toString (const QString
&name
, bool *ok
=0);
78 QByteArray
toByteArray (const QString
&name
, bool *ok
=0);
79 QKeySequence
toKeySequence (const QString
&name
, bool *ok
=0);
81 QString
asString (const QString
&name
, bool *ok
=0);
83 QStringList
keys () const;
84 QStringList
keysPfx (const QString
&pfx
) const;
86 static const char *typeName (Type type
);
98 QHash
<QString
, QVariant
> mKeys
;