| 145 | } |
| 146 | |
| 147 | void appendOptionsToRequest(Request& request, SEXP options_) { |
| 148 | if(options_== R_NilValue) { return; } |
| 149 | Rcpp::CharacterVector options(options_); |
| 150 | |
| 151 | if(!options.hasAttribute("names")) { |
| 152 | throw std::logic_error("Request options must be named."); |
| 153 | } |
| 154 | |
| 155 | if(options.attr("names") == R_NilValue) { |
| 156 | throw std::logic_error("Request optionnames must not be null."); |
| 157 | } |
| 158 | |
| 159 | Rcpp::CharacterVector options_names(options.attr("names")); |
| 160 | |
| 161 | if(options.length() && options_names.length()==0) { |
| 162 | throw std::logic_error("Request options must be non empty and named."); |
| 163 | } |
| 164 | |
| 165 | for(R_len_t i = 0; i < options.length(); i++) { |
| 166 | request.set(static_cast<std::string>(options_names[i]).c_str(), static_cast<std::string>(options[i]).c_str()); |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | void appendOverridesToRequest(Request& request, SEXP overrides_) { |
| 171 | if(overrides_ == R_NilValue) { return; } |
no outgoing calls
no test coverage detected