UNPKG

@itwin/ecschema-metadata

Version:

ECObjects core concepts in typescript

100 lines 4.89 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module Metadata */ Object.defineProperty(exports, "__esModule", { value: true }); exports.PropertyTypeUtils = exports.PropertyType = void 0; exports.propertyTypeToString = propertyTypeToString; const Exception_1 = require("./Exception"); var PropertyFlags; (function (PropertyFlags) { PropertyFlags[PropertyFlags["Primitive"] = 1] = "Primitive"; PropertyFlags[PropertyFlags["Struct"] = 2] = "Struct"; PropertyFlags[PropertyFlags["Array"] = 4] = "Array"; PropertyFlags[PropertyFlags["Navigation"] = 8] = "Navigation"; PropertyFlags[PropertyFlags["Enumeration"] = 16] = "Enumeration"; })(PropertyFlags || (PropertyFlags = {})); /** * @public @preview */ var PropertyType; (function (PropertyType) { PropertyType[PropertyType["Struct"] = 2] = "Struct"; PropertyType[PropertyType["Struct_Array"] = 6] = "Struct_Array"; PropertyType[PropertyType["Navigation"] = 8] = "Navigation"; PropertyType[PropertyType["Binary"] = 257] = "Binary"; PropertyType[PropertyType["Binary_Array"] = 261] = "Binary_Array"; PropertyType[PropertyType["Boolean"] = 513] = "Boolean"; PropertyType[PropertyType["Boolean_Array"] = 517] = "Boolean_Array"; PropertyType[PropertyType["DateTime"] = 769] = "DateTime"; PropertyType[PropertyType["DateTime_Array"] = 773] = "DateTime_Array"; PropertyType[PropertyType["Double"] = 1025] = "Double"; PropertyType[PropertyType["Double_Array"] = 1029] = "Double_Array"; PropertyType[PropertyType["Integer"] = 1281] = "Integer"; PropertyType[PropertyType["Integer_Array"] = 1285] = "Integer_Array"; PropertyType[PropertyType["Integer_Enumeration"] = 1297] = "Integer_Enumeration"; PropertyType[PropertyType["Integer_Enumeration_Array"] = 1301] = "Integer_Enumeration_Array"; PropertyType[PropertyType["Long"] = 1537] = "Long"; PropertyType[PropertyType["Long_Array"] = 1541] = "Long_Array"; PropertyType[PropertyType["Point2d"] = 1793] = "Point2d"; PropertyType[PropertyType["Point2d_Array"] = 1797] = "Point2d_Array"; PropertyType[PropertyType["Point3d"] = 2049] = "Point3d"; PropertyType[PropertyType["Point3d_Array"] = 2053] = "Point3d_Array"; PropertyType[PropertyType["String"] = 2305] = "String"; PropertyType[PropertyType["String_Array"] = 2309] = "String_Array"; PropertyType[PropertyType["String_Enumeration"] = 2321] = "String_Enumeration"; PropertyType[PropertyType["String_Enumeration_Array"] = 2325] = "String_Enumeration_Array"; PropertyType[PropertyType["IGeometry"] = 2561] = "IGeometry"; PropertyType[PropertyType["IGeometry_Array"] = 2565] = "IGeometry_Array"; })(PropertyType || (exports.PropertyType = PropertyType = {})); /** @internal */ var PropertyTypeUtils; (function (PropertyTypeUtils) { function isArray(type) { return (type === (PropertyFlags.Array | type)); } PropertyTypeUtils.isArray = isArray; function isPrimitive(type) { return (type === (PropertyFlags.Primitive | type)); } PropertyTypeUtils.isPrimitive = isPrimitive; function isStruct(type) { return (type === (PropertyFlags.Struct | type)); } PropertyTypeUtils.isStruct = isStruct; function isNavigation(type) { return (type === (PropertyFlags.Navigation | type)); } PropertyTypeUtils.isNavigation = isNavigation; function isEnumeration(type) { return (type === (PropertyFlags.Enumeration | type)); } PropertyTypeUtils.isEnumeration = isEnumeration; function asArray(type) { return type | PropertyFlags.Array; } PropertyTypeUtils.asArray = asArray; function getPrimitiveType(type) { return (0xFF01 & type); } PropertyTypeUtils.getPrimitiveType = getPrimitiveType; function fromPrimitiveType(type) { return type | 0; } PropertyTypeUtils.fromPrimitiveType = fromPrimitiveType; })(PropertyTypeUtils || (exports.PropertyTypeUtils = PropertyTypeUtils = {})); /** @internal */ function propertyTypeToString(type) { if (PropertyTypeUtils.isPrimitive(type)) return (PropertyTypeUtils.isArray(type)) ? "PrimitiveArrayProperty" : "PrimitiveProperty"; if (PropertyTypeUtils.isStruct(type)) return (PropertyTypeUtils.isArray(type)) ? "StructArrayProperty" : "StructProperty"; if (PropertyTypeUtils.isNavigation(type)) return "NavigationProperty"; throw new Exception_1.ECSchemaError(Exception_1.ECSchemaStatus.InvalidType, "Invalid propertyType"); } //# sourceMappingURL=PropertyTypes.js.map