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_2arg_named_definition()16 compound_2arg_named_definition::~compound_2arg_named_definition() {}
execute(processor & proc,char c)17 bool compound_2arg_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 * text1 = proc.next_arg()) {
22 if (const char * text2 = proc.next_arg()) {
23 action(proc, text1, text2);
24 return true;
25 } else
26 throw error(long_name, "missing option argument");
27 } else
28 throw error(long_name, "missing option argument");
29 }
30 }
31 return false;
32 }
execute(processor & proc,char c,const char * text1)33 bool compound_2arg_named_definition::execute(processor & proc, char c, const char * text1)
34 {
35 if (!*text1) return false;
36 if (char the_short_name = query_short_name()) {
37 if (the_short_name == c) {
38 if (const char * text2 = proc.next_arg()) {
39 action(proc, text1, text2);
40 return true;
41 } else
42 throw error(long_name, "missing option argument");
43 }
44 }
45 return false;
46 }
execute(processor & proc,const char * s)47 bool compound_2arg_named_definition::execute(processor & proc, const char * s)
48 {
49 if (const char * the_long_name = query_long_name()) {
50 if (0 == std::strcmp(the_long_name, s)) {
51 if (const char * text1 = proc.next_arg()) {
52 if (const char * text2 = proc.next_arg()) {
53 action(proc, text1, text2);
54 return true;
55 } else
56 throw error(long_name, "missing option argument");
57 } else
58 throw error(long_name, "missing option argument");
59 }
60 }
61 return false;
62 }
63