/
Value.ts
58 lines (51 loc) · 1.43 KB
/
Value.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
* @module Properties
*/
import { Primitives } from "./PrimitiveTypes";
import { PropertyRecord } from "./Record";
/**
* Enumeration for Format of the property value.
* @public
*/
export enum PropertyValueFormat {
Primitive,
Array,
Struct,
}
/** Base interface for a property value
* @public
*/
export interface BasePropertyValue {
valueFormat: PropertyValueFormat;
}
/** Primitive property value
* @public
*/
export interface PrimitiveValue extends BasePropertyValue {
valueFormat: PropertyValueFormat.Primitive;
value?: Primitives.Value;
displayValue?: string;
}
/** Struct property value
* @public
*/
export interface StructValue extends BasePropertyValue {
valueFormat: PropertyValueFormat.Struct;
members: { [name: string]: PropertyRecord };
}
/** Array property value
* @public
*/
export interface ArrayValue extends BasePropertyValue {
valueFormat: PropertyValueFormat.Array;
items: PropertyRecord[];
itemsTypeName: string;
}
/** Type for all property values
* @public
*/
export type PropertyValue = PrimitiveValue | StructValue | ArrayValue;