view m-toolbox/classes/+utils/@helper/getPublicMethods.m @ 5:5a49956df427
database-connection-manager
LTPDAPreferences panel for new LTPDADatabaseConnectionManager
author |
Daniele Nicolodi <nicolodi@science.unitn.it> |
date |
Mon, 05 Dec 2011 16:20:06 +0100 (2011-12-05) |
parents |
f0afece42f48 |
children |
|
line source
% GETPUBLICMETHODS returns a cell array of the public methods for the given
% class.
%
% CALL: [methods, minfos] = getPublicMethods(classname);
%
% M Hewitson 17-12-10
%
% $Id: getPublicMethods.m,v 1.1 2010/12/17 14:22:56 hewitson Exp $
%
function [mths, infos] = getPublicMethods(cl)
fprintf(' collecting methods for %s class...\n', cl);
cms = eval(['?' cl]);
m = [cms.Methods{:}];
if isempty(m)
mths = {};
infos = [];
return;
end
idx_static = [m(:).Static];
idx_hidden = [m(:).Hidden];
idx_public = strcmpi({m(:).Access}, 'public');
dc = [m(:).DefiningClass];
idx_handle = strcmpi({dc(:).Name}, 'handle');
idx = ~idx_static & ~idx_hidden & idx_public & ~idx_handle;
m = m(idx);
if isempty(m)
mths = {};
infos = [];
return;
end
mths = {m(:).Name};
infos = [];
cmd = sprintf('%s.getInfo', cl);
for kk=1:numel(m)
try
ii = feval(cmd, m(kk).Name);
% disp([' found method: ' mt.Name]);
infos = [infos ii];
catch
mths{kk} = '';
infos = [infos minfo];
warning('### could not get info about: %s', m(kk).Name);
end
end
idx = ~cellfun('isempty', mths);
mths = mths(idx);
infos = infos(idx);
[mths,i,j] = unique(mths);
infos = infos(i);
end