DDraceNetwork Docs
filecollection.h
Go to the documentation of this file.
1/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
2/* If you are missing that file, acquire a complete release at teeworlds.com. */
3#ifndef ENGINE_SHARED_FILECOLLECTION_H
4#define ENGINE_SHARED_FILECOLLECTION_H
5
6#include <base/system.h>
7#include <base/types.h>
8
9#include <cstdint>
10#include <vector>
11
12class IStorage;
13
15{
16 enum
17 {
18 TIMESTAMP_LENGTH = 20, // _YYYY-MM-DD_HH-MM-SS
19 };
20
22 {
25 CFileEntry(int64_t Timestamp, const char *pFilename)
26 {
27 m_Timestamp = Timestamp;
28 str_copy(m_aFilename, pFilename);
29 }
30 };
31
32 std::vector<CFileEntry> m_vFileEntries;
33 char m_aFileDesc[128];
35 char m_aFileExt[32];
39
40 bool ExtractTimestamp(const char *pTimestring, time_t *pTimestamp);
41 bool ParseFilename(const char *pFilename, time_t *pTimestamp);
42
43public:
44 void Init(IStorage *pStorage, const char *pPath, const char *pFileDesc, const char *pFileExt, int MaxEntries);
45
46 static int FilelistCallback(const char *pFilename, int IsDir, int StorageType, void *pUser);
47};
48
49#endif
Definition: filecollection.h:15
@ TIMESTAMP_LENGTH
Definition: filecollection.h:18
char m_aPath[IO_MAX_PATH_LENGTH]
Definition: filecollection.h:37
std::vector< CFileEntry > m_vFileEntries
Definition: filecollection.h:32
bool ParseFilename(const char *pFilename, time_t *pTimestamp)
Definition: filecollection.cpp:55
bool ExtractTimestamp(const char *pTimestring, time_t *pTimestamp)
Definition: filecollection.cpp:47
void Init(IStorage *pStorage, const char *pPath, const char *pFileDesc, const char *pFileExt, int MaxEntries)
Definition: filecollection.cpp:11
IStorage * m_pStorage
Definition: filecollection.h:38
static int FilelistCallback(const char *pFilename, int IsDir, int StorageType, void *pUser)
Definition: filecollection.cpp:89
char m_aFileExt[32]
Definition: filecollection.h:35
int m_FileExtLength
Definition: filecollection.h:36
char m_aFileDesc[128]
Definition: filecollection.h:33
int m_FileDescLength
Definition: filecollection.h:34
Definition: storage.h:20
int str_copy(char *dst, const char *src, int dst_size)
Definition: system.cpp:2761
Definition: filecollection.h:22
char m_aFilename[IO_MAX_PATH_LENGTH]
Definition: filecollection.h:24
CFileEntry(int64_t Timestamp, const char *pFilename)
Definition: filecollection.h:25
time_t m_Timestamp
Definition: filecollection.h:23
@ IO_MAX_PATH_LENGTH
Definition: types.h:43