naev 0.10.4
shiplog.h
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
4#pragma once
5
7#include <stdio.h>
8#include <stdlib.h>
9#include <string.h>
12#include "attributes.h"
13#include "nstring.h"
14#include "ntime.h"
15#include "nxml.h"
16
17#define LOG_ID_INVALID -2
18#define LOG_ID_ALL -1
20/* returns a log ID, for log with specified title. If overwrite set, and
21 title already exists, the log will be cleared and previous log ID
22 returned, otherwise a new log ID will be created. */
23NONNULL( 2, 3 )
24int shiplog_create( const char *idstr, const char *logname, const char *type, int overwrite, int maxLen );
25int shiplog_append( const char *idstr, const char *msg );/* Add a message to the log */
26int shiplog_appendByID( int logid, const char *msg );/* Add a message to the log */
27void shiplog_delete( int logid ); /* Delete a log. Use with care (removes all entries with this ID) */
28void shiplog_setRemove( int logid, ntime_t when ); /* Set a log to be removed once time increases */
29void shiplog_deleteType( const char *type );
30void shiplog_clear (void);
31void shiplog_new (void);
32int shiplog_save( xmlTextWriterPtr writer );
33int shiplog_load( xmlNodePtr parent );
34
35void shiplog_listTypes( int *ntypes, char ***logTypes, int includeAll );
36void shiplog_listLogsOfType( const char *type, int *nlogs, char ***logsOut, int **logIDs, int includeAll );
37int shiplog_getIdOfLogOfType ( const char *type, int selectedLog );
38void shiplog_listLog( int logid, const char *type,int *nentries, char ***logentries,int incempty );
39int shiplog_getID( const char *idstr );
void shiplog_new(void)
Set up the shiplog.
Definition: shiplog.c:370
int shiplog_appendByID(int logid, const char *msg)
Adds to the log file.
Definition: shiplog.c:202
int shiplog_load(xmlNodePtr parent)
Loads the logfiile.
Definition: shiplog.c:422
void shiplog_listLog(int logid, const char *type, int *nentries, char ***logentries, int incempty)
Get all log entries matching logid, or if logid==LOG_ID_ALL, matching type, or if type==NULL,...
Definition: shiplog.c:607
void shiplog_listLogsOfType(const char *type, int *nlogs, char ***logsOut, int **logIDs, int includeAll)
Lists matching logs (which haven't expired via "removeAfter") into the provided arrays.
Definition: shiplog.c:522
void shiplog_clear(void)
Clear the shiplog.
Definition: shiplog.c:355
void shiplog_delete(int logid)
Deletes a log (e.g. a cancelled mission may wish to do this, or the user might).
Definition: shiplog.c:267
void shiplog_setRemove(int logid, ntime_t when)
Sets the remove flag for a log - it will be removed once time increases, eg after a player takes off.
Definition: shiplog.c:317
int shiplog_append(const char *idstr, const char *msg)
Appends to the log file.
Definition: shiplog.c:174
void shiplog_deleteType(const char *type)
Deletes all logs of given type.
Definition: shiplog.c:338
int shiplog_create(const char *idstr, const char *logname, const char *type, int overwrite, int maxLen)
Creates a new log with given title of given type.
Definition: shiplog.c:54
int shiplog_getID(const char *idstr)
Checks to see if the log family exists.
Definition: shiplog.c:668