49 std::list<std::string>& class_names,
50 std::list<std::string>& file_names,
51 std::list<std::string>& include_dirs,
52 std::list<std::string>& user_classes,
53 std::string& cpp_dir_name,
54 std::string& cpp_ns_name,
55 std::string& cpp_hdr_dir,
56 std::string& info_file_name,
61 for (
int i = 1; i < argc; i++)
63 const char * cp = argv[i];
65 if (!strcmp(cp,
"-h") || !strcmp(cp,
"--help"))
70 else if (!strcmp(cp,
"-v") || !strcmp(cp,
"--verbose"))
74 else if (!strcmp(cp,
"-d") || !strcmp(cp,
"--c++-dir-name"))
76 if (++i == argc || argv[i][0] ==
'-')
79 cpp_dir_name = argv[i];
81 else if (!strcmp(cp,
"-n") || !strcmp(cp,
"--c++-namespace"))
83 if (++i == argc || argv[i][0] ==
'-')
86 cpp_ns_name = argv[i];
88 else if (!strcmp(cp,
"-i") || !strcmp(cp,
"--c++-headers-dir"))
90 if (++i == argc || argv[i][0] ==
'-')
93 cpp_hdr_dir = argv[i];
95 else if (!strcmp(cp,
"-f") || !strcmp(cp,
"--info-file-name"))
97 if (++i == argc || argv[i][0] ==
'-')
100 info_file_name = argv[i];
104 std::list<std::string> * slist = (
105 (!strcmp(cp,
"-c") || !strcmp(cp,
"--classes")) ? &class_names :
106 (!strcmp(cp,
"-s") || !strcmp(cp,
"--schema-files")) ? &file_names :
107 (!strcmp(cp,
"-I") || !strcmp(cp,
"--include-dirs")) ? &include_dirs :
108 (!strcmp(cp,
"-D") || !strcmp(cp,
"--user-defined-classes")) ? &user_classes :
115 for (; j < argc - i - 1; ++j)
117 if (argv[i + 1 + j][0] !=
'-')
118 slist->push_back(argv[i + 1 + j]);
126 std::cerr <<
"ERROR: Unexpected parameter: \"" << cp <<
"\"\n\n";
133 if (file_names.size() == 0)
135 std::cerr <<
"At least one schema file is required\n";
143 " Command line parameters:\n"
144 " c++ directory name: \"" << cpp_dir_name <<
"\"\n"
145 " c++ namespace name: \"" << cpp_ns_name <<
"\"\n"
146 " c++ headers directory: \"" << cpp_hdr_dir <<
"\"\n"
149 if (!class_names.empty())
151 std::cout << std::endl;
153 for (
const auto& i : class_names)
154 std::cout <<
" - " << i << std::endl;
158 std::cout <<
" no\n";
161 std::cout <<
" file names:";
163 if (!file_names.empty())
165 std::cout << std::endl;
167 for (
const auto& i : file_names)
168 std::cout <<
" * " << i << std::endl;
172 std::cout <<
" no\n";
175 std::cout <<
" include directories for search:";
177 if (!include_dirs.empty())
179 std::cout << std::endl;
181 for (
const auto& i : include_dirs)
182 std::cout <<
" * " << i << std::endl;
186 std::cout <<
" no\n";
189 std::cout <<
" user-defined classes:";
191 if (!user_classes.empty())
193 std::cout << std::endl;
195 for (
const auto& i : user_classes)
196 std::cout <<
" * " << i << std::endl;
200 std::cout <<
" no\n";
void parse_arguments(int argc, char *argv[], std::list< std::string > &class_names, std::list< std::string > &file_names, std::list< std::string > &include_dirs, std::list< std::string > &user_classes, std::string &cpp_dir_name, std::string &cpp_ns_name, std::string &cpp_hdr_dir, std::string &info_file_name, bool &verbose)