ddnet/src/engine/shared/filecollection.h
def b178c7c74a Make sure headers compile standalone
Not planning to do this automatically, but at least cleaning it up once
provides some benefit. Every header should include what it uses.

$ for i in src/**/*.h; do j=${i#"src/"}; echo $j; echo "#include <$j>\nint main() { return 0; }" | /usr/bin/c++ -DCONF_OPENSSL -DCONF_SQL -DCONF_VIDEORECORDER -DCONF_WAVPACK_CLOSE_FILE -DCONF_WAVPACK_OPEN_FILE_INPUT_EX -DGAME_RELEASE_VERSION=\"15.0.5\" -DGLEW_STATIC -D_FORTIFY_SOURCE=2 -I/usr/include/freetype2 -I/usr/include/opus -I/usr/include/SDL2 -I/usr/include/wavpack -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -Isrc -I/usr/include/mysql -I/home/deen/sys/include/ -O2 -g -DNDEBUG -fdiagnostics-color=always -fstack-protector-all -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wformat=2 -Wno-nullability-completeness -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wrestrict -std=gnu++11 -o /dev/null -x c++ -; done

Ignored: tuning.h, variables.h, config_common.h, mapitems_ex_types.h, mapbugs_list.h, protocol7.h, teehistorian_ex_chunks.h, protocol_ex_msgs.h, config.h, config_variables.h, external, keynames.h
2020-09-26 21:50:27 +02:00

43 lines
1.2 KiB
C++

/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
#ifndef ENGINE_SHARED_FILECOLLECTION_H
#define ENGINE_SHARED_FILECOLLECTION_H
#include <engine/storage.h>
#include <stddef.h>
class CFileCollection
{
enum
{
MAX_ENTRIES = 1001,
TIMESTAMP_LENGTH = 20, // _YYYY-MM-DD_HH-MM-SS
};
int64 m_aTimestamps[MAX_ENTRIES];
int m_NumTimestamps;
int m_MaxEntries;
char m_aFileDesc[128];
int m_FileDescLength;
char m_aFileExt[32];
int m_FileExtLength;
char m_aPath[512];
IStorage *m_pStorage;
int64 m_Remove; // Timestamp we want to remove
bool IsFilenameValid(const char *pFilename);
int64 ExtractTimestamp(const char *pTimestring);
void BuildTimestring(int64 Timestamp, char *pTimestring);
int64 GetTimestamp(const char *pFilename);
public:
void Init(IStorage *pStorage, const char *pPath, const char *pFileDesc, const char *pFileExt, int MaxEntries);
void AddEntry(int64 Timestamp);
static int FilelistCallback(const char *pFilename, int IsDir, int StorageType, void *pUser);
static int RemoveCallback(const char *pFilename, int IsDir, int StorageType, void *pUser);
};
#endif