提供配置文件的用户和全局运行缓存访问接口
更多...
#include <dconfigfile.h>
|
| virtual bool | load (const QString &localPrefix=QString())=0 |
| | 解析缓存配置文件
|
| |
| virtual bool | save (const QString &localPrefix=QString(), QJsonDocument::JsonFormat format=QJsonDocument::Indented, bool sync=false)=0 |
| | 保存缓存的值到磁盘中
|
| |
| virtual bool | isGlobal () const =0 |
| | 是否是全局缓存
|
| |
| virtual void | remove (const QString &key)=0 |
| | 删除缓存中的配置项
|
| |
| virtual QStringList | keyList () const =0 |
| | 返回配置内容的所有配置项
|
| |
| virtual bool | setValue (const QString &key, const QVariant &value, const int serial, const uint uid, const QString &callerAppid)=0 |
| | 设置缓存中的值
|
| |
| virtual QVariant | value (const QString &key) const =0 |
| | 获取缓存中的值
|
| |
| virtual int | serial (const QString &key) const =0 |
| | 返回配置项的单调递增值
|
| |
| virtual uint | uid () const =0 |
| | 用户标识,为全局缓存时,uid为非用户标识的特定值
|
| |
|
virtual void | setCachePathPrefix (const QString &prefix)=0 |
| |
◆ isGlobal()
| bool Dtk::Core::DConfigCache::isGlobal |
( |
| ) |
const |
|
pure virtual |
◆ keyList()
| QStringList Dtk::Core::DConfigCache::keyList |
( |
| ) |
const |
|
pure virtual |
◆ load()
| bool Dtk::Core::DConfigCache::load |
( |
const QString & |
localPrefix = QString() | ) |
|
|
pure virtual |
◆ remove()
| void Dtk::Core::DConfigCache::remove |
( |
const QString & |
key | ) |
|
|
pure virtual |
◆ save()
| bool Dtk::Core::DConfigCache::save |
( |
const QString & |
localPrefix = QString(), |
|
|
QJsonDocument::JsonFormat |
format = QJsonDocument::Indented, |
|
|
bool |
sync = false |
|
) |
| |
|
pure virtual |
保存缓存的值到磁盘中
- 参数
-
| [in] | localPrefix | 为目录前缀 |
| [in] | format | 保存格式 |
| [in] | sync | 是否立即刷新 |
- 返回
◆ serial()
| int Dtk::Core::DConfigCache::serial |
( |
const QString & |
key | ) |
const |
|
pure virtual |
返回配置项的单调递增值
- 参数
-
- 返回
- -1为无效值,表明没有配置此项
◆ setValue()
| bool Dtk::Core::DConfigCache::setValue |
( |
const QString & |
key, |
|
|
const QVariant & |
value, |
|
|
const int |
serial, |
|
|
const uint |
uid, |
|
|
const QString & |
callerAppid |
|
) |
| |
|
pure virtual |
设置缓存中的值
- 参数
-
| [in] | key | 配置项名称 |
| [in] | value | 需要设置的值 |
| [in] | uid | 设置时的用户id |
| [in] | callerAppid | 设置时的应用id |
- 返回
- 为true时表示重新设置了新值,false表示没有设置。
◆ uid()
| uint Dtk::Core::DConfigCache::uid |
( |
| ) |
const |
|
pure virtual |
用户标识,为全局缓存时,uid为非用户标识的特定值
- 返回
◆ value()
| QVariant Dtk::Core::DConfigCache::value |
( |
const QString & |
key | ) |
const |
|
pure virtual |
该类的文档由以下文件生成: