diff options
author | Mike Buland <eichlan@xagasoft.com> | 2006-06-29 05:50:44 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2006-06-29 05:50:44 +0000 |
commit | 937d960d2677c87ac6d68dc5445be115ac001d3e (patch) | |
tree | 35b33aebb0cab5073fc0778f13f2425d3e18278f /src/test/param | |
parent | dcd914665f6e8ea6ea4e648f7357f1c842273d87 (diff) | |
download | libbu++-937d960d2677c87ac6d68dc5445be115ac001d3e.tar.gz libbu++-937d960d2677c87ac6d68dc5445be115ac001d3e.tar.bz2 libbu++-937d960d2677c87ac6d68dc5445be115ac001d3e.tar.xz libbu++-937d960d2677c87ac6d68dc5445be115ac001d3e.zip |
Completely switched over to the much simpler, nicer pymake. Things look great,
and the old Makefile may soon fall into disrepair. To use the old one, which
should almost always be able to build at least thi library, call:
make -f Makefile.legacy
The new Makefile just calls pymake
Diffstat (limited to 'src/test/param')
-rw-r--r-- | src/test/param/param.cpp | 46 | ||||
-rw-r--r-- | src/test/param/param.h | 21 |
2 files changed, 67 insertions, 0 deletions
diff --git a/src/test/param/param.cpp b/src/test/param/param.cpp new file mode 100644 index 0000000..a4d2824 --- /dev/null +++ b/src/test/param/param.cpp | |||
@@ -0,0 +1,46 @@ | |||
1 | #include "param.h" | ||
2 | #include <stdio.h> | ||
3 | |||
4 | Param::Param() | ||
5 | { | ||
6 | addHelpBanner("param - A test of the libbu++ parameter systems\n" | ||
7 | "Enjoy with care and caution\n\nTest stuff:\n"); | ||
8 | addParam( "name", 's', mkproc( Param::printStuff ), &str, "Test a param param" ); | ||
9 | //addParam( "name", &str ); | ||
10 | addParam( "job", 'U', mkproc( Param::printStuff ), "Test a paramless param" ); | ||
11 | |||
12 | addHelpBanner("\nInformational:\n"); | ||
13 | addParam( "help", mkproc( ParamProc::help ), "Help!" ); | ||
14 | |||
15 | addHelpBanner("\nThanks for trying my test!\n\n"); | ||
16 | } | ||
17 | |||
18 | Param::~Param() | ||
19 | { | ||
20 | } | ||
21 | |||
22 | int Param::printStuff( int argc, char *argv[] ) | ||
23 | { | ||
24 | printf("------------%02d-------------\n", argc ); | ||
25 | for( int j = 0; j < argc; j++ ) | ||
26 | { | ||
27 | printf("%d: %s\n", j, argv[j] ); | ||
28 | } | ||
29 | printf("---------------------------\n" ); | ||
30 | printf("SETVAR===\"%s\"\n", str.c_str() ); | ||
31 | |||
32 | return 1; | ||
33 | } | ||
34 | |||
35 | int main( int argc, char *argv[] ) | ||
36 | { | ||
37 | if( argc == 1 ) | ||
38 | { | ||
39 | printf("You have to enter some parameter, try '--help'\n\n"); | ||
40 | return 0; | ||
41 | } | ||
42 | |||
43 | Param p; | ||
44 | p.process( argc, argv ); | ||
45 | } | ||
46 | |||
diff --git a/src/test/param/param.h b/src/test/param/param.h new file mode 100644 index 0000000..2756b69 --- /dev/null +++ b/src/test/param/param.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef PARAM_H | ||
2 | #define PARAM_H | ||
3 | |||
4 | #include <stdint.h> | ||
5 | |||
6 | #include "paramproc.h" | ||
7 | |||
8 | class Param : public ParamProc | ||
9 | { | ||
10 | public: | ||
11 | Param(); | ||
12 | virtual ~Param(); | ||
13 | |||
14 | private: | ||
15 | int printStuff( int argc, char *argv[] ); | ||
16 | |||
17 | std::string str; | ||
18 | uint32_t uint32; | ||
19 | }; | ||
20 | |||
21 | #endif | ||