Codechange: Use std::string in the driver and blitter selection code.

This commit is contained in:
Michael Lutz
2020-05-17 23:32:08 +02:00
parent a49fdb7ebb
commit 37bc2f8064
51 changed files with 126 additions and 166 deletions

View File

@@ -12,11 +12,12 @@
#include "core/enum_type.hpp"
#include "core/string_compare_type.hpp"
#include "string_type.h"
#include <map>
const char *GetDriverParam(const char * const *parm, const char *name);
bool GetDriverParamBool(const char * const *parm, const char *name);
int GetDriverParamInt(const char * const *parm, const char *name, int def);
const char *GetDriverParam(const StringList &parm, const char *name);
bool GetDriverParamBool(const StringList &parm, const char *name);
int GetDriverParamInt(const StringList &parm, const char *name, int def);
/** A driver for communicating with the user. */
class Driver {
@@ -26,7 +27,7 @@ public:
* @param parm Parameters passed to the driver.
* @return nullptr if everything went okay, otherwise an error message.
*/
virtual const char *Start(const char * const *parm) = 0;
virtual const char *Start(const StringList &parm) = 0;
/**
* Stop this driver.
@@ -66,7 +67,7 @@ private:
const char *name; ///< The name of the drivers of this factory.
const char *description; ///< The description of this driver.
typedef std::map<const char *, DriverFactoryBase *, StringCompare> Drivers; ///< Type for a map of drivers.
typedef std::map<std::string, DriverFactoryBase *> Drivers; ///< Type for a map of drivers.
/**
* Get the map with drivers.
@@ -99,7 +100,7 @@ private:
return driver_type_name[type];
}
static bool SelectDriverImpl(const char *name, Driver::Type type);
static bool SelectDriverImpl(const std::string &name, Driver::Type type);
protected:
DriverFactoryBase(Driver::Type type, int priority, const char *name, const char *description);
@@ -118,7 +119,7 @@ public:
}
}
static void SelectDriver(const char *name, Driver::Type type);
static void SelectDriver(const std::string &name, Driver::Type type);
static char *GetDriversInfo(char *p, const char *last);
/**