--- /dev/null
+#ifndef ARGREAD_H
+#define ARGREAD_H
+
+#include <vector>
+#include <string>
+
+using namespace std;
+
+#ifndef NULL
+#define NULL (void*)0
+#endif
+
+class argreader{
+public:
+ argreader(string n_name);
+
+ /*!
+ *\brief add a parameter to be looked for
+ *\param shortname A character for the short form. For example the 'h' in -h
+ *\param longname The double dash longname. For example 'input_file=' in --input_file= or
+ * 'ignore_errors' in --ignore--errors
+ *\param description A parameter description.
+ *\param status Pointer to an integer. Will be set to 1 if arg found.
+ *\target Pointer to a value should be read. If no value is needed, pass NULL.
+ *\placeholder A placeholder for the documentation. For example "<filename>" in -f<filename>
+ */
+ void add_param (string shortname, string longname, string description, int * status,
+ string * target=NULL, string placeholder=string("<string>"));
+
+ /*!
+ * Read in the args passed to main().
+ *\returns empty vector on success or the error messages to be output.
+ */
+ vector<string> read_args(int argc, char ** args);
+
+
+ vector<string> & get_free_args();
+
+ void get_help(vector<string> & );
+ vector<string> get_help();
+
+ void add_free_param(string placeholder, string description, int * status, string * target);
+
+
+
+private:
+ class parameter{
+ public:
+ parameter (string shortname, string longname,string description, int * status,
+ string * target=NULL, string placeholder=string("<string>"));
+ string shortname;
+ string longname;
+ int * status;
+ string * target;
+ string description;
+ string placeholder;
+ };
+
+ class free_parameter{
+ public:
+ free_parameter (string placeholder,string description,
+ int * status, string * target);
+ int * status;
+ string * target;
+ string description;
+ string placeholder;
+ };
+
+ vector<parameter>arguments;
+ vector<free_parameter>free_arguments;
+
+ string progname;
+};
+
+
+#endif