Gwyfile Library
Enumerations | Functions
Validity checking

Enumerations

enum  GwyfileCheckFlags { GWYFILE_CHECK_FLAG_VALIDITY = (1 << GWYFILE_ERROR_DOMAIN_VALIDITY) , GWYFILE_CHECK_FLAG_WARNING = (1 << GWYFILE_ERROR_DOMAIN_WARNING) , GWYFILE_CHECK_FLAG_GWYDDION = (1 << GWYFILE_ERROR_DOMAIN_DATA) }
 
enum  GwyfileInvalidCode { GWYFILE_INVALID_UTF8_NAME = 0 , GWYFILE_INVALID_UTF8_TYPE = 1 , GWYFILE_INVALID_UTF8_STRING = 2 , GWYFILE_INVALID_DOUBLE = 3 }
 
enum  GwyfileWarningCode { GWYFILE_WARNING_TYPE_IDENTIFIER = 0 , GWYFILE_WARNING_EMPTY_NAME = 1 }
 

Functions

bool gwyfile_check_object (const GwyfileObject *object, unsigned int flags, GwyfileErrorList *errlist)
 Checks an object for specifications violations. More...
 

Detailed Description

Libgwyfile functions ensure some minimal level of physical consistency of written files and only accept files that exhibit such consistency. However, there are some things the GWY file format specifications forbid but libgwyfile does not prevent you from doing. Similar, a few things are not a good idea even though the specifications do not explicitly forbid them.

You can use gwyfile_check_object() for further validation of a GWY file. At this moment the function only operates on the generic level, i.e. it does not check specific data organisation and relations in files written by Gwyddion.

Generally, you should never write files that do not pass the check with GWYFILE_CHECK_FLAG_VALIDITY (except for error handling testing). You should never need to read files that do not pass this check.

Files with errors only from the GWYFILE_CHECK_FLAG_WARNING category are nonstandard, but can be possibly meaningful as generic (non-Gwyddion) GWY files.

Files with errors only from the GWYFILE_CHECK_FLAG_GWYDDION category contain objects which look like Gwyddion-specific data but are not correct or consistent. Gwyddion would fail to load them. The check looks for various basic problems, but it is not comprehensive.

Enumeration Type Documentation

◆ GwyfileCheckFlags

Enumerator
GWYFILE_CHECK_FLAG_VALIDITY 

Enables checking for errors from the GWYFILE_ERROR_DOMAIN_VALIDITY category in gwyfile_check_object().

GWYFILE_CHECK_FLAG_WARNING 

Enables checking for errors from the GWYFILE_ERROR_DOMAIN_WARNING category in gwyfile_check_object().

GWYFILE_CHECK_FLAG_GWYDDION 

Enables checking for errors from the GWYFILE_ERROR_DOMAIN_WARNING category in gwyfile_check_object() that indicate incorrect or inconsistent Gwyddion-specific data objects. This includes GWYFILE_ERROR_MISSING_ITEM and GWYFILE_ERROR_ARRAY_SIZE.

Since
1.5

◆ GwyfileInvalidCode

Enumerator
GWYFILE_INVALID_UTF8_NAME 

Item name is not a valid UTF-8 string.

GWYFILE_INVALID_UTF8_TYPE 

Object type is not a valid UTF-8 string.

GWYFILE_INVALID_UTF8_STRING 

String value (or string array value) is not a valid UTF-8 string.

GWYFILE_INVALID_DOUBLE 

Double value is infinity or not-a-number.

◆ GwyfileWarningCode

Enumerator
GWYFILE_WARNING_TYPE_IDENTIFIER 

Object type is not a valid C identifier.

GWYFILE_WARNING_EMPTY_NAME 

Item name is an empty string.

Function Documentation

◆ gwyfile_check_object()

bool gwyfile_check_object ( const GwyfileObject *  object,
unsigned int  flags,
GwyfileErrorList errlist 
)

Checks an object for specifications violations.

This functions check for problems that are not physically prevented during normal libgwyfile usage.

Parameters
objectObject to check.
flagsCombination of bits from GwyfileCheckFlags defining the categories of problems to look for.
errlistError list for detailed report. Pass NULL if you are only interested in OK/not OK information. You can also pass an error list that already contains some errors; additional errors will be added to the list.
Returns
true if the object passed the checks.
Since
1.1