octave-maintainers
[Top][All Lists]
Advanced

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

Re: error function


From: Shai Ayal
Subject: Re: error function
Date: Tue, 15 May 2007 07:41:06 +0200

On 5/15/07, John W. Eaton <address@hidden> wrote:
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.

but no error messge is printed right? does it call error ("") ?

| 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".

I thought of is_rgb and is_radio. However I recal thatusing is_*
functions was the way to determine octave_value type, but then I read
somewhere that the recomended way was to try and convert and than
check error_state, as above. Can you elaborate on why this is
recommended for octave_value?

jwe



reply via email to

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