當前位置: 首頁>>代碼示例>>Golang>>正文


Golang go-gccxml.Named類代碼示例

本文整理匯總了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
}
開發者ID:sbinet,項目名稱:cwrap,代碼行數:9,代碼來源:package.go

示例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(),
	}}
}
開發者ID:sbinet,項目名稱:cwrap,代碼行數:10,代碼來源:parse.go

示例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 ""
}
開發者ID:sbinet,項目名稱:cwrap,代碼行數:12,代碼來源:package.go

示例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
}
開發者ID:h12w,項目名稱:cwrap,代碼行數:13,代碼來源:parse.go

示例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(),
	}}
}
開發者ID:sbinet,項目名稱:cwrap,代碼行數:12,代碼來源:parse.go

示例6: newExported

func newExported(t gcc.Named) baseCNamer {
	return baseCNamer{
		id:    t.Id(),
		cName: t.CName(),
		file:  t.File(),
	}
}
開發者ID:h12w,項目名稱:cwrap,代碼行數:7,代碼來源:parse.go

示例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
}
開發者ID:sbinet,項目名稱:cwrap,代碼行數:16,代碼來源:package.go

示例8: upperName

// upper camel name
func (pac *Package) upperName(o gcc.Named) string {
	return upperName(o.CName(), pac.From.NamePrefix)
}
開發者ID:sbinet,項目名稱:cwrap,代碼行數:4,代碼來源:package.go


注:本文中的github.com/hailiang/go-gccxml.Named類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。