Prints an error and throws invalid_option or invalid_option_value if the option could not be set
| 157 | public: |
| 158 | // Prints an error and throws invalid_option or invalid_option_value if the option could not be set |
| 159 | void setOption(Reference<ITransaction> tr, |
| 160 | StringRef optionStr, |
| 161 | bool enabled, |
| 162 | Optional<StringRef> arg, |
| 163 | bool intrans) { |
| 164 | auto transactionItr = transactionOptions.legalOptions.find(optionStr.toString()); |
| 165 | if (transactionItr != transactionOptions.legalOptions.end()) |
| 166 | setTransactionOption(tr, transactionItr->second, enabled, arg, intrans); |
| 167 | else { |
| 168 | fprintf(stderr, |
| 169 | "ERROR: invalid option '%s'. Try `help options' for a list of available options.\n", |
| 170 | optionStr.toString().c_str()); |
| 171 | throw invalid_option(); |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | // Applies all enabled transaction options to the given transaction |
| 176 | void apply(Reference<ITransaction> tr) { |