ScummVM API documentation
nuvie_file_list.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef NUVIE_FILES_NUVIE_FILE_LIST_H
23 #define NUVIE_FILES_NUVIE_FILE_LIST_H
24 
25 #include "ultima/shared/std/string.h"
26 #include "common/fs.h"
27 
28 namespace Ultima {
29 namespace Nuvie {
30 
31 using Std::list;
32 using Std::string;
33 
34 
35 #define NUVIE_SORT_TIME_DESC 0x1
36 #define NUVIE_SORT_TIME_ASC 0x2
37 #define NUVIE_SORT_NAME_DESC 0x3
38 #define NUVIE_SORT_NAME_ASC 0x5
39 
40 class Configuration;
41 
43 public:
44  Std::string filename;
45  uint32 m_time;
46 
47  bool operator<(const NuvieFileDesc &rhs) const {
48  return (rhs.m_time < this->m_time);
49  };
50  bool operator()(const NuvieFileDesc &lhs, const NuvieFileDesc &rhs) {
51  return (lhs.m_time > rhs.m_time);
52  };
53 };
54 
56 protected:
57  Std::list<NuvieFileDesc> file_list;
58 
59  uint8 sort_mode;
60 protected:
61  bool add_filename(const Common::String &fileName);
62 public:
63 
64  NuvieFileList();
65  ~NuvieFileList();
66 
67  bool open(const Common::Path &directory, const char *restrict, uint8 sort_mode);
68 
69  Std::string *next();
70  const Std::string *get_latest() const;
71  uint32 get_num_files() const;
72 
73  Std::set<Std::string> get_filenames() const;
74 
75  void close();
76 };
77 
78 
79 } // End of namespace Nuvie
80 } // End of namespace Ultima
81 
82 #endif
Definition: containers.h:120
Definition: str.h:59
Definition: list.h:39
Definition: path.h:52
Definition: detection.h:27
Definition: nuvie_file_list.h:55
Definition: nuvie_file_list.h:42
Definition: string.h:30
Definition: containers.h:200