/** * @module * * Pointer types and factory. */ import { type Class } from '@hqtsm/class'; import { Endian } from './endian.js'; import type { MemberInfos } from './members.js'; import type { ArrayBufferType } from './native.js'; import type { Type, TypeConstructor } from './type.js'; /** * Pointer to a type. * * @template T Value type. * @template TArrayBuffer Buffer type. */ export declare class Ptr = ArrayBufferType> extends Endian { /** * Pointer elements. */ [index: number]: T; /** * Create instance for buffer. * * @param buffer Buffer data. * @param byteOffset Byte offset into buffer. * @param littleEndian Host endian, little endian, big endian. */ constructor(buffer: TArrayBuffer, byteOffset?: number, littleEndian?: boolean | null); /** * Get accessor. * * @param index Pointer index. * @returns Pointer value. */ get(index: number): T; /** * Set accessor. * * @param index Pointer index. * @param value Pointer value. */ set(index: number, value: T): void; /** * Size of each element. */ static readonly BYTES_PER_ELEMENT: number; /** * Non-overlapping members. */ static readonly OVERLAPPING: boolean; /** * Members infos. */ static get MEMBERS(): MemberInfos; } /** * Pointer constructor. * * @template T Pointer type. * @template TArrayBuffer Buffer type. */ export interface PtrConstructor = Ptr, TArrayBuffer extends ArrayBufferType = ArrayBufferType> extends Omit, never> { /** * Create instance for buffer. * * @template _TArrayBuffer Buffer type. * @param buffer Buffer data. * @param byteOffset Byte offset into buffer. * @param littleEndian Host endian, little endian, big endian. */ new <_TArrayBuffer extends TArrayBuffer>(buffer: _TArrayBuffer, byteOffset?: number, littleEndian?: boolean | null): T & Ptr; /** * Create instance for buffer. * * @param buffer Buffer data. * @param byteOffset Byte offset into buffer. * @param littleEndian Host endian, little endian, big endian. */ new (buffer: TArrayBuffer, byteOffset?: number, littleEndian?: boolean | null): T & Ptr; /** * Type prototype. */ readonly prototype: T & Ptr; } /** * Pointer class. * * @template T Pointer type. * @template TArrayBuffer Buffer type. */ export type PtrClass = Ptr, TArrayBuffer extends ArrayBufferType = ArrayBufferType> = Class>; /** * Get pointer of type. * * @template T Type. * @param Type Type constructor. * @returns Ptr constructor. */ export declare function pointer(Type: TypeConstructor): PtrConstructor>; //# sourceMappingURL=ptr.d.ts.map