9 #include <xercesc/util/PlatformUtils.hpp>
10 #include <xercesc/util/TransService.hpp>
11 #include <xercesc/sax2/XMLReaderFactory.hpp>
14 #include "IException.h"
16 #include "IsisXMLChTrans.h"
18 #include "Preference.h"
21 #include "PvlKeyword.h"
22 #include "PvlObject.h"
30 namespace XERCES = XERCES_CPP_NAMESPACE;
39 StartParser(xmlfile.toLatin1().data());
66 const QString &value) {
70 if(param->values.size() > 0) {
71 QString message =
"A value for this parameter [" + paramName +
"] has "
72 "already been entered.";
76 param->values.clear();
77 param->values.push_back(value);
94 const vector<QString> &value) {
98 if(param->values.size() > 0) {
99 QString message =
"A value for this parameter [" + paramName +
"] has "
100 "already been entered.";
104 param->values.resize(value.size());
105 param->values = value;
132 if(param->type !=
"string" && param->type !=
"combo") {
133 QString message =
"Parameter [" + paramName +
"] is not a string.";
137 if(param->values.size() > 0) {
138 QString message =
"A value for this parameter [" + paramName +
"] has "
139 "already been saved (possibly by IsisGui). If you need to "
140 "change the value use \"Clear\" before the Put.";
144 param->values.clear();
145 param->values.push_back(value);
161 const vector<QString> &value) {
165 if(param->type !=
"string" && param->type !=
"combo") {
166 QString message =
"Parameter [" + paramName +
"] is not a string.";
170 if(param->values.size() > 0) {
171 QString message =
"A value for this parameter [" + paramName +
"] has "
172 "already been saved (possibly by IsisGui). If you need to "
173 "change the value use \"Clear\" before the Put.";
177 param->values.resize(value.size());
178 param->values = value;
196 const QString &value) {
200 if((param->type !=
"filename") && (param->type !=
"cube")) {
201 QString message =
"Parameter [" + paramName +
"] is not a filename.";
205 if(param->values.size() > 0) {
206 QString message =
"A value for this parameter [" + paramName +
"] has "
207 "already been saved (possibly by IsisGui). If you need to "
208 "change the value use \"Clear\" before the Put.";
212 param->values.clear();
213 param->values.push_back(value);
238 const vector<QString> &value) {
242 if((param->type !=
"filename") && (param->type !=
"cube")) {
243 QString message =
"Parameter [" + paramName +
"] is not a filename.";
247 if(param->values.size() > 0) {
248 QString message =
"A value for this parameter [" + paramName +
"] has "
249 "already been saved (possibly by IsisGui). If you need to "
250 "change the value use \"Clear\" before the Put.";
254 param->values.resize(value.size());
255 param->values = value;
280 if(param->type !=
"integer") {
281 QString message =
"Parameter [" + paramName +
"] is not an integer.";
285 if(param->values.size() > 0) {
286 QString message =
"A value for this parameter [" + paramName +
"] has "
287 "already been saved (possibly by IsisGui). If you need to "
288 "change the value use \"Clear\" before the Put.";
292 param->values.clear();
317 const vector<int> &value) {
321 if(param->type !=
"integer") {
322 QString message =
"Parameter [" + paramName +
"] is not an integer.";
326 if(param->values.size() > 0) {
327 QString message =
"A value for this parameter [" + paramName +
"] has "
328 "already been saved (possibly by IsisGui). If you need to "
329 "change the value use \"Clear\" before the Put.";
333 param->values.resize(value.size());
334 for(
unsigned int i = 0; i < value.size(); i++) {
362 const double &value) {
366 if(param->type !=
"double") {
367 QString message =
"Parameter [" + paramName +
"] is not a double.";
371 if(param->values.size() > 0) {
372 QString message =
"A value for this parameter [" + paramName +
"] has "
373 "already been saved (possibly by IsisGui). If you need to "
374 "change the value use \"Clear\" before the Put.";
378 param->values.clear();
403 const vector<double> &value) {
407 if(param->type !=
"double") {
408 QString message =
"Parameter [" + paramName +
"] is not a double.";
412 if(param->values.size() > 0) {
413 QString message =
"A value for this parameter [" + paramName +
"] has "
414 "already been saved (possibly by IsisGui). If you need to "
415 "change the value use \"Clear\" before the Put.";
419 param->values.resize(value.size());
420 for(
unsigned int i = 0; i < value.size(); i++) {
451 if(param->type !=
"boolean") {
452 QString message =
"Parameter [" + paramName +
"] is not a boolean.";
456 if(param->values.size() > 0) {
457 QString message =
"A value for this parameter [" + paramName +
"] has "
458 "already been saved (possibly by IsisGui). If you need to "
459 "change the value use \"Clear\" before the Put.";
463 param->values.clear();
465 param->values.push_back(
"YES");
468 param->values.push_back(
"NO");
493 const vector<bool> &value) {
497 if(param->type !=
"boolean") {
498 QString message =
"Parameter [" + paramName +
"] is not a boolean.";
502 if(param->values.size() > 0) {
503 QString message =
"A value for this parameter [" + paramName +
"] has "
504 "already been saved (possibly by IsisGui). If you need to "
505 "change the value use \"Clear\" before the Put.";
509 param->values.resize(value.size());
510 for(
unsigned int i = 0; i < value.size(); i++) {
512 param->values.push_back(
"YES");
515 param->values.push_back(
"NO");
541 if(param->values.size() == 0) {
542 if(param->defaultValues.size() == 0) {
543 QString message =
"Parameter [" + paramName +
"] has no value.";
547 value = param->defaultValues[0];
551 value = param->values[0];
570 vector<QString> &values)
const {
576 if(param->values.size() == 0) {
577 if(param->defaultValues.size() == 0) {
578 QString message =
"Parameter [" + paramName +
"] has no value.";
582 for(
unsigned int i = 0; i < param->defaultValues.size(); i++)
583 values.push_back(param->defaultValues[i]);
587 for(
unsigned int i = 0; i < param->values.size(); i++)
588 values.push_back(param->values[i]);
611 if((param->type !=
"filename") && (param->type !=
"cube")) {
612 QString message =
"Parameter [" + paramName +
"] is not a filename.";
617 if(param->values.size() == 0) {
618 if(param->defaultValues.size() == 0) {
619 QString message =
"Parameter [" + paramName +
"] has no value.";
623 value = param->defaultValues[0];
627 value = param->values[0];
631 if(extension !=
"") name = name.
addExtension(extension);
648 vector<QString> &values)
const {
652 if((param->type !=
"filename") && (param->type !=
"cube")) {
653 QString message =
"Parameter [" + paramName +
"] is not a filename.";
658 if(param->values.size() == 0) {
659 if(param->defaultValues.size() == 0) {
660 QString message =
"Parameter [" + paramName +
"] has no value.";
664 for(
unsigned int i = 0; i < param->defaultValues.size(); i++) {
666 values.push_back(name.expanded());
671 for(
unsigned int i = 0; i < param->values.size(); i++) {
673 values.push_back(name.expanded());
697 if(param->type !=
"string" && param->type !=
"combo") {
698 QString message =
"Parameter [" + paramName +
"] is not a string.";
702 if(param->values.size() == 0) {
703 if(param->defaultValues.size() == 0) {
704 QString message =
"Parameter [" + paramName +
"] has no value.";
708 value = param->defaultValues[0];
712 value = param->values[0];
715 if(param->listOptions.size() > 0) {
716 value = value.toUpper();
719 for(
unsigned int p = 0; p < param->listOptions.size(); p++) {
720 QString option = param->listOptions[p].value;
721 option = option.toUpper();
722 if(value == option) {
725 else if(value.startsWith(option) || option.startsWith(value)) {
727 foundcount = foundcount + 1;
730 if(foundcount == 0) {
731 QString message =
"Value [" + value +
"] for parameter [" +
732 paramName +
"] is not a valid value.";
736 QString message =
"Value [" + value +
"] for parameter [" +
737 paramName +
"] is not unique.";
740 return param->listOptions[found].value;
745 value = param->values[0];
765 vector<QString> &values)
const {
769 if(param->type !=
"string" && param->type !=
"combo") {
770 QString message =
"Parameter [" + paramName +
"] is not a string.";
776 if(param->values.size() == 0) {
777 if(param->defaultValues.size() == 0) {
778 QString message =
"Parameter [" + paramName +
"] has no value.";
782 for(
unsigned int i = 0; i < param->defaultValues.size(); i++)
783 values.push_back(param->defaultValues[i]);
787 for(
unsigned int i = 0; i < param->values.size(); i++)
788 values.push_back(param->values[i]);
811 if(param->type !=
"integer") {
812 QString message =
"Parameter [" + paramName +
"] is not an integer.";
817 if(param->values.size() == 0) {
818 if(param->defaultValues.size() == 0) {
819 QString message =
"Parameter [" + paramName +
"] has no value.";
823 value = param->defaultValues[0];
827 value = param->values[0];
847 vector<int> &values)
const {
851 if(param->type !=
"integer") {
852 QString message =
"Parameter [" + paramName +
"] is not an integer.";
858 if(param->values.size() == 0) {
859 if(param->defaultValues.size() == 0) {
860 QString message =
"Parameter [" + paramName +
"] has no value.";
864 for(
unsigned int i = 0; i < param->defaultValues.size(); i++)
865 value = param->defaultValues[i];
870 for(
unsigned int i = 0; i < param->values.size(); i++)
871 value = param->values[i];
895 if(param->type !=
"double") {
896 QString message =
"Parameter [" + paramName +
"] is not a double.";
901 if(param->values.size() == 0) {
902 if(param->defaultValues.size() == 0) {
903 QString message =
"Parameter [" + paramName +
"] has no value.";
907 value = param->defaultValues[0];
911 value = param->values[0];
930 vector<double> &values)
const {
934 if(param->type !=
"double") {
935 QString message =
"Parameter [" + paramName +
"] is not a double.";
941 if(param->values.size() == 0) {
942 if(param->defaultValues.size() == 0) {
943 QString message =
"Parameter [" + paramName +
"] has no value.";
947 for(
unsigned int i = 0; i < param->defaultValues.size(); i++)
948 value = param->defaultValues[i];
953 for(
unsigned int i = 0; i < param->values.size(); i++)
954 value = param->values[i];
977 if(param->type !=
"boolean") {
978 QString message =
"Parameter [" + paramName +
"] is not a boolean.";
983 if(param->values.size() == 0) {
984 if(param->defaultValues.size() == 0) {
985 QString message =
"Parameter [" + paramName +
"] has no value.";
989 value = param->defaultValues[0];
993 value = param->values[0];
1014 vector<bool> &values)
const {
1018 if(param->type !=
"boolean") {
1019 QString message =
"Parameter [" + paramName +
"] is not a boolean.";
1024 vector <QString> value;
1026 if(param->values.size() == 0) {
1027 if(param->defaultValues.size() == 0) {
1028 QString message =
"Parameter [" + paramName +
"] has no value.";
1032 for(
unsigned int i = 0; i < param->defaultValues.size(); i++) {
1033 tmp = param->defaultValues[i].toUpper();
1034 value.push_back(tmp);
1039 for(
unsigned int i = 0; i < param->values.size(); i++) {
1040 tmp = param->values[i].toUpper();
1041 value.push_back(tmp);
1045 for(
unsigned int i = 0; i < value.size(); i++) {
1046 values.push_back(StringToBool(value[i]));
1088 return groups.size();
1099 QString s = groups[index].name;
1113 for(
int i=0; i<(int)groups.size(); i++) {
1137 if (pvlObjName !=
"") {
1142 int grpIndex= GroupIndex(guiGrpName);
1144 if (pvlGrpName ==
"" || grpIndex == -1 ) {
1145 QString errMsg =
"Must provide Group Name\n";
1150 for(
int i=0; i<NumParams(grpIndex); i++) {
1151 QString paramName = ParamName(grpIndex, i);
1153 if(IsParamInPvlInclude(paramName,include)) {
1155 if(paramType ==
"double") {
1158 if(paramType ==
"integer") {
1161 if(paramType ==
"boolean") {
1164 if(paramType ==
"string" || paramType ==
"filename" || paramType ==
"combo") {
1170 if(pvlObj != NULL) {
1193 for(
int i=0; i<(int)include.size(); i++) {
1208 return groups[group].parameters.size();
1220 QString s = groups[group].parameters[param].name;
1233 QString s = groups[group].parameters[param].brief;
1246 QString s = groups[group].parameters[param].description;
1259 QString s = groups[group].parameters[param].minimum;
1272 QString s = groups[group].parameters[param].maximum;
1285 QString s = groups[group].parameters[param].minimum_inclusive;
1298 QString s = groups[group].parameters[param].maximum_inclusive;
1312 QString s = groups[group].parameters[param].odd;
1325 return groups[group].parameters[param].greaterThan.size();
1337 const int ¶m)
const {
1338 return groups[group].parameters[param].greaterThanOrEqual.size();
1350 return groups[group].parameters[param].lessThan.size();
1362 const int ¶m)
const {
1363 return groups[group].parameters[param].lessThanOrEqual.size();
1375 return groups[group].parameters[param].notEqual.size();
1388 const int &great)
const {
1389 QString s = groups[group].parameters[param].greaterThan[great];
1403 const int &great)
const {
1404 QString s = groups[group].parameters[param].greaterThanOrEqual[great];
1418 const int &les)
const {
1419 QString s = groups[group].parameters[param].lessThan[les];
1433 const int &les)
const {
1434 QString s = groups[group].parameters[param].lessThanOrEqual[les];
1448 const int ¬Eq)
const {
1449 QString s = groups[group].parameters[param].notEqual[notEq];
1463 const int &exclude)
const {
1464 QString s = groups[group].parameters[param].exclude[exclude];
1478 const int &include)
const {
1479 QString s = groups[group].parameters[param].include[include];
1493 QString s = groups[group].parameters[param].type;
1507 if(groups[group].parameters[param].defaultValues.size() == 0) {
1511 s = groups[group].parameters[param].defaultValues[0];
1526 if(groups[group].parameters[param].internalDefault.size() == 0) {
1530 s = groups[group].parameters[param].internalDefault;
1545 if(groups[group].parameters[param].filter.size() == 0) {
1549 s = groups[group].parameters[param].filter;
1564 if(groups[group].parameters[param].path.size() == 0) {
1568 s = groups[group].parameters[param].path;
1583 if(groups[group].parameters[param].fileMode.size() == 0) {
1587 s = groups[group].parameters[param].fileMode;
1602 return groups[group].parameters[param].listOptions.size();
1616 const int &option)
const {
1617 QString s = groups[group].parameters[param].listOptions[option].value;
1631 const int &option)
const {
1632 QString s = groups[group].parameters[param].listOptions[option].brief;
1646 const int &option)
const {
1647 QString s = groups[group].parameters[param].listOptions[option].description;
1661 const int &option)
const {
1662 return groups[group].parameters[param].listOptions[option].exclude.size();
1676 const int &option,
const int &exclude)
const {
1677 QString s = groups[group].parameters[param].listOptions[option].exclude[exclude];
1691 const int &option)
const {
1692 return groups[group].parameters[param].listOptions[option].include.size();
1706 const int &option,
const int &include)
const {
1707 QString s = groups[group].parameters[param].listOptions[option].include[include];
1720 return groups[group].parameters[param].exclude.size();
1732 return groups[group].parameters[param].include.size();
1744 return groups[group].parameters[param].pixelType;
1756 return groups[group].parameters[param].helpers.size();
1769 const int &helper)
const {
1770 return groups[group].parameters[param].helpers[helper].name;
1783 const int &helper)
const {
1784 return groups[group].parameters[param].helpers[helper].function;
1797 const int &helper)
const {
1798 return groups[group].parameters[param].helpers[helper].brief;
1811 const int &helper)
const {
1812 return groups[group].parameters[param].helpers[helper].description;
1825 const int &helper)
const {
1826 return groups[group].parameters[param].helpers[helper].icon;
1840 if(param->values.size() == 0) {
1855 param->values.clear();
1878 if(param->type !=
"cube") {
1879 QString message =
"Unable to get input cube attributes. Parameter ["
1880 + paramName +
"] is not a cube. Parameter type = [" + param->type +
"].";
1885 if(param->values.size() == 0) {
1886 if(param->defaultValues.size() == 0) {
1892 value = param->defaultValues[0];
1896 value = param->values[0];
1898 if(param->fileMode ==
"input") {
1902 QString message =
"Unable to get input cube attributes. Parameter ["
1903 + paramName +
"] is not an input. Parameter fileMode = [" + param->fileMode +
"].";
1906 return param->inCubeAtt;
1923 if(param->type !=
"cube") {
1924 QString message =
"Unable to get output cube attributes. Parameter ["
1925 + paramName +
"] is not a cube. Parameter type = [" + param->type +
"].";
1930 if(param->values.size() == 0) {
1931 if(param->defaultValues.size() == 0) {
1937 value = param->defaultValues[0];
1941 value = param->values[0];
1943 if(param->fileMode ==
"output") {
1948 QString message =
"Unable to get output cube attributes. Parameter ["
1949 + paramName +
"] is not an output. Parameter fileMode = [" + param->fileMode +
"].";
1952 return param->outCubeAtt;
1973 for(
unsigned int g = 0; g < groups.size(); g++) {
1974 for(
unsigned int p = 0; p < groups[g].parameters.size(); p++) {
1975 cur_pn = groups[g].parameters[p].name;
1977 if(cur_pn.find(pn) == 0) {
1980 QString message =
"Parameter [" + paramName +
"] is not unique.";
1986 param = &(groups[g].parameters[p]);
1991 param = &(groups[g].parameters[p]);
1997 QString message =
"Unknown parameter [" + paramName +
"].";
2000 else if((found > 1) && (!exact)) {
2001 QString message =
"Parameter [" + paramName +
"] is not unique.";
2020 for(
unsigned int i = 0; i < param->values.size(); i++) {
2021 if(param->type ==
"integer") {
2027 QString message =
"Unable to convert [" + param->values[i] +
"] to an integer,"
2028 " parameter [" + param->name +
"].";
2032 else if(param->type ==
"double") {
2038 QString message =
"Unable to convert [" + param->values[i] +
"] to a double,"
2039 " parameter [" + param->name +
"].";
2043 else if(param->type ==
"boolean") {
2044 QString v = param->values[i].toUpper();
2050 QString message =
"Illegal value for [" + param->name +
"], [" + param->values[i] +
"].";
2054 else if(param->type ==
"filename") {
2057 QString value(param->values[i]);
2060 if(name.
fileExists() && param->fileMode ==
"output") {
2061 CheckFileNamePreference(value, param->name);
2081 if(param->values.size() == 0) {
2082 for(
unsigned int i = 0; i < param->defaultValues.size(); i++) {
2085 if(param->type ==
"integer") {
2091 QString message =
"Unable to convert default [" + param->defaultValues[i] +
2092 "] to an integer, parameter [" + param->name +
"].";
2096 else if(param->type ==
"double") {
2102 QString message =
"Unable to convert default [" + param->defaultValues[i] +
2103 "] to a double, parameter [" + param->name +
"].";
2107 else if(param->type ==
"boolean") {
2108 QString v = param->defaultValues[i].toUpper();
2114 QString message =
"Illegal default value for [" + param->name +
"], ["
2115 + param->defaultValues[i] +
"].";
2119 else if(param->type ==
"filename") {
2121 QString value(param->defaultValues[i]);
2124 if(name.
fileExists() && param->fileMode ==
"output") {
2125 CheckFileNamePreference(value, param->name);
2132 if(param->listOptions.size() > 0) {
2133 for(
unsigned int i = 0; i < param->values.size(); i++) {
2138 for(
unsigned int p = 0; p < param->listOptions.size(); p++) {
2140 option = option.
UpCase();
2142 if(value == option) {
2145 QString message =
"Duplicate list options [" +
2146 param->listOptions[p].value +
2147 "] in parameter [" + param->name +
"].";
2155 else if(option.compare(0, min(value.size(), option.size()),
2156 value, 0, min(value.size(), option.size())) == 0) {
2160 if(!exact && partial == 0) {
2161 QString message =
"Value of [" + param->name +
"] must be one of [" +
2162 param->listOptions[0].value;
2163 for(
unsigned int p = 1; p < param->listOptions.size(); p++) {
2164 message +=
", " + param->listOptions[p].value;
2169 else if(!exact && partial > 1) {
2170 QString msg =
"Value of [" + param->name +
2171 "] does not match a list option uniquely.";
2178 if(param->minimum.length() > 0) {
2179 QString incl = param->minimum_inclusive;
2180 for(
unsigned int i = 0; i < param->values.size(); i++) {
2181 if(param->type ==
"integer") {
2182 QString value(param->values[i]);
2184 value = param->minimum;
2186 if(StringToBool(incl) && (temp < min)) {
2187 QString message =
"Parameter [" + param->name +
2188 "] must be greater than or equal to [" + param->minimum +
"].";
2191 else if(!StringToBool(incl) && (temp <= min)) {
2192 QString message =
"Parameter [" + param->name +
2193 "] must be greater than [" + param->minimum +
"].";
2197 else if(param->type ==
"double") {
2200 value = param->minimum;
2202 if(StringToBool(incl) && (temp < min)) {
2203 QString message =
"Parameter [" + param->name +
2204 "] must be greater than or equal to [" + param->minimum +
"].";
2207 else if(!StringToBool(incl) && (temp <= min)) {
2208 QString message =
"Parameter [" + param->name +
2209 "] must be greater than [" + param->minimum +
"].";
2214 if(param->values.size() == 0) {
2215 for(
unsigned int i = 0; i < param->defaultValues.size(); i++) {
2216 if(param->type ==
"integer") {
2219 value = param->minimum;
2221 if(StringToBool(incl) && (temp < min)) {
2222 QString message =
"Parameter [" + param->name +
2223 "] must be greater than or equal to [" + param->minimum +
"].";
2226 else if(!StringToBool(incl) && (temp <= min)) {
2227 QString message =
"Parameter [" + param->name +
2228 "] must be greater than [" + param->minimum +
"].";
2232 else if(param->type ==
"double") {
2235 value = param->minimum;
2237 if(StringToBool(incl) && (temp < min)) {
2238 QString message =
"Parameter [" + param->name +
2239 "] must be greater than or equal to [" + param->minimum +
"].";
2242 else if(!StringToBool(incl) && (temp <= min)) {
2243 QString message =
"Parameter [" + param->name +
2244 "] must be greater than [" + param->minimum +
"].";
2253 if(param->maximum.length() > 0) {
2254 QString incl = param->maximum_inclusive.toLower();
2255 for(
unsigned int i = 0; i < param->values.size(); i++) {
2256 if(param->type ==
"integer") {
2257 QString value(param->values[i]);
2259 value = param->maximum;
2261 if(StringToBool(incl) && (temp > max)) {
2262 QString message =
"Parameter [" + param->name +
2263 "] must be less than or equal to [" + param->maximum +
"].";
2266 else if(!StringToBool(incl) && (temp >= max)) {
2267 QString message =
"Parameter [" + param->name +
2268 "] must be less than [" + param->maximum +
"].";
2272 else if(param->type ==
"double") {
2275 value = param->maximum;
2277 if(StringToBool(incl) && (temp > max)) {
2278 QString message =
"Parameter [" + param->name +
2279 "] must be less than or equal to [" + param->maximum +
"].";
2282 else if(!StringToBool(incl) && (temp >= max)) {
2283 QString message =
"Parameter [" + param->name +
2284 "] must be less than [" + param->maximum +
"].";
2289 if(param->values.size() == 0) {
2290 for(
unsigned int i = 0; i < param->defaultValues.size(); i++) {
2291 if(param->type ==
"integer") {
2294 value = param->maximum;
2296 if(StringToBool(incl) && (temp > max)) {
2297 QString message =
"Parameter [" + param->name +
2298 "] must be less than or equal to [" + param->maximum +
"].";
2301 else if(!StringToBool(incl) && (temp >= max)) {
2302 QString message =
"Parameter [" + param->name +
2303 "] must be less than [" + param->maximum +
"].";
2307 else if(param->type ==
"double") {
2310 value = param->maximum;
2312 if(StringToBool(incl) && (temp > max)) {
2313 QString message =
"Parameter [" + param->name +
2314 "] must be less than or equal to [" + param->maximum +
"].";
2317 else if(!StringToBool(incl) && (temp >= max)) {
2318 QString message =
"Parameter [" + param->name +
2319 "] must be less than [" + param->maximum +
"].";
2328 QString odd = param->odd.toLower();
2330 if((odd !=
"") || StringToBool(odd)) {
2331 if(param->type !=
"integer") {
2332 QString message =
"Parameter [" + param->name +
2333 "] must be of type integer to have an [odd] test.";
2337 for(
unsigned int i = 0; i < param->values.size(); i++) {
2340 QString message =
"Value for [" + param->name +
"] must be odd.";
2369 QString overwritePreference = fileCustomization.
findKeyword(
"Overwrite")[0].simplified().trimmed();
2370 QString temp = overwritePreference;
2371 if(overwritePreference.toUpper() ==
"ERROR") {
2372 QString message =
"Invalid output filename for [" + paramname +
"]. The file [" + filename +
"] already exists. " +
2373 "The user preference file customization group is set to disallow file overwrites.";
2376 else if(overwritePreference.toUpper() !=
"ALLOW") {
2377 QString message =
"Invalid entry in user preference file FileCustomization group.";
2378 message +=
" Overwrite = [" + temp +
"]. Valid values: [Allow] or [Error].";
2388 for(
unsigned int g = 0; g < groups.size(); g++) {
2389 for(
unsigned int p = 0; p < groups[g].parameters.size(); p++) {
2395 for(
unsigned int item = 0; item < param->include.size(); item++) {
2398 if(param->type ==
"boolean") {
2399 if(((param->values.size() > 0) && StringToBool(param->values[0])) ||
2400 ((param->values.size() == 0) && (param->defaultValues.size() > 0)
2401 && StringToBool(param->defaultValues[0]))) {
2404 if((param2->values.size()) == 0 &&
2405 (param2->defaultValues.size() == 0) &&
2406 (param2->internalDefault.size() == 0)) {
2407 QString message =
"Parameter [" + param2->name +
2408 "] must be used if parameter [" +
2409 param->name +
"] equates to true.";
2419 if(param2->type ==
"boolean") {
2420 if(((param2->values.size() > 0) && StringToBool(param2->values[0])) ||
2421 ((param2->values.size() == 0) && (param2->defaultValues.size() > 0) &&
2422 StringToBool(param2->defaultValues[0]))) {
2423 if((param->values.size()) == 0 &&
2424 (param->defaultValues.size() == 0) &&
2425 (param->internalDefault.size() == 0)) {
2426 QString message =
"Parameter [" + param2->name +
2427 "] must be used if parameter [" +
2428 param->name +
"] is used.";
2436 if(param->values.size() > 0 &&
2437 param2->values.size() == 0 &&
2438 param2->defaultValues.size() == 0 &&
2439 param2->internalDefault.size() == 0) {
2440 QString message =
"Parameter [" + param2->name +
2441 "] must be used if parameter [" +
2442 param->name +
"] is used.";
2449 for(
unsigned int item = 0; item < param->exclude.size(); item++) {
2452 if(param->type ==
"boolean") {
2453 if(((param->values.size() > 0) && StringToBool(param->values[0])) ||
2454 ((param->values.size() == 0) && (param->defaultValues.size() > 0) &&
2455 StringToBool(param->defaultValues[0]))) {
2458 if(param2->values.size() > 0) {
2459 QString message =
"Parameter [" + param2->name +
2460 "] must NOT be used if parameter [" +
2461 param->name +
"] equates to true.";
2469 if(param2->type ==
"boolean") {
2470 if(((param2->values.size() > 0) && StringToBool(param2->values[0])) ||
2471 ((param2->values.size() == 0) && (param2->defaultValues.size() > 0) &&
2472 StringToBool(param2->defaultValues[0]))) {
2473 if(param->values.size() > 0) {
2474 QString message =
"Parameter [" + param2->name +
2475 "] must be used if parameter [" +
2476 param->name +
"] is used.";
2483 if(param->values.size() > 0 && param2->values.size() > 0) {
2484 QString message =
"Parameter [" + param2->name +
2485 "] must NOT be used if parameter [" +
2486 param->name +
"] is used.";
2494 if(param->values.size() > 0) {
2495 for(
unsigned int item = 0; item < param->greaterThan.size(); item++) {
2497 if(param2->values.size() != 0) {
2498 double double1, double2;
2499 if(param->type ==
"integer") {
2500 double1 = (double) GetInteger(param->name);
2502 else if(param->type ==
"double") {
2503 double1 = GetDouble(param->name);
2506 QString msg =
"Parameter is not INTEGER or DOUBLE type [" +
2511 if(param2->type ==
"integer") {
2512 double2 = GetInteger(param2->name);
2514 else if(param2->type ==
"double") {
2515 double2 = GetDouble(param2->name);
2518 QString msg =
"Parameter is not INTEGER or DOUBLE type [" +
2523 if(double2 >= double1) {
2524 QString message =
"Parameter [" + param->name +
2525 "] must be greater than parameter [" +
2526 param2->name +
"].";
2534 if(param->values.size() > 0) {
2535 for(
unsigned int item = 0; item < param->greaterThanOrEqual.size(); item++) {
2537 ReturnParam(param->greaterThanOrEqual[item]);
2538 if(param2->values.size() != 0) {
2539 double double1, double2;
2540 if(param->type ==
"integer") {
2541 double1 = (double) GetInteger(param->name);
2543 else if(param->type ==
"double") {
2544 double1 = GetDouble(param->name);
2547 QString msg =
"Parameter is not INTEGER or DOUBLE type [" +
2552 if(param2->type ==
"integer") {
2553 double2 = GetInteger(param2->name);
2555 else if(param2->type ==
"double") {
2556 double2 = GetDouble(param2->name);
2559 QString msg =
"Parameter is not INTEGER or DOUBLE type [" +
2564 if(double2 > double1) {
2565 QString message =
"Parameter [" + param->name +
2566 "] must be greater than or equal to parameter [" +
2567 param2->name +
"].";
2574 if(param->values.size() > 0) {
2575 for(
unsigned int item = 0; item < param->lessThan.size(); item++) {
2577 if(param2->values.size() != 0) {
2578 double double1, double2;
2579 if(param->type ==
"integer") {
2580 double1 = (double) GetInteger(param->name);
2582 else if(param->type ==
"double") {
2583 double1 = GetDouble(param->name);
2586 QString msg =
"Parameter is not INTEGER or DOUBLE type [" +
2591 if(param2->type ==
"integer") {
2592 double2 = GetInteger(param2->name);
2594 else if(param2->type ==
"double") {
2595 double2 = GetDouble(param2->name);
2598 QString msg =
"Parameter is not INTEGER or DOUBLE type [" +
2603 if(double2 <= double1) {
2604 QString message =
"Parameter [" + param->name +
2605 "] must be less than parameter [" +
2606 param2->name +
"].";
2614 if(param->values.size() > 0) {
2615 for(
unsigned int item = 0; item < param->lessThanOrEqual.size(); item++) {
2617 ReturnParam(param->lessThanOrEqual[item]);
2618 if(param2->values.size() != 0) {
2619 double double1, double2;
2620 if(param->type ==
"integer") {
2621 double1 = (double) GetInteger(param->name);
2623 else if(param->type ==
"double") {
2624 double1 = GetDouble(param->name);
2627 QString msg =
"Parameter is not INTEGER or DOUBLE type [" +
2632 if(param2->type ==
"integer") {
2633 double2 = GetInteger(param2->name);
2635 else if(param2->type ==
"double") {
2636 double2 = GetDouble(param2->name);
2639 QString msg =
"Parameter is not INTEGER or DOUBLE type [" +
2644 if(double2 < double1) {
2645 QString message =
"Parameter [" + param->name +
2646 "] must be less than or equal to parameter [" +
2647 param2->name +
"].";
2655 if(param->values.size() > 0) {
2656 for(
unsigned int item = 0; item < param->notEqual.size(); item++) {
2658 if(param2->values.size() != 0) {
2659 double double1, double2;
2660 if(param->type ==
"integer") {
2661 double1 = (double) GetInteger(param->name);
2663 else if(param->type ==
"double") {
2664 double1 = GetDouble(param->name);
2667 QString msg =
"Parameter is not INTEGER or DOUBLE type [" +
2672 if(param2->type ==
"integer") {
2673 double2 = GetInteger(param2->name);
2675 else if(param2->type ==
"double") {
2676 double2 = GetDouble(param2->name);
2679 QString msg =
"Parameter is not INTEGER or DOUBLE type [" +
2684 if(double2 == double1) {
2685 QString message =
"Parameter [" + param->name +
2686 "] must NOT be equal to parameter [" +
2687 param2->name +
"].";
2696 if(((param->values.size() > 0) || (param->defaultValues.size())) > 0) {
2697 for(
unsigned int o2 = 0; o2 < param->listOptions.size(); o2++) {
2698 QString value, option;
2699 if(param->type ==
"string" || param->type ==
"combo") {
2700 value = GetString(param->name);
2701 value = value.toUpper();
2702 option = param->listOptions[o2].value;
2703 option = option.toUpper();
2705 else if(param->type ==
"integer") {
2706 value = GetAsString(param->name);
2707 value = value.trimmed();
2708 option = param->listOptions[o2].value;
2709 option = option.trimmed();
2711 if(value == option) {
2712 for(
unsigned int e2 = 0; e2 < param->listOptions[o2].exclude.size(); e2++) {
2714 ReturnParam(param->listOptions[o2].exclude[e2]);
2715 if(param2->values.size() > 0) {
2716 QString message =
"Parameter [" + param2->name +
2717 "] can not be entered if parameter [" +
2718 param->name +
"] is equal to [" +
2729 if(((param->values.size() > 0) || (param->defaultValues.size())) > 0) {
2730 for(
unsigned int o2 = 0; o2 < param->listOptions.size(); o2++) {
2731 QString value, option;
2732 if(param->type ==
"string" || param->type ==
"combo") {
2733 value = GetString(param->name);
2734 value = value.toUpper();
2735 option = param->listOptions[o2].value;
2736 option = option.toUpper();
2738 else if(param->type ==
"integer") {
2739 value = GetAsString(param->name);
2740 value = value.trimmed();
2741 option = param->listOptions[o2].value;
2742 option = option.trimmed();
2744 if(value == option) {
2745 for(
unsigned int e2 = 0; e2 < param->listOptions[o2].include.size(); e2++) {
2747 ReturnParam(param->listOptions[o2].include[e2]);
2748 if((param2->values.size() == 0) &&
2749 (param2->defaultValues.size() == 0)) {
2750 QString message =
"Parameter [" + param2->name +
2751 "] must be entered if parameter [" +
2752 param->name +
"] is equal to [" +
2766 if((param->values.size() == 0) && (param->defaultValues.size() == 0) &&
2767 (param->internalDefault.size() == 0)) {
2768 bool excluded =
false;
2770 for(
unsigned int g2 = 0; g2 < groups.size(); g2++) {
2771 for(
unsigned int p2 = 0; p2 < groups[g2].parameters.size(); p2++) {
2772 for(
unsigned int o2 = 0;
2773 o2 < groups[g2].parameters[p2].listOptions.size(); o2++) {
2774 for(
unsigned int e2 = 0;
2775 e2 < groups[g2].parameters[p2].listOptions[o2].exclude.size();
2778 this->groups[g2].parameters[p2].listOptions[o2].exclude[e2];
2779 if(excl == param->name) {
2786 if(groups[g2].parameters[p2].type ==
"boolean") {
2788 if(((param2->values.size() > 0) && !StringToBool(param2->values[0])) ||
2789 ((param2->values.size() == 0) && (param2->defaultValues.size() > 0) &&
2790 !StringToBool(param2->defaultValues[0]))) {
2791 for(
unsigned int e2 = 0; e2 < groups[g2].parameters[p2].include.size();
2794 this->groups[g2].parameters[p2].include[e2];
2795 if(incl == param->name) {
2800 else if(((param2->values.size() > 0) && StringToBool(param2->values[0])) ||
2801 ((param2->values.size() == 0) && (param2->defaultValues.size() > 0) &&
2802 StringToBool(param2->defaultValues[0]))) {
2803 for(
unsigned int e2 = 0; e2 < groups[g2].parameters[p2].exclude.size();
2806 this->groups[g2].parameters[p2].exclude[e2];
2807 if(excl == param->name) {
2818 for(
unsigned int item = 0; item < param->exclude.size(); item++) {
2820 if((param2->values.size() != 0) ||
2821 (param2->defaultValues.size() != 0) ||
2822 (param2->internalDefault.size() != 0)) {
2823 if(param2->type !=
"boolean") {
2827 if(((param2->values.size() > 0) && !StringToBool(param2->values[0])) ||
2828 ((param2->values.size() == 0) && (param2->defaultValues.size() > 0) &&
2829 !StringToBool(param2->defaultValues[0]))) {
2838 for(
unsigned int item = 0; item < param->include.size(); item++) {
2840 if(param2->type ==
"boolean") {
2841 if(((param2->values.size() > 0) && !StringToBool(param2->values[0])) ||
2842 ((param2->values.size() == 0) && (param2->defaultValues.size() > 0) &&
2843 !StringToBool(param2->defaultValues[0]))) {
2850 QString message =
"Parameter [" + param->name +
"] must be entered.";
2869 value = value.toUpper();
2873 else if(!value.compare(
"NO")) {
2876 else if(!value.compare(
"FALSE")) {
2879 else if(!value.compare(
"F")) {
2882 else if(!value.compare(
"N")) {
2885 else if(!value.compare(
"YES")) {
2888 else if(!value.compare(
"TRUE")) {
2891 else if(!value.compare(
"Y")) {
2894 else if(!value.compare(
"T")) {
2898 QString message =
"Invalid boolean value [" + value +
"].";
2914 for(
unsigned int g = 0; g < groups.size(); g++) {
2915 for(
unsigned int p = 0; p < groups[g].parameters.size(); p++) {
2918 if(param->values.size() > 0) {
2921 for(
unsigned int value = 0; value < param->values.size(); value++) {
2922 paramKeyword.
addValue(param->values[value]);
2925 group += paramKeyword;
2929 else if(param->defaultValues.size() > 0) {
2932 for(
unsigned int value = 0;
2933 value < param->defaultValues.size();
2935 paramKeyword.
addValue(param->defaultValues[value]);
2938 group += paramKeyword;
2943 for(
unsigned int g = 0; g < groups.size(); g++) {
2944 for(
unsigned int p = 0; p < groups[g].parameters.size(); p++) {
2947 if(((param->values.size() > 0) || (param->defaultValues.size())) > 0) {
2948 for(
unsigned int o2 = 0; o2 < param->listOptions.size(); o2++) {
2950 if(param->type ==
"string" || param->type ==
"combo") {
2951 value = GetAsString(param->name);
2953 option = param->listOptions[o2].value;
2954 option = option.
UpCase();
2956 else if(param->type ==
"integer") {
2957 value = GetAsString(param->name);
2958 value = value.
Trim(
"\n\r\t\f\v\b");
2959 option = param->listOptions[o2].value;
2960 option = option.
Trim(
"\n\r\t\f\v\b");
2962 if(value == option) {
2963 for(
unsigned int e2 = 0; e2 < param->listOptions[o2].exclude.size(); e2++) {
2965 ReturnParam(param->listOptions[o2].exclude[e2]);
2988 QString st =
"000-00-00";
2989 for(
unsigned int i = 0; i < changes.size(); i++) {
2990 if(changes[i].date > st) st = changes[i].date;
3007 XERCES::XMLPlatformUtils::Initialize();
3010 catch(
const XERCES::XMLException &toCatch) {
3012 QString message =
"Error during XML parser initialization" +
3013 (QString)XERCES::XMLString::transcode(toCatch.getMessage());
3021 parser = XERCES::XMLReaderFactory::createXMLReader();
3024 XERCES::SAX2XMLReader::ValSchemes valScheme = XERCES::SAX2XMLReader::Val_Never;
3025 if(valScheme == XERCES::SAX2XMLReader::Val_Auto) {
3026 parser->setFeature(XERCES::XMLString::transcode(
"http://xml.org/sax/features/validation"),
true);
3027 parser->setFeature(XERCES::XMLString::transcode(
"http://apache.org/xml/features/validation/dynamic"),
true);
3029 else if(valScheme == XERCES::SAX2XMLReader::Val_Never) {
3030 parser->setFeature(XERCES::XMLString::transcode(
"http://xml.org/sax/features/validation"),
false);
3033 else if(valScheme == XERCES::SAX2XMLReader::Val_Always) {
3034 parser->setFeature(XERCES::XMLString::transcode(
"http://xml.org/sax/features/validation"),
true);
3035 parser->setFeature(XERCES::XMLString::transcode(
"http://apache.org/xml/features/validation/dynamic"),
false);
3039 bool doSchema =
false;
3040 parser->setFeature(XERCES::XMLString::transcode(
"http://apache.org/xml/features/validation/schema"), doSchema);
3042 bool schemaFullChecking =
false;
3043 parser->setFeature(XERCES::XMLString::transcode(
"http://apache.org/xml/features/validation/schema-full-checking"), schemaFullChecking);
3047 char *encodingName =
const_cast<char *
>(
"LATIN1");
3048 bool expandNamespaces = false ;
3053 parser->parse(xmlfile);
3055 catch (
const XERCES::XMLException &toCatch) {
3056 QString message =
"Error in application XML file: " +
3057 (QString)XERCES::XMLString::transcode(toCatch.getMessage());
3059 XERCES::XMLPlatformUtils::Terminate();
3065 QString filePath = (QString) xmlfile;
3066 QString previousErrorMessage = (QString) e.
toString();
3067 QString additionalErrorMessage =
"Error while parsing application XML file [" + filePath +
"]";
3070 XERCES::XMLPlatformUtils::Terminate();
3076 XERCES::XMLPlatformUtils::Terminate();