20 #ifndef __GWYFILE_GWYFILE_H__
21 #define __GWYFILE_GWYFILE_H__ 1
27 typedef enum {
false = 0,
true = 1 } bool;
36 typedef unsigned int uint32_t;
37 typedef long long int int64_t;
38 typedef unsigned long long int uint64_t;
55 #ifndef DOXYGEN_SHOULD_SKIP_THIS
57 #define GWYFILE_NULL_TERMINATED __attribute__((sentinel))
58 #define GWYFILE_MALLOC __attribute__((malloc))
59 #define GWYFILE_PURE __attribute__((pure))
60 #define GWYFILE_UNUSED __attribute__((unused))
62 #define GWYFILE_NULL_TERMINATED
63 #define GWYFILE_MALLOC
65 #define GWYFILE_UNUSED
188 const char *filename,
202 const wchar_t *filename,
217 ...) GWYFILE_NULL_TERMINATED GWYFILE_MALLOC;
220 unsigned int nitems) GWYFILE_MALLOC;
229 const
char *name) GWYFILE_PURE;
240 unsigned int n) GWYFILE_PURE;
276 ...) GWYFILE_NULL_TERMINATED GWYFILE_MALLOC;
279 ...) GWYFILE_NULL_TERMINATED;
282 ...) GWYFILE_NULL_TERMINATED GWYFILE_MALLOC;
285 ...) GWYFILE_NULL_TERMINATED;
292 ...) GWYFILE_NULL_TERMINATED GWYFILE_MALLOC;
295 ...) GWYFILE_NULL_TERMINATED;
297 ...) GWYFILE_NULL_TERMINATED GWYFILE_MALLOC;
300 ...) GWYFILE_NULL_TERMINATED;
306 ...) GWYFILE_NULL_TERMINATED GWYFILE_MALLOC;
309 ...) GWYFILE_NULL_TERMINATED;
311 GwyfileObject **curves,
312 ...) GWYFILE_NULL_TERMINATED GWYFILE_MALLOC;
315 ...) GWYFILE_NULL_TERMINATED;
317 ...) GWYFILE_NULL_TERMINATED GWYFILE_MALLOC;
320 ...) GWYFILE_NULL_TERMINATED;
322 ...) GWYFILE_NULL_TERMINATED GWYFILE_MALLOC;
325 ...) GWYFILE_NULL_TERMINATED;
327 ...) GWYFILE_NULL_TERMINATED GWYFILE_MALLOC;
330 ...) GWYFILE_NULL_TERMINATED;
332 ...) GWYFILE_NULL_TERMINATED GWYFILE_MALLOC;
335 ...) GWYFILE_NULL_TERMINATED;
337 ...) GWYFILE_NULL_TERMINATED GWYFILE_MALLOC;
340 ...) GWYFILE_NULL_TERMINATED;
342 ...) GWYFILE_NULL_TERMINATED GWYFILE_MALLOC;
345 ...) GWYFILE_NULL_TERMINATED;
347 ...) GWYFILE_NULL_TERMINATED GWYFILE_MALLOC;
350 ...) GWYFILE_NULL_TERMINATED;
352 ...) GWYFILE_NULL_TERMINATED GWYFILE_MALLOC;
355 ...) GWYFILE_NULL_TERMINATED;
357 ...) GWYFILE_NULL_TERMINATED GWYFILE_MALLOC;
360 ...) GWYFILE_NULL_TERMINATED;
363 ...) GWYFILE_NULL_TERMINATED GWYFILE_MALLOC;
366 ...) GWYFILE_NULL_TERMINATED;
370 ...) GWYFILE_NULL_TERMINATED GWYFILE_MALLOC;
373 ...) GWYFILE_NULL_TERMINATED;
377 ...) GWYFILE_NULL_TERMINATED;
384 unsigned int *nchannels) GWYFILE_MALLOC;
386 unsigned int *nvolume) GWYFILE_MALLOC;
388 unsigned int *ngraphs) GWYFILE_MALLOC;
390 unsigned int *nxyz) GWYFILE_MALLOC;
392 unsigned int *nxyz) GWYFILE_MALLOC;
394 unsigned int *nspectra) GWYFILE_MALLOC;
429 bool value) GWYFILE_MALLOC;
439 char value) GWYFILE_MALLOC;
449 int32_t value) GWYFILE_MALLOC;
459 int64_t value) GWYFILE_MALLOC;
469 double value) GWYFILE_MALLOC;
479 char *value) GWYFILE_MALLOC;
481 const
char *value) GWYFILE_MALLOC;
483 const
char *value) GWYFILE_MALLOC;
498 GwyfileObject *value) GWYFILE_MALLOC;
502 GwyfileObject *value);
510 uint32_t array_length) GWYFILE_MALLOC;
513 uint32_t array_length) GWYFILE_MALLOC;
516 uint32_t array_length) GWYFILE_MALLOC;
521 uint32_t array_length);
524 uint32_t array_length);
527 uint32_t array_length);
535 uint32_t array_length) GWYFILE_MALLOC;
537 const int32_t *value,
538 uint32_t array_length) GWYFILE_MALLOC;
540 const int32_t *value,
541 uint32_t array_length) GWYFILE_MALLOC;
546 uint32_t array_length);
548 const int32_t *value,
549 uint32_t array_length);
551 const int32_t *value,
552 uint32_t array_length);
560 uint32_t array_length) GWYFILE_MALLOC;
562 const int64_t *value,
563 uint32_t array_length) GWYFILE_MALLOC;
565 const int64_t *value,
566 uint32_t array_length) GWYFILE_MALLOC;
571 uint32_t array_length);
573 const int64_t *value,
574 uint32_t array_length);
576 const int64_t *value,
577 uint32_t array_length);
585 uint32_t array_length) GWYFILE_MALLOC;
588 uint32_t array_length) GWYFILE_MALLOC;
591 uint32_t array_length) GWYFILE_MALLOC;
596 uint32_t array_length);
599 uint32_t array_length);
602 uint32_t array_length);
610 uint32_t array_length) GWYFILE_MALLOC;
612 const
char *const *value,
613 uint32_t array_length) GWYFILE_MALLOC;
615 const
char *const *value,
616 uint32_t array_length) GWYFILE_MALLOC;
621 uint32_t array_length);
623 const
char *const *value,
624 uint32_t array_length);
626 const
char *const *value,
627 uint32_t array_length);
634 GwyfileObject **value,
635 uint32_t array_length) GWYFILE_MALLOC;
638 GwyfileObject **value,
639 uint32_t array_length);
GwyfileCopyMethod
Definition: gwyfile.h:176
@ GWYFILE_COPY_ALL
All data are copied. The copy will own all its data.
Definition: gwyfile.h:179
@ GWYFILE_COPY_DEFAULT
The default behaviour, i.e. GWYFILE_COPY_IF_OWNED.
Definition: gwyfile.h:178
@ GWYFILE_COPY_NONE
No data are copied. The copy will not own any data.
Definition: gwyfile.h:180
@ GWYFILE_COPY_IF_OWNED
Owned data are copied so the copy also own its data; not owned data are not copied.
Definition: gwyfile.h:177
bool gwyfile_write_file(GwyfileObject *object, const char *filename, GwyfileError **error)
Writes a GWY file to a named file.
Definition: gwyfile.c:331
GwyfileObject * gwyfile_read_file(const char *filename, GwyfileError **error)
Reads a GWY file from a named file and returns its top-level object.
Definition: gwyfile.c:405
GwyfileObject * gwyfile_read_wfile(const wchar_t *filename, GwyfileError **error)
Reads a GWY file from a named file and returns its top-level object (wide-character variant).
Definition: gwyfile.c:486
bool gwyfile_write_wfile(GwyfileObject *object, const wchar_t *filename, GwyfileError **error)
Writes a GWY file to a named file (wide-character variant).
Definition: gwyfile.c:447
bool gwyfile_fwrite(GwyfileObject *object, FILE *stream, GwyfileError **error)
Writes a GWY file to a stdio stream.
Definition: gwyfile.c:523
GwyfileObject * gwyfile_fread(FILE *stream, size_t max_size, GwyfileError **error)
Reads a GWY file from a stdio stream and returns the top-level object.
Definition: gwyfile.c:565
GwyfileObject * gwyfile_object_new_lawn(int xres, int yres, int ncurves, double xreal, double yreal,...)
Creates a new GWY file GwyLawn object.
Definition: gwyfile.c:1256
GwyfileObject * gwyfile_object_new_surface(int n,...)
Creates a new GWY file GwySurface object.
Definition: gwyfile.c:1098
bool gwyfile_object_selectionpath_get(const GwyfileObject *object, GwyfileError **error,...)
Obtains information and/or data from a GWY file GwySelectionPath object.
Definition: gwyfile.c:4084
GwyfileObject * gwyfile_object_new_selectionprojective(int nsel,...)
Creates a new GWY file GwySelectionProjective object.
Definition: gwyfile.c:1970
bool gwyfile_object_datafield_get(const GwyfileObject *object, GwyfileError **error,...)
Obtains information and/or data from a GWY file GwyDataField object.
Definition: gwyfile.c:2372
bool gwyfile_object_selectionellipse_get(const GwyfileObject *object, GwyfileError **error,...)
Obtains information and/or data from a GWY file GwySelectionEllipse object.
Definition: gwyfile.c:3790
bool gwyfile_object_selectioncross_get(const GwyfileObject *object, GwyfileError **error,...)
Obtains information and/or data from a GWY file GwySelectionCross object.
Definition: gwyfile.c:3676
bool gwyfile_object_siunit_get(const GwyfileObject *object, GwyfileError **error,...)
Obtains information and/or data from a GWY file GwySIUnit object.
Definition: gwyfile.c:4154
bool gwyfile_object_selectionrectangle_get(const GwyfileObject *object, GwyfileError **error,...)
Obtains information and/or data from a GWY file GwySelectionRectangle object.
Definition: gwyfile.c:3733
GwyfileObject * gwyfile_object_new_selectionellipse(int nsel,...)
Creates a new GWY file GwySelectionEllipse object.
Definition: gwyfile.c:1891
bool gwyfile_object_selectionaxis_get(const GwyfileObject *object, GwyfileError **error,...)
Obtains information and/or data from a GWY file GwySelectionAxis object.
Definition: gwyfile.c:4019
bool gwyfile_object_spectra_get(const GwyfileObject *object, GwyfileError **error,...)
Obtains information and/or data from a GWY file GwySpectra object.
Definition: gwyfile.c:3487
GwyfileObject * gwyfile_object_new_brick(int xres, int yres, int zres, double xreal, double yreal, double zreal,...)
Creates a new GWY file GwyBrick object.
Definition: gwyfile.c:1003
bool gwyfile_object_graphmodel_get(const GwyfileObject *object, GwyfileError **error,...)
Obtains information and/or data from a GWY file GwyGraphModel object.
Definition: gwyfile.c:3319
GwyfileObject * gwyfile_object_new_datafield(int xres, int yres, double xreal, double yreal,...)
Creates a new GWY file GwyDataField object.
Definition: gwyfile.c:831
GwyfileObject * gwyfile_object_new_selectioncross(int nsel,...)
Creates a new GWY file GwySelectionCross object.
Definition: gwyfile.c:1774
GwyfileObject * gwyfile_object_new_selectionaxis(int nsel, int orientation,...)
Creates a new GWY file GwySelectionAxis object.
Definition: gwyfile.c:2009
GwyfileObject * gwyfile_object_new_spectra(int ncurves, GwyfileObject **curves,...)
Creates a new GWY file GwySpectra object.
Definition: gwyfile.c:1389
bool gwyfile_object_graphcurvemodel_get(const GwyfileObject *object, GwyfileError **error,...)
Obtains information and/or data from a GWY file GwyGraphCurveModel object.
Definition: gwyfile.c:3168
bool gwyfile_object_lawn_get(const GwyfileObject *object, GwyfileError **error,...)
Obtains information and/or data from a GWY file GwyLawn object.
Definition: gwyfile.c:2960
GwyfileObject * gwyfile_object_new_selectionline(int nsel,...)
Creates a new GWY file GwySelectionLine object.
Definition: gwyfile.c:1813
bool gwyfile_object_selectionpoint_get(const GwyfileObject *object, GwyfileError **error,...)
Obtains information and/or data from a GWY file GwySelectionPoint object.
Definition: gwyfile.c:3619
GwyfileObject * gwyfile_object_new_selectionrectangle(int nsel,...)
Creates a new GWY file GwySelectionRectangle object.
Definition: gwyfile.c:1852
GwyfileObject * gwyfile_object_new_dataline(int res, double real,...)
Creates a new GWY file GwyDataLine object.
Definition: gwyfile.c:911
GwyfileObject * gwyfile_object_new_selectionpoint(int nsel,...)
Creates a new GWY file GwySelectionPoint object.
Definition: gwyfile.c:1734
bool gwyfile_object_brick_get(const GwyfileObject *object, GwyfileError **error,...)
Obtains information and/or data from a GWY file GwyBrick object.
Definition: gwyfile.c:2613
GwyfileObject * gwyfile_object_new_siunit(const char *unitstr)
Creates a new GWY file GwySIUnit object.
Definition: gwyfile.c:2091
bool gwyfile_object_surface_get(const GwyfileObject *object, GwyfileError **error,...)
Obtains information and/or data from a GWY file GwySurface object.
Definition: gwyfile.c:2716
bool gwyfile_object_selectionlattice_get(const GwyfileObject *object, GwyfileError **error,...)
Obtains information and/or data from a GWY file GwySelectionLattice object.
Definition: gwyfile.c:3903
GwyfileObject * gwyfile_object_new_graphcurvemodel(int ndata,...)
Creates a new GWY file GwyGraphCurveModel object.
Definition: gwyfile.c:1487
bool gwyfile_object_dataline_get(const GwyfileObject *object, GwyfileError **error,...)
Obtains information and/or data from a GWY file GwyDataLine object.
Definition: gwyfile.c:2478
bool gwyfile_object_selectionprojective_get(const GwyfileObject *object, GwyfileError **error,...)
Obtains information and/or data from a GWY file GwySelectionProjective object.
Definition: gwyfile.c:3962
bool gwyfile_object_selectionline_get(const GwyfileObject *object, GwyfileError **error,...)
Obtains information and/or data from a GWY file GwySelectionLine object.
Definition: gwyfile.c:3846
GwyfileObject * gwyfile_object_new_selectionlattice(int nsel,...)
Creates a new GWY file GwySelectionLattice object.
Definition: gwyfile.c:1930
GwyfileObject * gwyfile_object_new_graphmodel(int ncurves,...)
Creates a new GWY file GwyGraphModel object.
Definition: gwyfile.c:1608
GwyfileObject * gwyfile_object_new_selectionpath(int nsel, double slackness, bool closed,...)
Creates a new GWY file GwySelectionPath object.
Definition: gwyfile.c:2057
bool gwyfile_check_object(const GwyfileObject *object, unsigned int flags, GwyfileErrorList *errlist)
Checks an object for specifications violations.
Definition: gwyfile.c:9065
GwyfileInvalidCode
Definition: gwyfile.h:156
GwyfileWarningCode
Definition: gwyfile.h:163
GwyfileCheckFlags
Definition: gwyfile.h:150
@ GWYFILE_INVALID_DOUBLE
Double value is infinity or not-a-number.
Definition: gwyfile.h:160
@ GWYFILE_INVALID_UTF8_NAME
Item name is not a valid UTF-8 string.
Definition: gwyfile.h:157
@ GWYFILE_INVALID_UTF8_STRING
String value (or string array value) is not a valid UTF-8 string.
Definition: gwyfile.h:159
@ GWYFILE_INVALID_UTF8_TYPE
Object type is not a valid UTF-8 string.
Definition: gwyfile.h:158
@ GWYFILE_WARNING_TYPE_IDENTIFIER
Object type is not a valid C identifier.
Definition: gwyfile.h:164
@ GWYFILE_WARNING_EMPTY_NAME
Item name is an empty string.
Definition: gwyfile.h:165
@ GWYFILE_CHECK_FLAG_GWYDDION
Enables checking for errors from the GWYFILE_ERROR_DOMAIN_WARNING category in gwyfile_check_object() ...
Definition: gwyfile.h:153
@ GWYFILE_CHECK_FLAG_WARNING
Enables checking for errors from the GWYFILE_ERROR_DOMAIN_WARNING category in gwyfile_check_object().
Definition: gwyfile.h:152
@ GWYFILE_CHECK_FLAG_VALIDITY
Enables checking for errors from the GWYFILE_ERROR_DOMAIN_VALIDITY category in gwyfile_check_object()...
Definition: gwyfile.h:151
GwyfileErrorCode
Definition: gwyfile.h:117
void gwyfile_error_list_init(GwyfileErrorList *errlist)
Initializes a GwyfileErrorList.
Definition: gwyfile.c:9009
void gwyfile_error_clear(GwyfileError **error)
Clears a GwyfileError.
Definition: gwyfile.c:8990
void gwyfile_error_list_clear(GwyfileErrorList *errlist)
Frees all errors in a GwyfileErrorList.
Definition: gwyfile.c:9026
GwyfileErrorDomain
Definition: gwyfile.h:110
@ GWYFILE_ERROR_OBJECT_NAME
A Gwyddion-specific GWY file data object has the wrong name (type).
Definition: gwyfile.h:125
@ GWYFILE_ERROR_CONFINEMENT
A piece of data does not fit inside its parent object or item.
Definition: gwyfile.h:120
@ GWYFILE_ERROR_TRUNCATED
The top-level object is truncated.
Definition: gwyfile.h:128
@ GWYFILE_ERROR_LONG_STRING
Too long string was encountered.
Definition: gwyfile.h:123
@ GWYFILE_ERROR_TOO_DEEP_NESTING
The object/item nesting depth exceeds the allowed maximum.
Definition: gwyfile.h:127
@ GWYFILE_ERROR_ARRAY_SIZE
An array has an invalid size, i.e. zero or mismatching other sizes.
Definition: gwyfile.h:121
@ GWYFILE_ERROR_MISSING_ITEM
A mandatory item in a Gwyddion-specific GWY file data object is missing.
Definition: gwyfile.h:126
@ GWYFILE_ERROR_ITEM_TYPE
Unknown data item type was encountered.
Definition: gwyfile.h:119
@ GWYFILE_ERROR_DUPLICATE_NAME
Multiple items of the same name were encountered in an object.
Definition: gwyfile.h:122
@ GWYFILE_ERROR_OBJECT_SIZE
An object size does not fit into a 32bit integer.
Definition: gwyfile.h:124
@ GWYFILE_ERROR_MAGIC
The file does not have the expected magic header.
Definition: gwyfile.h:118
@ GWYFILE_ERROR_DOMAIN_SYSTEM
System error domain: codes are equal to errno values. They reflect I/O failures and other system erro...
Definition: gwyfile.h:111
@ GWYFILE_ERROR_DOMAIN_VALIDITY
Libgwyfle validity error domain: codes are equal to GwyfileInvalidCode values. Errors from this domai...
Definition: gwyfile.h:113
@ GWYFILE_ERROR_DOMAIN_DATA
Libgwyfle data error domain: codes are equal to GwyfileErrorCode values. They represent data format e...
Definition: gwyfile.h:112
@ GWYFILE_ERROR_DOMAIN_WARNING
Libgwyfle validity error domain: codes are equal to GwyfileInvalidCode values. Errors from this domai...
Definition: gwyfile.h:114
int * gwyfile_object_container_enumerate_volume(const GwyfileObject *object, unsigned int *nvolume)
Enumerates volume data in a Gwyddion GWY file.
Definition: gwyfile.c:4325
int * gwyfile_object_container_enumerate_channels(const GwyfileObject *object, unsigned int *nchannels)
Enumerates channels in a Gwyddion GWY file.
Definition: gwyfile.c:4271
int * gwyfile_object_container_enumerate_spectra(const GwyfileObject *object, unsigned int *nspectra)
Enumerates spectra in a Gwyddion GWY file.
Definition: gwyfile.c:4546
int * gwyfile_object_container_enumerate_xyz(const GwyfileObject *object, unsigned int *nxyz)
Enumerates XYZ data in a Gwyddion GWY file.
Definition: gwyfile.c:4435
int * gwyfile_object_container_enumerate_graphs(const GwyfileObject *object, unsigned int *ngraphs)
Enumerates graphs in a Gwyddion GWY file.
Definition: gwyfile.c:4380
int * gwyfile_object_container_enumerate_curvemaps(const GwyfileObject *object, unsigned int *nxyz)
Enumerates curve map data in a Gwyddion GWY file.
Definition: gwyfile.c:4490
bool gwyfile_item_get_bool(const GwyfileItem *item)
Gets the boolean value contained in a GWY file data item.
Definition: gwyfile.c:5440
void gwyfile_item_set_bool(GwyfileItem *item, bool value)
Sets the value of a boolean GWY file item.
Definition: gwyfile.c:5422
GwyfileItem * gwyfile_item_new_bool(const char *name, bool value)
Creates a new boolean GWY file item.
Definition: gwyfile.c:5406
void gwyfile_item_set_char_array_const(GwyfileItem *item, const char *value, uint32_t array_length)
Sets the value of a character array GWY file item.
Definition: gwyfile.c:6099
const char * gwyfile_item_get_char_array(const GwyfileItem *item)
Gets the character array value contained in a GWY file data item.
Definition: gwyfile.c:6132
void gwyfile_item_set_char_array_copy(GwyfileItem *item, const char *value, uint32_t array_length)
Sets the value of a character array GWY file item.
Definition: gwyfile.c:6037
GwyfileItem * gwyfile_item_new_char_array_copy(const char *name, const char *value, uint32_t array_length)
Creates a new character array GWY file item.
Definition: gwyfile.c:6008
GwyfileItem * gwyfile_item_new_char_array_const(const char *name, const char *value, uint32_t array_length)
Creates a new character array GWY file item.
Definition: gwyfile.c:6071
void gwyfile_item_set_char_array(GwyfileItem *item, char *value, uint32_t array_length)
Sets the value of a character array GWY file item.
Definition: gwyfile.c:5973
char * gwyfile_item_take_char_array(GwyfileItem *item)
Takes the character array value contained in a GWY file data item.
Definition: gwyfile.c:6156
GwyfileItem * gwyfile_item_new_char_array(const char *name, char *value, uint32_t array_length)
Creates a new character array GWY file item.
Definition: gwyfile.c:5949
GwyfileItem * gwyfile_item_new_char(const char *name, char value)
Creates a new character GWY file item.
Definition: gwyfile.c:5456
char gwyfile_item_get_char(const GwyfileItem *item)
Gets the character value contained in a GWY file data item.
Definition: gwyfile.c:5490
void gwyfile_item_set_char(GwyfileItem *item, char value)
Sets the value of a character GWY file item.
Definition: gwyfile.c:5472
GwyfileItem * gwyfile_item_new_double_array_copy(const char *name, const double *value, uint32_t array_length)
Creates a new double array GWY file item.
Definition: gwyfile.c:6697
void gwyfile_item_set_double_array(GwyfileItem *item, double *value, uint32_t array_length)
Sets the value of a double array GWY file item.
Definition: gwyfile.c:6662
double * gwyfile_item_take_double_array(GwyfileItem *item)
Takes the double array value contained in a GWY file data item.
Definition: gwyfile.c:6844
GwyfileItem * gwyfile_item_new_double_array(const char *name, double *value, uint32_t array_length)
Creates a new double array GWY file item.
Definition: gwyfile.c:6638
GwyfileItem * gwyfile_item_new_double_array_const(const char *name, const double *value, uint32_t array_length)
Creates a new double array GWY file item.
Definition: gwyfile.c:6760
void gwyfile_item_set_double_array_const(GwyfileItem *item, const double *value, uint32_t array_length)
Sets the value of a double array GWY file item.
Definition: gwyfile.c:6788
const double * gwyfile_item_get_double_array(const GwyfileItem *item)
Gets the double array value contained in a GWY file data item.
Definition: gwyfile.c:6820
void gwyfile_item_set_double_array_copy(GwyfileItem *item, const double *value, uint32_t array_length)
Sets the value of a 64bit integer array GWY file item.
Definition: gwyfile.c:6726
GwyfileItem * gwyfile_item_new_double(const char *name, double value)
Creates a new double GWY file item.
Definition: gwyfile.c:5606
double gwyfile_item_get_double(const GwyfileItem *item)
Gets the double value contained in a GWY file data item.
Definition: gwyfile.c:5640
void gwyfile_item_set_double(GwyfileItem *item, double value)
Sets the value of a double GWY file item.
Definition: gwyfile.c:5622
GwyfileItem * gwyfile_item_new_int32_array_copy(const char *name, const int32_t *value, uint32_t array_length)
Creates a new 32bit integer array GWY file item.
Definition: gwyfile.c:6238
void gwyfile_item_set_int32_array_const(GwyfileItem *item, const int32_t *value, uint32_t array_length)
Sets the value of a 32bit integer array GWY file item.
Definition: gwyfile.c:6326
void gwyfile_item_set_int32_array_copy(GwyfileItem *item, const int32_t *value, uint32_t array_length)
Sets the value of a 32bit integer array GWY file item.
Definition: gwyfile.c:6267
GwyfileItem * gwyfile_item_new_int32_array_const(const char *name, const int32_t *value, uint32_t array_length)
Creates a new 32bit integer array GWY file item.
Definition: gwyfile.c:6298
GwyfileItem * gwyfile_item_new_int32_array(const char *name, int32_t *value, uint32_t array_length)
Creates a new 32bit integer array GWY file item.
Definition: gwyfile.c:6179
const int32_t * gwyfile_item_get_int32_array(const GwyfileItem *item)
Gets the 32bit integer array value contained in a GWY file data item.
Definition: gwyfile.c:6359
int32_t * gwyfile_item_take_int32_array(GwyfileItem *item)
Takes the 32bit integer array value contained in a GWY file data item.
Definition: gwyfile.c:6384
void gwyfile_item_set_int32_array(GwyfileItem *item, int32_t *value, uint32_t array_length)
Sets the value of a 32bit integer array GWY file item.
Definition: gwyfile.c:6203
void gwyfile_item_set_int32(GwyfileItem *item, int32_t value)
Sets the value of a 32bit integer GWY file item.
Definition: gwyfile.c:5522
int32_t gwyfile_item_get_int32(const GwyfileItem *item)
Gets the 32bit integer value contained in a GWY file data item.
Definition: gwyfile.c:5540
GwyfileItem * gwyfile_item_new_int32(const char *name, int32_t value)
Creates a new 32bit integer GWY file item.
Definition: gwyfile.c:5506
void gwyfile_item_set_int64_array_copy(GwyfileItem *item, const int64_t *value, uint32_t array_length)
Sets the value of a 64bit integer array GWY file item.
Definition: gwyfile.c:6495
void gwyfile_item_set_int64_array(GwyfileItem *item, int64_t *value, uint32_t array_length)
Sets the value of a 64bit integer array GWY file item.
Definition: gwyfile.c:6431
GwyfileItem * gwyfile_item_new_int64_array_copy(const char *name, const int64_t *value, uint32_t array_length)
Creates a new 64bit integer array GWY file item.
Definition: gwyfile.c:6466
int64_t * gwyfile_item_take_int64_array(GwyfileItem *item)
Takes the 64bit integer array value contained in a GWY file data item.
Definition: gwyfile.c:6615
GwyfileItem * gwyfile_item_new_int64_array_const(const char *name, const int64_t *value, uint32_t array_length)
Creates a new 64bit integer array GWY file item.
Definition: gwyfile.c:6529
void gwyfile_item_set_int64_array_const(GwyfileItem *item, const int64_t *value, uint32_t array_length)
Sets the value of a 64bit integer array GWY file item.
Definition: gwyfile.c:6557
const int64_t * gwyfile_item_get_int64_array(const GwyfileItem *item)
Gets the 64bit integer array value contained in a GWY file data item.
Definition: gwyfile.c:6590
GwyfileItem * gwyfile_item_new_int64_array(const char *name, int64_t *value, uint32_t array_length)
Creates a new 64bit integer array GWY file item.
Definition: gwyfile.c:6407
int64_t gwyfile_item_get_int64(const GwyfileItem *item)
Gets the 64bit integer value contained in a GWY file data item.
Definition: gwyfile.c:5590
void gwyfile_item_set_int64(GwyfileItem *item, int64_t value)
Sets the value of a 64bit integer GWY file item.
Definition: gwyfile.c:5572
GwyfileItem * gwyfile_item_new_int64(const char *name, int64_t value)
Creates a new 64bit integer GWY file item.
Definition: gwyfile.c:5556
GwyfileItem * gwyfile_item_new_object_array(const char *name, GwyfileObject **value, uint32_t array_length)
Creates a new object array GWY file item.
Definition: gwyfile.c:7155
void gwyfile_item_set_object_array(GwyfileItem *item, GwyfileObject **value, uint32_t array_length)
Sets the value of a object array GWY file item.
Definition: gwyfile.c:7184
GwyfileObject *const * gwyfile_item_get_object_array(const GwyfileItem *item)
Gets the object array value contained in a GWY file data item.
Definition: gwyfile.c:8100
GwyfileObject * gwyfile_item_get_object(const GwyfileItem *item)
Gets the object value contained in a GWY file data item.
Definition: gwyfile.c:5903
GwyfileItem * gwyfile_item_new_object(const char *name, GwyfileObject *value)
Creates a new object GWY file item.
Definition: gwyfile.c:5856
void gwyfile_item_set_object(GwyfileItem *item, GwyfileObject *value)
Sets the value of an object GWY file item.
Definition: gwyfile.c:5877
GwyfileObject * gwyfile_item_release_object(GwyfileItem *item)
Releases the object contained in a GWY file data item and frees the item.
Definition: gwyfile.c:5922
GwyfileItem * gwyfile_item_new_string_array_const(const char *name, const char *const *value, uint32_t array_length)
Creates a new string array GWY file item.
Definition: gwyfile.c:7034
const char *const * gwyfile_item_get_string_array(const GwyfileItem *item)
Gets the string array value contained in a GWY file data item.
Definition: gwyfile.c:7109
char ** gwyfile_item_take_string_array(GwyfileItem *item)
Takes the string array value contained in a GWY file data item.
Definition: gwyfile.c:7133
void gwyfile_item_set_string_array_const(GwyfileItem *item, const char *const *value, uint32_t array_length)
Sets the value of a string array GWY file item.
Definition: gwyfile.c:7068
void gwyfile_item_set_string_array_copy(GwyfileItem *item, const char *const *value, uint32_t array_length)
Sets the value of a string array GWY file item.
Definition: gwyfile.c:6987
GwyfileItem * gwyfile_item_new_string_array(const char *name, char **value, uint32_t array_length)
Creates a new string array GWY file item.
Definition: gwyfile.c:6867
void gwyfile_item_set_string_array(GwyfileItem *item, char **value, uint32_t array_length)
Sets the value of a string array GWY file item.
Definition: gwyfile.c:6896
GwyfileItem * gwyfile_item_new_string_array_copy(const char *name, const char *const *value, uint32_t array_length)
Creates a new string array GWY file item.
Definition: gwyfile.c:6940
GwyfileItem * gwyfile_item_new_string(const char *name, char *value)
Creates a new string GWY file item.
Definition: gwyfile.c:5660
GwyfileItem * gwyfile_item_new_string_copy(const char *name, const char *value)
Creates a new string GWY file item.
Definition: gwyfile.c:5712
GwyfileItem * gwyfile_item_new_string_const(const char *name, const char *value)
Creates a new string GWY file item.
Definition: gwyfile.c:5763
void gwyfile_item_set_string_const(GwyfileItem *item, const char *value)
Sets the value of a string GWY file item.
Definition: gwyfile.c:5786
void gwyfile_item_set_string_copy(GwyfileItem *item, const char *value)
Sets the value of a string GWY file item.
Definition: gwyfile.c:5733
void gwyfile_item_set_string(GwyfileItem *item, char *value)
Sets the value of a string GWY file item.
Definition: gwyfile.c:5681
const char * gwyfile_item_get_string(const GwyfileItem *item)
Gets the string value contained in a GWY file data item.
Definition: gwyfile.c:5814
char * gwyfile_item_take_string(GwyfileItem *item)
Takes the string value contained in a GWY file data item.
Definition: gwyfile.c:5836
GwyfileItem * gwyfile_item_read_memory(const void *buffer, size_t size, size_t *bytes_read, GwyfileError **error)
Reads a GWY file data item from a memory buffer.
Definition: gwyfile.c:8056
uint32_t gwyfile_item_array_length(const GwyfileItem *item)
Obtains the array length of a GWY file data item.
Definition: gwyfile.c:7326
bool gwyfile_item_fwrite(const GwyfileItem *item, FILE *stream, GwyfileError **error)
Writes a GWY file data item to a stdio stream.
Definition: gwyfile.c:7382
GwyfileItem * gwyfile_item_copy(const GwyfileItem *item, GwyfileCopyMethod method)
Creates a copy of a data item.
Definition: gwyfile.c:5309
size_t gwyfile_item_size(const GwyfileItem *item)
Obtains the serialized total size of a GWY file data item.
Definition: gwyfile.c:7363
size_t gwyfile_item_data_size(const GwyfileItem *item)
Obtains the serialized size of a GWY file data item data.
Definition: gwyfile.c:7345
const char * gwyfile_item_name(const GwyfileItem *item)
Obtains the name of a GWY file data item.
Definition: gwyfile.c:7311
GwyfileItem * gwyfile_item_fread(FILE *stream, size_t max_size, GwyfileError **error)
Reads a GWY file data item from a stdio stream.
Definition: gwyfile.c:7830
GwyfileItemType
Definition: gwyfile.h:87
size_t gwyfile_item_write_memory(const GwyfileItem *item, void *buffer, size_t size, GwyfileError **error)
Writes a GWY file data item to a memory buffer.
Definition: gwyfile.c:7511
void gwyfile_item_free(GwyfileItem *item)
Frees a GWY file data item.
Definition: gwyfile.c:7229
bool gwyfile_item_owns_data(const GwyfileItem *item)
Reports if a GWY file item owns its data.
Definition: gwyfile.c:8082
GwyfileItemType gwyfile_item_type(const GwyfileItem *item)
Obtains the type of a GWY file data item.
Definition: gwyfile.c:7298
@ GWYFILE_ITEM_INT32
32bit integer.
Definition: gwyfile.h:90
@ GWYFILE_ITEM_DOUBLE_ARRAY
Array of IEEE double precision floating point numbers.
Definition: gwyfile.h:98
@ GWYFILE_ITEM_STRING
String of characters.
Definition: gwyfile.h:93
@ GWYFILE_ITEM_OBJECT_ARRAY
Array of objects, i.e. a nested data structures.
Definition: gwyfile.h:100
@ GWYFILE_ITEM_INT64_ARRAY
Array of 64bit integers.
Definition: gwyfile.h:97
@ GWYFILE_ITEM_STRING_ARRAY
Array of character strings.
Definition: gwyfile.h:99
@ GWYFILE_ITEM_CHAR_ARRAY
Array of characters.
Definition: gwyfile.h:95
@ GWYFILE_ITEM_BOOL
Boolean (true or false).
Definition: gwyfile.h:88
@ GWYFILE_ITEM_INT64
64bit integer.
Definition: gwyfile.h:91
@ GWYFILE_ITEM_INT32_ARRAY
Array of 32bit integers.
Definition: gwyfile.h:96
@ GWYFILE_ITEM_OBJECT
Object, i.e. a nested data structure.
Definition: gwyfile.h:94
@ GWYFILE_ITEM_DOUBLE
IEEE double precision floating point number.
Definition: gwyfile.h:92
@ GWYFILE_ITEM_CHAR
Single character.
Definition: gwyfile.h:89
GwyfileItem * gwyfile_object_take(GwyfileObject *object, const char *name)
Takes an item from a GWY file data object.
Definition: gwyfile.c:4771
void gwyfile_object_foreach(const GwyfileObject *object, GwyfileObjectForeachFunc function, void *user_data)
Calls a function for each item contained in a GWY file data object.
Definition: gwyfile.c:4894
GwyfileObject * gwyfile_object_new(const char *name,...)
Creates a new GWY file object.
Definition: gwyfile.c:607
GwyfileItem * gwyfile_object_get_nth(const GwyfileObject *object, unsigned int n)
Gets n-th data item from a GWY file object.
Definition: gwyfile.c:4875
const char * gwyfile_object_name(const GwyfileObject *object)
Obtains the name of a GWY file data object.
Definition: gwyfile.c:4599
bool gwyfile_object_remove(GwyfileObject *object, const char *name)
Removes an item from a GWY file data object and frees it.
Definition: gwyfile.c:4712
GwyfileItem * gwyfile_object_get_with_type(const GwyfileObject *object, const char *name, GwyfileItemType type)
Finds a data item in a GWY file object, ensuring its type.
Definition: gwyfile.c:4806
size_t gwyfile_object_size(const GwyfileObject *object)
Obtains the serialized size of a GWY file data object.
Definition: gwyfile.c:4615
GwyfileObject * gwyfile_object_newv(const char *name, GwyfileItem **items, unsigned int nitems)
Creates a new GWY file object.
Definition: gwyfile.c:651
bool gwyfile_object_add(GwyfileObject *object, GwyfileItem *item)
Adds an data item to a GWY file data object.
Definition: gwyfile.c:4652
GwyfileObject * gwyfile_object_copy(const GwyfileObject *object, GwyfileCopyMethod method)
Creates a copy of a GWY file object.
Definition: gwyfile.c:686
void(* GwyfileObjectForeachFunc)(const GwyfileItem *item, void *user_data)
Type of function for iterating over GWY file data object items.
Definition: gwyfile.h:213
GwyfileObject * gwyfile_object_read_memory(const void *buffer, size_t size, size_t *bytes_read, GwyfileError **error)
Reads a GWY file data object from a memory buffer.
Definition: gwyfile.c:5196
GwyfileObject * gwyfile_object_fread(FILE *stream, size_t max_size, GwyfileError **error)
Reads a GWY file data object from a stdio stream.
Definition: gwyfile.c:5233
size_t gwyfile_object_write_memory(const GwyfileObject *object, void *buffer, size_t size, GwyfileError **error)
Writes a GWY file data object to a memory buffer.
Definition: gwyfile.c:5255
size_t gwyfile_object_data_size(const GwyfileObject *object)
Obtains the serialized data size of a GWY file data object.
Definition: gwyfile.c:4631
bool gwyfile_object_fwrite(GwyfileObject *object, FILE *stream, GwyfileError **error)
Writes a GWY file data object to a stdio stream.
Definition: gwyfile.c:4972
unsigned int gwyfile_object_nitems(const GwyfileObject *object)
Obtains the number of items in a GWY file data object.
Definition: gwyfile.c:4920
GwyfileItem * gwyfile_object_take_with_type(GwyfileObject *object, const char *name, GwyfileItemType type)
Takes a data item from a GWY file object, ensuring its type.
Definition: gwyfile.c:4836
GwyfileItem * gwyfile_object_get(const GwyfileObject *object, const char *name)
Finds a data item in a GWY file object.
Definition: gwyfile.c:4746
const char ** gwyfile_object_item_names(const GwyfileObject *object)
Constructs the list of names of all items in a GWY file data object.
Definition: gwyfile.c:4937
void gwyfile_object_free(GwyfileObject *object)
Frees a GWY file data object.
Definition: gwyfile.c:4577
List of errors.
Definition: gwyfile.h:137
GwyfileError ** errors
Array holding the errors.
Definition: gwyfile.h:138
size_t n
Number of errors in the list.
Definition: gwyfile.h:139
Detailed information about an error.
Definition: gwyfile.h:131
char * message
Text message describing the error. It is allocated when the error struct is created and freed with gw...
Definition: gwyfile.h:134
int code
Particular error code. For errors from the system domain it is equal to errno while for libgwyfile-sp...
Definition: gwyfile.h:133
GwyfileErrorDomain domain
Identifier of the class of errors.
Definition: gwyfile.h:132
One piece of data in a GWY file.
Data structure with named components.