BaseTextDocument 类
class Core::BaseTextDocumentBaseTextDocument 类是一个用于与文本一起工作的非常通用的基类。 更多信息...
头文件 | #include <coreplugin/textdocument.h> |
继承自 | Core::IDocument |
公共函数
Utils::TextFileFormat | format() const |
Core::BaseTextDocument::ReadResult | read(const Utils::FilePath &filePath, QStringList *plainTextList, QString *errorString) |
Core::BaseTextDocument::ReadResult | read(const Utils::FilePath &filePath, QString *plainText, QString *errorString) |
bool | write(const Utils::FilePath &filePath, const QString &data, QString *errorMessage) const |
bool | write(const Utils::FilePath &filePath, const Utils::TextFileFormat &format, const QString &data, QString *errorMessage) const |
另请参阅 Utils::TextFileFormat.
成员函数文档
Utils::TextFileFormat BaseTextDocument::format() const
返回从最后一次调用 read() 获得的格式。
Core::BaseTextDocument::ReadResult BaseTextDocument::read(const Utils::FilePath &filePath, QStringList *plainTextList, QString *errorString)
自动检测文件格式并将由 filePath 指定的文本文件读入由 plainTextList 指定的字符串列表中。
如果在写入文件时发生错误,errorString 将设置为错误详情。
返回操作是否成功。
Core::BaseTextDocument::ReadResult BaseTextDocument::read(const Utils::FilePath &filePath, QString *plainText, QString *errorString)
自动检测文件格式并将由 filePath 指定的文本文件读入 plainText 中。
如果在写入文件时发生错误,errorString 将设置为错误详情。
返回操作是否成功。
bool BaseTextDocument::write(const Utils::FilePath &filePath, const QString &data, QString *errorMessage) const
将字符串文件 filePath 的内容(data)写入。使用上次从文件中读取的格式。
如果在写入文件时发生错误,errorMessage将设置错误详情。
返回操作是否成功。
bool BaseTextDocument::write(const Utils::FilePath &filePath, const Utils::TextFileFormat &format, const QString &data, QString *errorMessage) const
将文本文件filePath的内容(data)写入。使用自定义格式format。
如果在写入文件时发生错误,errorMessage将设置错误详情。
返回操作是否成功。
©2024 The Qt Company Ltd. 本文档中的文档贡献均为各自所有者的版权。本处提供的文档是根据自由软件基金会发布的GNU自由文档许可证版本1.3的条款许可的。Qt以及相应标志为芬兰和其他国家的The Qt Company Ltd的商标。所有其他商标均为各自所有者的财产。