Documentation
¶
Index ¶
- func CPPTypeToTS(t string) (string, bool)
- type ArgHelpers
- type CPPArg
- type CPPArgDefault
- type CPPClass
- type CPPFieldDecl
- type CPPFriend
- type CPPFriendFunc
- type CPPMethod
- type CPPType
- type ClassOpts
- type Config
- type EnumField
- type FnArg
- type FnOpts
- type JSWrapperOpts
- type MethodTransforms
- type PackageConfig
- func (c PackageConfig) IsEnvTS() bool
- func (c PackageConfig) IsFieldWrapped(className string, fnName string) bool
- func (c PackageConfig) IsMethodIgnored(name string) bool
- func (c PackageConfig) IsMethodWrapped(className string, fnName string) bool
- func (c PackageConfig) ResolvedBindingsImportPath(packageDir string) string
- func (c PackageConfig) ResolvedBindingsOutPath(packageDir string) string
- func (c PackageConfig) ResolvedHeaderOutPath(packageDir string) string
- func (c PackageConfig) ResolvedWrapperOutPath(packageDir string) string
- func (c PackageConfig) TypeHasHandler(name string) *TypeHandler
- type PackageGenerator
- func (g *PackageGenerator) Generate() (string, string, string, error)
- func (g *PackageGenerator) WriteEnvClassWrapper(className string, class *CPPClass, methods map[string]*CPPMethod, ...) string
- func (g *PackageGenerator) WriteEnvExports(classes map[string]*CPPClass, methods map[string]*CPPMethod, ...) string
- func (g *PackageGenerator) WriteEnvImports(classes map[string]*CPPClass, methods map[string]*CPPMethod, ...) string
- func (g *PackageGenerator) WriteEnvWrappedFns(methods map[string]*CPPMethod, processedMethods map[string]*CPPMethod, ...) string
- func (g *PackageGenerator) WriteEnvWrapper(sb *strings.Builder, classes map[string]*CPPClass, ...)
- type ParsedClassDecl
- type ParsedMethod
- type PreprocessBlock
- type QualifiedIdentifier
- type ResHelpers
- type TSGo
- type TemplateArg
- type TemplateDecl
- type TemplateDeclArg
- type TemplateMethod
- type TypeHandler
- type TypeMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CPPTypeToTS ¶
Types ¶
type ArgHelpers ¶
type CPPArgDefault ¶
type CPPArgDefault struct {
Val *string
}
type CPPClass ¶
type CPPClass struct {
NameSpace *string
FieldDecl *[]*CPPFieldDecl
FriendDecl *[]*CPPFriend
Decl *[]*ParsedClassDecl
TemplateDecl *[]*TemplateMethod
}
type CPPFieldDecl ¶
type CPPFriend ¶
type CPPFriend struct {
Ident *string
QualifiedIdent *QualifiedIdentifier
IsClass bool
Type *CPPType
FuncDecl *CPPFriendFunc
}
type CPPFriendFunc ¶
type CPPFriendFunc struct {
QualifiedIdent *QualifiedIdentifier
Args *[]*CPPArg
}
type CPPType ¶
type CPPType struct {
FullType *string
Scope *string
Name *string
NameSpace *string
TemplateType *[]*TemplateArg
}
type Config ¶
type Config struct {
Packages []*PackageConfig `yaml:"packages"`
}
func (Config) PackageConfig ¶
func (c Config) PackageConfig(packagePath string) *PackageConfig
func (Config) PackageNames ¶
type JSWrapperOpts ¶
type MethodTransforms ¶
type PackageConfig ¶
type PackageConfig struct {
// The package path just like you would import it in Go
Path string `yaml:"path"`
// Where this output should be written to.
// If you specify a folder it will be written to a file `index.ts` within that folder. By default it is written into the Golang package folder.
BindingsOutPath string `yaml:"bindings_out_path"`
HeaderOutPath string `yaml:"header_out_path"`
JSWrapperOpts JSWrapperOpts `yaml:"js_wrapper_opts"`
// Customize the indentation (use \t if you want tabs)
Indent string `yaml:"indent"`
// Specify your own custom type translations, useful for custom types, `time.Time` and `null.String`.
// Be default unrecognized types will be output as `any /* name */`.
TypeMappings map[string]TypeMap `yaml:"type_mappings"`
TypeHandlers map[string]TypeHandler `yaml:"type_handlers"`
ClassOpts map[string]ClassOpts `yaml:"class_opts"`
// This content will be put at the top of the output Typescript file.
// You would generally use this to import custom types.
HeaderFrontmatter string `yaml:"header_frontmatter"`
BindingsFrontmatter string `yaml:"bindings_frontmatter"`
IgnoredMethods []string `yaml:"ignored_methods"`
GlobalForcedMethods []FnOpts `yaml:"global_methods"`
GlobalTypeOutTransforms map[string]string `yaml:"global_type_out_transforms"`
MethodTransforms map[string]MethodTransforms `yaml:"method_transforms"`
GlobalVars string `yaml:"global_vars"`
HelperFuncs map[string]string `yaml:"helper_funcs"`
}
func (PackageConfig) IsEnvTS ¶
func (c PackageConfig) IsEnvTS() bool
func (PackageConfig) IsFieldWrapped ¶
func (c PackageConfig) IsFieldWrapped(className string, fnName string) bool
func (PackageConfig) IsMethodIgnored ¶
func (c PackageConfig) IsMethodIgnored(name string) bool
func (PackageConfig) IsMethodWrapped ¶
func (c PackageConfig) IsMethodWrapped(className string, fnName string) bool
func (PackageConfig) ResolvedBindingsImportPath ¶
func (c PackageConfig) ResolvedBindingsImportPath(packageDir string) string
func (PackageConfig) ResolvedBindingsOutPath ¶
func (c PackageConfig) ResolvedBindingsOutPath(packageDir string) string
func (PackageConfig) ResolvedHeaderOutPath ¶
func (c PackageConfig) ResolvedHeaderOutPath(packageDir string) string
func (PackageConfig) ResolvedWrapperOutPath ¶
func (c PackageConfig) ResolvedWrapperOutPath(packageDir string) string
func (PackageConfig) TypeHasHandler ¶
func (c PackageConfig) TypeHasHandler(name string) *TypeHandler
type PackageGenerator ¶
type PackageGenerator struct {
NameSpace *string
Name *string
Path *string
RootNode *sitter.Node
Input *[]byte
// contains filtered or unexported fields
}
Responsible for generating the code for an input package
func (*PackageGenerator) Generate ¶
func (g *PackageGenerator) Generate() (string, string, string, error)
func (*PackageGenerator) WriteEnvClassWrapper ¶
func (*PackageGenerator) WriteEnvExports ¶
func (*PackageGenerator) WriteEnvImports ¶
func (*PackageGenerator) WriteEnvWrappedFns ¶
type ParsedClassDecl ¶
type ParsedMethod ¶
type PreprocessBlock ¶
type QualifiedIdentifier ¶
type QualifiedIdentifier struct {
Scope *string
Name *string
TemplateArgs *[]*TemplateArg
}
type ResHelpers ¶
type TSGo ¶
type TSGo struct {
// contains filtered or unexported fields
}
Generator for one or more input packages, responsible for linking them together if necessary.
type TemplateArg ¶
type TemplateArg struct {
Identifier *string
}
type TemplateDecl ¶
type TemplateDecl struct {
Args *[]*TemplateDeclArg
}
type TemplateDeclArg ¶
type TemplateMethod ¶
type TypeHandler ¶
Click to show internal directories.
Click to hide internal directories.