naev 0.12.5
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>
11
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 \
19 -1
20
21/* returns a log ID, for log with specified title. If overwrite set, and
22 title already exists, the log will be cleared and previous log ID
23 returned, otherwise a new log ID will be created. */
24NONNULL( 2, 3 )
25int shiplog_create( const char *idstr, const char *logname, const char *type,
26 int overwrite, int maxLen );
27int shiplog_append( const char *idstr,
28 const char *msg ); /* Add a message to the log */
29int shiplog_appendByID( int logid,
30 const char *msg ); /* Add a message to the log */
31void shiplog_delete( int logid ); /* Delete a log. Use with care (removes all
32 entries with this ID) */
34 int logid, ntime_t when ); /* Set a log to be removed once time increases */
35void shiplog_deleteType( const char *type );
36void shiplog_clear( void );
37void shiplog_new( void );
38int shiplog_save( xmlTextWriterPtr writer );
39int shiplog_load( xmlNodePtr parent );
40
41void shiplog_listTypes( int *ntypes, char ***logTypes, int includeAll );
42void shiplog_listLogsOfType( const char *type, int *nlogs, char ***logsOut,
43 int **logIDs, int includeAll );
44int shiplog_getIdOfLogOfType( const char *type, int selectedLog );
45void shiplog_listLog( int logid, const char *type, int *nentries,
46 char ***logentries, int incempty );
47int shiplog_getID( const char *idstr );
void shiplog_new(void)
Set up the shiplog.
Definition shiplog.c:382
int shiplog_appendByID(int logid, const char *msg)
Adds to the log file.
Definition shiplog.c:211
int shiplog_load(xmlNodePtr parent)
Loads the logfiile.
Definition shiplog.c:434
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:635
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:547
void shiplog_clear(void)
Clear the shiplog.
Definition shiplog.c:367
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:277
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:330
int shiplog_append(const char *idstr, const char *msg)
Appends to the log file.
Definition shiplog.c:183
void shiplog_deleteType(const char *type)
Deletes all logs of given type.
Definition shiplog.c:351
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:56
int shiplog_getID(const char *idstr)
Checks to see if the log family exists.
Definition shiplog.c:696