cpp

package
v0.0.0-...-87137c7 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: Apache-2.0, MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(conf config.Conf, outdir string, renderType string)

func GenerateCppRandom

func GenerateCppRandom(conf config.Conf, num int, outdir string)

GenerateCppRandom generates randomized types for all templates

func GetFloatTypes

func GetFloatTypes() []string

func GetFloatValue

func GetFloatValue(floatType string, isComplex bool) string

GetFloatValue returns a float value depending on type of float and if is complex TODO not written yet!

func GetIntegralNumericTypes

func GetIntegralNumericTypes() []string

Integral numeric types

func GetIntegralTypes

func GetIntegralTypes(withinStruct bool, withinUnion bool) []string

INTEGRAL Possible integral types NOTE __int128 removed for now, need help to define!

func GetIntegralValue

func GetIntegralValue(integralType string, isSigned bool, name string) string

GetIntegralValue returns an integral value depending on the type

func WriteTemplate

func WriteTemplate(path string, t *template.Template, funcs *map[string]Function)

WriteTemplate to a filepath

Types

type FloatFormalParam

type FloatFormalParam struct {
	Name      string `json:"name"`
	Type      string `json:"type"`
	IsComplex bool   `json:"is_complex"`
	IsPointer bool   `json:"is_pointer"`
	Value     string `json:"value"`
}

Integral Types

func (FloatFormalParam) Assert

func (p FloatFormalParam) Assert() string

Assert an integral formal param

func (FloatFormalParam) Declaration

func (p FloatFormalParam) Declaration() string

Declaration of a float

func (FloatFormalParam) DeclareFormalParam

func (p FloatFormalParam) DeclareFormalParam() string

Declaration of a formal param

func (FloatFormalParam) DeclareValue

func (p FloatFormalParam) DeclareValue() string

DeclareValues includes the value

func (FloatFormalParam) GetFieldName

func (p FloatFormalParam) GetFieldName() string

GetFieldName returns the name without decoration

func (FloatFormalParam) GetName

func (p FloatFormalParam) GetName() string

GetName returns the name

func (FloatFormalParam) GetRawType

func (p FloatFormalParam) GetRawType() string

Raw type

func (FloatFormalParam) GetType

func (p FloatFormalParam) GetType() string

Type of an integral formal param

func (FloatFormalParam) GetValue

func (p FloatFormalParam) GetValue() string

Value returns the string representation of the value

func (FloatFormalParam) Prefix

func (p FloatFormalParam) Prefix() string

Prefix of an integral formal param

func (FloatFormalParam) Print

func (p FloatFormalParam) Print() string

Print prints an float formal param

func (FloatFormalParam) Reference

func (p FloatFormalParam) Reference() string

Reference of an integral formal param

type FormalParam

type FormalParam interface {
	GetName() string
	GetFieldName() string
	GetType() string
	GetRawType() string
	Prefix() string
	Print() string
	Assert() string
	Reference() string
	DeclareFormalParam() string
	DeclareValue() string
	Declaration() string
	GetValue() string
}

FormalParam holds a type of formal parameter

func GenerateFormalParams

func GenerateFormalParams(entry config.Render, nestingCount int, withinStruct bool, withinUnion bool) []FormalParam

Generate formal params, either for a function or structure

func NewFloat

func NewFloat() FormalParam

func NewFormalParam

func NewFormalParam(entry config.Render, nestingCount int, withinStruct bool, withinUnion bool) FormalParam

Functions to create new Formal Parameters (all random)

func NewInt

func NewInt(usePointers bool) FormalParam

NewInt returns a new int

func NewIntegral

func NewIntegral(withinStruct bool, withinUnion bool, usePointers bool) FormalParam

NewIntegral returns a new integral type

func NewIntegralNumeric

func NewIntegralNumeric(usePointers bool) FormalParam

NewIntegralNumeric returns a new integral numeric type

func NewStruct

func NewStruct(entry config.Render, nestingCount int, usePointers bool) FormalParam

NewStruct returns a new struct type, which also includes its own set of fields

type Function

type Function struct {
	Name         string        `json:"name"`
	FormalParams []FormalParam `json:"parameters,omitempty"`
}

A Function holds a name and one or more formal params

func GenerateFunction

func GenerateFunction(name string, entry config.Render) Function

Generate a function from an entry

type IntegralFormalParam

type IntegralFormalParam struct {
	Name      string `json:"name"`
	Type      string `json:"type"`
	IsSigned  bool   `json:"is_signed"`
	IsPointer bool   `json:"is_pointer"`
	Value     string `json:"value"`
}

Integral Types

func (IntegralFormalParam) Assert

func (p IntegralFormalParam) Assert() string

Assert an integral formal param

func (IntegralFormalParam) Declaration

func (p IntegralFormalParam) Declaration() string

Declaration of an integral formal param

func (IntegralFormalParam) DeclareFormalParam

func (p IntegralFormalParam) DeclareFormalParam() string

Declaration of a formal param

func (IntegralFormalParam) DeclareValue

func (p IntegralFormalParam) DeclareValue() string

DeclareValues includes the value

func (IntegralFormalParam) GetFieldName

func (p IntegralFormalParam) GetFieldName() string

func (IntegralFormalParam) GetName

func (p IntegralFormalParam) GetName() string

GetName returns the string representation of the value

func (IntegralFormalParam) GetRawType

func (p IntegralFormalParam) GetRawType() string

func (IntegralFormalParam) GetType

func (p IntegralFormalParam) GetType() string

GetType of an integral formal param

func (IntegralFormalParam) GetValue

func (p IntegralFormalParam) GetValue() string

GetValue returns the string representation of the value

func (IntegralFormalParam) Prefix

func (p IntegralFormalParam) Prefix() string

Prefix of an integral formal param

func (IntegralFormalParam) Print

func (p IntegralFormalParam) Print() string

Print prints an integral formal param

func (IntegralFormalParam) Reference

func (p IntegralFormalParam) Reference() string

Reference of an integral formal param

type StructureParam

type StructureParam struct {
	Type      string        `json:"type"`
	Value     string        `json:"value"`
	Name      string        `json:"name"`
	IsPointer bool          `json:"is_pointer"`
	Fields    []FormalParam `json:"fields"`
	IsUnion   bool          `json:"is_union"`
}

Structure or Union Type

func (StructureParam) Assert

func (p StructureParam) Assert() string

Assert a structure param

func (StructureParam) Declaration

func (p StructureParam) Declaration() string

Declaration is for a separate declaration of just the type

func (StructureParam) DeclareFormalParam

func (p StructureParam) DeclareFormalParam() string

DeclareFormalParams just declares the type (and if a pointer)

func (StructureParam) DeclareValue

func (p StructureParam) DeclareValue() string

Declaration of a structure

func (StructureParam) GetFieldName

func (p StructureParam) GetFieldName() string

GetFieldName returns the field name

func (StructureParam) GetName

func (p StructureParam) GetName() string

GetName returns the name

func (StructureParam) GetRawType

func (p StructureParam) GetRawType() string

Get the raw type

func (StructureParam) GetType

func (p StructureParam) GetType() string

GetType for a general param

func (StructureParam) GetValue

func (p StructureParam) GetValue() string

Value returns the string representation of the value

func (StructureParam) Prefix

func (p StructureParam) Prefix() string

Prefix of an structure formal param

func (StructureParam) Print

func (p StructureParam) Print() string

Print a general param

func (StructureParam) Reference

func (p StructureParam) Reference() string

Reference of a structure param

Jump to

Keyboard shortcuts

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