1 /* COPYING ******************************************************************
2 For copyright and licensing terms, see the file named COPYING.
3 // **************************************************************************
4 */
5 
6 #include <iostream>
7 #include <iomanip>
8 #include <cstring>
9 #include <cstdlib>
10 #include <cctype>
11 
12 #include "popt.h"
13 
14 using namespace popt;
15 
~compound_named_definition()16 compound_named_definition::~compound_named_definition() {}
execute(processor & proc,char c)17 bool compound_named_definition::execute(processor & proc, char c)
18 {
19 	if (char the_short_name = query_short_name()) {
20 		if (the_short_name == c) {
21 			if (const char * text = proc.next_arg()) {
22 				action(proc, text);
23 				return true;
24 			} else
25 				throw error(long_name, "missing option argument");
26 		}
27 	}
28 	return false;
29 }
execute(processor & proc,char c,const char * text)30 bool compound_named_definition::execute(processor & proc, char c, const char * text)
31 {
32 	if (!*text) return false;
33 	if (char the_short_name = query_short_name()) {
34 		if (the_short_name == c) {
35 			action(proc, text);
36 			return true;
37 		}
38 	}
39 	return false;
40 }
execute(processor & proc,const char * s)41 bool compound_named_definition::execute(processor & proc, const char * s)
42 {
43 	if (const char * the_long_name = query_long_name()) {
44 		if (0 == std::strcmp(the_long_name, s)) {
45 			if (const char * text = proc.next_arg()) {
46 				action(proc, text);
47 				return true;
48 			} else
49 				throw error(long_name, "missing option argument");
50 		}
51 	}
52 	return false;
53 }
54