// Code generated by cmd/cgo; DO NOT EDIT.

//line /home/josie/.cache/paru/clone/wiiudownloader/src/pkg/mod/github.com/gotk3/gotk3@v0.6.5-0.20240618185848-ff349ae13f56/cairo/status.go:1:1
package cairo

// #include <stdlib.h>
// #include <cairo.h>
// #include <cairo-gobject.h>
import _ "unsafe"
import (
	"errors"
	"strings"
	"unsafe"
)

// Status is a representation of Cairo's cairo_status_t.
type Status int

const (
	STATUS_SUCCESS                   Status = ( /*line :17:44*/_Ciconst_CAIRO_STATUS_SUCCESS /*line :17:65*/)
	STATUS_NO_MEMORY                 Status = ( /*line :18:44*/_Ciconst_CAIRO_STATUS_NO_MEMORY /*line :18:67*/)
	STATUS_INVALID_RESTORE           Status = ( /*line :19:44*/_Ciconst_CAIRO_STATUS_INVALID_RESTORE /*line :19:73*/)
	STATUS_INVALID_POP_GROUP         Status = ( /*line :20:44*/_Ciconst_CAIRO_STATUS_INVALID_POP_GROUP /*line :20:75*/)
	STATUS_NO_CURRENT_POINT          Status = ( /*line :21:44*/_Ciconst_CAIRO_STATUS_NO_CURRENT_POINT /*line :21:74*/)
	STATUS_INVALID_MATRIX            Status = ( /*line :22:44*/_Ciconst_CAIRO_STATUS_INVALID_MATRIX /*line :22:72*/)
	STATUS_INVALID_STATUS            Status = ( /*line :23:44*/_Ciconst_CAIRO_STATUS_INVALID_STATUS /*line :23:72*/)
	STATUS_NULL_POINTER              Status = ( /*line :24:44*/_Ciconst_CAIRO_STATUS_NULL_POINTER /*line :24:70*/)
	STATUS_INVALID_STRING            Status = ( /*line :25:44*/_Ciconst_CAIRO_STATUS_INVALID_STRING /*line :25:72*/)
	STATUS_INVALID_PATH_DATA         Status = ( /*line :26:44*/_Ciconst_CAIRO_STATUS_INVALID_PATH_DATA /*line :26:75*/)
	STATUS_READ_ERROR                Status = ( /*line :27:44*/_Ciconst_CAIRO_STATUS_READ_ERROR /*line :27:68*/)
	STATUS_WRITE_ERROR               Status = ( /*line :28:44*/_Ciconst_CAIRO_STATUS_WRITE_ERROR /*line :28:69*/)
	STATUS_SURFACE_FINISHED          Status = ( /*line :29:44*/_Ciconst_CAIRO_STATUS_SURFACE_FINISHED /*line :29:74*/)
	STATUS_SURFACE_TYPE_MISMATCH     Status = ( /*line :30:44*/_Ciconst_CAIRO_STATUS_SURFACE_TYPE_MISMATCH /*line :30:79*/)
	STATUS_PATTERN_TYPE_MISMATCH     Status = ( /*line :31:44*/_Ciconst_CAIRO_STATUS_PATTERN_TYPE_MISMATCH /*line :31:79*/)
	STATUS_INVALID_CONTENT           Status = ( /*line :32:44*/_Ciconst_CAIRO_STATUS_INVALID_CONTENT /*line :32:73*/)
	STATUS_INVALID_FORMAT            Status = ( /*line :33:44*/_Ciconst_CAIRO_STATUS_INVALID_FORMAT /*line :33:72*/)
	STATUS_INVALID_VISUAL            Status = ( /*line :34:44*/_Ciconst_CAIRO_STATUS_INVALID_VISUAL /*line :34:72*/)
	STATUS_FILE_NOT_FOUND            Status = ( /*line :35:44*/_Ciconst_CAIRO_STATUS_FILE_NOT_FOUND /*line :35:72*/)
	STATUS_INVALID_DASH              Status = ( /*line :36:44*/_Ciconst_CAIRO_STATUS_INVALID_DASH /*line :36:70*/)
	STATUS_INVALID_DSC_COMMENT       Status = ( /*line :37:44*/_Ciconst_CAIRO_STATUS_INVALID_DSC_COMMENT /*line :37:77*/)
	STATUS_INVALID_INDEX             Status = ( /*line :38:44*/_Ciconst_CAIRO_STATUS_INVALID_INDEX /*line :38:71*/)
	STATUS_CLIP_NOT_REPRESENTABLE    Status = ( /*line :39:44*/_Ciconst_CAIRO_STATUS_CLIP_NOT_REPRESENTABLE /*line :39:80*/)
	STATUS_TEMP_FILE_ERROR           Status = ( /*line :40:44*/_Ciconst_CAIRO_STATUS_TEMP_FILE_ERROR /*line :40:73*/)
	STATUS_INVALID_STRIDE            Status = ( /*line :41:44*/_Ciconst_CAIRO_STATUS_INVALID_STRIDE /*line :41:72*/)
	STATUS_FONT_TYPE_MISMATCH        Status = ( /*line :42:44*/_Ciconst_CAIRO_STATUS_FONT_TYPE_MISMATCH /*line :42:76*/)
	STATUS_USER_FONT_IMMUTABLE       Status = ( /*line :43:44*/_Ciconst_CAIRO_STATUS_USER_FONT_IMMUTABLE /*line :43:77*/)
	STATUS_USER_FONT_ERROR           Status = ( /*line :44:44*/_Ciconst_CAIRO_STATUS_USER_FONT_ERROR /*line :44:73*/)
	STATUS_NEGATIVE_COUNT            Status = ( /*line :45:44*/_Ciconst_CAIRO_STATUS_NEGATIVE_COUNT /*line :45:72*/)
	STATUS_INVALID_CLUSTERS          Status = ( /*line :46:44*/_Ciconst_CAIRO_STATUS_INVALID_CLUSTERS /*line :46:74*/)
	STATUS_INVALID_SLANT             Status = ( /*line :47:44*/_Ciconst_CAIRO_STATUS_INVALID_SLANT /*line :47:71*/)
	STATUS_INVALID_WEIGHT            Status = ( /*line :48:44*/_Ciconst_CAIRO_STATUS_INVALID_WEIGHT /*line :48:72*/)
	STATUS_INVALID_SIZE              Status = ( /*line :49:44*/_Ciconst_CAIRO_STATUS_INVALID_SIZE /*line :49:70*/)
	STATUS_USER_FONT_NOT_IMPLEMENTED Status = ( /*line :50:44*/_Ciconst_CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED /*line :50:83*/)
	STATUS_DEVICE_TYPE_MISMATCH      Status = ( /*line :51:44*/_Ciconst_CAIRO_STATUS_DEVICE_TYPE_MISMATCH /*line :51:78*/)
	STATUS_DEVICE_ERROR              Status = ( /*line :52:44*/_Ciconst_CAIRO_STATUS_DEVICE_ERROR /*line :52:70*/)
	// STATUS_INVALID_MESH_CONSTRUCTION Status = C.CAIRO_STATUS_INVALID_MESH_CONSTRUCTION (since 1.12)
	// STATUS_DEVICE_FINISHED           Status = C.CAIRO_STATUS_DEVICE_FINISHED (since 1.12)
)

var key_Status = map[Status]string{

	STATUS_SUCCESS:                   "CAIRO_STATUS_SUCCESS",
	STATUS_NO_MEMORY:                 "CAIRO_STATUS_NO_MEMORY",
	STATUS_INVALID_RESTORE:           "CAIRO_STATUS_INVALID_RESTORE",
	STATUS_INVALID_POP_GROUP:         "CAIRO_STATUS_INVALID_POP_GROUP",
	STATUS_NO_CURRENT_POINT:          "CAIRO_STATUS_NO_CURRENT_POINT",
	STATUS_INVALID_MATRIX:            "CAIRO_STATUS_INVALID_MATRIX",
	STATUS_INVALID_STATUS:            "CAIRO_STATUS_INVALID_STATUS",
	STATUS_NULL_POINTER:              "CAIRO_STATUS_NULL_POINTER",
	STATUS_INVALID_STRING:            "CAIRO_STATUS_INVALID_STRING",
	STATUS_INVALID_PATH_DATA:         "CAIRO_STATUS_INVALID_PATH_DATA",
	STATUS_READ_ERROR:                "CAIRO_STATUS_READ_ERROR",
	STATUS_WRITE_ERROR:               "CAIRO_STATUS_WRITE_ERROR",
	STATUS_SURFACE_FINISHED:          "CAIRO_STATUS_SURFACE_FINISHED",
	STATUS_SURFACE_TYPE_MISMATCH:     "CAIRO_STATUS_SURFACE_TYPE_MISMATCH",
	STATUS_PATTERN_TYPE_MISMATCH:     "CAIRO_STATUS_PATTERN_TYPE_MISMATCH",
	STATUS_INVALID_CONTENT:           "CAIRO_STATUS_INVALID_CONTENT",
	STATUS_INVALID_FORMAT:            "CAIRO_STATUS_INVALID_FORMAT",
	STATUS_INVALID_VISUAL:            "CAIRO_STATUS_INVALID_VISUAL",
	STATUS_FILE_NOT_FOUND:            "CAIRO_STATUS_FILE_NOT_FOUND",
	STATUS_INVALID_DASH:              "CAIRO_STATUS_INVALID_DASH",
	STATUS_INVALID_DSC_COMMENT:       "CAIRO_STATUS_INVALID_DSC_COMMENT",
	STATUS_INVALID_INDEX:             "CAIRO_STATUS_INVALID_INDEX",
	STATUS_CLIP_NOT_REPRESENTABLE:    "CAIRO_STATUS_CLIP_NOT_REPRESENTABLE",
	STATUS_TEMP_FILE_ERROR:           "CAIRO_STATUS_TEMP_FILE_ERROR",
	STATUS_INVALID_STRIDE:            "CAIRO_STATUS_INVALID_STRIDE",
	STATUS_FONT_TYPE_MISMATCH:        "CAIRO_STATUS_FONT_TYPE_MISMATCH",
	STATUS_USER_FONT_IMMUTABLE:       "CAIRO_STATUS_USER_FONT_IMMUTABLE",
	STATUS_USER_FONT_ERROR:           "CAIRO_STATUS_USER_FONT_ERROR",
	STATUS_NEGATIVE_COUNT:            "CAIRO_STATUS_NEGATIVE_COUNT",
	STATUS_INVALID_CLUSTERS:          "CAIRO_STATUS_INVALID_CLUSTERS",
	STATUS_INVALID_SLANT:             "CAIRO_STATUS_INVALID_SLANT",
	STATUS_INVALID_WEIGHT:            "CAIRO_STATUS_INVALID_WEIGHT",
	STATUS_INVALID_SIZE:              "CAIRO_STATUS_INVALID_SIZE",
	STATUS_USER_FONT_NOT_IMPLEMENTED: "CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED",
	STATUS_DEVICE_TYPE_MISMATCH:      "CAIRO_STATUS_DEVICE_TYPE_MISMATCH",
	STATUS_DEVICE_ERROR:              "CAIRO_STATUS_DEVICE_ERROR",
}

func StatusToString(status Status) string {
	s, ok := key_Status[status]
	if !ok {
		s = "CAIRO_STATUS_UNDEFINED"
	}
	return s
}

func marshalStatus(p uintptr) (interface{}, error) {
	c := ( /*line :106:7*/_Cfunc_g_value_get_enum /*line :106:24*/)((* /*line :106:28*/_Ctype_GValue /*line :106:36*/)(unsafe.Pointer(p)))
	return Status(c), nil
}

// String returns a readable status messsage usable in texts.
func (s Status) String() string {
	str := StatusToString(s)
	str = strings.Replace(str, "CAIRO_STATUS_", "", 1)
	str = strings.Replace(str, "_", " ", 0)
	return strings.ToLower(str)
}

// ToError returns the error for the status. Returns nil if success.
func (s Status) ToError() error {
	if s == STATUS_SUCCESS {
		return nil
	}
	return errors.New(s.String())
}
