tlcodegen

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MPL-2.0 Imports: 17 Imported by: 0

README

Сделано

  • Тупла некорректный код генерит для вложенных туплов, сделать функции записи и чтения
  • uint32 только bare
  • передача нат-параметров для union
  • часть проверок на уникальность конструкторов, имён типов, тэгов, запретил 0 тэг
  • поля с одинаковыми Title(name) // hren a:Bool A:int = Hren;
  • постарался вынести VK-специфичную часть в отдельный файл
  • сделал проверки-эвристики для встроенных типов, була.
  • Починить рекурсивные типы - генерировать * поля-указатели
  • убраны конфликты глобальных имён
  • Решить проблему совпадения имён для Go-типов, вероятно придётся сделать мапку с использованными гошными именами
  • Разбиение по файликам
  • tlglobal namespace
  • Починить nat-param в dictionary сделать как в векторе
  • Сгенерировать код проверки fields_mask
  • Енумы сделать
  • Сделать чтобы Arith.Res был uint32 и не было промежуточных переполнений
  • Генерация фабрики factory.go
  • Анонимные поля в квадратных скобках, вообще корректность квадратных скобок
  • Структы из 1 безымянного поля делать typedef
  • Убрать HandlerContext из старого tlgen
  • сделать чтобы тэги встроенных типов, була, maybe можно было задавать как угодно
  • Сделать тип Tuple обыкновенным, использовать для реализации его и вектора встроенный тип n*[]
  • Bytes-версии - map[*]T -> []struct{K, V}
  • убрал зависимость от package tlrw
  • разложил типы по файлам, пока что примерно
  • привёл в порядок имена функций записи обёрток, туплов и векторов
  • Тип True поддерживать в филд масках особым образом (посмотреть, как в старом было сделано)
  • Отдельный код для Maybe (пока некорретный - проверить с аргументом int Int, Vector, в том числе с пробросом парамтеров)
  • Код работы с JSON
  • задавать желаемый package для кода

TODO

  • запретить совпадения имён между полями и аргументами шаблона
  • Оставить в пакете tlrw только независящий от тэгов код

Замена повторяющегося типа на Vector tlgen 1.0

hren b:a*[int] a:# = Hren;

Compile TL schema to TLO nat_term: found type type_type make: *** [Makefile:16: gen] Error 1


hren a:# c:float b:a*[int] = Hren;

replace arrays: replace in constructors: hren: b: expected vector multiplicity to be next to the array


hren a:# b:a*[int] c:a*[int] = Hren;

replace arrays: replace in constructors: hren: b: expected a single usage of multiplicity, found 2


hren a:float b:a*[int] = Hren;

Compile TL schema to TLO nat_term: found type type_type


hren a:int b:a*[int] = Hren;

Compile TL schema to TLO nat_term: found type type_type


О нашёл ещё работающий вариант с анонимным полем

hren a:# b:[int] = Hren;
// Hren описывает следующий комбинатор:
// hren b:(Vector %Int) = Hren
type Hren struct {
        B []int32
}

Но анонимные поля отдельная фишка


hren # = Hren;
// hren # = Hren
type Hren uint32

hren int int = Hren;
// hren %Int %Int = Hren
type Hren struct {
        Int int32
        Int1 int32
}

hren int # = Hren;

bad line: 1 uint32 так почему-то нельзя, лол Ты пока не умеешь с анонимными


anon int = Anon;
// TL: anon int = Anon;
type Anon struct { 
	int32
}

hren # b:[int] = Hren;
// hren b:(Vector %Int) = Hren
type Hren struct {
	B []int32
}

hren # [int] = Hren;
// Hren описывает следующий комбинатор:
// hren (Vector %Int) = Hren
type Hren []int32

ого неожиданно

hren a:# [int] = Hren;
// Hren описывает следующий комбинатор:
// hren (Vector %Int) = Hren
type Hren []int32

ну понятно, сначала срабатывает свёртка 2х полей в одно, дальше если это поле получилось анонимным то срабатывает механизм генерации алиаса вместо структа, нам второй пока не нужен


hren a:# b:int c:a*[int] = Hren;

replace arrays: replace in constructors: hren: c: expected vector multiplicity to be next to the array


hren # b:a*[int] = Hren;

Compile TL schema to TLO nat_term: found type type_type


Значит все паттерны замены которые я пока нашёл

N:# B:N*[t] -> B: Vector[t]
N:# B:[t] -> B: Vector[t]
# B:[t] -> B: Vector[t]
# [t] -> "пустое имя": Vector[t] 

Documentation

Index

Constants

View Source
const BasicTLCPPNamespaceName = "basictl" // does not contain tl prefix
View Source
const BasicTLGoPackageName = "basictl" // does not contain tl prefix
View Source
const BuiltinTupleName = "__tuple"
View Source
const BuiltinVectorName = "__vector"
View Source
const ConstantsPackageName = "constants"
View Source
const EnableWarningsSimpleTypeName = true
View Source
const EnableWarningsUnionNameExact = true
View Source
const EnableWarningsUnionNamePrefix = true
View Source
const EnableWarningsUnionNamespace = true
View Source
const FactoryGoPackageName = "factory" // does not contain tl prefix
View Source
const HeaderComment = "// Code generated by vktl/cmd/tlgen2; DO NOT EDIT."
View Source
const MetaGoPackageName = "meta" // does not contain tl prefix
View Source
const TlJSONHTML = "tljson.html"

Variables

This section is empty.

Functions

func CNameToCamelName

func CNameToCamelName(s string) string

TODO - investigate if this function is good

func EnableWarningsSimpleTypeNameSkipLegacy added in v1.0.6

func EnableWarningsSimpleTypeNameSkipLegacy(conFullName string) bool

func EnableWarningsUnionNameExactSkipLegacy added in v1.0.6

func EnableWarningsUnionNameExactSkipLegacy(conFullName string) bool

func EnableWarningsUnionNamePrefixSkipLegacy added in v1.0.6

func EnableWarningsUnionNamePrefixSkipLegacy(conName string, typePrefix string, typeSuffix string) bool

func EnableWarningsUnionNamespaceSkipLegacy added in v1.0.6

func EnableWarningsUnionNamespaceSkipLegacy(conNamespace string, typeNamespace string) bool

func GenerateUnusedNatTemplates added in v1.0.6

func GenerateUnusedNatTemplates(conFullName string) bool

func IsUnionBool

func IsUnionBool(tlType []*tlast.Combinator) (isBool bool, falseDesc *tlast.Combinator, trueDesc *tlast.Combinator)

func IsUnionMaybe

func IsUnionMaybe(tlType []*tlast.Combinator) (isMaybe bool, emptyDesc *tlast.Combinator, okDesc *tlast.Combinator)

func ReplaceSquareBracketsElem

func ReplaceSquareBracketsElem(tl tlast.TL, forTLO bool) (tlast.TL, error)

all non-trivial contents of [] is turned into new types we make copy deep anough to not affect original constructors

func ToLowerFirst added in v1.0.6

func ToLowerFirst(str string) string

func ToUpperFirst added in v1.0.6

func ToUpperFirst(str string) string

func TypeRWWrapperLessGlobal

func TypeRWWrapperLessGlobal(a *TypeRWWrapper, b *TypeRWWrapper) int

func TypeRWWrapperLessLocal

func TypeRWWrapperLessLocal(a *TypeRWWrapper, b *TypeRWWrapper) int

Types

type ActualNatArg

type ActualNatArg struct {
	Arith tlast.Arithmetic

	FieldIndex int
	// contains filtered or unexported fields
}

type Deconflicter

type Deconflicter struct {
	// contains filtered or unexported fields
}

type DirectImports

type DirectImports struct {
	// contains filtered or unexported fields
}

for golang cycle detection

type DirectIncludesCPP

type DirectIncludesCPP struct {
	// contains filtered or unexported fields
}

for C++ includes

type Field

type Field struct {
	BitNumber uint32 // only used when fieldMask != nil
	// contains filtered or unexported fields
}

func (*Field) Bare

func (f *Field) Bare() bool

type Gen2

type Gen2 struct {

	// artifacts
	RootPackageName string

	// golang specific
	BasicPackageNameFull string // basic types are in separate namespace to minimize conflicts
	GlobalPackageName    string // we generate all go types in this package, because we need circular dependencies
	FactoryPackageName   string
	MetaPackageName      string

	// c++ specific
	RootCPPNamespaceElements    []string
	DetailsCPPNamespaceElements []string
	DetailsCPPNamespace         string // basictl::details

	Namespaces map[string]*Namespace // Handlers Code is inside

	// result
	TLO  []byte            // schema represented in tlo format, described using tls.* combinator
	Code map[string]string // fileName->Content, split by file names relative to output dir
	// contains filtered or unexported fields
}

func GenerateCode

func GenerateCode(tl tlast.TL, options Gen2Options) (*Gen2, error)

func (*Gen2) GenerateVectorTuple

func (gen *Gen2) GenerateVectorTuple(myWrapper *TypeRWWrapper, vectorLike bool, tlType *tlast.Combinator, lrc LocalResolveContext) error

func (*Gen2) InternalPrefix

func (gen *Gen2) InternalPrefix() string

func (*Gen2) WriteToDir

func (gen *Gen2) WriteToDir(outdir string) error

WriteToDir Most common action with generated code, so clients do not repeat it

type Gen2Options

type Gen2Options struct {
	TypesWhileList       string
	BytesVersions        string
	TLPackageNameFull    string
	BasicPackageNameFull string // if empty, will be created
	Verbose              bool
	GenerateRPCCode      bool
	BasicRPCPath         string
	GenerateRandomCode   bool
	SchemaDocumentation  bool
	SplitInternal        bool
	Language             string
	RootCPPNamespace     string
	CopyrightFilePath    string
	WarningsAreErrors    bool
	ErrorWriter          io.Writer // all Errors and warnings should be redirected to this io.Writer, by default it is os.Stderr
}

type HalfResolvedArgument added in v1.0.6

type HalfResolvedArgument struct {
	Name string                 // if empty, this is not argument position
	Args []HalfResolvedArgument // recursion
}

type InsFile

type InsFile struct {
	// contains filtered or unexported fields
}

type InternalNamespace

type InternalNamespace struct {
	DebugID      int   // for identification in logs
	FloodCounter int64 // beware!

	Namespaces    map[string]struct{}
	DirectImports *DirectImports
	Types         []*TypeRWWrapper

	SubPath string
	Name    string
}

func (*InternalNamespace) FindRecursiveImports

func (n *InternalNamespace) FindRecursiveImports(ri map[*InternalNamespace][]*InternalNamespace, replace *InternalNamespace)

func (*InternalNamespace) ImportsSingleNamedNamespace

func (n *InternalNamespace) ImportsSingleNamedNamespace() (empty bool, name string)

func (*InternalNamespace) Prefix

func (n *InternalNamespace) Prefix(directImports *DirectImports, in *InternalNamespace) string

func (InternalNamespace) String

func (n InternalNamespace) String() string

type LocalNatArg

type LocalNatArg struct {
	NamePR tlast.PositionRange
	TypePR tlast.PositionRange
	// contains filtered or unexported fields
}

type LocalResolveContext

type LocalResolveContext struct {
	// contains filtered or unexported fields
}

type LocalTypeArg

type LocalTypeArg struct {
	PR tlast.PositionRange // original template arg reference
	// contains filtered or unexported fields
}

type Namespace

type Namespace struct {
	// contains filtered or unexported fields
}

type ResolvedArgument added in v1.0.2

type ResolvedArgument struct {
	Arith tlast.Arithmetic
	// contains filtered or unexported fields
}

type TypeRW

type TypeRW interface {
	BeforeCodeGenerationStep1() // during first phase, some wr.trw are nil due to recursive types. So we delay some
	BeforeCodeGenerationStep2() // during second phase, union fields recursive bit is set

	IsDictKeySafe() (isSafe bool, isString bool) // natives are safe, other types TBD

	GenerateCode(bytesVersion bool, directImports *DirectImports) string

	CPPFillRecursiveChildren(visitedNodes map[*TypeRWWrapper]bool)

	CPPHasBytesVersion() bool
	CPPTypeResettingCode(bytesVersion bool, val string) string
	CPPTypeWritingCode(bytesVersion bool, val string, bare bool, natArgs []string, last bool) string
	CPPTypeReadingCode(bytesVersion bool, val string, bare bool, natArgs []string, last bool) string
	CPPGenerateCode(hpp *strings.Builder, hppInc *DirectIncludesCPP, hppIncFwd *DirectIncludesCPP, hppDet *strings.Builder, hppDetInc *DirectIncludesCPP, cppDet *strings.Builder, cppDetInc *DirectIncludesCPP, bytesVersion bool, forwardDeclaration bool)
	// contains filtered or unexported methods
}

TODO remove skipAlias after we start generating go code like we do for C++

type TypeRWBool

type TypeRWBool struct {
	// contains filtered or unexported fields
}

func (*TypeRWBool) BeforeCodeGenerationStep1 added in v1.0.2

func (trw *TypeRWBool) BeforeCodeGenerationStep1()

func (*TypeRWBool) BeforeCodeGenerationStep2

func (trw *TypeRWBool) BeforeCodeGenerationStep2()

func (*TypeRWBool) CPPFillRecursiveChildren

func (trw *TypeRWBool) CPPFillRecursiveChildren(visitedNodes map[*TypeRWWrapper]bool)

func (*TypeRWBool) CPPGenerateCode

func (trw *TypeRWBool) CPPGenerateCode(hpp *strings.Builder, hppInc *DirectIncludesCPP, hppIncFwd *DirectIncludesCPP, hppDet *strings.Builder, hppDetInc *DirectIncludesCPP, cppDet *strings.Builder, cppDetInc *DirectIncludesCPP, bytesVersion bool, forwardDeclaration bool)

func (*TypeRWBool) CPPHasBytesVersion

func (trw *TypeRWBool) CPPHasBytesVersion() bool

func (*TypeRWBool) CPPTypeReadingCode

func (trw *TypeRWBool) CPPTypeReadingCode(bytesVersion bool, val string, bare bool, natArgs []string, last bool) string

func (*TypeRWBool) CPPTypeResettingCode

func (trw *TypeRWBool) CPPTypeResettingCode(bytesVersion bool, val string) string

func (*TypeRWBool) CPPTypeWritingCode

func (trw *TypeRWBool) CPPTypeWritingCode(bytesVersion bool, val string, bare bool, natArgs []string, last bool) string

func (*TypeRWBool) GenerateCode

func (trw *TypeRWBool) GenerateCode(bytesVersion bool, directImports *DirectImports) string

func (*TypeRWBool) IsDictKeySafe

func (trw *TypeRWBool) IsDictKeySafe() (isSafe bool, isString bool)

func (*TypeRWBool) StreamGenerateCode

func (trw *TypeRWBool) StreamGenerateCode(qw422016 *qt422016.Writer, bytesVersion bool, directImports *DirectImports)

func (*TypeRWBool) WriteGenerateCode

func (trw *TypeRWBool) WriteGenerateCode(qq422016 qtio422016.Writer, bytesVersion bool, directImports *DirectImports)

type TypeRWBrackets

type TypeRWBrackets struct {
	// contains filtered or unexported fields
}

func (*TypeRWBrackets) BeforeCodeGenerationStep1 added in v1.0.2

func (trw *TypeRWBrackets) BeforeCodeGenerationStep1()

func (*TypeRWBrackets) BeforeCodeGenerationStep2

func (trw *TypeRWBrackets) BeforeCodeGenerationStep2()

func (*TypeRWBrackets) CPPFillRecursiveChildren

func (trw *TypeRWBrackets) CPPFillRecursiveChildren(visitedNodes map[*TypeRWWrapper]bool)

func (*TypeRWBrackets) CPPGenerateCode

func (trw *TypeRWBrackets) CPPGenerateCode(hpp *strings.Builder, hppInc *DirectIncludesCPP, hppIncFwd *DirectIncludesCPP, hppDet *strings.Builder, hppDetInc *DirectIncludesCPP, cppDet *strings.Builder, cppDetInc *DirectIncludesCPP, bytesVersion bool, forwardDeclaration bool)

func (*TypeRWBrackets) CPPHasBytesVersion

func (trw *TypeRWBrackets) CPPHasBytesVersion() bool

func (*TypeRWBrackets) CPPTypeReadingCode

func (trw *TypeRWBrackets) CPPTypeReadingCode(bytesVersion bool, val string, bare bool, natArgs []string, last bool) string

func (*TypeRWBrackets) CPPTypeResettingCode

func (trw *TypeRWBrackets) CPPTypeResettingCode(bytesVersion bool, val string) string

func (*TypeRWBrackets) CPPTypeWritingCode

func (trw *TypeRWBrackets) CPPTypeWritingCode(bytesVersion bool, val string, bare bool, natArgs []string, last bool) string

func (*TypeRWBrackets) GenerateCode

func (tuple *TypeRWBrackets) GenerateCode(bytesVersion bool, directImports *DirectImports) string

func (*TypeRWBrackets) IsDictKeySafe

func (trw *TypeRWBrackets) IsDictKeySafe() (isSafe bool, isString bool)

func (*TypeRWBrackets) StreamGenerateCode

func (tuple *TypeRWBrackets) StreamGenerateCode(qw422016 *qt422016.Writer, bytesVersion bool, directImports *DirectImports)

func (*TypeRWBrackets) WriteGenerateCode

func (tuple *TypeRWBrackets) WriteGenerateCode(qq422016 qtio422016.Writer, bytesVersion bool, directImports *DirectImports)

type TypeRWMaybe

type TypeRWMaybe struct {
	// contains filtered or unexported fields
}

func (*TypeRWMaybe) BeforeCodeGenerationStep1 added in v1.0.2

func (trw *TypeRWMaybe) BeforeCodeGenerationStep1()

func (*TypeRWMaybe) BeforeCodeGenerationStep2

func (trw *TypeRWMaybe) BeforeCodeGenerationStep2()

func (*TypeRWMaybe) CPPFillRecursiveChildren

func (trw *TypeRWMaybe) CPPFillRecursiveChildren(visitedNodes map[*TypeRWWrapper]bool)

func (*TypeRWMaybe) CPPGenerateCode

func (trw *TypeRWMaybe) CPPGenerateCode(hpp *strings.Builder, hppInc *DirectIncludesCPP, hppIncFwd *DirectIncludesCPP, hppDet *strings.Builder, hppDetInc *DirectIncludesCPP, cppDet *strings.Builder, cppDetInc *DirectIncludesCPP, bytesVersion bool, forwardDeclaration bool)

func (*TypeRWMaybe) CPPHasBytesVersion

func (trw *TypeRWMaybe) CPPHasBytesVersion() bool

func (*TypeRWMaybe) CPPTypeReadingCode

func (trw *TypeRWMaybe) CPPTypeReadingCode(bytesVersion bool, val string, bare bool, natArgs []string, last bool) string

func (*TypeRWMaybe) CPPTypeResettingCode

func (trw *TypeRWMaybe) CPPTypeResettingCode(bytesVersion bool, val string) string

func (*TypeRWMaybe) CPPTypeWritingCode

func (trw *TypeRWMaybe) CPPTypeWritingCode(bytesVersion bool, val string, bare bool, natArgs []string, last bool) string

func (*TypeRWMaybe) GenerateCode

func (maybe *TypeRWMaybe) GenerateCode(bytesVersion bool, directImports *DirectImports) string

func (*TypeRWMaybe) IsDictKeySafe

func (trw *TypeRWMaybe) IsDictKeySafe() (isSafe bool, isString bool)

func (*TypeRWMaybe) StreamGenerateCode

func (maybe *TypeRWMaybe) StreamGenerateCode(qw422016 *qt422016.Writer, bytesVersion bool, directImports *DirectImports)

func (*TypeRWMaybe) WriteGenerateCode

func (maybe *TypeRWMaybe) WriteGenerateCode(qq422016 qtio422016.Writer, bytesVersion bool, directImports *DirectImports)

type TypeRWPrimitive

type TypeRWPrimitive struct {
	// contains filtered or unexported fields
}

func (*TypeRWPrimitive) BeforeCodeGenerationStep1 added in v1.0.2

func (trw *TypeRWPrimitive) BeforeCodeGenerationStep1()

func (*TypeRWPrimitive) BeforeCodeGenerationStep2

func (trw *TypeRWPrimitive) BeforeCodeGenerationStep2()

func (*TypeRWPrimitive) CPPFillRecursiveChildren

func (trw *TypeRWPrimitive) CPPFillRecursiveChildren(visitedNodes map[*TypeRWWrapper]bool)

func (*TypeRWPrimitive) CPPGenerateCode

func (trw *TypeRWPrimitive) CPPGenerateCode(hpp *strings.Builder, hppInc *DirectIncludesCPP, hppIncFwd *DirectIncludesCPP, hppDet *strings.Builder, hppDetInc *DirectIncludesCPP, cppDet *strings.Builder, cppDetInc *DirectIncludesCPP, bytesVersion bool, forwardDeclaration bool)

func (*TypeRWPrimitive) CPPHasBytesVersion

func (trw *TypeRWPrimitive) CPPHasBytesVersion() bool

func (*TypeRWPrimitive) CPPTypeReadingCode

func (trw *TypeRWPrimitive) CPPTypeReadingCode(bytesVersion bool, val string, bare bool, natArgs []string, last bool) string

func (*TypeRWPrimitive) CPPTypeResettingCode

func (trw *TypeRWPrimitive) CPPTypeResettingCode(bytesVersion bool, val string) string

func (*TypeRWPrimitive) CPPTypeWritingCode

func (trw *TypeRWPrimitive) CPPTypeWritingCode(bytesVersion bool, val string, bare bool, natArgs []string, last bool) string

func (*TypeRWPrimitive) GenerateCode

func (trw *TypeRWPrimitive) GenerateCode(byteVersion bool, directImports *DirectImports) string

func (*TypeRWPrimitive) IsDictKeySafe

func (trw *TypeRWPrimitive) IsDictKeySafe() (isSafe bool, isString bool)

type TypeRWStruct

type TypeRWStruct struct {
	Fields []Field

	ResultType         *TypeRWWrapper
	ResultNatArgs      []ActualNatArg
	ResultHalfResolved HalfResolvedArgument
	// contains filtered or unexported fields
}

func (*TypeRWStruct) BeforeCodeGenerationStep1 added in v1.0.2

func (trw *TypeRWStruct) BeforeCodeGenerationStep1()

func (*TypeRWStruct) BeforeCodeGenerationStep2

func (trw *TypeRWStruct) BeforeCodeGenerationStep2()

func (*TypeRWStruct) CPPFillRecursiveChildren

func (trw *TypeRWStruct) CPPFillRecursiveChildren(visitedNodes map[*TypeRWWrapper]bool)

func (*TypeRWStruct) CPPGenerateCode

func (trw *TypeRWStruct) CPPGenerateCode(hpp *strings.Builder, hppInc *DirectIncludesCPP, hppIncFwd *DirectIncludesCPP, hppDet *strings.Builder, hppDetInc *DirectIncludesCPP, cppDet *strings.Builder, cppDetInc *DirectIncludesCPP, bytesVersion bool, forwardDeclaration bool)

func (*TypeRWStruct) CPPHasBytesVersion

func (trw *TypeRWStruct) CPPHasBytesVersion() bool

func (*TypeRWStruct) CPPReadFields

func (trw *TypeRWStruct) CPPReadFields(bytesVersion bool, hppDetInc *DirectIncludesCPP, cppDetInc *DirectIncludesCPP) string

func (*TypeRWStruct) CPPResetFields

func (trw *TypeRWStruct) CPPResetFields(bytesVersion bool) string

func (*TypeRWStruct) CPPTypeReadingCode

func (trw *TypeRWStruct) CPPTypeReadingCode(bytesVersion bool, val string, bare bool, natArgs []string, last bool) string

func (*TypeRWStruct) CPPTypeResettingCode

func (trw *TypeRWStruct) CPPTypeResettingCode(bytesVersion bool, val string) string

func (*TypeRWStruct) CPPTypeWritingCode

func (trw *TypeRWStruct) CPPTypeWritingCode(bytesVersion bool, val string, bare bool, natArgs []string, last bool) string

func (*TypeRWStruct) CPPWriteFields

func (trw *TypeRWStruct) CPPWriteFields(bytesVersion bool) string

func (*TypeRWStruct) GenerateCode

func (struct_ *TypeRWStruct) GenerateCode(bytesVersion bool, directImports *DirectImports) string

func (*TypeRWStruct) IsDictKeySafe

func (trw *TypeRWStruct) IsDictKeySafe() (isSafe bool, isString bool)

func (*TypeRWStruct) StreamGenerateCode

func (struct_ *TypeRWStruct) StreamGenerateCode(qw422016 *qt422016.Writer, bytesVersion bool, directImports *DirectImports)

func (*TypeRWStruct) WriteGenerateCode

func (struct_ *TypeRWStruct) WriteGenerateCode(qq422016 qtio422016.Writer, bytesVersion bool, directImports *DirectImports)

type TypeRWUnion

type TypeRWUnion struct {
	Fields []Field
	IsEnum bool
	// contains filtered or unexported fields
}

func (*TypeRWUnion) BeforeCodeGenerationStep1 added in v1.0.2

func (trw *TypeRWUnion) BeforeCodeGenerationStep1()

func (*TypeRWUnion) BeforeCodeGenerationStep2

func (trw *TypeRWUnion) BeforeCodeGenerationStep2()

func (*TypeRWUnion) CPPAllNames

func (trw *TypeRWUnion) CPPAllNames(bytesVersion bool) string

func (*TypeRWUnion) CPPAllTags

func (trw *TypeRWUnion) CPPAllTags(bytesVersion bool) string

func (*TypeRWUnion) CPPFillRecursiveChildren

func (trw *TypeRWUnion) CPPFillRecursiveChildren(visitedNodes map[*TypeRWWrapper]bool)

func (*TypeRWUnion) CPPGenerateCode

func (trw *TypeRWUnion) CPPGenerateCode(hpp *strings.Builder, hppInc *DirectIncludesCPP, hppIncFwd *DirectIncludesCPP, hppDet *strings.Builder, hppDetInc *DirectIncludesCPP, cppDet *strings.Builder, cppDetInc *DirectIncludesCPP, bytesVersion bool, forwardDeclaration bool)

func (*TypeRWUnion) CPPGetters

func (trw *TypeRWUnion) CPPGetters(bytesVersion bool) string

func (*TypeRWUnion) CPPHasBytesVersion

func (trw *TypeRWUnion) CPPHasBytesVersion() bool

func (*TypeRWUnion) CPPReadFields

func (trw *TypeRWUnion) CPPReadFields(bytesVersion bool, hppInc *DirectIncludesCPP, cppDetInc *DirectIncludesCPP) string

func (*TypeRWUnion) CPPSetters

func (trw *TypeRWUnion) CPPSetters(bytesVersion bool) string

func (*TypeRWUnion) CPPTypeReadingCode

func (trw *TypeRWUnion) CPPTypeReadingCode(bytesVersion bool, val string, bare bool, natArgs []string, last bool) string

func (*TypeRWUnion) CPPTypeResettingCode

func (trw *TypeRWUnion) CPPTypeResettingCode(bytesVersion bool, val string) string

func (*TypeRWUnion) CPPTypeWritingCode

func (trw *TypeRWUnion) CPPTypeWritingCode(bytesVersion bool, val string, bare bool, natArgs []string, last bool) string

func (*TypeRWUnion) CPPWriteFields

func (trw *TypeRWUnion) CPPWriteFields(bytesVersion bool) string

func (*TypeRWUnion) GenerateCode

func (union *TypeRWUnion) GenerateCode(bytesVersion bool, directImports *DirectImports) string

func (*TypeRWUnion) HasShortFieldCollision added in v1.0.2

func (trw *TypeRWUnion) HasShortFieldCollision(wr *TypeRWWrapper) bool

func (*TypeRWUnion) IsDictKeySafe

func (trw *TypeRWUnion) IsDictKeySafe() (isSafe bool, isString bool)

func (*TypeRWUnion) StreamGenerateCode

func (union *TypeRWUnion) StreamGenerateCode(qw422016 *qt422016.Writer, bytesVersion bool, directImports *DirectImports)

func (*TypeRWUnion) WriteGenerateCode

func (union *TypeRWUnion) WriteGenerateCode(qq422016 qtio422016.Writer, bytesVersion bool, directImports *DirectImports)

type TypeRWWrapper

type TypeRWWrapper struct {
	NatParams []string // external params of type Read/Write method, with nat_ prefix

	WrLong        *TypeRWWrapper // long transitioning code
	WrWithoutLong *TypeRWWrapper // long transitioning code
	// contains filtered or unexported fields
}

func (*TypeRWWrapper) AnnotationsMask added in v1.0.6

func (w *TypeRWWrapper) AnnotationsMask() uint32

func (*TypeRWWrapper) CPPDefaultInitializer

func (w *TypeRWWrapper) CPPDefaultInitializer(halfResolved HalfResolvedArgument, halfResolve bool) string

func (*TypeRWWrapper) CPPFillRecursiveChildren

func (w *TypeRWWrapper) CPPFillRecursiveChildren(visitedNodes map[*TypeRWWrapper]bool)

func (*TypeRWWrapper) CPPTypeStringInNamespace

func (w *TypeRWWrapper) CPPTypeStringInNamespace(bytesVersion bool, hppInc *DirectIncludesCPP) string

func (*TypeRWWrapper) CPPTypeStringInNamespaceHalfResolved added in v1.0.6

func (w *TypeRWWrapper) CPPTypeStringInNamespaceHalfResolved(bytesVersion bool, hppInc *DirectIncludesCPP, halfResolved HalfResolvedArgument) string

func (*TypeRWWrapper) CanonicalString added in v1.0.2

func (w *TypeRWWrapper) CanonicalString(bare bool) string

func (*TypeRWWrapper) CanonicalStringTop added in v1.0.2

func (w *TypeRWWrapper) CanonicalStringTop() string

func (*TypeRWWrapper) FillRecursiveChildren

func (w *TypeRWWrapper) FillRecursiveChildren(visitedNodes map[*TypeRWWrapper]bool)

func (*TypeRWWrapper) FillRecursiveUnwrap

func (w *TypeRWWrapper) FillRecursiveUnwrap(visitedNodes map[*TypeRWWrapper]bool)

func (*TypeRWWrapper) HasAnnotation added in v1.0.6

func (w *TypeRWWrapper) HasAnnotation(str string) bool

func (*TypeRWWrapper) IsTrueType

func (w *TypeRWWrapper) IsTrueType() bool

func (*TypeRWWrapper) JSONHelpFullType added in v1.0.2

func (w *TypeRWWrapper) JSONHelpFullType(bare bool, fields []Field, natArgs []ActualNatArg) string

func (*TypeRWWrapper) JSONHelpNatArg added in v1.0.2

func (w *TypeRWWrapper) JSONHelpNatArg(fields []Field, natArg ActualNatArg) string

func (*TypeRWWrapper) JSONHelpString

func (w *TypeRWWrapper) JSONHelpString() string

func (*TypeRWWrapper) MarkHasBytesVersion

func (w *TypeRWWrapper) MarkHasBytesVersion(visitedNodes map[*TypeRWWrapper]bool) bool

func (*TypeRWWrapper) MarkWantsBytesVersion

func (w *TypeRWWrapper) MarkWantsBytesVersion(visitedNodes map[*TypeRWWrapper]bool)

func (*TypeRWWrapper) NatArgs added in v1.0.2

func (w *TypeRWWrapper) NatArgs(result []ActualNatArg, prefix string) []ActualNatArg

Assign structural names to external arguments

func (*TypeRWWrapper) ShouldWriteEnumElementAlias

func (w *TypeRWWrapper) ShouldWriteEnumElementAlias() bool

func (*TypeRWWrapper) ShouldWriteTypeAlias

func (w *TypeRWWrapper) ShouldWriteTypeAlias() bool

func (*TypeRWWrapper) TypeJSONEmptyCondition

func (w *TypeRWWrapper) TypeJSONEmptyCondition(bytesVersion bool, val string, ref bool) string

func (*TypeRWWrapper) TypeJSONReadingCode

func (w *TypeRWWrapper) TypeJSONReadingCode(bytesVersion bool, directImports *DirectImports, ins *InternalNamespace, jvalue string, val string, natArgs []string, ref bool) string

func (*TypeRWWrapper) TypeJSONWritingCode

func (w *TypeRWWrapper) TypeJSONWritingCode(bytesVersion bool, directImports *DirectImports, ins *InternalNamespace, val string, natArgs []string, ref bool) string

func (*TypeRWWrapper) TypeRandomCode

func (w *TypeRWWrapper) TypeRandomCode(bytesVersion bool, directImports *DirectImports, ins *InternalNamespace, val string, natArgs []string, ref bool) string

func (*TypeRWWrapper) TypeReadingCode

func (w *TypeRWWrapper) TypeReadingCode(bytesVersion bool, directImports *DirectImports, ins *InternalNamespace, val string, bare bool, natArgs []string, ref bool, last bool) string

func (*TypeRWWrapper) TypeResettingCode

func (w *TypeRWWrapper) TypeResettingCode(bytesVersion bool, directImports *DirectImports, ins *InternalNamespace, val string, ref bool) string

func (*TypeRWWrapper) TypeString2

func (w *TypeRWWrapper) TypeString2(bytesVersion bool, directImports *DirectImports, ins *InternalNamespace, isLocal bool, skipAlias bool) string

func (*TypeRWWrapper) TypeWritingCode

func (w *TypeRWWrapper) TypeWritingCode(bytesVersion bool, directImports *DirectImports, ins *InternalNamespace, val string, bare bool, natArgs []string, ref bool, last bool) string

Jump to

Keyboard shortcuts

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