00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "programBase.h"
00020
00021 #include <notify.h>
00022
00023 class TestProgram : public ProgramBase {
00024 public:
00025 TestProgram();
00026
00027 bool _bool_a;
00028 int _count_b;
00029 int _int_c;
00030 };
00031
00032 TestProgram::
00033 TestProgram() {
00034 set_program_description
00035 ("This is a simple test program to verify the effectiveness of the "
00036 "ProgramBase base class as a base class for simple programs. It "
00037 "includes some simple options and some description strings that are "
00038 "long enough to require word-wrapping.\r"
00039 "Don't expect anything fancy, though.");
00040 add_runline("[opts]");
00041
00042 add_option
00043 ("bog", "", 90,
00044 "This is test option 'bog'. It is a simple boolean toggle; if it appears "
00045 "at all, it sets a boolean flag to indicate that. If it does not "
00046 "appear, it leaves the boolean flag alone.\r"
00047 "There's not a whole lot of point to this option, when you come down "
00048 "to it.",
00049 &TestProgram::dispatch_none, &_bool_a);
00050
00051 add_option
00052 ("b", "", 90, "Test option b",
00053 &TestProgram::dispatch_count, NULL, &_count_b);
00054 _count_b = 0;
00055
00056 add_option
00057 ("c", "integer_parameter", 90,
00058 "This is test option 'c'. It takes an integer parameter.",
00059 &TestProgram::dispatch_int, NULL, &_int_c);
00060 _int_c = 0;
00061 }
00062
00063
00064 int main(int argc, char *argv[]) {
00065 TestProgram t;
00066 t.parse_command_line(argc, argv);
00067
00068 nout << "Executed successfully.\n"
00069 << " _bool_a = " << t._bool_a << "\n"
00070 << " _count_b = " << t._count_b << "\n"
00071 << " _int_c = " << t._int_c << "\n";
00072 return 0;
00073 }