From ebbc3e7cd2086a9f62a857dffe9ab0bd1f5da768 Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Fri, 8 Mar 2013 00:00:52 +1100 Subject: - Removed legacy command line hard-coded partition name parameters. - As a result of the above two points, there are no "known boot partitions", and hence boot partitions are not automatically flashed last. - Made partitions flash in the order in order in which partition arguments are specified. Hence, it's recommended that you specify boot partitions last. - Added --usb-level argument that can be used for debugging libusbx, or flashing issues in general. - Removed generally non-functional firmware dumping behaviour. - Removed auto-resume functionality - Although this feature was definitely nice to have; I believe it may be responsible for flashing compatibility issues for a variety of devices. - As a result of the above. In order perform another action after a --no-reboot action, you must provide the --resume flag. - Heimdall Frontend also has support for specifying the --resume flag via a GUI. Heimdall Frontend also tries to keep track of your actions and enable "Resume" automatically after a "No Reboot" action. - Refactored quite a few of the actions, and code responsible for flashing (particularly PIT file flashing). - Bumped version to 1.4RC3 *however* this commit is not yet an official release candidate. It's still a WIP. In particular build files still have not been updated for Linux and OS X. --- heimdall/source/Arguments.h | 63 +++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 28 deletions(-) (limited to 'heimdall/source/Arguments.h') diff --git a/heimdall/source/Arguments.h b/heimdall/source/Arguments.h index 17f31fa..b64028b 100644 --- a/heimdall/source/Arguments.h +++ b/heimdall/source/Arguments.h @@ -24,12 +24,11 @@ // C/C++ Standard Library #include #include +#include // Heimdall #include "Heimdall.h" -using namespace std; - namespace Heimdall { typedef enum @@ -37,20 +36,21 @@ namespace Heimdall kArgumentTypeFlag = 0, kArgumentTypeString, kArgumentTypeUnsignedInteger - } ArgumentType; class Argument { private: - ArgumentType argumentType; + std::string name; + ArgumentType type; protected: - Argument(ArgumentType argumentType) + Argument(const std::string& name, ArgumentType type) { - this->argumentType = argumentType; + this->name = name; + this->type = type; } public: @@ -59,9 +59,14 @@ namespace Heimdall { } - ArgumentType GetArgumentType(void) const + const std::string& GetName(void) const + { + return name; + } + + ArgumentType GetType(void) const { - return argumentType; + return type; } }; @@ -69,31 +74,31 @@ namespace Heimdall { private: - FlagArgument() : Argument(kArgumentTypeFlag) + FlagArgument(const std::string& name) : Argument(name, kArgumentTypeFlag) { } public: - static FlagArgument *ParseArgument(int argc, char **argv, int& argi); + static FlagArgument *ParseArgument(const std::string& name, int argc, char **argv, int& argi); }; class StringArgument : public Argument { private: - string value; + std::string value; - StringArgument(const string& value) : Argument(kArgumentTypeString) + StringArgument(const std::string& name, const std::string& value) : Argument(name, kArgumentTypeString) { this->value = value; } public: - static StringArgument *ParseArgument(int argc, char **argv, int& argi); + static StringArgument *ParseArgument(const std::string& name, int argc, char **argv, int& argi); - const string& GetValue(void) const + const std::string& GetValue(void) const { return (value); } @@ -105,14 +110,14 @@ namespace Heimdall unsigned int value; - UnsignedIntegerArgument(unsigned int value) : Argument(kArgumentTypeUnsignedInteger) + UnsignedIntegerArgument(const std::string& name, unsigned int value) : Argument(name, kArgumentTypeUnsignedInteger) { this->value = value; } public: - static UnsignedIntegerArgument *ParseArgument(int argc, char **argv, int& argi); + static UnsignedIntegerArgument *ParseArgument(const std::string& name, int argc, char **argv, int& argi); unsigned int GetValue(void) const { @@ -124,36 +129,38 @@ namespace Heimdall { private: - const map argumentTypes; - const map shortArgumentAliases; - const map argumentAliases; + const std::map argumentTypes; + const std::map shortArgumentAliases; + const std::map argumentAliases; - map arguments; + std::vector argumentVector; + std::map argumentMap; public: - Arguments(const map& argumentTypes, const map& shortArgumentAliases = (map()), - const map& argumentAliases = (map())); + Arguments(const std::map& argumentTypes, + const std::map& shortArgumentAliases = std::map(), + const std::map& argumentAliases = std::map()); ~Arguments(); // argi is the index of the first argument to parse. bool ParseArguments(int argc, char **argv, int argi); - const Argument *GetArgument(string argumentName) const + const Argument *GetArgument(std::string argumentName) const { - map::const_iterator it = arguments.find(argumentName); - return (it != arguments.end() ? it->second : nullptr); + std::map::const_iterator it = argumentMap.find(argumentName); + return (it != argumentMap.end() ? it->second : nullptr); } - const map& GetArgumentTypes(void) const + const std::map& GetArgumentTypes(void) const { return (argumentTypes); } - const map& GetArguments(void) const + const std::vector& GetArguments(void) const { - return (arguments); + return (argumentVector); } }; } -- cgit v1.2.3