aboutsummaryrefslogtreecommitdiff
path: root/src/HTTPD_FileList.h
blob: fc3e5fc1725811e940d3c969bf681e115cbae4b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef _HTTPDFILELIST_H_
#define _HTTPDFILELIST_H_ 1

/* SW temporary explicit paths while testing SString module */
#include "CactusConnect/HTTPD/src/SString.h"
#include "CactusConnect/HTTPD/src/SString_Namespace.h"

typedef struct httpFileItem_tag
{
  const String *thorn;
  const String *varname;
  const String *mimetype;
  const String *slice;
  const String *description;
  const String *filename;
  const String *linkname;
} httpFileItem;

typedef enum {FLFALSE, FLTRUE} FLBOOL;

/* a wrapper module around PtrList for type safety */

typedef struct PtrList_tag FileList;

#ifdef __cplusplus
extern "C"
{
#endif

size_t          HTTPD_FileList_NumberOfItems( const FileList * );
FileList *      HTTPD_FileList_New( void );
void            HTTPD_FileList_Delete( FileList * );

void            HTTPD_FileList_FreeItemsInListAndEmpty( FileList * );
void            HTTPD_FileList_Append( FileList *, httpFileItem * item );
httpFileItem *  HTTPD_FileList_Item( const FileList *, size_t index );

typedef int     (*HTTPD_FileListSortComparison)( const httpFileItem *,
						const httpFileItem * );
int		HTTPD_FileListCompare_Var_Thorn_Slice( const httpFileItem *,
						const httpFileItem * );

void            HTTPD_FileList_SortAccordingTo( FileList *, HTTPD_FileListSortComparison comparison );

#ifdef __cplusplus
}
#endif


#define NumberOfFiles( a ) \
                HTTPD_FileList_NumberOfItems( a )
#define FileItem( a, b ) \
                HTTPD_FileList_Item( a, b )
#define AppendFile( a, b ) \
                HTTPD_FileList_Append( a, b )
#define SortFilesAccordingTo( a, b ) \
                HTTPD_FileList_SortAccordingTo( a, b )
#define FreeFileItemsInListAndEmpty( a ) \
                HTTPD_FileList_FreeItemsInListAndEmpty( a )
#define Variable_Thorn_Slice \
                HTTPD_FileListCompare_Var_Thorn_Slice
#endif