diff options
| author | KuroiIeWa5Da <tyuki@adu.me> | 2012-01-28 06:10:44 -0600 |
|---|---|---|
| committer | KuroiIeWa5Da <tyuki@adu.me> | 2012-01-28 06:10:44 -0600 |
| commit | 42569734720d794a4f1cd93e456ee8347dec7135 (patch) | |
| tree | 1e98cc6d6a574feac0911705c86d14bfab7915dc /music/pokeredmusicdisasm/args.h | |
| parent | fixed problem with compiling wav pattern program (diff) | |
| download | pokeyellow-42569734720d794a4f1cd93e456ee8347dec7135.tar.gz pokeyellow-42569734720d794a4f1cd93e456ee8347dec7135.tar.xz pokeyellow-42569734720d794a4f1cd93e456ee8347dec7135.zip | |
Updated Music Disassembler to support more advanced parameters
hg-commit-id: 0aba4647e4f6
Diffstat (limited to 'music/pokeredmusicdisasm/args.h')
| -rw-r--r-- | music/pokeredmusicdisasm/args.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/music/pokeredmusicdisasm/args.h b/music/pokeredmusicdisasm/args.h new file mode 100644 index 00000000..c8e931f2 --- /dev/null +++ b/music/pokeredmusicdisasm/args.h @@ -0,0 +1,38 @@ +#ifndef ARGS_H
+#define ARGS_H
+
+#include <string>
+#include <vector>
+#include <sstream>
+
+class Args
+{
+public:
+ Args(int _argc, char**& _argv);
+
+ template<class T> // Get the argument automatically in any format that stringstream can output to
+ void GetValueC(int ind, T& var, std::ios_base::fmtflags flags = std::ios_base::dec, bool param2 = false)
+ {
+ std::stringstream _tmpstr;
+
+ _tmpstr << GetValue(ind, param2);
+ _tmpstr.flags(flags);
+ _tmpstr >> var;
+ }
+
+ int GetArgs(); // Get number of args
+ std::string GetArgv(int ind); // Get the arg based on true index
+ bool IsLongOption(int ind); // Is that argument a --long-key=value
+ bool IsShortOption(int ind, bool param2 = false); // Is that argument a --long-key=value
+
+ std::string GetKey(int ind); // Get the key, if not a key/value then returns the arg
+ std::string GetValue(int ind, bool param2 = false); // Get the value, if not a key/value then returns the arg
+
+ int SearchKeys(const char* str); // Return the index number of found key or -1 if not found
+
+private:
+ int argc;
+ std::vector<std::string> argv;
+};
+
+#endif
\ No newline at end of file |
