63 lines
1.8 KiB
C

#ifndef EDAPI_JOURNAL_FILE_H
#define EDAPI_JOURNAL_FILE_H
#include <edapi/journal/entry.h>
#include <edapi/error.h>
#include <glib.h>
#include <glib-object.h>
G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE(EDJournalFile, ed_journal_file, ED, JOURNALFILE, GObject);
#define ED_TYPE_JOURNALFILE ed_journal_file_get_type()
EDJournalFile *ed_journal_file_new(void);
EDErrorCode ed_journal_file_parse_filename(
char const *basename,
gchar **date,
gint *part
);
/**
* Opens the given journal file, and peeks into it. This
* function fails if the given file cannot be opened. Loading
* entries is a time consuming task (especially with multiple
* files in a journal), so this function only peeks the first
* few entries to figure out game version and CMDR name, and
* it peeks the last entry to determine date range of the
* journal file.
*
* To fully load all entries call ed_journal_file_load().
*/
EDErrorCode ed_journal_file_open(EDJournalFile *file,
char const *filename,
GError **error);
/**
* Load all entries from this given journal.
*/
EDErrorCode ed_journal_file_load(EDJournalFile *self, GError **error);
GDateTime *ed_journal_file_get_datetime(EDJournalFile *self);
gchar const *ed_journal_file_get_commander(EDJournalFile *self);
gchar const *ed_journal_file_get_gameversion(EDJournalFile *self);
EDJournalEntry *ed_journal_file_get_first(EDJournalFile *self);
EDJournalEntry *ed_journal_file_get_last(EDJournalFile *self);
gboolean ed_journal_file_has_entries_in_range(EDJournalFile *self,
GDateTime *start,
GDateTime *end);
gint ed_journal_file_compare_asc(EDJournalFile *lhs, EDJournalFile *rhs);
gint ed_journal_file_compare_desc(EDJournalFile *lhs, EDJournalFile *rhs);
G_END_DECLS
#endif