UNPKG

@tripsnek/tmf

Version:

TypeScript Modeling Framework - A TypeScript port of the Eclipse Modeling Framework (EMF)

144 lines 5.41 kB
import { EPackage } from '../metamodel/api/epackage.js'; import { EClass } from '../metamodel/api/eclass.js'; import { EClassifier } from '../metamodel/api/eclassifier.js'; import { EStructuralFeature } from '../metamodel/api/estructural-feature.js'; import { EOperation } from '../metamodel/api/eoperation.js'; import { EDataType } from '../metamodel/api/edata-type.js'; /** * Utility methods used for TMF source code generation, including * EPackage/EFactory specializations and individual EClassifier files. */ export declare class TGenUtils { static API_PATH: string; static GEN_PATH: string; static IMPL_PATH: string; static DEFAULT_IMPORTS: string; static ECORE_DEFAULT_IMPORTS: string; /** * Generates statements for importing a set of packages into a file residing * in the directory of the host package. * @param pkgToImport * @param host */ static generateImportStatementsForExternalPackages(pkgToImport: Set<EPackage>, host: EPackage, prefix: string): string; /** * Generates import statements for the API .ts files for a set of EClassifiers. * @param imports */ static genApiImports(eclass: EClass, toImport: Set<EClassifier>, pathToApiDir: string): string; /** * Method signature for an EOperation. * @param eop */ static eopSignature(eop: EOperation): string; static eopReturnType(eop: EOperation): string; /** * Invocation of an EOperation. * * @param eop */ static eopInvocation(eop: EOperation): string; static genGenClassName(eclass: EClass): string; static genImplClassName(eclass: EClass): string; /** * Method name for feature setter. * @param f */ static setterName(f: EStructuralFeature): string; static basicSetterName(f: EStructuralFeature): string; /** * Method name for feature getter. * @param f */ static getterName(f: EStructuralFeature): string; /** * Method signature for feature setter. * @param f */ static setterSig(f: EStructuralFeature): string; /** * Method signature for feature basic setter. * @param f */ static basicSetterSig(f: EStructuralFeature): string; static setterParamName(f: EStructuralFeature): string; /** * Method signature for feature getter. * @param f */ static getterSig(f: EStructuralFeature): string; /** * Gets the name of the data type for the given feature. * @param f */ static getTypeName(f: EStructuralFeature): string; /** * Capitalizes the first letter of the given string. * @param s */ static capitalize(s: string): string; /** * First letter to lower case. * @param s */ static uncapitalize(s: string): string; /** * Converts the string to snake case (with underscores preceding * upper letters), and then to all upper case. * * @param str */ static snakeUpperCase(str: string): string; /** * Converts the string to kebab case (with dashes preceding * upper letters), and then to all lower case. * * @param str */ static kebabLowerCase(str: string): string; /** * Generates camel-case class name from original '-'separated package name * with some optional suffix (like 'Factory' or 'Package') tacked on. * @param pkg * @param suffix */ private static genPkgClassName; static genPackageClassName(pkg: EPackage): string; static genPackageFileName(pkg: EPackage): string; static genUtilsFileName(pkg: EPackage): string; static genFactoryClassName(pkg: EPackage): string; static genFactoryFileName(pkg: EPackage): string; static genClassApiName(eClass: EClassifier, async?: boolean): string; static genClassGenName(eClass: EClass, async?: boolean): string; static genClassImplName(eClass: EClass): string; static genClassIdFieldName(eclassifier: EClassifier): string; static genFeatureIdFieldName(feature: EStructuralFeature): string; static genOperationIdFieldName(feature: EOperation): string; static genFeatureCountFieldName(eclass: EClass): string; static genFeatureGetterName(feature: EStructuralFeature): string; static genOperationGetterName(feature: EOperation): string; static genEdataTypeGetter(feature: EDataType): string; static genEclassGetterName(eclassifier: EClassifier): string; /** * Generates reference to the package instance for the 'to' EClass, and * registers it as a package to import if it is different from that * of the 'from' EClass. * * @param to * @param from * @param pkgToImport */ static getReferenceToPackageInstance(to: EClassifier, from: EClassifier, pkgToImport: Set<EPackage>): string; static getPathToRoot(pkg: EPackage): string; /** * Computes the import path necessary to resolve an EClass in a different * package. * @param fromClass * @param toClass */ static getPathToTypeInOtherPkg(fromClass: EClass, toClass: EClassifier): string; static getPathToOtherPackageFlat(fromPackage: EPackage, toPackage: EPackage): string; static getPathToOtherPackage(fromPackage: EPackage, toPackage: EPackage): string; static inSameLib(eclass1: EClass, eclass2: EClass): boolean; } //# sourceMappingURL=tgen-utils.d.ts.map