Skip to content

Commit

Permalink
More consistent about searching ParamValueSpan case insensitively by …
Browse files Browse the repository at this point in the history
…default

Signed-off-by: Larry Gritz <lg@larrygritz.com>
  • Loading branch information
lgritz committed Feb 28, 2024
1 parent c682f85 commit fbc8862
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions src/include/OpenImageIO/paramlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,17 +394,17 @@ class OIIO_UTIL_API ParamValueList : public std::vector<ParamValue> {
return f != cend() ? &(*f) : nullptr;
}

/// Case insensitive search for an integer, with default if not found.
/// Automatically will return an int even if the data is really
/// unsigned, short, or byte, but not float. It will retrieve from a
/// string, but only if the string is entirely a valid int format.
/// Search for an integer, with default if not found. Automatically will
/// return an int even if the data is really unsigned, short, or byte, but
/// not float. It will retrieve from a string, but only if the string is
/// entirely a valid int format.
int get_int(string_view name, int defaultval = 0,
bool casesensitive = false, bool convert = true) const;

/// Case insensitive search for a float, with default if not found.
/// Automatically will return a float even if the data is really double
/// or half. It will retrieve from a string, but only if the string is
/// entirely a valid float format.
/// Search for a float, with default if not found. Automatically will
/// return a float even if the data is really double or half. It will
/// retrieve from a string, but only if the string is entirely a valid
/// float format.
float get_float(string_view name, float defaultval = 0,
bool casesensitive = false, bool convert = true) const;

Expand Down Expand Up @@ -611,51 +611,51 @@ class OIIO_UTIL_API ParamValueSpan : public cspan<ParamValue> {
}

const_iterator find(string_view name, TypeDesc type = TypeUnknown,
bool casesensitive = true) const;
bool casesensitive = false) const;
const_iterator find(ustring name, TypeDesc type = TypeUnknown,
bool casesensitive = true) const;
bool casesensitive = false) const;

/// Case insensitive search for an integer, with default if not found.
/// Automatically will return an int even if the data is really
/// unsigned, short, or byte, but not float. It will retrieve from a
/// string, but only if the string is entirely a valid int format.
int get_int(string_view name, int defaultval = 0, bool casesensitive = true,
bool convert = true) const;
int get_int(ustring name, int defaultval = 0, bool casesensitive = true,
/// Search for an integer, with default if not found. Automatically will
/// return an int even if the data is really unsigned, short, or byte, but
/// not float. It will retrieve from a string, but only if the string is
/// entirely a valid int format.
int get_int(string_view name, int defaultval = 0,
bool casesensitive = false, bool convert = true) const;
int get_int(ustring name, int defaultval = 0, bool casesensitive = false,
bool convert = true) const;

/// Case insensitive search for a float, with default if not found.
/// Automatically will return a float even if the data is really double
/// or half. It will retrieve from a string, but only if the string is
/// entirely a valid float format.
/// Search for a float, with default if not found. Automatically will
/// return a float even if the data is really double or half. It will
/// retrieve from a string, but only if the string is entirely a valid
/// float format.
float get_float(string_view name, float defaultval = 0,
bool casesensitive = true, bool convert = true) const;
bool casesensitive = false, bool convert = true) const;
float get_float(ustring name, float defaultval = 0,
bool casesensitive = true, bool convert = true) const;
bool casesensitive = false, bool convert = true) const;

/// Simple way to get a string attribute, with default provided.
/// If the value is another type, it will be turned into a string.
string_view get_string(string_view name,
string_view defaultval = string_view(),
bool casesensitive = true,
bool casesensitive = false,
bool convert = true) const;
string_view get_string(ustring name, string_view defaultval = string_view(),
bool casesensitive = true,
bool casesensitive = false,
bool convert = true) const;
ustring get_ustring(string_view name,
string_view defaultval = string_view(),
bool casesensitive = true, bool convert = true) const;
bool casesensitive = false, bool convert = true) const;
ustring get_ustring(ustring name, string_view defaultval = string_view(),
bool casesensitive = true, bool convert = true) const;
bool casesensitive = false, bool convert = true) const;

/// Does the span contain the named attribute?
bool contains(string_view name, TypeDesc type = TypeUnknown,
bool casesensitive = true) const
bool casesensitive = false) const
{
return (find(name, type, casesensitive) != end());
}
bool contains(ustring name, TypeDesc type = TypeUnknown,
bool casesensitive = true) const
bool casesensitive = false) const
{
return (find(name, type, casesensitive) != end());
}
Expand Down

0 comments on commit fbc8862

Please sign in to comment.