JcatFile: libjcat Reference Manual

## JcatFile JcatFile |

## Functions

JcatFile * | jcat_file_new ()
gchar * | jcat_file_to_string ()
gboolean | jcat_file_import_stream ()
gboolean | jcat_file_import_file ()
gboolean | jcat_file_import_json ()
gboolean | jcat_file_export_stream ()
gboolean | jcat_file_export_file ()
gchar * | jcat_file_export_json ()
GPtrArray * | jcat_file_get_items ()
JcatItem * | jcat_file_get_item_by_id ()
JcatItem * | jcat_file_get_item_default ()
void | jcat_file_add_item ()
guint32 | jcat_file_get_version_major ()
guint32 | jcat_file_get_version_minor ()

## Types and Values

#define | JCAT_TYPE_FILE
struct | JcatFileClass
| JcatFile

## Description

## Functions

### jcat_file_new ()

    JcatFile *
    jcat_file_new (void);

Creates a new file.

#### Returns

a JcatFile

Since: 0.1.0

### jcat_file_to_string ()

    gchar *
    jcat_file_to_string (JcatFile *self);

Converts the JcatFile to a string.

#### Parameters

self | JcatFile |

#### Returns

string

Since: 0.1.0

### jcat_file_import_stream ()

    gboolean
    jcat_file_import_stream (JcatFile *self,
                             GInputStream *istream,
                             JcatImportFlags flags,
                             GCancellable *cancellable,
                             GError **error);

Imports a compressed Jcat file from a file.

#### Parameters

self | JcatFile |
istream | GInputStream |
flags | JcatImportFlags, typically `JCAT_IMPORT_FLAG_NONE` |
cancellable | GCancellable, or `NULL` |
error | GError, or `NULL` |

#### Returns

`TRUE` for success

Since: 0.1.0

### jcat_file_import_file ()

    gboolean
    jcat_file_import_file (JcatFile *self,
                           GFile *gfile,
                           JcatImportFlags flags,
                           GCancellable *cancellable,
                           GError **error);

Imports a compressed Jcat file from an input stream.

#### Parameters

self | JcatFile |
gfile | gfile |
flags | JcatImportFlags, typically `JCAT_IMPORT_FLAG_NONE` |
cancellable | GCancellable, or `NULL` |
error | GError, or `NULL` |

#### Returns

`TRUE` for success

Since: 0.1.0

### jcat_file_import_json ()

    gboolean
    jcat_file_import_json (JcatFile *self,
                           const gchar *json,
                           JcatImportFlags flags,
                           GError **error);

Imports a Jcat file from raw JSON.

#### Parameters

self | JcatFile |
json | JSON data |
flags | JcatImportFlags, typically `JCAT_IMPORT_FLAG_NONE` |
error | GError, or `NULL` |

#### Returns

`TRUE` for success

Since: 0.1.0

### jcat_file_export_stream ()

    gboolean
    jcat_file_export_stream (JcatFile *self,
                             GOutputStream *ostream,
                             JcatExportFlags flags,
                             GCancellable *cancellable,
                             GError **error);

Exports a Jcat file to a compressed stream.

#### Parameters

self | JcatFile |
ostream | GOutputStream |
flags | a JcatExportFlags, typically `JCAT_EXPORT_FLAG_NONE` |
cancellable | GCancellable, or `NULL` |
error | GError, or `NULL` |

#### Returns

`TRUE` for success

Since: 0.1.0

### jcat_file_export_file ()

    gboolean
    jcat_file_export_file (JcatFile *self,
                           GFile *gfile,
                           JcatExportFlags flags,
                           GCancellable *cancellable,
                           GError **error);

Exports a Jcat file to a compressed file.

#### Parameters

self | JcatFile |
gfile | gfile |
flags | a JcatExportFlags, typically `JCAT_EXPORT_FLAG_NONE` |
cancellable | GCancellable, or `NULL` |
error | GError, or `NULL` |

#### Returns

`TRUE` for success

Since: 0.1.0

### jcat_file_export_json ()

    gchar *
    jcat_file_export_json (JcatFile *self,
                           JcatExportFlags flags,
                           GError **error);

Exports a Jcat file to raw JSON.

#### Parameters

self | JcatFile |
flags | a JcatExportFlags, typically `JCAT_EXPORT_FLAG_NONE` |
error | GError, or `NULL` |

#### Returns

JSON output, or `NULL` for error.

[transfer full]

Since: 0.1.0

### jcat_file_get_items ()

    GPtrArray *
    jcat_file_get_items (JcatFile *self);

Returns all the items in the file.

#### Parameters

self | JcatFile |

#### Returns

all the items in the file.

[transfer container][element-type JcatItem]

Since: 0.1.0

### jcat_file_get_item_by_id ()

    JcatItem *
    jcat_file_get_item_by_id (JcatFile *self,
                              const gchar *id,
                              GError **error);

Finds the item with the specified ID, falling back to the ID alias if set.

#### Parameters

self | JcatFile |
id | An ID, typically a filename basename |
error | GError, or `NULL` |

#### Returns

a JcatItem, or `NULL` if the filename was not found.

[transfer full]

Since: 0.1.0

### jcat_file_get_item_default ()

    JcatItem *
    jcat_file_get_item_default (JcatFile *self,
                                GError **error);

Finds the default item. If more than one JcatItem exists this function will return with an error.

#### Parameters

self | JcatFile |
error | GError, or `NULL` |

#### Returns

a JcatItem, or `NULL` if no default exists.

[transfer full]

Since: 0.1.0

### jcat_file_add_item ()

    void
    jcat_file_add_item (JcatFile *self,
                        JcatItem *item);

Adds an item to a file.

#### Parameters

self | JcatFile |
item | JcatItem |

Since: 0.1.0

### jcat_file_get_version_major ()

    guint32
    jcat_file_get_version_major (JcatFile *self);

Returns the major version number of the Jcat specification

#### Parameters

self | JcatFile |

#### Returns

integer

Since: 0.1.0

### jcat_file_get_version_minor ()

    guint32
    jcat_file_get_version_minor (JcatFile *self);

Returns the minor version number of the Jcat specification

#### Parameters

self | JcatFile |

#### Returns

integer

Since: 0.1.0

## Types and Values

### JCAT_TYPE_FILE

    #define JCAT_TYPE_FILE (jcat_file_get_type ())

### struct JcatFileClass

    struct JcatFileClass {
    	GObjectClass		 parent_class;
    	gpointer		 padding[15];
    };

### JcatFile

    typedef struct _JcatFile JcatFile;