import { Tag } from "../tag"; import { File, ReadStyle } from "../file"; /** * Common logic for parsing sequential tags at the start or end of a file. Classes that inherit * from this class are expected to provide `while(parser.read())` functionality. If {@link read} * returns `true` the tag that was just read can be read from {@link currentTag}. */ export default abstract class TagParser { private readonly _file; private readonly _readStyle; private _currentTag; private _fileOffset; protected constructor(file: File, readStyle: ReadStyle, initialOffset: number); /** * Tag that was just read from the file. This will be `undefined` until {@link read} is called. * The value is not guaranteed if {@link read} returns `false` */ get currentTag(): Tag; protected set currentTag(value: Tag); protected get file(): File; protected get fileOffset(): number; protected set fileOffset(value: number); protected get readStyle(): ReadStyle; /** * Reads the next tag from the file. * @returns * `true` is returned if a tag is found, the tag can be accessed from * {@link currentTag}. `false` is returned if no tag was found. */ abstract read(): boolean; }