| 
                             DtkCore
                             
                            DTK Core module 
                         | 
                    
ddcifile.h 是关于dci文件相关操作的一个类,实现了 DCI 文件的逻辑。其只是对数据的打包 dci文件的结构路径如下: 更多...
#include <ddcifile.h>
  
Public 类型 | |
| enum | FileType { UnknowFile , File = 1 , Directory = 2 , Symlink = 3 } | 
Public 成员函数 | |
| DDciFile (const QString &fileName) | |
| DDciFile (const QByteArray &data) | |
| bool | isValid () const | 
| 判断读取的dci文件是否有效   | |
| QString | lastErrorString () const | 
| 获取上一个报错信息,为人类可读字符串,可以通过此报错信息来获取错误内容,一般情况下是因为文件不存在或者文件名过长(>62个字符)导致。  | |
| bool | writeToFile (const QString &fileName) const | 
| 写入文件,在做完对于dci文件的操作之后调用此接口,为保存的作用   | |
| bool | writeToDevice (QIODevice *device) const | 
| 写入到设备,设备指的是qt中的io设备,可以在qt文档中找到相关信息   | |
| QByteArray | toData () const | 
| 返回dci文件的原始数据,以QByteArray形式返回   | |
| QStringList | list (const QString &dir, bool onlyFileName=false) const | 
| 列出文件列表   | |
| int | childrenCount (const QString &dir) const | 
| 子文件计数  | |
| bool | exists (const QString &filePath) const | 
| 判断文件是否存在   | |
| FileType | type (const QString &filePath) const | 
| 判断文件类型   | |
| QByteArray | dataRef (const QString &filePath) const | 
| 获取dci内部文件的数据,以一种引用(软连接)的方式获取,不会产生数据的的复制   | |
| QString | name (const QString &filePath) const | 
| 获取dci内文件的文件名   | |
| QString | symlinkTarget (const QString &filePath, bool originData=false) const | 
| 获取软链目标   | |
| bool | mkdir (const QString &filePath) | 
| 创建目录(注意:此目录指的是在dci文件内部的目录,而不是指的是传统目录)   | |
| bool | writeFile (const QString &filePath, const QByteArray &data, bool override=false) | 
| 写入文件   | |
| bool | remove (const QString &filePath) | 
| 移除文件   | |
| bool | rename (const QString &filePath, const QString &newFilePath, bool override=false) | 
| 重命名文件   | |
| bool | copy (const QString &from, const QString &to) | 
| bool | link (const QString &source, const QString &to) | 
| 链接文件   | |
静态 Public 成员函数 | |
| static void | registerFileEngine () | 
| static constexpr int | metadataSizeV1 () | 
| MAGIC_SIZE + VERSION_SIZE + FILE_COUNT_SIZE: 4+1+3 = 8  | |
额外继承的成员函数 | |
  Protected 成员函数 继承自 Dtk::Core::DObject | |
| DObject (DObject *parent=nullptr) | |
| DObject (DObjectPrivate &dd, DObject *parent=nullptr) | |
  Protected 属性 继承自 Dtk::Core::DObject | |
| QScopedPointer< DObjectPrivate > | d_d_ptr | 
ddcifile.h 是关于dci文件相关操作的一个类,实现了 DCI 文件的逻辑。其只是对数据的打包 dci文件的结构路径如下:
     
| QByteArray Dtk::Core::DDciFile::dataRef | ( | const QString & | filePath | ) | const | 
获取dci内部文件的数据,以一种引用(软连接)的方式获取,不会产生数据的的复制
| [in] | filePath | DCI图标结构路径 | 
| 如果返回为空字符串,则说明此文件不存在或者无效 | 
| bool Dtk::Core::DDciFile::exists | ( | const QString & | filePath | ) | const | 
判断文件是否存在
| [in] | filePath | DCI图标结构路径 | 
| bool Dtk::Core::DDciFile::isValid | ( | ) | const | 
判断读取的dci文件是否有效
当指定的dci文件未成功加载时,此函数会返回false,一般会出现在文件格式错误(不是一个dci格式的文件),或者是dci文件数据被篡改而无法识别的情况
| bool Dtk::Core::DDciFile::link | ( | const QString & | source, | 
| const QString & | to | ||
| ) | 
链接文件
| [in] | source | 文件源 | 
| [in] | to | 链接目标 | 
| QStringList Dtk::Core::DDciFile::list | ( | const QString & | dir, | 
| bool | onlyFileName = false  | 
        ||
| ) | const | 
列出文件列表
| [in] | dir | 文件夹地址 | 
| [in] | onlyFileName | 是否只显示文件名 默认为false | 
| bool Dtk::Core::DDciFile::mkdir | ( | const QString & | filePath | ) | 
创建目录(注意:此目录指的是在dci文件内部的目录,而不是指的是传统目录)
| [in] | filePath | DCI图标结构路径 | 
| QString Dtk::Core::DDciFile::name | ( | const QString & | filePath | ) | const | 
获取dci内文件的文件名
| [in] | filePath | DCI图标结构路径 | 
| 如果返回为空字符串,则说明此文件不存在或者无效 | 
| bool Dtk::Core::DDciFile::remove | ( | const QString & | filePath | ) | 
移除文件
| [in] | filePath | DCI图标结构路径 | 
| bool Dtk::Core::DDciFile::rename | ( | const QString & | filePath, | 
| const QString & | newFilePath, | ||
| bool | override = false  | 
        ||
| ) | 
重命名文件
| [in] | filePath | DCI图标结构路径 | 
| [in] | newFilePath | 新文件的路径 | 
| [in] | override | 当文件已经存在时,是否覆盖此文件,默认状态下不执行覆盖,会在lasterror中记录"The target file is existed"错误信息。 如果传入为true,则会执行覆盖操作,** 此操作不可逆 **。 | 
| QString Dtk::Core::DDciFile::symlinkTarget | ( | const QString & | filePath, | 
| bool | originData = false  | 
        ||
| ) | const | 
获取软链目标
| [in] | filePath | DCI图标结构路径 | 
| [in] | originData | 
| 如果返回为空字符串,则说明此文件不存在或者无效 | 
| QByteArray Dtk::Core::DDciFile::toData | ( | ) | const | 
| FileType Dtk::Core::DDciFile::type | ( | const QString & | filePath | ) | const | 
| bool Dtk::Core::DDciFile::writeFile | ( | const QString & | filePath, | 
| const QByteArray & | data, | ||
| bool | override = false  | 
        ||
| ) | 
写入文件
| [in] | filePath | DCI图标结构路径 | 
| [in] | data | 数据内容 | 
| [in] | override | 当文件已经存在时,是否覆盖此文件,默认状态下不执行覆盖,会在lasterror中记录"The target file is existed"错误信息。 如果传入为true,则会执行覆盖操作,** 此操作不可逆 **。 | 
| bool Dtk::Core::DDciFile::writeToDevice | ( | QIODevice * | device | ) | const | 
| bool Dtk::Core::DDciFile::writeToFile | ( | const QString & | fileName | ) | const | 
写入文件,在做完对于dci文件的操作之后调用此接口,为保存的作用
| [in] | fileName | 文件名 |