/** @packageDocumentation * @module Quantity */ /** The regular expression to parse [format strings]($docs/bis/ec/kindofquantity.md#format-string) * provided in serialized formats as well as the full name of an [[OverrideFormat]]. * * `formatName(precision)[unitName|unitLabel][unitName|unitLabel][unitName|unitLabel][unitName|unitLabel]` * * Explanation of the regex: * - ([\w.:]+) * - Grabs the format full name * - (\(([^\)]+)\))? * - Grabs the precision part with and without the `()`. * - The parentheses are needed to validate the entire string. (TODO: Need to check if this is true) * - (\[([^\|\]]+)([\|])?([^\]]+)?\])? * - 4 of these make up the rest of the regex, none of them are required so each end in `?` * - Grabs the unit name and label including the `[]` * - Grabs the unit name, `|` and label separately * @internal */ export declare const formatStringRgx: RegExp; /** @internal */ export declare function getItemNamesFromFormatString(formatString: string): Iterable; /** @beta */ export declare enum FormatTraits { Uninitialized = 0, /** Show trailing zeroes to requested precision. */ TrailZeroes = 1, /** Indicates that the fractional part of the number is required when the fraction is zero */ KeepSingleZero = 2, /** Zero magnitude returns blank display value */ ZeroEmpty = 4, /** Show decimal point when value to right of decimal is empty */ KeepDecimalPoint = 8, /** Use the rounding factor. Not yet supported */ ApplyRounding = 16, /** Show a dash between whole value and fractional value */ FractionDash = 32, /** Append the quantity's unit label */ ShowUnitLabel = 64, /** Prepend unit label. Not yet supported */ PrependUnitLabel = 128, /** show a grouping in each group of 1000. */ Use1000Separator = 256, /** Indicates that if an exponent value is positive to not include a `+`. By default a sign, `+` or `-`, is always shown. Not yet supported */ ExponentOnlyNegative = 512 } /** Precision for Fractional formatted value types. Values must be powers of 2, ranging from Whole (1/1) through 1/256. * @beta */ export declare enum FractionalPrecision { One = 1, Two = 2, Four = 4, Eight = 8, Sixteen = 16, ThirtyTwo = 32, SixtyFour = 64, OneHundredTwentyEight = 128, TwoHundredFiftySix = 256 } /** Precision for Decimal, Scientific, and Station formatted value types. Range from 1/(10^0) through 1/(10^12). * @beta */ export declare enum DecimalPrecision { Zero = 0, One = 1, Two = 2, Three = 3, Four = 4, Five = 5, Six = 6, Seven = 7, Eight = 8, Nine = 9, Ten = 10, Eleven = 11, Twelve = 12 } /** Supported format types * @beta */ export declare enum FormatType { /** Decimal display (ie 2.125) */ Decimal = "Decimal", /** Fractional display (ie 2-1/8) */ Fractional = "Fractional", /** Scientific Notation (ie 1.04e3) */ Scientific = "Scientific", /** Civil Engineering Stationing (ie 1+00). */ Station = "Station", /** Bearing angle e.g. N05:00:00E. Requires provided quantities to be of the angle phenomenon */ Bearing = "Bearing", /** Azimuth angle e.g. 45°30'00". Requires provided quantities to be of the angle phenomenon */ Azimuth = "Azimuth", /** Ratio display e,g. 1:2 or 0.3:1. */ Ratio = "Ratio" } /** required if type is scientific * @beta */ export declare enum ScientificType { /** Non-zero value left of decimal point (ie 1.2345e3) */ Normalized = "Normalized", /** Zero value left of decimal point (ie 0.12345e4) */ ZeroNormalized = "ZeroNormalized" } /** required if type is ratio * @beta */ export declare enum RatioType { /** One to N ratio (ie 1:N) */ OneToN = "OneToN", /** N to One ratio (ie N:1) */ NToOne = "NToOne", /** the lesser value scales to 1. e.g. input 0.5 turns into 2:1 | input 2 turns into 1:2 */ ValueBased = "ValueBased", /** scales the input ratio to its simplest integer form using the greatest common divisor (GCD) of the values. e.g. 0.3 turns into 3:10 */ UseGreatestCommonDivisor = "UseGreatestCommonDivisor" } /** The format type for the numbers within a ratio. * @beta */ export declare enum RatioFormatType { /** Decimal display (ie 2.125) */ Decimal = "Decimal", /** Fractional display (ie 2-1/8) */ Fractional = "Fractional" } /** Determines how the sign of values are displayed * @beta */ export declare enum ShowSignOption { /** Never show a sign even if the value is negative. */ NoSign = "NoSign", /** Only show a sign when the value is negative. */ OnlyNegative = "OnlyNegative", /** Always show a sign whether the value is positive or negative. */ SignAlways = "SignAlways", /** Only show a sign when the value is negative but use parentheses instead of a negative sign. For example, -10 is formatted as `(10)`. */ NegativeParentheses = "NegativeParentheses" } /** * @beta * @deprecated in 4.10 - might be removed in next major version. ScientificType is now a string enum and doesn't need a serialization method. You can access the enum directly. */ export declare function scientificTypeToString(scientificType: ScientificType): string; /** * @beta */ export declare function parseScientificType(scientificType: string, formatName: string): ScientificType; /** @beta */ export declare function parseRatioType(ratioType: string, formatName: string): RatioType; /** @beta */ export declare function parseRatioFormatType(ratioFormatType: string, formatName: string): RatioFormatType; /** @beta */ export declare function parseShowSignOption(showSignOption: string, formatName: string): ShowSignOption; /** * @beta * @deprecated in 4.10 - might be removed in next major version. ShowSignOption is now a string enum and doesn't need a serialization method. You can access the enum directly. */ export declare function showSignOptionToString(showSign: ShowSignOption): string; /** @beta */ export declare function parseFormatTrait(formatTraitsString: string, formatName: string): FormatTraits; /** @beta */ export declare function getTraitString(trait: FormatTraits): "trailZeroes" | "keepSingleZero" | "zeroEmpty" | "keepDecimalPoint" | "applyRounding" | "fractionDash" | "showUnitLabel" | "prependUnitLabel" | "use1000Separator" | "exponentOnlyNegative"; /** @beta */ export declare function formatTraitsToArray(currentFormatTrait: FormatTraits): string[]; /** @beta */ export declare function parseFormatType(jsonObjType: string, formatName: string): FormatType; /** @beta * @deprecated in 4.10 - might be removed in next major version. FormatType is now a string enum and doesn't need a serialization method. You can access the enum directly. */ export declare function formatTypeToString(type: FormatType): string; /** @beta */ export declare function parseDecimalPrecision(jsonObjPrecision: number, formatName: string): DecimalPrecision; /** @beta validates the input value, that is typically extracted for persisted JSON data, is a valid FractionalPrecision */ export declare function parseFractionalPrecision(jsonObjPrecision: number, formatName: string): FractionalPrecision; /** @beta validates the input value, that is typically extracted for persisted JSON data, is a valid DecimalPrecision or FractionalPrecision. */ export declare function parsePrecision(precision: number, type: FormatType, formatName: string): DecimalPrecision | FractionalPrecision; //# sourceMappingURL=FormatEnums.d.ts.map