2016-02-22 11:33:31 -05:00
|
|
|
#include <boost/format.hpp>
|
|
|
|
|
2022-12-11 04:10:26 -05:00
|
|
|
namespace osrm::server::service
|
2016-02-22 11:33:31 -05:00
|
|
|
{
|
|
|
|
|
|
|
|
const constexpr char PARAMETER_SIZE_MISMATCH_MSG[] =
|
|
|
|
"Number of elements in %1% size %2% does not match coordinate size %3%";
|
|
|
|
|
|
|
|
template <typename ParamT>
|
|
|
|
bool constrainParamSize(const char *msg_template,
|
|
|
|
const char *name,
|
|
|
|
const ParamT ¶m,
|
|
|
|
const std::size_t target_size,
|
|
|
|
std::string &help)
|
|
|
|
{
|
|
|
|
if (param.size() > 0 && param.size() != target_size)
|
|
|
|
{
|
|
|
|
help = (boost::format(msg_template) % name % param.size() % target_size).str();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2022-12-20 12:00:11 -05:00
|
|
|
} // namespace osrm::server::service
|