2
* Copyright (C) 2001 by Holger Rapp
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version 2
7
* of the License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
#ifndef __S__FILE_LOCATOR
21
#define __S__FILE_LOCATOR
25
#include "singleton.h"
27
/** class File_Locator
29
* This class is responsible for locating files in several directorys
30
* and to list them in a easy to use manner.
32
class File_Locator : public Singleton<File_Locator> {
33
// Forbidden functions
34
File_Locator(const File_Locator&);
35
File_Locator& operator=(const File_Locator&);
39
static const unsigned int MAX_PATHL=MAX_PATH;
41
static const unsigned int MAX_PATHL=256;
43
static const unsigned int MAX_DIRS=5;
44
static const unsigned int MAX_SUBDIRL=20;
45
static const unsigned int MAX_SUBDIRS=10;
48
static const unsigned char SEP[]="\\";
49
static const unsigned char CSEP='\\';
51
static const unsigned char SEP[]="/";
52
static const unsigned char CSEP='/';
67
void add_searchdir(const char*, const unsigned int);
68
const char* locate_file(const char*, const int=-1);
69
Last_action get_state(void) const;
70
void register_subdir(const unsigned int, const char*);
72
const char* get_new_filename(const char*, const int=-1);
73
void set_def_writedir(const unsigned int id);
75
// Listings of all available files
76
void init_filelisting( const int, const char[5] );
77
const char* get_next_file(void);
78
void end_filelisting(void);
81
char dirs[MAX_DIRS][MAX_PATHL];
82
char subdirs[MAX_SUBDIRL][MAX_SUBDIRS];
83
char retval[MAX_PATHL+MAX_SUBDIRL];
93
void open_next_dir(void);
97
#define g_fileloc File_Locator::get_singleton()
104
#define TYPE_CAMPAIGN 5
107
#define TYPE_EFFECT 8
109
#endif /* __S__FILE_LOCATOR */