@itwin/ecschema-metadata
Version:
ECObjects core concepts in typescript
51 lines • 2.46 kB
TypeScript
import { BeEvent } from "@itwin/core-bentley";
import { FormatDefinition, FormatsChangedArgs, FormatsProvider, MutableFormatsProvider } from "@itwin/core-quantity";
import { FormatSet } from "../Deserialization/JsonProps";
/**
* A mutable format provider that manages format definitions within a format set.
* When formats are added or removed, the underlying format set is automatically updated.
* @beta
*/
export declare class FormatSetFormatsProvider implements MutableFormatsProvider {
onFormatsChanged: BeEvent<(args: FormatsChangedArgs) => void>;
private _formatSet;
private _fallbackProvider?;
private _references;
constructor(props: {
formatSet: FormatSet;
fallbackProvider?: FormatsProvider;
});
/**
* Adds or updates the format definition returned for a kind of quantity. Takes either a format definition or a kind of quantity full name that will be used to lookup the format that will be used.
* @param name A kind of quantity full name used as a key to lookup this format
* @param format The format definition or the name of a kind of quantity
*/
addFormat(name: string, format: FormatDefinition | string): Promise<void>;
/**
* Clears the fallback provider, if one is set.
*/
clearFallbackProvider(): void;
/**
* Retrieves a format definition by its name from the format set. If not found, it checks the fallback provider to find the format, else returns undefined.
* If the format is a string reference to another format, it resolves the reference and returns the FormatDefinition.
*/
getFormat(input: string): Promise<FormatDefinition | undefined>;
/**
* Resolves a string reference to its FormatDefinition, following chains of references.
* @param reference The string reference to resolve
* @param visited Set of visited references to detect circular references
*/
private resolveReference;
/**
* Removes a format definition or string reference from the format set.
* @param name The name of the format to remove
*/
removeFormat(name: string): Promise<void>;
/**
* Gets all format names that reference the target format (directly or indirectly).
* @param target The format name to find references to
* @returns Set of format names that reference the target
*/
private getFormatsReferencingTarget;
}
//# sourceMappingURL=FormatSetFormatsProvider.d.ts.map