Class GError
- All Implemented Interfaces:
Proxy
GError structure contains information about
an error that has occurred.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()Makes a copy oferror.static QuarkdomainRegister(String errorTypeName, long errorTypePrivateSize, @Nullable ErrorInitFunc errorTypeInit, @Nullable ErrorCopyFunc errorTypeCopy, @Nullable ErrorClearFunc errorTypeClear) This function registers an extendedGErrordomain.static QuarkdomainRegisterStatic(String errorTypeName, long errorTypePrivateSize, @Nullable ErrorInitFunc errorTypeInit, @Nullable ErrorCopyFunc errorTypeCopy, @Nullable ErrorClearFunc errorTypeClear) This function registers an extendedGErrordomain.voidfree()Frees aGErrorand associated resources.static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the GError classstatic GErrorCreates a newGError; unlike g_error_new(),messageis not a printf()-style format string.booleanReturnstrueif this Error matchesdomainandcode,falseotherwise.intreadCode()Read the value of the fieldcode.Read the value of the fielddomain.Read the value of the fieldmessage.voidwriteCode(int code) Write a value in the fieldcode.voidwriteDomain(Quark domain) Write a value in the fielddomain.voidwriteMessage(String message, Arena _arena) Write a value in the fieldmessage.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
GError
Create a GError proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
GError
Creates a newGErrorwith the givendomainandcode,and a message formatted withformat.- Parameters:
domain- error domaincode- error codeformat- printf()-style format for error messagevarargs- parameters for message format
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readDomain
Read the value of the fielddomain.- Returns:
- The value of the field
domain
-
writeDomain
Write a value in the fielddomain.- Parameters:
domain- The new value for the fielddomain
-
readCode
public int readCode()Read the value of the fieldcode.- Returns:
- The value of the field
code
-
writeCode
public void writeCode(int code) Write a value in the fieldcode.- Parameters:
code- The new value for the fieldcode
-
readMessage
Read the value of the fieldmessage.- Returns:
- The value of the field
message
-
writeMessage
-
literal
Creates a newGError; unlike g_error_new(),messageis not a printf()-style format string. Use this function ifmessagecontains text you don't have control over, that could include printf() escape sequences.- Parameters:
domain- error domaincode- error codemessage- error message- Returns:
- a new
GError
-
domainRegister
public static Quark domainRegister(String errorTypeName, long errorTypePrivateSize, @Nullable ErrorInitFunc errorTypeInit, @Nullable ErrorCopyFunc errorTypeCopy, @Nullable ErrorClearFunc errorTypeClear) This function registers an extendedGErrordomain.errorTypeNamewill be duplicated. Otherwise does the same as g_error_domain_register_static().- Parameters:
errorTypeName- string to create aGQuarkfromerrorTypePrivateSize- size of the private error data in byteserrorTypeInit- function initializing fields of the private error dataerrorTypeCopy- function copying fields of the private error dataerrorTypeClear- function freeing fields of the private error data- Returns:
GQuarkrepresenting the error domain- Since:
- 2.68
-
domainRegisterStatic
public static Quark domainRegisterStatic(String errorTypeName, long errorTypePrivateSize, @Nullable ErrorInitFunc errorTypeInit, @Nullable ErrorCopyFunc errorTypeCopy, @Nullable ErrorClearFunc errorTypeClear) This function registers an extendedGErrordomain.errorTypeNameshould not be freed.errorTypePrivateSizemust be greater than 0.errorTypeInitreceives an initializedGErrorand should then initialize the private data.errorTypeCopyis a function that receives both original and a copyGErrorand should copy the fields of the private error data. The standardGErrorfields are already handled.errorTypeClearreceives the pointer to the error, and it should free the fields of the private error data. It should not free the struct itself though.Normally, it is better to use G_DEFINE_EXTENDED_ERROR(), as it already takes care of passing valid information to this function.
- Parameters:
errorTypeName- static string to create aGQuarkfromerrorTypePrivateSize- size of the private error data in byteserrorTypeInit- function initializing fields of the private error dataerrorTypeCopy- function copying fields of the private error dataerrorTypeClear- function freeing fields of the private error data- Returns:
GQuarkrepresenting the error domain- Since:
- 2.68
-
copy
-
free
public void free()Frees aGErrorand associated resources. -
matches
Returnstrueif this Error matchesdomainandcode,falseotherwise. In particular, when this Error isnull,falsewill be returned.If
domaincontains aFAILED(or otherwise generic) error code, you should generally not check for it explicitly, but should instead treat any not-explicitly-recognized error code as being equivalent to theFAILEDcode. This way, if the domain is extended in the future to provide a more specific error code for a certain case, your code will still work.- Parameters:
domain- an error domaincode- an error code- Returns:
- whether this Error has
domainandcode
-