2025-04-28 14:47:49 +02:00

59 lines
1.4 KiB
C

#ifndef EDAPI_JOURNAL_ENTRY_H
#define EDAPI_JOURNAL_ENTRY_H
#include <edapi/error.h>
#include <glib.h>
#include <glib-object.h>
#define ED_JOURNAL_ENTRY_FILEHEADER "Fileheader"
#define ED_JOURNAL_ENTRY_COMMANDER "Commander"
G_BEGIN_DECLS
struct _EDJournalEntryClass {
GObjectClass parent_class;
gpointer padding[42];
};
G_DECLARE_DERIVABLE_TYPE(
EDJournalEntry, ed_journal_entry, ED, JOURNALENTRY, GObject);
#define ED_TYPE_JOURNALENTRY ed_journal_entry_get_type()
/**
* Returns a new EDJournalEntry object.
*/
EDJournalEntry *ed_journal_entry_new(void);
/**
* Returns a new EDJournalEntry object, and automatically parses
* the given JSON line.
*/
EDJournalEntry *ed_journal_entry_new_parse(gchar const *line, GError **error);
EDErrorCode ed_journal_entry_parse(EDJournalEntry *self,
gchar const *line,
GError **error);
/**
* Returns the underlying json_t pointer. This is a jansson
* pointer and it should not be freed.
*/
void *ed_journal_entry_get_json(EDJournalEntry *self);
gchar const *ed_journal_entry_get_string(EDJournalEntry *self,
gchar const *name);
gchar const *ed_journal_entry_get_event(EDJournalEntry *self);
/**
* Returns true if the journal entry is of the given event.
*/
gboolean ed_journal_entry_is(EDJournalEntry *self, gchar const *event);
G_END_DECLS
#endif