本页内容

Core::BaseTextDocument Class

class Core::BaseTextDocument

BaseTextDocument 类是一个用于处理文本的文档的通用基类。更多内容...

Header: #include <coreplugin/textdocument.h>
Inherits: Core::IDocument

公共函数

Utils::TextFileFormat format() const
Core::BaseTextDocument::ReadResult read(const Utils::FilePath &filePath)
Utils::Result<> write(const Utils::FilePath &filePath, const QString &data) const
Utils::Result<> write(const Utils::FilePath &filePath, const Utils::TextFileFormat &format, const QString &data) const

详细说明

该类包含用于根据编码和行结束符设置保存及读取文本文件的辅助方法。

另请参阅 Utils::TextFileFormat 。

成员函数文档

Utils::TextFileFormat BaseTextDocument::format() const

返回上次调用read()时获得的格式。

Core::BaseTextDocument::ReadResult BaseTextDocument::read(const Utils::FilePath &filePath)

自动检测文件格式,并读取由filePath 指定的文本文件。

返回操作是否成功。

Utils::Result<> BaseTextDocument::write(const Utils::FilePath &filePath, const QString &data) const

输出文本文件filePath 的内容(data )。使用该文件上次调用read()时获取的格式。

返回操作是否成功。

Utils::Result<> BaseTextDocument::write(const Utils::FilePath &filePath, const Utils::TextFileFormat &format, const QString &data) const

输出文本文件filePath 的内容(data )。使用自定义格式format 。

返回操作是否成功。

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.