QmlJS: Add documentation for QmlJS::Value.

Also:
* Remove unnecessary QmlJS:: qualifications in existing documentation.
* Remove unnecessary explicit links in the documentation.

Change-Id: Icb41941d98b5cfe9d2fb3b3887fafee16635eb13
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
Christian Kamm
2011-11-09 16:02:59 +01:00
parent 35cad941c9
commit dfd58916cd
5 changed files with 46 additions and 18 deletions

View File

@@ -48,17 +48,16 @@ using namespace QmlJS::AST;
/*! /*!
\class QmlJS::Bind \class QmlJS::Bind
\brief Collected information about a single Document. \brief Collected information about a single Document.
\sa QmlJS::Document QmlJS::Context \sa Document Context
Each QmlJS::Document owns an instance of Bind. It provides access to data Each Document owns an instance of Bind. It provides access to data
that can be derived by looking at the document in isolation. If you need that can be derived by looking at the document in isolation. If you need
information that goes beyond that, you need to use a information that goes beyond that, you need to use a Context.
\l{QmlJS::Context}.
The document's imports are classified and available through imports(). The document's imports are classified and available through imports().
This class makes the structural information found in the AST available This class makes the structural information found in the AST available
for analysis through \l{QmlJS::Value} instances. See findQmlObject(), for analysis through Value instances. See findQmlObject(),
idEnvironment(), rootObjectValue() and findAttachedJSScope(). idEnvironment(), rootObjectValue() and findAttachedJSScope().
*/ */

View File

@@ -39,10 +39,10 @@ using namespace QmlJS::AST;
/*! /*!
\class QmlJS::Context \class QmlJS::Context
\brief Holds information about relationships between documents in a QmlJS::Snapshot. \brief Holds information about relationships between documents in a Snapshot.
\sa QmlJS::Document QmlJS::Link QmlJS::Snapshot \sa Document Link Snapshot
Contexts are usually created through \l{QmlJS::Link}. Contexts are usually created through Link.
Once created, a Context is immutable and can be freely shared between threads. Once created, a Context is immutable and can be freely shared between threads.

View File

@@ -44,15 +44,15 @@ using namespace QmlJS::AST;
/*! /*!
\class QmlJS::Document \class QmlJS::Document
\brief A Qml or JavaScript document. \brief A Qml or JavaScript document.
\sa QmlJS::Snapshot \sa Snapshot
Documents are usually created by the \l{QmlJS::ModelManagerInterface} Documents are usually created by the ModelManagerInterface
and stored in a \l{QmlJS::Snapshot}. They allow access to data such as and stored in a Snapshot. They allow access to data such as
the file path, source code, abstract syntax tree and the \l{QmlJS::Bind} the file path, source code, abstract syntax tree and the Bind
instance for the document. instance for the document.
To make sure unused and outdated documents are removed correctly, Document To make sure unused and outdated documents are removed correctly, Document
instances are usually accessed through a shared pointer, see \l{Document::Ptr}. instances are usually accessed through a shared pointer, see Document::Ptr.
Documents in a Snapshot are immutable: They, or anything reachable through them, 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 must not be changed. This allows Documents to be shared freely among threads
@@ -62,9 +62,9 @@ using namespace QmlJS::AST;
/*! /*!
\class QmlJS::LibraryInfo \class QmlJS::LibraryInfo
\brief A Qml library. \brief A Qml library.
\sa QmlJS::Snapshot \sa Snapshot
A LibraryInfo is created when the \l{QmlJS::ModelManagerInterface} finds A LibraryInfo is created when the ModelManagerInterface finds
a Qml library and parses the qmldir file. The instance holds information about a Qml library and parses the qmldir file. The instance holds information about
which Components the library provides and which plugins to load. which Components the library provides and which plugins to load.
@@ -76,12 +76,12 @@ using namespace QmlJS::AST;
/*! /*!
\class QmlJS::Snapshot \class QmlJS::Snapshot
\brief A set of Document::Ptr and LibraryInfo instances. \brief A set of Document::Ptr and LibraryInfo instances.
\sa QmlJS::Document QmlJS::LibraryInfo \sa Document LibraryInfo
A Snapshot holds and offers access to a set of Document and LibraryInfo instances. 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 Usually Snapshots are copies of the snapshot maintained and updated by the
\l{QmlJS::ModelManagerInterface} that updates its instance as parsing ModelManagerInterface that updates its instance as parsing
threads finish and new information becomes available. threads finish and new information becomes available.
*/ */

View File

@@ -61,6 +61,35 @@ using namespace LanguageUtils;
using namespace QmlJS; using namespace QmlJS;
using namespace QmlJS::AST; using namespace QmlJS::AST;
/*!
\class QmlJS::Value
\brief Abstract base class for the result of a JS expression.
\sa Evaluate ValueOwner ValueVisitor
A Value represents a category of JavaScript values, such as number
(NumberValue), string (StringValue) or functions with a
specific signature (FunctionValue). It can also represent internal
categories such as "a QML component instantiation defined in a file"
(ASTObjectValue), "a QML component defined in C++"
(CppComponentValue) or "no specific information is available"
(UnknownValue).
The Value class itself provides accept() for admitting
\l{ValueVisitor}s and a do-nothing getSourceLocation().
Value instances should be cast to a derived type either through the
asXXX() helper functions such as asNumberValue() or via the
value_cast() template function.
Values are the result of many operations in the QmlJS code model:
\list
\o \l{Evaluate}
\o Context::lookupType() and Context::lookupReference()
\o ScopeChain::lookup()
\o ObjectValue::lookupMember()
\endlist
*/
namespace { namespace {
class LookupMember: public MemberProcessor class LookupMember: public MemberProcessor

View File

@@ -126,7 +126,7 @@ public:
/*! /*!
\class QmlJS::Link \class QmlJS::Link
\brief Creates a Context for a Snapshot. \brief Creates a Context for a Snapshot.
\sa QmlJS::Context QmlJS::Snapshot \sa Context Snapshot
Initializes a context by resolving imports. This is an expensive operation. Initializes a context by resolving imports. This is an expensive operation.