aboutsummaryrefslogtreecommitdiffstats
path: root/heimdall/source/Arguments.h
diff options
context:
space:
mode:
authorBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2013-03-08 00:00:52 +1100
committerBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2013-03-08 00:12:27 +1100
commitebbc3e7cd2086a9f62a857dffe9ab0bd1f5da768 (patch)
tree2267ec17efe5435887cb68169a56418acf7a9f05 /heimdall/source/Arguments.h
parent9d7008e4ba010162945d985adf560dce7274bc00 (diff)
downloadexternal_heimdall-ebbc3e7cd2086a9f62a857dffe9ab0bd1f5da768.zip
external_heimdall-ebbc3e7cd2086a9f62a857dffe9ab0bd1f5da768.tar.gz
external_heimdall-ebbc3e7cd2086a9f62a857dffe9ab0bd1f5da768.tar.bz2
- 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.
Diffstat (limited to 'heimdall/source/Arguments.h')
-rw-r--r--heimdall/source/Arguments.h63
1 files changed, 35 insertions, 28 deletions
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 <map>
#include <string>
+#include <vector>
// 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<string, ArgumentType> argumentTypes;
- const map<string, string> shortArgumentAliases;
- const map<string, string> argumentAliases;
+ const std::map<std::string, ArgumentType> argumentTypes;
+ const std::map<std::string, std::string> shortArgumentAliases;
+ const std::map<std::string, std::string> argumentAliases;
- map<string, Argument *> arguments;
+ std::vector<const Argument *> argumentVector;
+ std::map<std::string, const Argument *> argumentMap;
public:
- Arguments(const map<string, ArgumentType>& argumentTypes, const map<string, string>& shortArgumentAliases = (map<string, string>()),
- const map<string, string>& argumentAliases = (map<string, string>()));
+ Arguments(const std::map<std::string, ArgumentType>& argumentTypes,
+ const std::map<std::string, std::string>& shortArgumentAliases = std::map<std::string, std::string>(),
+ const std::map<std::string, std::string>& argumentAliases = std::map<std::string, std::string>());
~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<string, Argument *>::const_iterator it = arguments.find(argumentName);
- return (it != arguments.end() ? it->second : nullptr);
+ std::map<std::string, const Argument *>::const_iterator it = argumentMap.find(argumentName);
+ return (it != argumentMap.end() ? it->second : nullptr);
}
- const map<string, ArgumentType>& GetArgumentTypes(void) const
+ const std::map<std::string, ArgumentType>& GetArgumentTypes(void) const
{
return (argumentTypes);
}
- const map<string, Argument *>& GetArguments(void) const
+ const std::vector<const Argument *>& GetArguments(void) const
{
- return (arguments);
+ return (argumentVector);
}
};
}