func (v View) ResolvePackage(curPkg, api string) string {
	if apiPkg, ok := v.PackageMap[api]; ok {
		if curPkg == apiPkg {
			return ""
		}
		return apiPkg
	}
	return "gdnative"
}
ResolvePackage will look up the api in the package map for the Go package name
that we should use.
package classes
import (
	"bytes"
	"encoding/json"
	"encoding/xml"
	"io/ioutil"
	"log"
	"os"
	"os/exec"
	"regexp"
	"sort"
	"strings"
	"text/template"
	"unicode"
	"github.com/kr/pretty"
	"github.com/pinzolo/casee"
)
type View struct {
	API          GDAPI
	APIs         []GDAPI
	Package      string
	PackageMap   map[string]string
	Imports      map[string]map[string]bool
	ClassDocs    map[string]string
	MethodDocs   map[string]map[string]string
	SingletonMap map[string]bool
}
func (v View) ClassDoc(class string) string {
	class = v.GoClassName(class)
	if _, ok := v.ClassDocs[class]; ok {
		return v.UltraTrim(v.ClassDocs[class])
	}
	return "Undocumented"
}
func (v View) MethodDoc(class, method string) string {
	if _, ok := v.MethodDocs[class][method]; ok {
		return v.UltraTrim(v.MethodDocs[class][method])
	}
	return "Undocumented"
}
func (v View) Trim(str string) string {
	return strings.TrimSpace(str)
}
func (v View) UltraTrim(input string) string {
	re_leadclose_whtsp := regexp.MustCompile(`^[\s\p{Zs}]+|[\s\p{Zs}]+$`)
	re_inside_whtsp := regexp.MustCompile(`[\s\p{Zs}]{2,}`)
	final := re_leadclose_whtsp.ReplaceAllString(input, "")
	final = re_inside_whtsp.ReplaceAllString(final, " ")
	return final
}
func (v View) GetImports() []string {
	imports := []string{}
	for key, _ := range v.Imports[v.API.Name] {
		imports = append(imports, key)
	}
	return imports
}
func (v View) GoName(str string) string {
	if str == "float" {
		str = "real"
	}
	return casee.ToPascalCase(strings.Replace(str, "godot_", "", 1))
}
func (v View) GoEmptyReturnType(str string) string {
	if v.IsEnum(str) {
		return "gdnative.NewEmptyInt"
	}
	str = strings.Replace(str, "*", "", 1)
	str = strings.TrimSpace(str)
	if v.IsGodotClass(str) {
		return "gdnative.NewEmptyObject"
	} else {
		return "gdnative.NewEmpty" + v.GoName(str)
	}
}
func (v View) GoNewFromPointerType(str string) string {
	if strings.Contains(str, "enum") || strings.Contains(str, "Enum") {
		return "Int"
	}
	if str == "float" {
		str = "real"
	}
	str = strings.Replace(str, "*", "", 1)
	str = strings.TrimSpace(str)
	if v.IsGodotClass(str) {
		return str
	}
	str = casee.ToPascalCase(str)
	return str
}
func (v View) GoClassName(classString string) string {
	if strings.HasPrefix(classString, "_") {
		return strings.Replace(classString, "_", "", 1)
	}
	return classString
}
func (v View) GoMethodName(methodString string) string {
	isPrivate := false
	if strings.HasPrefix(methodString, "_") {
		methodString = strings.Replace(methodString, "_", "X_", 1)
		isPrivate = true
	}
	methodString = casee.ToPascalCase(methodString)
	if isPrivate {
		return strings.Replace(methodString, "X", "X_", 1)
	}
	for _, api := range v.APIs {
		if api.Name == methodString {
			methodString = methodString + "Method"
		}
	}
	return methodString
}
func (v View) GoArgName(argString string) string {
	switch argString {
	case "type":
		return "aType"
	case "default":
		return "aDefault"
	case "var":
		return "variable"
	case "func":
		return "function"
	case "return":
		return "returns"
	case "range":
		return "rng"
	case "interface":
		return "intrfce"
	}
	return casee.ToCamelCase(argString)
}
func (v View) GoValue(returnString string) string {
	if strings.Contains(returnString, "enum.") {
		returnString = strings.Replace(returnString, "enum.", "", 1)
		if strings.Contains(returnString, "::") {
			returnSlice := strings.Split(returnString, "::")
			className := returnSlice[0]
			enumName := returnSlice[1]
			if v.IsGodotClass(className) {
				return className + enumName
			}
			return "gdnative." + className + enumName
		}
		return "gdnative." + returnString
	}
	if returnString == "void" {
		return ""
	}
	if v.IsGodotClass(returnString) {
		return returnString
	} else {
		if returnString == "float" {
			returnString = "real"
		}
		return "gdnative." + casee.ToPascalCase(returnString)
	}
}
func (v View) IsValidClass(classString, inheritsString string) bool {
	runeString := []rune(classString)
	if strings.HasPrefix(classString, "@") {
		return false
	}
	if unicode.IsLower(runeString[0]) {
		return false
	}
	if classString == "Object" {
		return true
	}
	if v.Trim(inheritsString) == "" {
		return false
	}
	return true
}
func (v View) IsEnum(str string) bool {
	if strings.Contains(str, "enum") || strings.Contains(str, "Enum") {
		return true
	}
	return false
}
func (v View) SetClassName(classString string, singleton bool) string {
	if strings.HasPrefix(classString, "_") {
		classString = strings.Replace(classString, "_", "", 1)
	}
	if singleton {
		return casee.ToCamelCase(classString)
	}
	return classString
}
func (v View) SetBaseClassName(baseClass string) string {
	return v.SetClassName(baseClass, v.SingletonMap[baseClass])
}
func (v View) PackageName(classString string) string {
	str := strings.ToLower(classString)
	switch str {
	case "range":
		return "ranges"
	}
	return str
}