Function utils::initPDFFromString

Function Documentation

auto utils::initPDFFromString(const std::string &value, const std::string &prefix = "") -> pdfs::PDF

Initialize a PDF from a string.

If value can be converted to a numerical value (via utils::stod), this is interpreted as specifying a delta function at that value. Otherwise, value is interpreted as the name of a PDF file descriptor, with the path to the file resolved by utils::getFilePath.

Parameters:
  • value – The string to interpret; plays the same role as the value of the toml key in TOMLUtils.hpp’s initPDFFromKey()

  • prefix – Prefix to look for PDF file relative to SLUG_DIR

Throws:

std::runtime_error – if value is not numeric and does not name a file that can be found