octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: error function


From: John W. Eaton
Subject: Re: error function
Date: Tue, 15 May 2007 00:51:25 -0400

On 15-May-2007, Shai Ayal wrote:

| This is of course recoverable. How about using the approach taken by
| octave_value when trying to extract a wrong type? The following code
| is used in many places:
| 
| void somefunc ( octave_value& val)
|       std::string c = val.string_value ();
|       
|       if (! error_state )
| 
| does octave_value set the error_state directly or does it call a function?

The string_value method calls error if it can't perform the
conversion.

| When the value is "none", then the relevant element shouldn't be drawn
| at all -- an eample is line.markeredgecolor which can be none and than
| the markers will ot have the edge drawn, only the face.
| The "auto" value is a bit contrived -- an example doesn't spring to
| mind, but it is conceiveable that then the color would have to be
| computed based on the value of other properties as well, so it can't
| be computed by the rgb function.

Maybe you need

  bool rgb_property::is_none (void) const;
  bool rgb_property::is_auto (void) const;
  const double *rgb_property::rgb_value (void) const;

and then code that uses this class will just have to check if it cares
about "none" and "auto".  I don't know what else to suggest unless the
rgb function can somehow return reasonable values when the state is
"none" or "auto".

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]