aboutsummaryrefslogtreecommitdiff
path: root/common/advancedDetector.h
diff options
context:
space:
mode:
authorMax Horn2006-12-19 22:43:15 +0000
committerMax Horn2006-12-19 22:43:15 +0000
commit865d8717a3270f3b913a3fbfa64bcfc5ca746db4 (patch)
tree1535c5152fe6d28068a06e290793398b25582f07 /common/advancedDetector.h
parentcd46b0d57d709956b34a4ae37a87ee4767a7986f (diff)
downloadscummvm-rg350-865d8717a3270f3b913a3fbfa64bcfc5ca746db4.tar.gz
scummvm-rg350-865d8717a3270f3b913a3fbfa64bcfc5ca746db4.tar.bz2
scummvm-rg350-865d8717a3270f3b913a3fbfa64bcfc5ca746db4.zip
* Change the GameList typedef to a proper class with an additional
constructor which takes a PlainGameDescriptor 'list' * Replaced real_ADVANCED_DETECTOR_GAMEID_LIST by this new constructor * Removed ADVANCED_DETECTOR_GAMEID_LIST and ADVANCED_DETECTOR_FIND_GAMEID * Some minor cleanup svn-id: r24893
Diffstat (limited to 'common/advancedDetector.h')
-rw-r--r--common/advancedDetector.h121
1 files changed, 55 insertions, 66 deletions
diff --git a/common/advancedDetector.h b/common/advancedDetector.h
index ac64c4bb8c..437f17d8f9 100644
--- a/common/advancedDetector.h
+++ b/common/advancedDetector.h
@@ -53,11 +53,55 @@ struct ADObsoleteGameID {
typedef Array<int> ADList;
typedef Array<const ADGameDescription*> ADGameDescList;
-// FIXME/TODO: Rename this function to something more sensible.
-// Possibly move it inside class AdvancedDetector ?
-// Maybe rename it to something like asGameList or pgdArrayToGameList,
-// and move it to base/game.h. Or add a constructor to GameList ... ?
-GameList real_ADVANCED_DETECTOR_GAMEID_LIST(const PlainGameDescriptor *list);
+
+
+// TODO/FIXME: Fingolfin asks: Why is AdvancedDetector a class, considering that
+// it is only used as follow:
+// 1) Create an instance of it on the stack
+// 2) invoke registerGameDescriptions and setFileMD5Bytes
+// 3) invoke detectGame *once*
+// Obviously, 2) could also be handled by passing more params to detectGame.
+// So it seem we could replace this class by a simple advancedDetectGame(...)
+// function, w/o a class or instantiating object... ? Or is there a deeper
+// reason I miss?
+class AdvancedDetector {
+
+public:
+ AdvancedDetector();
+ ~AdvancedDetector() {};
+
+
+ void registerGameDescriptions(ADGameDescList gameDescriptions) {
+ _gameDescriptions = gameDescriptions;
+ }
+
+ /**
+ * Specify number of bytes which are used to calculate MD5.
+ * Default value is 0 which means whole file.
+ */
+ void setFileMD5Bytes(int bytes) { _fileMD5Bytes = bytes; }
+
+ /**
+ * Detect games in specified directory.
+ * Parameters language and platform are used to pass on values
+ * specified by the user. I.e. this is used to restrict search scope.
+ *
+ * @param fslist FSList to scan or NULL for scanning all specified
+ * default directories.
+ * @param language restrict results to specified language only
+ * @param platform restrict results to specified platform only
+ * @return list of indexes to GameDescriptions of matched games
+ */
+ ADList detectGame(const FSList *fslist, Language language, Platform platform);
+
+private:
+ ADGameDescList _gameDescriptions;
+
+ int _fileMD5Bytes;
+
+ String getDescription(int num) const;
+};
+
// FIXME/TODO: Rename this function to something more sensible.
// Possibly move it inside class AdvancedDetector ?
@@ -102,18 +146,6 @@ PluginError real_ADVANCED_DETECTOR_ENGINE_CREATE(
);
-#define ADVANCED_DETECTOR_GAMEID_LIST(engine,list) \
- GameList Engine_##engine##_gameIDList() { \
- return Common::real_ADVANCED_DETECTOR_GAMEID_LIST(list); \
- } \
- void dummyFuncToAllowTrailingSemicolon()
-
-#define ADVANCED_DETECTOR_FIND_GAMEID(engine,list,obsoleteList) \
- GameDescriptor Engine_##engine##_findGameID(const char *gameid) { \
- return Common::real_ADVANCED_DETECTOR_FIND_GAMEID(gameid,list,obsoleteList); \
- } \
- void dummyFuncToAllowTrailingSemicolon()
-
#define ADVANCED_DETECTOR_DETECT_GAMES(engine,detectFunc) \
DetectedGameList Engine_##engine##_detectGames(const FSList &fslist) { \
return detectFunc(fslist); \
@@ -132,59 +164,16 @@ PluginError real_ADVANCED_DETECTOR_ENGINE_CREATE(
void dummyFuncToAllowTrailingSemicolon()
#define ADVANCED_DETECTOR_DEFINE_PLUGIN(engine,createFunction,detectFunc,list,obsoleteList) \
- ADVANCED_DETECTOR_GAMEID_LIST(engine, list); \
- ADVANCED_DETECTOR_FIND_GAMEID(engine, list, obsoleteList); \
+ GameList Engine_##engine##_gameIDList() { \
+ return GameList(list); \
+ } \
+ GameDescriptor Engine_##engine##_findGameID(const char *gameid) { \
+ return Common::real_ADVANCED_DETECTOR_FIND_GAMEID(gameid,list,obsoleteList); \
+ } \
ADVANCED_DETECTOR_DETECT_GAMES(engine, detectFunc); \
ADVANCED_DETECTOR_ENGINE_CREATE(engine, createFunction, detectFunc, obsoleteList)
-// TODO/FIXME: Fingolfin asks: Why is AdvancedDetector a class, considering that
-// it is only used as follow:
-// 1) Create an instance of it on the stack
-// 2) invoke registerGameDescriptions and setFileMD5Bytes
-// 3) invoke detectGame *once*
-// Obviously, 2) could also be handled by passing more params to detectGame.
-// So it seem we could replace this class by a simple advancedDetectGame(...)
-// function, w/o a class or instantiating object... ? Or is there a deeper
-// reason I miss?
-class AdvancedDetector {
-
-public:
- AdvancedDetector();
- ~AdvancedDetector() {};
-
-
- void registerGameDescriptions(ADGameDescList gameDescriptions) {
- _gameDescriptions = gameDescriptions;
- }
-
- /**
- * Specify number of bytes which are used to calculate MD5.
- * Default value is 0 which means whole file.
- */
- void setFileMD5Bytes(int bytes) { _fileMD5Bytes = bytes; }
-
- /**
- * Detect games in specified directory.
- * Parameters language and platform are used to pass on values
- * specified by the user. I.e. this is used to restrict search scope.
- *
- * @param fslist FSList to scan or NULL for scanning all specified
- * default directories.
- * @param language restrict results to specified language only
- * @param platform restrict results to specified platform only
- * @return list of indexes to GameDescriptions of matched games
- */
- ADList detectGame(const FSList *fslist, Language language, Platform platform);
-
-private:
- ADGameDescList _gameDescriptions;
-
- int _fileMD5Bytes;
-
- String getDescription(int num) const;
-};
-
} // End of namespace Common
#endif