Core::BaseTextDocument Class
class Core::BaseTextDocumentThe BaseTextDocument class is a very general base class for documents that work with text. More...
Header: | #include <coreplugin/textdocument.h> |
Inherits: | Core::IDocument |
Public Functions
Utils::TextFileFormat | format() const |
Core::BaseTextDocument::ReadResult | read(const Utils::FilePath &filePath, QString *plainText) |
Core::BaseTextDocument::ReadResult | read(const Utils::FilePath &filePath, QStringList *plainTextList) |
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 |
Detailed Description
This class contains helper methods for saving and reading text files with encoding and line ending settings.
See also Utils::TextFileFormat.
Member Function Documentation
Utils::TextFileFormat BaseTextDocument::format() const
Returns the format obtained from the last call to read().
Core::BaseTextDocument::ReadResult BaseTextDocument::read(const Utils::FilePath &filePath, QString *plainText)
Autodetects file format and reads the text file specified by filePath into plainText.
Returns whether the operation was successful.
Core::BaseTextDocument::ReadResult BaseTextDocument::read(const Utils::FilePath &filePath, QStringList *plainTextList)
Autodetects file format and reads the text file specified by filePath into a list of strings specified by plainTextList.
Returns whether the operation was successful.
Utils::Result<> BaseTextDocument::write(const Utils::FilePath &filePath, const QString &data) const
Writes out the contents (data) of the text file filePath. Uses the format obtained from the last read() of the file.
Returns whether the operation was successful.
Utils::Result<> BaseTextDocument::write(const Utils::FilePath &filePath, const Utils::TextFileFormat &format, const QString &data) const
Writes out the contents (data) of the text file filePath. Uses the custom format format.
Returns whether the operation was successful.