本文整理匯總了Golang中github.com/hailiang/go-gccxml.Named.CName方法的典型用法代碼示例。如果您正苦於以下問題:Golang Named.CName方法的具體用法?Golang Named.CName怎麽用?Golang Named.CName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/hailiang/go-gccxml.Named
的用法示例。
在下文中一共展示了Named.CName方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: newExported
func newExported(t gcc.Named) baseCNamer {
return baseCNamer{
id: t.Id(),
cName: t.CName(),
file: t.File(),
}
}
示例2: lowerName
// lower camel name
func (pac *Package) lowerName(o gcc.Named) string {
s := snakeToLowerCamel(o.CName())
switch s {
case "type", "len":
s += "_"
}
return s
}
示例3: 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(),
}}
}
示例4: 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 ""
}
示例5: 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
}
示例6: 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(),
}}
}
示例7: upperName
// upper camel name
func (pac *Package) upperName(o gcc.Named) string {
return upperName(o.CName(), pac.From.NamePrefix)
}