import { PrimitiveBundle } from './bundle'; /** * Maps a name to a key index. * * @public */ export interface KeyIndexMap { [name: string]: KeyIndex; } /** * Indexes each string in an array to its offset in the array. * * @public */ export interface KeyIndex { readonly index: { [P in T]: number; }; readonly keys: T[]; readonly size: number; readonly last: number; get(key: T): number; } /** * Function for fetching a single field. * * @public */ export interface FieldArrow { readonly offset: number; get(bundle: PrimitiveBundle): string; } /** * Function for entering a new scope. * * @public */ export interface ScopeArrow { readonly map: { [P in T]: R; }; get(key: T): R | undefined; } /** * Function for fetching a field based on plural category and * number of digits. * * @public */ export interface DigitsArrow { readonly offset: number; readonly index: KeyIndex; readonly values: number[]; readonly size2: number; /** * Gets the field for the given plural category and number of integer digits. */ get(bundle: PrimitiveBundle, key: T, digits: number): [string, number]; } /** * Function representing a 1-dimensional vector. * * @public */ export interface Vector1Arrow { /** * Indicates this vector exists in the bundle. */ exists(bundle: PrimitiveBundle): boolean; /** * Fast way to check if a key is valid, even if it has no value. */ valid(key: T): boolean; /** * Gets the field at the corresponding offset of the given key. */ get(bundle: PrimitiveBundle, key: T | T[]): string; /** * Full mapping of all keys to the corresponding fields. */ mapping(bundle: PrimitiveBundle): { [P in T]: string; }; } /** * Function representing a 2-dimensional vector. * * @public */ export interface Vector2Arrow { /** * Indicates this vector exists in the bundle. */ exists(bundle: PrimitiveBundle): boolean; /** * Fast way to check if a key is valid, even if it has no value. */ valid(key1: T | T[], key2: S | S[]): boolean; /** * Gets the field at the corresponding offset [key1, key2] */ get(bundle: PrimitiveBundle, key1: T | T[], key2: S | S[]): string; /** * Full mapping of all keys to the corresponding fields. */ mapping(bundle: PrimitiveBundle): { [P in T]: { [Q in S]: string; }; }; } /** * Function representing a 3-dimensional vector. * * @public */ export interface Vector3Arrow { /** * Indicates this vector exists in the bundle. */ exists(bundle: PrimitiveBundle): boolean; /** * Gets the field at the corresponding offset [key1, key2, key3] */ get(bundle: PrimitiveBundle, key1: T | T[], key2: S | S[], key3: U | U[]): string; /** * Full mapping of all keys to the corresponding fields. */ mapping(bundle: PrimitiveBundle): { [P in T]: { [Q in S]: { [R in U]: string; }; }; }; }