import { BrsNumber, BrsType } from "."; import { Boxable } from "./Boxing"; import { RoString } from "./components/RoString"; import { roBoolean } from "./components/RoBoolean"; import { RoInvalid } from "./components/RoInvalid"; /** Set of values supported in BrightScript. */ export declare enum ValueKind { Interface = 0, Invalid = 1, Boolean = 2, String = 3, Int32 = 4, Int64 = 5, Float = 6, Double = 7, Callable = 8, Uninitialized = 9, Dynamic = 10, Void = 11, Object = 12 } export declare namespace ValueKind { /** * Converts a `ValueKind` enum member to a human-readable string representation. * @returns a textual representation of the provided value kind. */ function toString(kind: ValueKind): string; /** * Fetches a `ValueKind` enum member by its string representation. * @param kind the string representation of a `ValueKind` * @returns the corresponding `ValueKind` if one exists, otherwise `undefined`. */ function fromString(kind: string): ValueKind | undefined; } /** * Converts the data type of a field to the appropriate value kind. * @param type data type of field */ export declare function getValueKindFromFieldType(type: string): ValueKind.Invalid | ValueKind.Boolean | ValueKind.String | ValueKind.Int32 | ValueKind.Int64 | ValueKind.Float | ValueKind.Callable | ValueKind.Object; /** * Converts a specified BrightScript type in string into BrsType representation, with actual value * Note: only native types are fully supported so far. Objects such as node/array/AA are created with default values, * instead of the value that gets passed in. * @param {string} type data type of field * @param {string} value optional value specified as string * @returns {BrsType} BrsType value representation of the type */ export declare function getBrsValueFromFieldType(type: string, value?: string): BrsType; /** Check if the passed value implements the Comparable interface * @param value the BrightScript value to be checked. * @returns `true` if `value` is comparable, otherwise `false`. */ export declare function isComparable(value: BrsType): value is BrsType & Comparable; /** The base for all BrightScript types. */ export interface BrsValue { /** * Type differentiator for all BrightScript values. Used to allow comparisons of `.kind` to * produce valuable compile-time type inferences. */ readonly kind: ValueKind; /** * Converts the current value to a human-readable string. * @param parent The (optional) BrightScript value that this value is being printed in the context of. * @returns A human-readable representation of this value. */ toString(parent?: BrsType): string; /** * Determines whether or not this value is equal to some `other` value. * @param other The value to compare this value to. * @returns `true` if this value is strictly equal to the `other` value, otherwise `false`. */ equalTo(other: BrsType): BrsBoolean; } /** The set of operations required for a BrightScript datatype to be compared to another. */ export interface Comparable { /** * Determines whether or not this value is less than some `other` value. * @param other The value to compare this value to. * @returns `true` if this value is less than the `other` value, otherwise `false`. */ lessThan(other: BrsType): BrsBoolean; /** * Determines whether or not this value is greater than some `other` value. * @param other The value to compare this value to. * @returns `true` if this value is greater than the `other` value, otherwise `false`. */ greaterThan(other: BrsType): BrsBoolean; /** * Returns the value to be used on comparisons * @returns the current value, the type will depend on the object */ getValue(): any; } /** Internal representation of a string in BrightScript. */ export declare class BrsString implements BrsValue, Comparable, Boxable { readonly value: string; readonly kind = ValueKind.String; constructor(value: string); lessThan(other: BrsType): BrsBoolean; greaterThan(other: BrsType): BrsBoolean; equalTo(other: BrsType): BrsBoolean; getValue(): string; toString(parent?: BrsType): string; concat(other: BrsType): BrsString; box(): RoString; } /** Internal representation of a boolean in BrightScript. */ export declare class BrsBoolean implements BrsValue, Comparable, Boxable { private readonly value; readonly kind = ValueKind.Boolean; private constructor(); toBoolean(): boolean; static False: BrsBoolean; static True: BrsBoolean; static from(value: boolean): BrsBoolean; lessThan(other: BrsType): BrsBoolean; greaterThan(other: BrsType): BrsBoolean; equalTo(other: BrsType): BrsBoolean; getValue(): boolean; toString(parent?: BrsType): string; box(): roBoolean; /** * Returns the boolean AND of this value with another value. * @param other the other value to AND with this one. * @returns `BrsBoolean.True` if both this value and the other are true, otherwise * `BrsBoolean.False`. */ and(other: BrsBoolean | BrsNumber): BrsBoolean; /** * Returns the boolean OR of this value with another value. * @param other the other value to AND with this one. * @returns `BrsBoolean.True` if either this value or the other are true, otherwise * `BrsBoolean.False`. */ or(other: BrsBoolean | BrsNumber): BrsBoolean; /** * Returns the boolean negation of this value with another value. * @returns `BrsBoolean.True` if either this value is false, otherwise * `BrsBoolean.False`. */ not(): BrsBoolean; } /** Internal representation of the BrightScript `invalid` value. */ export declare class BrsInvalid implements BrsValue, Comparable, Boxable { readonly kind = ValueKind.Invalid; static Instance: BrsInvalid; lessThan(other: BrsType): BrsBoolean; greaterThan(other: BrsType): BrsBoolean; equalTo(other: BrsType): BrsBoolean; getValue(): BrsInvalid; toString(parent?: BrsType): string; box(): RoInvalid; } /** Internal representation of uninitialized BrightScript variables. */ export declare class Uninitialized implements BrsValue, Comparable { readonly kind = ValueKind.Uninitialized; static Instance: Uninitialized; lessThan(other: BrsType): BrsBoolean; greaterThan(other: BrsType): BrsBoolean; equalTo(other: BrsType): BrsBoolean; getValue(): undefined; toString(parent?: BrsType): string; }