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";
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the base class of a family of classes that represent particular image file types that PNMImag...
static PNMFileTypeRegistry * get_global_ptr()
Returns a pointer to the global PNMFileTypeRegistry object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PNMFileType * get_type_from_extension(const std::string &filename) const
Tries to determine what the PNMFileType is likely to be for a particular image file based on its exte...
This class maintains the set of all known PNMFileTypes in the universe.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
string trim_right(const string &str)
Returns a new string representing the contents of the given string with the trailing whitespace remov...