diff options
author | Michael Lutz <michi@icosahedron.de> | 2020-05-17 23:32:08 +0200 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2020-05-21 20:02:34 +0200 |
commit | 37bc2f806462b3c2a84891b3aad6db00e935da86 (patch) | |
tree | 9f832e8646ec0c4a4038f6c0642c853fbe02038a /src/driver.h | |
parent | a49fdb7ebbb8d8ce96bcd7bd779b18bcd86d0643 (diff) | |
download | openttd-37bc2f806462b3c2a84891b3aad6db00e935da86.tar.xz |
Codechange: Use std::string in the driver and blitter selection code.
Diffstat (limited to 'src/driver.h')
-rw-r--r-- | src/driver.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/driver.h b/src/driver.h index 3ac4f7f8a..68d9fac92 100644 --- a/src/driver.h +++ b/src/driver.h @@ -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); /** |