Mercurial > hg > octave-lyh
changeset 15770:e61405133a76
Add new isjava function.
* libinterp/octave-value/ov-base.h: Add new virtual function is_java ().
Returns false.
libinterp/octave-value/ov-java.h: Overload virtual function is_java to return
true for objects in class octave_java.
libinterp/octave-value/ov.h: Add is_java function that calls objects
is_java function.
* libinterp/octave-value/ov-java.cc: Add new DEFUN (isjava) which uses
is_java. Placed outside HAVE_JAVA ifdef so that it is always available.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 12 Dec 2012 13:15:31 -0800 |
parents | eade542fedaa |
children | 4698ea77aa75 |
files | libinterp/octave-value/ov-base.h libinterp/octave-value/ov-java.cc libinterp/octave-value/ov-java.h libinterp/octave-value/ov.h |
diffstat | 4 files changed, 26 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-base.h +++ b/libinterp/octave-value/ov-base.h @@ -365,6 +365,8 @@ virtual bool is_object (void) const { return false; } + virtual bool is_java (void) const { return false; } + virtual bool is_cs_list (void) const { return false; } virtual bool is_magic_colon (void) const { return false; }
--- a/libinterp/octave-value/ov-java.cc +++ b/libinterp/octave-value/ov-java.cc @@ -2209,3 +2209,22 @@ #endif +// Outside of #ifdef HAVE_JAVA because it is desirable to be able to +// merely test for the presence of a Java object without having Java installed. +DEFUN (isjava, args, , + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} isjava (@var{x})\n\ +Return true if @var{x} is a Java object.\n\ +@seealso{class, typeinfo, isa}\n\ +@end deftypefn") +{ + octave_value retval; + + if (args.length () != 1) + print_usage (); + else + retval = args(0).is_java (); + + return retval; +} +