本文整理匯總了Golang中github.com/hailiang/go-gccxml.Named類的典型用法代碼示例。如果您正苦於以下問題:Golang Named類的具體用法?Golang Named怎麽用?Golang Named使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Named類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: lowerName
// lower camel name
func (pac *Package) lowerName(o gcc.Named) string {
s := snakeToLowerCamel(o.CName())
switch s {
case "type", "len":
s += "_"
}
return s
}
示例2: newPtrTypedef
func (pac *Package) newPtrTypedef(t gcc.Named) Ptr {
goName := pac.globalName(t)
if goName == "" {
goName = "uintptr"
}
return Ptr{namer{
goName: goName,
cgoName: "C." + t.CName(),
}}
}
示例3: globalName
// type name that may be declared in this or included packages.
func (pac *Package) globalName(o gcc.Named) string {
if pac.fileIds.Has(o.File()) && pac.hasPrefix(o.CName()) {
return pac.localName(o)
}
for _, inc := range pac.Included {
if goName := inc.globalName(o); goName != "" && !contains(goName, ".") {
return joins(inc.PacName, ".", goName)
}
}
return ""
}
示例4: lowerName
// lower camel name
func lowerName(o gcc.Named) string {
s := snakeToLowerCamel(o.CName())
switch s {
case "func", "interface", "select", "defer", "go", "map",
"chan", "package", "fallthrough", "range", "type", "import", "var",
"true", "false", "iota", "nil",
"append", "cap", "close", "complex", "copy", "delete", "imag", "len",
"make", "new", "panic", "print", "println", "real", "recover":
s += "_"
}
return s
}
示例5: newPtrReference
func (pac *Package) newPtrReference(t gcc.Named) Ptr {
goName := pac.globalName(t)
if goName == "" {
goName = "uintptr"
} else {
goName = "*" + goName
}
return Ptr{namer{
goName: goName,
cgoName: "*C." + t.CName(),
}}
}
示例6: newExported
func newExported(t gcc.Named) baseCNamer {
return baseCNamer{
id: t.Id(),
cName: t.CName(),
file: t.File(),
}
}
示例7: localName
// upper name that is unique within the package
func (pac *Package) localName(o gcc.Named) string {
n := pac.upperName(o)
if sid, exists := pac.localNames[n]; !exists || o.Id() == sid {
pac.localNames[n] = o.Id()
return n
}
for {
n += "_"
if _, exists := pac.localNames[n]; !exists {
break
}
}
pac.localNames[n] = o.Id()
return n
}
示例8: upperName
// upper camel name
func (pac *Package) upperName(o gcc.Named) string {
return upperName(o.CName(), pac.From.NamePrefix)
}