Value Class | Extending Qt Creator Manual

Extending Qt Creator Manual | Value

Extending Qt Creator Manual 4.3.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(ValueVisitor *) const = 0
virtual const AnchorLineValue * | asAnchorLineValue() const
virtual const ASTFunctionValue * | asAstFunctionValue() const
virtual const ASTObjectValue * | asAstObjectValue() const
virtual const ASTPropertyReference * | asAstPropertyReference() const
virtual const ASTSignal * | asAstSignal() const
virtual const ASTVariableReference * | asAstVariableReference() const
virtual const BooleanValue * | asBooleanValue() const
virtual const ColorValue * | asColorValue() const
virtual const CppComponentValue * | asCppComponentValue() const
virtual const Function * | asFunction() const
virtual const FunctionValue * | asFunctionValue() const
virtual const IntValue * | asIntValue() const
virtual const JSImportScope * | asJSImportScope() const
virtual const MetaFunction * | asMetaFunction() const
virtual const NullValue * | asNullValue() const
virtual const NumberValue * | asNumberValue() const
virtual const ObjectValue * | asObjectValue() const
virtual const QmlEnumValue * | asQmlEnumValue() const
virtual const QmlPrototypeReference * | asQmlPrototypeReference() const
virtual const Internal::QtObjectPrototypeReference * | asQtObjectPrototypeReference() const
virtual const RealValue * | asRealValue() const
virtual const Reference * | asReference() const
virtual const StringValue * | asStringValue() const
virtual const TypeScope * | asTypeScope() const
virtual const UndefinedValue * | asUndefinedValue() const
virtual const UnknownValue * | asUnknownValue() const
virtual const 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(ValueVisitor *) const

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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