simc-ast-builder
Version:
Parser and AST generator for SimulationCraft files
85 lines • 2.83 kB
TypeScript
/**
* Registry for Field instances
* Provides a central registry for field definitions with dynamic registration
*/
import { Field, FieldOptions } from "./Field";
/**
* Registry for Field instances
*/
export declare class FieldRegistry {
/**
* Map of field names to Field instances
*/
private fields;
/**
* Clear all fields from the registry
*/
clear(): void;
/**
* Create a boolean field and register it
* @param name Name of the field
* @param options Additional options for the field
* @returns The created and registered boolean field
*/
createBooleanField(name: string, options?: Omit<FieldOptions, "type">): Field;
/**
* Create and register a field
* @param name Name of the field
* @param options Options for the field
* @returns The created and registered field
*/
createField(name: string, options?: FieldOptions): Field;
/**
* Create a neutral field and register it
* @param name Name of the field
* @param options Additional options for the field
* @returns The created and registered neutral field
*/
createNeutralField(name: string, options?: Omit<FieldOptions, "type">): Field;
/**
* Create a numeric field and register it
* @param name Name of the field
* @param options Additional options for the field
* @returns The created and registered numeric field
*/
createNumericField(name: string, options?: Omit<FieldOptions, "type">): Field;
/**
* Get a field from the registry by name
* @param name Name of the field to get
* @returns The field with the given name, or undefined if not found
*/
get(name: string): Field | undefined;
/**
* Get all fields in the registry
* @returns Array of all fields in the registry
*/
getAll(): Field[];
/**
* Get a field by name, creating it if it doesn't exist
* @param name Name of the field
* @param defaultType Default type to use if the field doesn't exist
* @returns The existing or newly created field
*/
getOrCreate(name: string, defaultType?: "boolean" | "numeric" | "neutral"): Field;
/**
* Check if a field exists in the registry
* @param name Name of the field to check
* @returns True if the field exists in the registry
*/
has(name: string): boolean;
/**
* Initialize the registry with default fields from the FIELD_MAP
*/
initializeDefaults(): void;
/**
* Register a field in the registry
* @param field Field to register
* @returns The registered field
*/
register(field: Field): Field;
}
/**
* Singleton instance of the FieldRegistry
*/
export declare const fieldRegistry: FieldRegistry;
//# sourceMappingURL=FieldRegistry.d.ts.map