import { default as Cursor } from './Cursor'; import { SchemaType, default as RegistryInterface } from '../interfaces/RegistryInterface'; /** * Abstract Parser. * * TypeScript version by Logue. * Original version written by HybridEidolon's saredit * @see https://github.com/HybridEidolon/saredit */ export default abstract class AbstractParser { protected readonly decoder: TextDecoder; /** * Get parsed struct * @param buffer - buffer to parse * @param schema - schema to parse with * @param registries - registries of schemas or parsers to use (including base registry) */ parse(buffer: ArrayBuffer, schema: SchemaType, registries?: RegistryInterface[]): any; /** * Goes through a schema object and fill its data in order based on cursor and registry * @param payload - attributes to parse */ parseAttribute({ cursor, schema, registry, }: { cursor: Cursor; schema: any; registry: RegistryInterface; }): any; }