Validate — Check data sanity and consistency
GSList * | gwy_data_validate () |
const gchar * | gwy_data_error_desrcibe () |
void | gwy_data_validation_failure_list_free () |
enum | GwyDataError |
enum | GwyDataValidateFlags |
GwyDataValidationFailure |
#include <app/gwyapp.h>
A GwyContainer can be used to represent all sorts of data. However, Gwyddion, the application, follows certain
conventions in data organization. Function gwy_data_validate()
checks whether the data actually follows them. This
includes but is not limited to representability of keys in ASCII, conformance to the key naming convention, types
of objects and other items corresponding to expectation, string values being valid UTF-8 and no stray secondary
data.
GSList * gwy_data_validate (GwyContainer *data
,GwyDataValidateFlags flags
);
Checks the contents of a data file.
If GWY_DATA_VALIDATE_CORRECT
is given in flags
, correctable problems are corrected. At present correctable
problems are those that can be fixed by removal of the offending data.
data |
Data container. It should not be managed by the data browser (yet) if flags contain
|
|
flags |
Validation flags. Some influence what is checked, some determine what to do when problems are found. |
List of errors found, free with gwy_data_validation_failure_list_free()
. The list is independent on
whether GWY_DATA_VALIDATE_CORRECT
is given in flags, even though the offending items may be no longer
exist in the container after correction. If GWY_DATA_VALIDATE_NO_REPORT
is present in flags, NULL
is
always returned.
Since: 2.9
const gchar *
gwy_data_error_desrcibe (GwyDataError error
);
Describes a data validation error type.
error |
Data validation error type. |
Error description as an untranslated string owned by the library.
Since: 2.9
void
gwy_data_validation_failure_list_free (GSList *list
);
Frees a data validation failure list.
list |
Failure list returned by |
Since: 2.9
Type of data validation errors.
Key format is invalid (e.g. does not start with |
||
Key contains unprintable characters or characters not representable in ASCII. |
||
Key does not correspond to any data item known to this version of Gwyddion. |
||
Key corresponds to a data item with bogus id number. |
||
Wrong item type (for instance an integer at key |
||
String value is not valid UTF-8. |
||
Reference count is higher than 1. |
||
Secondary data item (e.g. mask, selection or visibility) without a corresponding valid primary data item. |
Since: 2.9
Flags controlling gwy_data_validate()
behaviour.
Note passing GWY_DATA_VALIDATE_NO_REPORT
is allowed only if GWY_DATA_VALIDATE_CORRECT
is present too.
Report all unknown keys as |
||
Report all object items with reference count higher than 1 as
|
||
All above flags combined. |
||
Attempt to correct problems. |
||
Do not report problems. |
Since: 2.9
typedef struct { GwyDataError error; GQuark key; gchar *details; } GwyDataValidationFailure;
Information about one data validate error.
Note the structure may contain more private fields.
GwyDataError |
Error type. |
|
Key of the problematic data item. |
||
Error details, may be |
Since: 2.9