changeset 15897:a413c6fe1726 classdef

Add metaclass function. * libinterp/octave-value/ov-classdef.cc (Fmetaclass): New function.
author Michael Goffioul <michael.goffioul@gmail.com>
date Fri, 04 Jan 2013 14:29:13 -0500
parents 57be060d7672
children b8bff84022d6
files libinterp/octave-value/ov-classdef.cc
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-classdef.cc	Thu Jan 03 21:01:11 2013 -0500
+++ b/libinterp/octave-value/ov-classdef.cc	Fri Jan 04 14:29:13 2013 -0500
@@ -2601,6 +2601,29 @@
   return retval;
 }
 
+DEFUN (metaclass, args, /* nargout */,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} metaclass (obj)\n\
+Returns the meta.class object corresponding to the class of @var{obj}.\n\
+@end deftypefn")
+{
+  octave_value retval;
+
+  if (args.length () == 1)
+    {
+      cdef_object obj = to_cdef (args(0));
+
+      if (! error_state)
+        retval = to_ov (obj.get_class ());
+      else
+        print_usage ();
+    }
+  else
+    print_usage ();
+
+  return retval;
+}
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***