#ifndef EDAPI_JOURNAL_FILE_H #define EDAPI_JOURNAL_FILE_H #include #include #include #include #include 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_peek(EDJournalFile *file, char const *filename, GError **error); /** * Opens the file and seeks to its end. If any new entries are * added by the game then ed_journal_file_read() will return new * entries. */ EDErrorCode ed_journal_file_open_tail(EDJournalFile *self); void ed_journal_file_close(EDJournalFile *self); EDJournalEntry *ed_journal_file_read(EDJournalFile *self, 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); EDCommander *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