mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
HDB: Add getCount to FileMan
It counts the number of MPC entries that have a specific substring in their filename
This commit is contained in:
parent
8e62d001fc
commit
846d799b19
@ -143,6 +143,22 @@ int32 FileMan::getLength(const char *string, DataType type) {
|
||||
return file->ulength;
|
||||
}
|
||||
|
||||
int FileMan::getCount(char *subString, DataType type) {
|
||||
int count = 0;
|
||||
Common::String fileString;
|
||||
|
||||
for (MPCIterator it = _dir.begin(); it != _dir.end(); it++) {
|
||||
fileString = (*it)->filename;
|
||||
if (fileString.contains(subString)) {
|
||||
if ((*it)->type == type) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
#if 0
|
||||
MPCEntry **FileMan::findNextData(MPCIterator begin) {
|
||||
Common::String fileString;
|
||||
@ -158,17 +174,6 @@ MPCEntry **FileMan::findNextData(MPCIterator begin) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int FileMan::findAmount(char *string, DataType type) {
|
||||
int count = 0;
|
||||
|
||||
MPCIterator it = findFirstData(string, type);
|
||||
while (it && (*it)->type == type) {
|
||||
count++;
|
||||
it = findNextData(it);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // End of Namespace HDB
|
||||
|
@ -76,17 +76,9 @@ public:
|
||||
void closeMPC();
|
||||
void seek(int32 offset, int flag);
|
||||
|
||||
/*
|
||||
TODO: Implement the loadData functions for the various
|
||||
DataTypes as they are encountered.
|
||||
|
||||
void loadData(char *string, uint32 *length);
|
||||
*/
|
||||
|
||||
Common::SeekableReadStream *findFirstData(const char *string, DataType type);
|
||||
int32 getLength(const char *string, DataType type);
|
||||
//MPCEntry **findNextData(MPCIterator it);
|
||||
//int findAmount(char *string, DataType type);
|
||||
int getCount(char *subString, DataType type);
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user