cpp

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CExprGenerator added in v1.1.0

type CExprGenerator struct {
	*gen.GenExprDispatcher
	GenType          func(definition.Type) (string, error)
	ValueStr         string
	GenState         *CppGeneratorState       // optional
	LiteralGenerator gen.LiteralGeneratorImpl // optional
}

func NewCExprGenerator added in v1.1.0

func NewCExprGenerator(genType func(definition.Type) (string, error), valueStr string, genState *CppGeneratorState) *CExprGenerator

func (CExprGenerator) GenerateBinopExpr added in v1.1.0

func (g CExprGenerator) GenerateBinopExpr(expr *definition.BinopExpr) (string, error)

func (CExprGenerator) GenerateCastExpr added in v1.1.0

func (g CExprGenerator) GenerateCastExpr(expr *definition.CastExpr) (string, error)

func (CExprGenerator) GenerateConstantExpr added in v1.1.0

func (g CExprGenerator) GenerateConstantExpr(expr *definition.ConstantExpr) (string, error)

func (CExprGenerator) GenerateExpr added in v1.1.0

func (g CExprGenerator) GenerateExpr(expr definition.Expr) (string, error)

func (CExprGenerator) GenerateRawExpr added in v1.1.0

func (g CExprGenerator) GenerateRawExpr(expr *definition.RawExpr) (string, error)

func (CExprGenerator) GenerateTenaryExpr added in v1.1.0

func (g CExprGenerator) GenerateTenaryExpr(expr *definition.TenaryExpr) (string, error)

func (CExprGenerator) GenerateUnopExpr added in v1.1.0

func (g CExprGenerator) GenerateUnopExpr(expr *definition.UnopExpr) (string, error)

func (CExprGenerator) GenerateValueExpr added in v1.1.0

func (g CExprGenerator) GenerateValueExpr(expr *definition.ValueExpr) (string, error)

type CLiteralGenerator added in v1.1.0

type CLiteralGenerator struct {
	*gen.GenLiteralDispatcher
}

func NewCLiteralGenerator added in v1.1.0

func NewCLiteralGenerator() *CLiteralGenerator

func (CLiteralGenerator) GenerateBoolLiteral added in v1.1.0

func (g CLiteralGenerator) GenerateBoolLiteral(literal *definition.BoolLiteral) (string, error)

func (CLiteralGenerator) GenerateFloatLiteral added in v1.1.0

func (g CLiteralGenerator) GenerateFloatLiteral(literal *definition.FloatLiteral) (string, error)

func (CLiteralGenerator) GenerateIntLiteral added in v1.1.0

func (g CLiteralGenerator) GenerateIntLiteral(literal *definition.IntLiteral) (string, error)

func (CLiteralGenerator) GenerateLiteral added in v1.1.0

func (g CLiteralGenerator) GenerateLiteral(literal definition.Literal) (string, error)

func (CLiteralGenerator) GenerateStringLiteral added in v1.1.0

func (g CLiteralGenerator) GenerateStringLiteral(literal *definition.StringLiteral) (string, error)

type CppGenerator

type CppGenerator struct {
	*gen.GenDispatcher
	GenCtx   *gen.GenCtx
	GenUnits *util.OrderedMap[string, *GeneratedUnit]
	GenTypes *util.OrderedMap[string, *GeneratedType]
	GenStack *util.OrderedMap[string, any]
	GenState *CppGeneratorState
	Warning  definition.TopLevelWarning
}

func NewCppGenerator

func NewCppGenerator() *CppGenerator

func (*CppGenerator) Generate

func (g *CppGenerator) Generate(ctx *gen.GenCtx) (retErr error, retWarnings error)

func (CppGenerator) GenerateArray added in v1.1.0

func (g CppGenerator) GenerateArray(array *definition.Array) (string, error)

func (CppGenerator) GenerateArrayDefaultValue added in v1.1.0

func (g CppGenerator) GenerateArrayDefaultValue(array *definition.Array) (string, error)

func (CppGenerator) GenerateBasicType added in v1.1.0

func (g CppGenerator) GenerateBasicType(type_ *definition.BasicType) (string, error)

func (CppGenerator) GenerateBasicTypeDefaultValue added in v1.1.0

func (g CppGenerator) GenerateBasicTypeDefaultValue(type_ *definition.BasicType) (string, error)

func (CppGenerator) GenerateBytes added in v1.1.0

func (g CppGenerator) GenerateBytes(bytes *definition.Bytes) (string, error)

func (CppGenerator) GenerateBytesDefaultValue added in v1.1.0

func (g CppGenerator) GenerateBytesDefaultValue(bytes *definition.Bytes) (string, error)

func (CppGenerator) GenerateConstantField added in v1.1.0

func (g CppGenerator) GenerateConstantField(field *definition.ConstantField) (string, error)

func (CppGenerator) GenerateCustomGetter added in v1.1.0

func (g CppGenerator) GenerateCustomGetter(method *definition.GetMethod) (string, error)

func (CppGenerator) GenerateCustomGetterDecl added in v1.1.0

func (g CppGenerator) GenerateCustomGetterDecl(method *definition.GetMethod) (string, error)

func (CppGenerator) GenerateCustomSetter added in v1.1.0

func (g CppGenerator) GenerateCustomSetter(method *definition.SetMethod) (string, error)

func (CppGenerator) GenerateCustomSetterDecl added in v1.1.0

func (g CppGenerator) GenerateCustomSetterDecl(method *definition.SetMethod) (string, error)

func (CppGenerator) GenerateDecoder added in v1.1.0

func (g CppGenerator) GenerateDecoder(structDef *definition.Struct) (string, error)

func (CppGenerator) GenerateDecoderDecl added in v1.1.0

func (g CppGenerator) GenerateDecoderDecl(structDef *definition.Struct) (string, error)

func (CppGenerator) GenerateDefaultGetter added in v1.1.0

func (g CppGenerator) GenerateDefaultGetter(method *definition.GetMethod) (string, error)

func (CppGenerator) GenerateDefaultGetterDecl added in v1.1.0

func (g CppGenerator) GenerateDefaultGetterDecl(method *definition.GetMethod) (string, error)

func (CppGenerator) GenerateDefaultSetter added in v1.1.0

func (g CppGenerator) GenerateDefaultSetter(method *definition.SetMethod) (string, error)

func (CppGenerator) GenerateDefaultSetterDecl added in v1.1.0

func (g CppGenerator) GenerateDefaultSetterDecl(method *definition.SetMethod) (string, error)

func (CppGenerator) GenerateEmbeddedField added in v1.1.0

func (g CppGenerator) GenerateEmbeddedField(field *definition.EmbeddedField) (string, error)

func (CppGenerator) GenerateEncoder added in v1.1.0

func (g CppGenerator) GenerateEncoder(structDef *definition.Struct) (string, error)

func (CppGenerator) GenerateEncoderDecl added in v1.1.0

func (g CppGenerator) GenerateEncoderDecl(structDef *definition.Struct) (string, error)

func (CppGenerator) GenerateEnum added in v1.1.0

func (g CppGenerator) GenerateEnum(enumDef *definition.Enum) (string, error)

func (CppGenerator) GenerateEnumDefaultValue added in v1.1.0

func (g CppGenerator) GenerateEnumDefaultValue(enumDef *definition.Enum) (string, error)

func (CppGenerator) GenerateExpr added in v1.1.0

func (g CppGenerator) GenerateExpr(expr definition.Expr, valueStr string) (string, error)

func (CppGenerator) GenerateField added in v1.1.0

func (g CppGenerator) GenerateField(field definition.Field) (string, error)

func (CppGenerator) GenerateMethod added in v1.1.0

func (g CppGenerator) GenerateMethod(method definition.Method) (string, error)

func (CppGenerator) GenerateMethodDecl added in v1.1.0

func (g CppGenerator) GenerateMethodDecl(method definition.Method) (string, error)

func (CppGenerator) GenerateNormalField added in v1.1.0

func (g CppGenerator) GenerateNormalField(field *definition.NormalField) (string, error)

func (CppGenerator) GenerateRawGetter added in v1.1.0

func (g CppGenerator) GenerateRawGetter(field definition.Field) (string, error)

func (CppGenerator) GenerateRawGetterDecl added in v1.1.0

func (g CppGenerator) GenerateRawGetterDecl(field definition.Field) (string, error)

func (CppGenerator) GenerateRawSetter added in v1.1.0

func (g CppGenerator) GenerateRawSetter(field definition.Field) (string, error)

func (CppGenerator) GenerateRawSetterDecl added in v1.1.0

func (g CppGenerator) GenerateRawSetterDecl(field definition.Field) (string, error)

func (CppGenerator) GenerateString added in v1.1.0

func (g CppGenerator) GenerateString(string_ *definition.String) (string, error)

func (CppGenerator) GenerateStringDefaultValue added in v1.1.0

func (g CppGenerator) GenerateStringDefaultValue(string_ *definition.String) (string, error)

func (CppGenerator) GenerateStruct added in v1.1.0

func (g CppGenerator) GenerateStruct(structDef *definition.Struct) (string, error)

func (CppGenerator) GenerateStructDefaultValue added in v1.1.0

func (g CppGenerator) GenerateStructDefaultValue(structDef *definition.Struct) (string, error)

func (CppGenerator) GenerateType added in v1.1.0

func (g CppGenerator) GenerateType(type_ definition.Type) (string, error)

func (CppGenerator) GenerateTypeDefaultValue added in v1.1.0

func (g CppGenerator) GenerateTypeDefaultValue(type_ definition.Type) (string, error)

func (CppGenerator) GenerateUnit added in v1.1.0

func (g CppGenerator) GenerateUnit(unit *definition.CompilationUnit) error

func (CppGenerator) GenerateVoidField added in v1.1.0

func (g CppGenerator) GenerateVoidField(field *definition.VoidField) (string, error)

type CppGeneratorState added in v1.1.0

type CppGeneratorState struct {
	UseMathH     bool
	UseStringH   bool
	UseStdLibH   bool
	UseBytesType bool
}

func NewCppGeneratorState added in v1.1.0

func NewCppGeneratorState() *CppGeneratorState

type GeneratedType

type GeneratedType struct {
	GeneratedDef     string
	GeneratedFuncDef string
}

type GeneratedUnit added in v1.1.0

type GeneratedUnit struct {
	SourceUnit     *definition.CompilationUnit
	GeneratedTypes *util.OrderedMap[string, *GeneratedType]
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL