Extending Qt Creator Manual | Value

Extending Qt Creator Manual 4.7.0

# Value Class

(QmlJS::Value)

The Value class is an abstract base class for the result of a JS expression. More...

Header: | #include <Value>

- List of all members, including inherited members

## Public Functions

| Value()
virtual | ~Value()
virtual void | accept(QmlJS::ValueVisitor *) const = 0
virtual const QmlJS::AnchorLineValue * | asAnchorLineValue() const
virtual const QmlJS::ASTFunctionValue * | asAstFunctionValue() const
virtual const QmlJS::ASTObjectValue * | asAstObjectValue() const
virtual const QmlJS::ASTPropertyReference * | asAstPropertyReference() const
virtual const QmlJS::ASTSignal * | asAstSignal() const
virtual const QmlJS::ASTVariableReference * | asAstVariableReference() const
virtual const QmlJS::BooleanValue * | asBooleanValue() const
virtual const QmlJS::ColorValue * | asColorValue() const
virtual const QmlJS::CppComponentValue * | asCppComponentValue() const
virtual const QmlJS::Function * | asFunction() const
virtual const QmlJS::FunctionValue * | asFunctionValue() const
virtual const QmlJS::IntValue * | asIntValue() const
virtual const QmlJS::JSImportScope * | asJSImportScope() const
virtual const QmlJS::MetaFunction * | asMetaFunction() const
virtual const QmlJS::NullValue * | asNullValue() const
virtual const QmlJS::NumberValue * | asNumberValue() const
virtual const QmlJS::ObjectValue * | asObjectValue() const
virtual const QmlJS::QmlEnumValue * | asQmlEnumValue() const
virtual const QmlJS::QmlPrototypeReference * | asQmlPrototypeReference() const
virtual const Internal::QtObjectPrototypeReference * | asQtObjectPrototypeReference() const
virtual const QmlJS::RealValue * | asRealValue() const
virtual const QmlJS::Reference * | asReference() const
virtual const QmlJS::StringValue * | asStringValue() const
virtual const QmlJS::TypeScope * | asTypeScope() const
virtual const QmlJS::UndefinedValue * | asUndefinedValue() const
virtual const QmlJS::UnknownValue * | asUnknownValue() const
virtual const QmlJS::UrlValue * | asUrlValue() const
virtual bool | getSourceLocation(QString *fileName, int *line, int *column) const

## Detailed Description

The Value class is an abstract base class for the result of a JS expression.

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 ValueVisitors 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:

- Evaluate
- Context::lookupType() and Context::lookupReference()
- ScopeChain::lookup()
- ObjectValue::lookupMember()

See also Evaluate, ValueOwner, and ValueVisitor.

## Member Function Documentation

### Value::Value()

Default constructs an instance of Value.

### `[virtual]` Value::~Value()

Destroys the instance of Value. The destructor is virtual.

### `[pure virtual]` void Value::accept(QmlJS::ValueVisitor *) const

### `[virtual]` const QmlJS::AnchorLineValue *Value::asAnchorLineValue() const

### `[virtual]` const QmlJS::ASTFunctionValue *Value::asAstFunctionValue() const

### `[virtual]` const QmlJS::ASTObjectValue *Value::asAstObjectValue() const

### `[virtual]` const QmlJS::ASTPropertyReference *Value::asAstPropertyReference() const

### `[virtual]` const QmlJS::ASTSignal *Value::asAstSignal() const

### `[virtual]` const QmlJS::ASTVariableReference *Value::asAstVariableReference() const

### `[virtual]` const QmlJS::BooleanValue *Value::asBooleanValue() const

### `[virtual]` const QmlJS::ColorValue *Value::asColorValue() const

### `[virtual]` const QmlJS::CppComponentValue *Value::asCppComponentValue() const

### `[virtual]` const QmlJS::Function *Value::asFunction() const

### `[virtual]` const QmlJS::FunctionValue *Value::asFunctionValue() const

### `[virtual]` const QmlJS::IntValue *Value::asIntValue() const

### `[virtual]` const QmlJS::JSImportScope *Value::asJSImportScope() const

### `[virtual]` const QmlJS::MetaFunction *Value::asMetaFunction() const

### `[virtual]` const QmlJS::NullValue *Value::asNullValue() const

### `[virtual]` const QmlJS::NumberValue *Value::asNumberValue() const

### `[virtual]` const QmlJS::ObjectValue *Value::asObjectValue() const

### `[virtual]` const QmlJS::QmlEnumValue *Value::asQmlEnumValue() const

### `[virtual]` const QmlJS::QmlPrototypeReference *Value::asQmlPrototypeReference() const

### `[virtual]` const Internal::QtObjectPrototypeReference *Value::asQtObjectPrototypeReference() const

### `[virtual]` const QmlJS::RealValue *Value::asRealValue() const

### `[virtual]` const QmlJS::Reference *Value::asReference() const

### `[virtual]` const QmlJS::StringValue *Value::asStringValue() const

### `[virtual]` const QmlJS::TypeScope *Value::asTypeScope() const

### `[virtual]` const QmlJS::UndefinedValue *Value::asUndefinedValue() const

### `[virtual]` const QmlJS::UnknownValue *Value::asUnknownValue() const

### `[virtual]` const QmlJS::UrlValue *Value::asUrlValue() const

### `[virtual]` bool Value::getSourceLocation(QString *fileName, int *line, int *column) const