diff libinterp/interpfcn/load-path.h @ 16690:1c45e22fc444 classdef

Implement meta.package.getAllPackages() method. * libinterp/interpfcn/load-path.h (load_path::get_all_package_names): New static method. (load_path::do_get_all_package_names): New method. * libinterp/interpfcn/load-path.cc (load_path::do_get_all_package_names): New method. * libinterp/octave-value/ov-classdef/cc (package_getAllPackages): New static function. (install_classdef): Install it as "meta.package,getAllPackages" method.
author Michael Goffioul <michael.goffioul@gmail.com>
date Mon, 20 May 2013 14:37:25 -0400
parents edbb123cbe3a
children
line wrap: on
line diff
--- a/libinterp/interpfcn/load-path.h
+++ b/libinterp/interpfcn/load-path.h
@@ -132,6 +132,14 @@
       ? instance->do_find_package (package_name) : false;
   }
 
+  static std::list<std::string>
+  get_all_package_names (bool only_top_level = true)
+  {
+    return instance_ok ()
+      ? instance->do_get_all_package_names (only_top_level)
+      : std::list<std::string> ();
+  }
+
   static std::string find_fcn (const std::string& fcn, std::string& dir_name,
                                const std::string& pack_name = std::string ())
   {
@@ -671,6 +679,8 @@
     return (loader_map.find (package_name) != loader_map.end ());
   }
 
+  std::list<std::string> do_get_all_package_names (bool only_top_level) const;
+
   std::string do_find_file (const std::string& file) const;
 
   std::string do_find_dir (const std::string& dir) const;