UNPKG

fixparser

Version:

FIX.Latest / 5.0 SP2 Parser / AI Agent Trading

42 lines (41 loc) 1.66 kB
import { type ISpecDatatypes } from '../../spec/SpecDatatypes.ts'; import type { FIXValue } from '../../util/util.ts'; import type { Field } from '../Field.ts'; /** * Class for managing FIX data types. * Provides functionality to validate and process different FIX data types, * including numeric types (int, float) and string types. */ export declare class DataTypes { /** Array of all available data type specifications */ dataTypes: ISpecDatatypes[]; /** Cache map for looking up data types by name */ cacheMap: Map<string, ISpecDatatypes>; /** Cache map for type-specific formatters and validators */ cacheTypeMap: Map<string, { formatter: typeof parseInt | typeof parseFloat | StringConstructor; validator: any; }>; /** * Creates a new DataTypes instance and initializes the cache maps * with all available data type specifications and their corresponding * formatters and validators. */ constructor(); /** * Validates a value against its expected data type. * * @param {FIXValue} value - The value to validate * @param {string | undefined} type - The expected data type * @returns {boolean} True if the value is valid for the type, false otherwise */ validateDatatype(value: FIXValue, type: string | undefined): boolean; /** * Processes a field's data type, setting appropriate type information * and converting values to their proper format if necessary. * * @param {Field} field - The field to process * @param {string} type - The data type to set */ processDatatype(field: Field, type: string): void; }