Document Class


The Document class creates a QML or JavaScript document. More...

Header: #include <Document>

Public Types

typedef MutablePtr
typedef Ptr

Public Functions

AST::Node *ast() const
Bind *bind() const
QString componentName() const
QList<DiagnosticMessage> diagnosticMessages() const
int editorRevision() const
const QmlJS::Engine *engine() const
AST::ExpressionNode *expression() const
QString fileName() const
QByteArray fingerprint() const
QString importId() const
bool isParsedCorrectly() const
bool isQmlDocument() const
QList<AST::SourceLocation> jsDirectives() const
AST::Program *jsProgram() const
Dialect language() const
bool parse()
bool parseExpression()
bool parseJavaScript()
bool parseQml()
QString path() const
Document::Ptr ptr() const
AST::UiProgram *qmlProgram() const
void setEditorRevision(int revision)
void setLanguage(Dialect l)
void setSource(const QString &source)
QString source() const

Static Public Members

MutablePtr create(const QString &fileName, Dialect language)

Protected Functions

Document(const QString &fileName, Dialect language)

Detailed Description

The Document class creates a QML or JavaScript document.

Documents are usually created by the ModelManagerInterface and stored in a Snapshot. They allow access to data such as the file path, source code, abstract syntax tree and the Bind instance for the document.

To make sure unused and outdated documents are removed correctly, Document instances are usually accessed through a shared pointer, see Document::Ptr.

Documents in a Snapshot are immutable: They, or anything reachable through them, must not be changed. This allows Documents to be shared freely among threads without extra synchronization.

See also Snapshot.

Member Type Documentation

typedef Document::MutablePtr

typedef Document::Ptr

Member Function Documentation

[protected] Document::Document(const QString &fileName, Dialect language)

Default constructs an instance of Document.


Destroys the instance of Document.

AST::Node *Document::ast() const

Bind *Document::bind() const

QString Document::componentName() const

[static] MutablePtr Document::create(const QString &fileName, Dialect language)

QList<DiagnosticMessage> Document::diagnosticMessages() const

int Document::editorRevision() const

See also setEditorRevision().

const QmlJS::Engine *Document::engine() const

AST::ExpressionNode *Document::expression() const

QString Document::fileName() const

QByteArray Document::fingerprint() const

QString Document::importId() const

bool Document::isParsedCorrectly() const

bool Document::isQmlDocument() const

QList<AST::SourceLocation> Document::jsDirectives() const

AST::Program *Document::jsProgram() const

Dialect Document::language() const

See also setLanguage().

bool Document::parse()

bool Document::parseExpression()

bool Document::parseJavaScript()

bool Document::parseQml()

QString Document::path() const

Document::Ptr Document::ptr() const

AST::UiProgram *Document::qmlProgram() const

void Document::setEditorRevision(int revision)

See also editorRevision().

void Document::setLanguage(Dialect l)

See also language().

void Document::setSource(const QString &source)

See also source().

QString Document::source() const

See also setSource().