File: reporting_object_display.m

package info (click to toggle)
dynare 4.4.3-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 41,356 kB
  • ctags: 15,842
  • sloc: cpp: 77,029; ansic: 29,056; pascal: 13,241; sh: 4,811; objc: 3,061; yacc: 3,013; makefile: 1,479; lex: 1,258; python: 162; lisp: 54; xml: 8
file content (89 lines) | stat: -rw-r--r-- 2,441 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
function reporting_object_display(o)
%function reporting_object_display(o)
% Display a Reporting Object
%   i.e., one of: elements
%                 graph
%                 objArray
%                 page
%                 pages
%                 report
%                 section
%                 sections
%                 series
%                 seriesElements
%                 table
%                 vspace
%
% INPUTS
%   o   [object] reporting object
%
% OUTPUTS
%   none
%
% SPECIAL REQUIREMENTS
%   none

% Copyright (C) 2013 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.

fprintf('\n%s Object = \n\n', upper(class(o)));
fields = fieldnames(o);
for i=1:length(fields)
    fprintf('    %s: ', fields{i});
    val = o.(fields{i});
    if iscell(val)
        fprintf('{');
        for j=1:length(val)
            assert(ischar(val{j}));
            fprintf('''%s''', val{j});
            if j~=length(val)
                fprintf(', ');
            end
        end
        fprintf('}');
    elseif ischar(val)
        fprintf('''%s''', val);
    elseif isnumeric(val)
        fprintf('%s', num2str(val));
    elseif islogical(val)
        if val
            fprintf('true');
        else
            fprintf('false');
        end
    elseif isobject(val)
        if isa(val, 'dates')
            fprintf('<dates: %s, ..., %s>', ...
                    date2string(val(1)), date2string(val(end)));
        elseif isa(val, 'dseries')
            if numel(val) == 1
                fprintf('<dseries: %s>', val.name{1});
            else
                fprintf('%s', class(val));
            end
        else
            cl = class(val);
            fprintf('%d', val.(['num' upper(cl(1)) cl(2:end)]));
        end
    else
        keyboard
        fprintf('fix this');
    end
    fprintf('\n');
end
fprintf('\n');
end