25 extract_param_value(
const string &str,
string ¶m,
string &value) {
29 while (i < str.length() && isspace(str[i])) {
36 while (i < str.length() && !isspace(str[i])) {
42 param = str.substr(start, end - start);
45 while (i < str.length() && isspace(str[i])) {
53 parse_image_type_request(
const string &word,
PNMFileType *&color_type,
59 string color_name = word;
61 size_t comma = word.find(
',');
62 if (comma != string::npos) {
65 color_name = word.substr(0, comma);
66 alpha_name = word.substr(comma + 1);
69 if (!color_name.empty()) {
71 if (color_type ==
nullptr) {
72 nout <<
"Image file type '" << color_name <<
"' is unknown.\n";
77 if (!alpha_name.empty()) {
79 if (alpha_type ==
nullptr) {
80 nout <<
"Image file type '" << alpha_name <<
"' is unknown.\n";