当前位置: 首页>>代码示例>>Golang>>正文


Golang Function.Class方法代码示例

本文整理汇总了Golang中github.com/therecipe/qt/internal/binding/parser.Function.Class方法的典型用法代码示例。如果您正苦于以下问题:Golang Function.Class方法的具体用法?Golang Function.Class怎么用?Golang Function.Class使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/therecipe/qt/internal/binding/parser.Function的用法示例。


在下文中一共展示了Function.Class方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: IsPrivateSignal

func IsPrivateSignal(f *parser.Function) bool {

	var fData string

	switch runtime.GOOS {
	case "darwin":
		fData = utils.Load(fmt.Sprintf("/usr/local/Qt5.5.1/5.5/clang_64/lib/%v.framework/Versions/5/Headers/%v", strings.Title(parser.ClassMap[f.Class()].DocModule), filepath.Base(f.Filepath)))

	case "windows":
		fData = utils.Load(fmt.Sprintf("C:\\Qt\\Qt5.5.1\\5.5\\mingw492_32\\include\\%v\\%v", strings.Title(parser.ClassMap[f.Class()].DocModule), filepath.Base(f.Filepath)))

	case "linux":
		switch runtime.GOARCH {
		case "amd64":
			{
				fData = utils.Load(fmt.Sprintf("/usr/local/Qt5.5.1/5.5/gcc_64/include/%v/%v", strings.Title(parser.ClassMap[f.Class()].DocModule), filepath.Base(f.Filepath)))
			}
		case "386":
			{
				fData = utils.Load(fmt.Sprintf("/usr/local/Qt5.5.1/5.5/gcc/include/%v/%v", strings.Title(parser.ClassMap[f.Class()].DocModule), filepath.Base(f.Filepath)))
			}
		}
	}

	if fData != "" {
		return strings.Contains(strings.Split(strings.Split(fData, f.Name+"(")[1], ")")[0], "QPrivateSignal")
	} else {
		fmt.Println("converter.IsPrivateSignal", f.Class())
	}

	return false
}
开发者ID:mouse225,项目名称:qt,代码行数:32,代码来源:body_input.go

示例2: CppBodyInput

func CppBodyInput(f *parser.Function) (o string) {

	if f.Meta == "slot" {
		for _, p := range f.Parameters {
			o += fmt.Sprintf(", Q_ARG(%v, %v)", CppBodyInputSlotValue(f, p), cppInput(p.Name, p.Value, f))
		}
		return
	}

	if f.Meta == "signal" {
		for _, p := range f.Parameters {

			if isEnum(f.Class(), cleanValue(p.Value)) {
				o += fmt.Sprintf("%v, ", cppEnum(f, cleanValue(p.Value), true))
			} else {
				o += fmt.Sprintf("%v, ", p.Value)
			}
		}
		return strings.TrimSuffix(o, ", ")
	}

	for _, p := range f.Parameters {
		o += fmt.Sprintf("%v, ", cppInput(p.Name, p.Value, f))
	}

	return strings.TrimSuffix(o, ", ")
}
开发者ID:mouse225,项目名称:qt,代码行数:27,代码来源:body_input.go

示例3: isBlocked

func isBlocked(f *parser.Function) bool {
	for _, n := range []string{"relations", "scriptValueFromQMetaObject", "fromScriptValue", "QPlaceProposedSearchResult", "evaluateTo", "detected", "isRecordType", "replace", "insert", "remove", "find", "changedStates", "requestTexture", "draw", "setTabPositions", "setExtraSelections", "disconnect", "QJsonObject", "QJsonArray", "QAccessibleStateChangeEvent", "hitTest", "setupUi", "setEditFocus", "toUnicode", "registerConverter", "registerEqualsComparator", "registerComparators", "hasRegisteredConverterFunction", "hasRegisteredComparators", "setNavigationMode", "navigationMode", "setNativeArguments", "setAlphaChannel", "setDefaultAction", "unregisterEventNotifier", "QXmlStreamWriter", "hasEditFocus", "QTextStream", "QStringRef", "QSignalBlocker", "defaultAction", "canConvert", "queryItemValue", "hasQueryItem", "hasEncodedQueryItem", "hasLocalData", "registerEventNotifier", "registerTimer", "setYMD", "nativeArguments"} {
		if f.Name == n {
			f.Access = "unsupported_isBlocked"
			return true
		}
	}

	for _, n := range []string{"QAccessibleInterface::state", "QAccessibleWidget::state"} {
		if f.Fullname == n {
			f.Access = "unsupported_isBlocked"
			return true
		}
	}

	//Android Only
	for _, blockedAndroid := range []string{"setAsDockMenu", "setSelect"} {
		if f.Name == blockedAndroid {
			f.Access = "unsupported_isBlocked_Android"
			return true
		}
	}

	if f.Name == "value" && f.Class() == "QVariant" {
		f.Access = "unsupported_goFunction"
		return true
	}

	if f.Class() == "QAudioBuffer" && strings.Contains(f.Output, "T") {
		f.Access = "unsupported_goFunction"
		return true
	}

	return false
}
开发者ID:mouse225,项目名称:qt,代码行数:35,代码来源:templater.go

示例4: goInput

func goInput(name string, value string, f *parser.Function) string {
	var vOld = value

	name = cleanName(name)
	value = cleanValue(value)

	switch value {
	case "QStringList":
		{
			return fmt.Sprintf("C.CString(strings.Join(%v, \"|\"))", name)
		}

	case "uchar", "char", "QString":
		{
			if strings.Contains(vOld, "**") {
				return fmt.Sprintf("C.CString(strings.Join(%v, \"|\"))", name)
			}
			return fmt.Sprintf("C.CString(%v)", name)
		}

	case "bool":
		{
			return fmt.Sprintf("C.int(qt.GoBoolToInt(%v))", name)
		}

	case "int":
		{
			return fmt.Sprintf("C.int(%v)", name)
		}

	case "qreal":
		{
			return fmt.Sprintf("C.double(%v)", name)
		}

	case "jclass":
		{
			return name
		}
	}

	switch {
	case isEnum(f.Class(), value):
		{
			return fmt.Sprintf("C.int(%v)", name)
		}

	case isClass(value):
		{
			if m := module(parser.ClassMap[value].Module); m != module(f) {
				return fmt.Sprintf("%v.PointerFrom%v(%v)", m, strings.Title(value), name)
			}
			return fmt.Sprintf("PointerFrom%v(%v)", strings.Title(value), name)
		}
	}

	f.Access = "unsupported_goInput"
	return f.Access
}
开发者ID:xland,项目名称:qt,代码行数:59,代码来源:input.go

示例5: goOutputFailed

func goOutputFailed(value string, f *parser.Function) string {
	var vOld = value

	value = cleanValue(value)

	switch value {
	case "bool":
		return "false"

	case "int", "qreal", "qint64":
		return "0"

	case "uchar", "char", "QString":
		return "\"\""

	case "QStringList":
		return "make([]string, 0)"

	case "void", "":
		if strings.Contains(vOld, "*") {
			return "nil"
		}
		return ""

	case "T", "JavaVM", "jclass", "jobject":

		switch f.TemplateMode {
		case "Int":
			{
				return "0"
			}
		case "Boolean":
			{
				return "false"
			}
		case "Void":
			{
				return ""
			}
		}

		return "nil"
	}

	switch {
	case isEnum(f.Class(), value):
		return "0"

	case isClass(value):
		return "nil"

	default:
		f.Access = "unsupported_GoBodyOutputFailed"
		return f.Access
	}
}
开发者ID:mouse225,项目名称:qt,代码行数:56,代码来源:output.go

示例6: cppType

func cppType(f *parser.Function, value string) string {
	var vOld = value

	value = cleanValue(value)

	switch value {
	case "uchar", "char", "QString", "QStringList":
		{
			return "char*"
		}

	case "bool", "int":
		{
			return "int"
		}

	case "void", "":
		{
			if strings.Contains(vOld, "*") {
				return "void*"
			}
			return "void"
		}

	case "T", "JavaVM", "jclass":
		{
			return "void*"
		}

	case "qreal":
		{
			return "double"
		}

	case "...":
		{
			return ""
		}
	}

	switch {
	case isEnum(f.Class(), value):
		{
			return "int"
		}

	case isClass(value):
		{
			return "void*"
		}
	}

	f.Access = "unsupported_cppType"
	return f.Access
}
开发者ID:xland,项目名称:qt,代码行数:55,代码来源:type.go

示例7: CppBodyInputSlotValue

func CppBodyInputSlotValue(f *parser.Function, p *parser.Parameter) string {
	if strings.Contains(p.Value, "*") {
		return fmt.Sprintf("%v*", cleanValue(p.Value))
	}

	if isEnum(f.Class(), p.Value) {
		return cppEnum(f, p.Value, false)
	}

	return cleanValue(p.Value)
}
开发者ID:mouse225,项目名称:qt,代码行数:11,代码来源:body_input.go

示例8: cgoOutput

func cgoOutput(name string, value string, f *parser.Function) string {

	name = cleanName(name)
	value = cleanValue(value)

	switch value {
	case "QStringList":
		{
			return fmt.Sprintf("strings.Split(%v, \"|\")", cgoOutput(name, "QString", f))
		}

	case "uchar", "char", "QString":
		{
			return fmt.Sprintf("C.GoString(%v)", name)
		}

	case "int":
		{
			return fmt.Sprintf("int(%v)", name)
		}

	case "bool":
		{
			return fmt.Sprintf("%v != 0", cgoOutput(name, "int", f))
		}

	case "void", "":
		{
			return ""
		}
	}

	switch {
	case isEnum(f.Class(), value):
		{
			if c, exists := parser.ClassMap[class(cppEnum(f, value, false))]; exists && module(c.Module) != module(f) && module(c.Module) != "" {
				return fmt.Sprintf("%v.%v(%v)", module(c.Module), goEnum(f, value), name)
			}
			return fmt.Sprintf("%v(%v)", goEnum(f, value), name)
		}

	case isClass(value):
		{
			if m := module(parser.ClassMap[value].Module); m != module(f) {
				return fmt.Sprintf("%v.New%vFromPointer(%v)", m, value, name)
			}
			return fmt.Sprintf("New%vFromPointer(%v)", value, name)
		}
	}

	f.Access = "unsupported_cgoOutput"
	return f.Access
}
开发者ID:xland,项目名称:qt,代码行数:53,代码来源:output.go

示例9: CppBodyInputCallback

func CppBodyInputCallback(f *parser.Function) (o string) {
	for _, p := range f.Parameters {

		if isEnum(f.Class(), cleanValue(p.Value)) {
			o += fmt.Sprintf("%v %v, ", cppEnum(f, cleanValue(p.Value), true), cleanName(p.Name))
		} else {
			o += fmt.Sprintf("%v %v, ", p.Value, cleanName(p.Name))
		}
	}

	return strings.TrimSuffix(o, ", ")
}
开发者ID:mouse225,项目名称:qt,代码行数:12,代码来源:body_input.go

示例10: goFunction

func goFunction(f *parser.Function) string {
	if f.Meta == "signal" && !f.Overload {
		var tmp string
		for _, signalMode := range []string{"Connect", "Disconnect", "callback"} {
			f.SignalMode = signalMode
			if signalMode == "callback" {
				tmp += fmt.Sprintf("//export callback%v%v\n", f.Class(), strings.Title(f.Name))
			}
			tmp += fmt.Sprintf("%v{\n%v\n}\n\n", goFunctionHeader(f), goFunctionBody(f))
		}
		f.SignalMode = ""
		return tmp
	}
	return fmt.Sprintf("%v{\n%v\n}", goFunctionHeader(f), goFunctionBody(f))
}
开发者ID:xland,项目名称:qt,代码行数:15,代码来源:function_go.go

示例11: goFunction

func goFunction(f *parser.Function) string {
	if f.Meta == "signal" || strings.Contains(f.Virtual, "impure") && f.Output == "void" {
		var tmp string
		for _, signalMode := range []string{"Connect", "Disconnect", "callback"} {
			f.SignalMode = signalMode
			if signalMode == "callback" {
				tmp += fmt.Sprintf("//export callback%v%v", f.Class(), strings.Replace(strings.Title(f.Name), "~", "Destroy", -1))
				if f.Overload {
					tmp += f.OverloadNumber
				}
				tmp += "\n"
			}
			tmp += fmt.Sprintf("%v{\n%v\n}\n\n", goFunctionHeader(f), goFunctionBody(f))
		}
		f.SignalMode = ""

		var isPrivate bool
		if f.Meta == "signal" {
			isPrivate = converter.IsPrivateSignal(f)
		}

		var tmpMeta = f.Meta
		f.Meta = "plain"
		if !isPrivate {
			tmp += fmt.Sprintf("%v{\n%v\n}\n\n", goFunctionHeader(f), goFunctionBody(f))
			if tmpMeta != "signal" {
				var tmpTmp = strings.Replace(fmt.Sprintf("%v{\n%v\n}\n\n", goFunctionHeader(f), goFunctionBody(f)), "_"+strings.Title(f.Name)+"(", "_"+strings.Title(f.Name)+"Default(", -1)
				tmp += strings.Replace(tmpTmp, ")"+strings.Title(f.Name)+"(", ")"+strings.Title(f.Name)+"Default(", -1)
			}
		}
		f.Meta = tmpMeta

		return tmp
	}

	if isGeneric(f) {
		var tmp string
		for _, m := range jniGenericModes(f) {
			f.TemplateMode = m
			tmp += fmt.Sprintf("%v{\n%v\n}\n", goFunctionHeader(f), goFunctionBody(f))
		}
		f.TemplateMode = ""
		return tmp
	}

	return fmt.Sprintf("%v{\n%v\n}", goFunctionHeader(f), goFunctionBody(f))
}
开发者ID:mouse225,项目名称:qt,代码行数:47,代码来源:function_go.go

示例12: cgoType

func cgoType(f *parser.Function, value string) string {

	value = cleanValue(value)

	switch value {
	case "uchar", "char", "QString", "QStringList":
		{
			return "*C.char"
		}

	case "bool", "int":
		{
			return "C.int"
		}

	case "void", "":
		{
			return ""
		}

	case "qreal":
		{
			return "C.double"
		}

	case "qint64":
		{
			return "C.longlong"
		}
	}

	switch {
	case isEnum(f.Class(), value):
		{
			return "C.int"
		}

	case isClass(value):
		{
			return "unsafe.Pointer"
		}
	}

	f.Access = "unsupported_cgoType"
	return f.Access
}
开发者ID:mouse225,项目名称:qt,代码行数:46,代码来源:type.go

示例13: isDerivedFromSlot

func isDerivedFromSlot(of *parser.Function) bool {

	var c = parser.ClassMap[of.Class()]

	for _, bcName := range c.GetAllBases([]string{}) {
		if bc, exists := parser.ClassMap[bcName]; exists {
			for _, f := range bc.Functions {
				if strings.Contains(f.Virtual, "impure") && f.Output == "void" {
					if of.Name == f.Name && (of.Meta == "slot" || f.Meta == "slot") {
						return true
					}
				}
			}
		}
	}

	return false
}
开发者ID:mouse225,项目名称:qt,代码行数:18,代码来源:templater.go

示例14: CppBodyOutputCallback

func CppBodyOutputCallback(f *parser.Function) (o string) {

	//TODO: parse from docs
	var this = "this"
	if strings.Contains(strings.Split(f.Signature, ")")[1], "const") {
		this = fmt.Sprintf("const_cast<My%v*>(this)", f.Class())
	}

	if parser.ClassMap[f.Class()].IsQObjectSubClass() {
		o += fmt.Sprintf("%v, %v", this, cppOutput("this->objectName()", "QString", f))
	} else {
		o += fmt.Sprintf("%v, %v", this, cppOutput("this->objectNameAbs()", "QString", f))
	}

	for _, p := range f.Parameters {
		o += fmt.Sprintf(", %v", cppOutput(p.Name, p.Value, f))
	}
	return
}
开发者ID:mouse225,项目名称:qt,代码行数:19,代码来源:body_input.go

示例15: isDerivedFromPure

func isDerivedFromPure(of *parser.Function) bool {

	var c = parser.ClassMap[of.Class()]

	for _, bcName := range c.GetAllBases([]string{}) {
		if bc, exists := parser.ClassMap[bcName]; exists {
			for _, f := range bc.Functions {
				if f.Virtual == "impure" && !isDerivedFromSlot(of) {
					return false
				}
				if f.Virtual == "pure" && f.Output == "void" {
					if of.Name == f.Name {
						return true
					}
				}
			}
		}
	}

	return false
}
开发者ID:mouse225,项目名称:qt,代码行数:21,代码来源:templater.go


注:本文中的github.com/therecipe/qt/internal/binding/parser.Function.Class方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。