Extending Qt Creator Manual | Context

Extending Qt Creator Manual 4.5.2

# Context Class

(QmlJS::Context)

The Context class holds information about relationships between documents in a Snapshot. More...

Header: | #include <Context>

- List of all members, including inherited members

## Public Types

typedef | ImportsPerDocument

## Public Functions

| ~Context()
QString | defaultPropertyName(const ObjectValue *object) const
const Imports * | imports(const Document *doc) const
const Value * | lookupReference(const Value *value) const
const ObjectValue * | lookupType(const Document *doc, AST::UiQualifiedId *qmlTypeName, AST::UiQualifiedId *qmlTypeNameEnd = 0) const
const ObjectValue * | lookupType(const Document *doc, const QStringList &qmlTypeName) const
ContextPtr | ptr() const
Snapshot | snapshot() const
ValueOwner * | valueOwner() const
ViewerContext | viewerContext() const

## Static Public Members

ContextPtr | create(const Snapshot &snapshot, ValueOwner *valueOwner, const ImportsPerDocument &imports, const ViewerContext &viewerContext)

## Detailed Description

The Context class holds information about relationships between documents in a Snapshot.

Contexts are usually created through Link. Once created, a Context is immutable and can be freely shared between threads.

Their main purpose is to allow lookup of types with lookupType() and resolving of references through lookupReference(). As such, they form the basis for creating a ScopeChain.

Information about the imports of a Document can be accessed with imports().

When dealing with a QmlJSEditor::QmlJSEditorDocument it is unnecessary to construct a new Context manually. Instead use QmlJSEditorDocument::semanticInfo()::context.

See also Document, Link, and Snapshot.

## Member Type Documentation

### typedef Context::ImportsPerDocument

## Member Function Documentation

### Context::~Context()

Destroys the instance of Context.

### `[static]` ContextPtr Context::create(const Snapshot &snapshot, ValueOwner *valueOwner, const ImportsPerDocument &imports, const ViewerContext &viewerContext)

### QString Context::defaultPropertyName(const ObjectValue *object) const

### const Imports *Context::imports(const Document *doc) const

### const Value *Context::lookupReference(const Value *value) const

### const ObjectValue *Context::lookupType(const Document *doc, AST::UiQualifiedId *qmlTypeName, AST::UiQualifiedId *qmlTypeNameEnd = 0) const

### const ObjectValue *Context::lookupType(const Document *doc, const QStringList &qmlTypeName) const

### ContextPtr Context::ptr() const

### Snapshot Context::snapshot() const

### ValueOwner *Context::valueOwner() const

### ViewerContext Context::viewerContext() const