summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kamm <christian.d.kamm@nokia.com>2010-09-15 15:25:59 +0200
committerChristian Kamm <christian.d.kamm@nokia.com>2010-09-15 15:26:34 +0200
commit8df6dd6d7d04791ae0d014b50ceeff5d2212d31f (patch)
tree23a7a704a3ee44eab037c4947bbcf0afbc7d3070
parentee3ad439a892021709b2bd149c5371897b7da10d (diff)
downloadqt-creator-8df6dd6d7d04791ae0d014b50ceeff5d2212d31f.tar.gz
QmlJS: Add initial documentation for the base classes of the code model.
-rw-r--r--src/libs/qmljs/qmljsbind.cpp16
-rw-r--r--src/libs/qmljs/qmljsdocument.cpp41
-rw-r--r--src/libs/qmljs/qmljslink.cpp13
3 files changed, 70 insertions, 0 deletions
diff --git a/src/libs/qmljs/qmljsbind.cpp b/src/libs/qmljs/qmljsbind.cpp
index f6acc38b3e..9f94dd0381 100644
--- a/src/libs/qmljs/qmljsbind.cpp
+++ b/src/libs/qmljs/qmljsbind.cpp
@@ -39,6 +39,22 @@ using namespace QmlJS;
using namespace QmlJS::AST;
using namespace QmlJS::Interpreter;
+/*!
+ \class QmlJS::Bind
+ \brief Collected information about a single Document.
+ \sa QmlJS::Document QmlJS::Link
+
+ Each QmlJS::Document owns a instance of Bind. It provides access to data
+ that can be derived by looking at the document in isolation. If you need
+ information that goes beyond that, you need to create a
+ \l{QmlJS::Interpreter::Context} using \l{QmlJS::Link}.
+
+ The document's imports are classified and available through fileImports(),
+ directoryImports() and libraryImports().
+
+ It allows AST to code model lookup through findQmlObject() and findFunctionScope().
+*/
+
Bind::Bind(Document *doc)
: _doc(doc),
_currentObjectValue(0),
diff --git a/src/libs/qmljs/qmljsdocument.cpp b/src/libs/qmljs/qmljsdocument.cpp
index 8cad21c1d4..c1d9d7f3cb 100644
--- a/src/libs/qmljs/qmljsdocument.cpp
+++ b/src/libs/qmljs/qmljsdocument.cpp
@@ -39,6 +39,47 @@
using namespace QmlJS;
using namespace QmlJS::AST;
+/*!
+ \class QmlJS::Document
+ \brief A Qml or JavaScript document.
+ \sa QmlJS::Snapshot
+
+ Documents are usually created by the \l{QmlJSEditor::Internal::ModelManager}
+ and stored in a \l{QmlJS::Snapshot}. They allow access to data such as
+ the file path, source code, abstract syntax tree and the \l{QmlJS::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 \l{Document::Ptr}.
+*/
+
+/*!
+ \class QmlJS::LibraryInfo
+ \brief A Qml library.
+ \sa QmlJS::Snapshot
+
+ A LibraryInfo is created when the \l{QmlJSEditor::Internal::ModelManager} finds
+ a Qml library and parses the qmldir file. The instance holds information about
+ which Components the library provides and which plugins to load.
+
+ The ModelManager will try to extract detailed information about the types
+ defined in the plugins this library loads. Once it is done, the data will
+ be available through the metaObjects() function.
+*/
+
+/*!
+ \class QmlJS::Snapshot
+ \brief A set of Document::Ptr and LibraryInfo instances.
+ \sa QmlJS::Document QmlJS::LibraryInfo
+
+ A Snapshot holds and offers access to a set of Document and LibraryInfo instances.
+
+ Usually Snapshots are copies of the snapshot maintained and updated by the
+ \l{QmlJSEditor::Internal::ModelManager} that updates its instance as parsing
+ threads finish and new information becomes available.
+*/
+
+
Document::Document(const QString &fileName)
: _engine(0)
, _pool(0)
diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp
index 5cab864e7e..583a884f78 100644
--- a/src/libs/qmljs/qmljslink.cpp
+++ b/src/libs/qmljs/qmljslink.cpp
@@ -43,6 +43,19 @@ using namespace QmlJS;
using namespace QmlJS::Interpreter;
using namespace QmlJS::AST;
+/*!
+ \class QmlJS::Link
+ \brief Initializes the Context for a Document.
+ \sa QmlJS::Document QmlJS::Interpreter::Context
+
+ Initializes a context by resolving imports and building the root scope
+ chain. Currently, this is a expensive operation.
+
+ It's recommended to use a the \l{LookupContext} returned by
+ \l{QmlJSEditor::SemanticInfo::lookupContext()} instead of building a new
+ \l{Context} with \l{Link}.
+*/
+
Link::Link(Context *context, const Document::Ptr &doc, const Snapshot &snapshot,
const QStringList &importPaths)
: _doc(doc)