Mercurial > octave-nkf
comparison src/graphics.cc @ 7523:f2000f1971ab
new row_vector_property class
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 25 Feb 2008 03:44:50 -0500 |
parents | b1cfd33a364b |
children | 52d58b0463ed |
comparison
equal
deleted
inserted
replaced
7522:8a6965a01176 | 7523:f2000f1971ab |
---|---|
484 xok = false; | 484 xok = false; |
485 } | 485 } |
486 } | 486 } |
487 else | 487 else |
488 return true; | 488 return true; |
489 } | |
490 | |
491 return xok; | |
492 } | |
493 | |
494 bool | |
495 row_vector_property::validate (const octave_value& v) | |
496 { | |
497 bool xok = false; | |
498 | |
499 // FIXME: should we always support []? | |
500 if (v.is_empty () && v.is_double_type ()) | |
501 return true; | |
502 | |
503 // check value type | |
504 if (type_constraints.size () > 0) | |
505 { | |
506 for (std::list<std::string>::const_iterator it = type_constraints.begin (); | |
507 ! xok && it != type_constraints.end (); ++it) | |
508 if ((*it) == v.type_name ()) | |
509 xok = true; | |
510 } | |
511 else | |
512 xok = v.is_double_type (); | |
513 | |
514 if (xok) | |
515 { | |
516 dim_vector vdims = v.dims (); | |
517 | |
518 xok = vdims.length () != 2 || (vdims(0) != 1 && vdims(1) != 1); | |
489 } | 519 } |
490 | 520 |
491 return xok; | 521 return xok; |
492 } | 522 } |
493 | 523 |