time | Calls | line |
---|
| | 58 | function p = getParserByClass(classname)
|
< 0.001 | 47 | 59 | persistent map baseParser
|
| | 60 |
|
< 0.001 | 47 | 61 | if isempty(map)
|
| | 62 | map = containers.Map('KeyType','char','ValueType','any');
|
| | 63 | baseParser = inputParser;
|
| | 64 | baseParser.PartialMatching = false;
|
| | 65 | baseParser.CaseSensitive = false;
|
| | 66 | baseParser.KeepUnmatched = true;
|
| | 67 | baseParser.StructExpand = true;
|
< 0.001 | 47 | 68 | end
|
| | 69 |
|
0.002 | 47 | 70 | if map.isKey(classname)
|
< 0.001 | 47 | 71 | p = map(classname);
|
| | 72 | else
|
| | 73 | % create custom parser for this class
|
| | 74 | newParser = baseParser.copy();
|
| | 75 | newParser.FunctionName = classname;
|
| | 76 | % get public properties
|
| | 77 | props = unique(properties(classname))';
|
| | 78 |
|
| | 79 | % Add accessable properties given access by this mixin class
|
| | 80 | % This treats properties as NV pairs that might otherwise not be settable
|
| | 81 | % through the public interface.
|
| | 82 | me = meta.class.fromName(classname);
|
| | 83 | access = {me.PropertyList(:).GetAccess};
|
| | 84 | for i = 1:numel(access)
|
| | 85 | accessList = [access{i}];
|
| | 86 | if iscell(accessList)
|
| | 87 | accessors = [accessList{:}];
|
| | 88 | if any(strcmp('matlab.io.internal.mixin.HasPropertiesAsNVPairs',{accessors.Name}))
|
| | 89 | props{end+1} = me.PropertyList(i).Name; %#ok<AGROW>
|
| | 90 | end
|
| | 91 | end
|
| | 92 | end
|
| | 93 |
|
| | 94 | for p = props
|
| | 95 | newParser.addParameter(p{:},[]);
|
| | 96 | end
|
| | 97 | map(classname) = newParser;
|
| | 98 | p = newParser;
|
< 0.001 | 47 | 99 | end
|
| | 100 |
|
< 0.001 | 47 | 101 | end
|
Other subfunctions in this file are not included in this listing.