diff --git a/src/@report/addGraph.m b/src/@report/addGraph.m index 9e0e691e88cad9e5adcb238c5c946388c7cb7520..1c703a37b8a5398dbf3309c70454e55bafe9a4ad 100644 --- a/src/@report/addGraph.m +++ b/src/@report/addGraph.m @@ -12,7 +12,7 @@ function o = addGraph(o, varargin) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2013-2014 Dynare Team +% Copyright (C) 2013-2015 Dynare Team % % This file is part of Dynare. % @@ -29,6 +29,10 @@ function o = addGraph(o, varargin) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. +assert(length(o.pages) > 0, ... + '@report.addGraph: Before adding a graph, you must add a page and a section.'); +assert(length(o.pages{end}.sections) > 0, ... + '@report.addGraph: Before adding a graph, you must add a section.'); o.pages{end}.sections{end} = ... o.pages{end}.sections{end}.addGraph(varargin{:}); end diff --git a/src/@report/addParagraph.m b/src/@report/addParagraph.m index 4ec7209a35d524f1d2ed8c182b53c08be57091ab..56e605f53d2ad367759fb8f9b3679f614cdbf761 100644 --- a/src/@report/addParagraph.m +++ b/src/@report/addParagraph.m @@ -12,7 +12,7 @@ function o = addParagraph(o, varargin) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2013-2014 Dynare Team +% Copyright (C) 2013-2015 Dynare Team % % This file is part of Dynare. % @@ -29,6 +29,10 @@ function o = addParagraph(o, varargin) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. +assert(length(o.pages) > 0, ... + '@report.addParagraph: Before adding a paragraph, you must add a page and a section.'); +assert(length(o.pages{end}.sections) > 0, ... + '@report.addParagraph: Before adding a paragraph, you must add a section.'); o.pages{end}.sections{end} = ... o.pages{end}.sections{end}.addParagraph(varargin{:}); end diff --git a/src/@report/addSection.m b/src/@report/addSection.m index 3387b9466662585443e01420a974d8932e535956..eec30fd5c882be575cd758ffdb40f47dcc60269d 100644 --- a/src/@report/addSection.m +++ b/src/@report/addSection.m @@ -12,7 +12,7 @@ function o = addSection(o, varargin) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2013-2014 Dynare Team +% Copyright (C) 2013-2015 Dynare Team % % This file is part of Dynare. % @@ -29,5 +29,7 @@ function o = addSection(o, varargin) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. +assert(length(o.pages) > 0, ... + '@report.addSection: Before adding a section, you must add a page.'); o.pages{end} = o.pages{end}.addSection(varargin{:}); end diff --git a/src/@report/addSeries.m b/src/@report/addSeries.m index 459230bfe0c45cb07d89ce5174e38f58655389e1..28f90639d00da90b0c4815e1b80a3db3f2a858e4 100644 --- a/src/@report/addSeries.m +++ b/src/@report/addSeries.m @@ -12,7 +12,7 @@ function o = addSeries(o, varargin) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2013-2014 Dynare Team +% Copyright (C) 2013-2015 Dynare Team % % This file is part of Dynare. % @@ -29,6 +29,15 @@ function o = addSeries(o, varargin) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. +assert(length(o.pages) > 0, ... + ['@report.addSeries: Before adding a series, you must add a page, ' ... + 'section, and either a graph or a table.']); +assert(length(o.pages{end}.sections) > 0, ... + ['@report.addSeries: Before adding a series, you must add a section and ' ... + 'either a graph or a table']); +assert(length(o.pages{end}.sections.elements) > 0, ... + ['@report.addSeries: Before adding a series, you must add ' ... + 'either a graph or a table']); assert(isa(o.pages{end}.sections{end}.elements{end}, 'graph') || ... isa(o.pages{end}.sections{end}.elements{end}, 'report_table'), ... '@report.addSeries: you can only add a series to a report_table or graph object'); diff --git a/src/@report/addTable.m b/src/@report/addTable.m index 4b1f8c0d4d7812f9faa2c1787d931e31b058650b..8a0e125301efa9dc6118f7a351f933e54eab475c 100644 --- a/src/@report/addTable.m +++ b/src/@report/addTable.m @@ -12,7 +12,7 @@ function o = addTable(o, varargin) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2013-2014 Dynare Team +% Copyright (C) 2013-2015 Dynare Team % % This file is part of Dynare. % @@ -29,6 +29,10 @@ function o = addTable(o, varargin) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. +assert(length(o.pages) > 0, ... + '@report.addTable: Before adding a table, you must add a page and a section.'); +assert(length(o.pages{end}.sections) > 0, ... + '@report.addTable: Before adding a table, you must add a section.'); o.pages{end}.sections{end} = ... o.pages{end}.sections{end}.addTable(varargin{:}); end diff --git a/src/@report/addVspace.m b/src/@report/addVspace.m index f4ca186d6c6296d6c92356a0c28b630a6d6c99fb..4e01c8626fcdb916278d05d8de3eb8b5774ee44e 100644 --- a/src/@report/addVspace.m +++ b/src/@report/addVspace.m @@ -12,7 +12,7 @@ function o = addVspace(o, varargin) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2013-2014 Dynare Team +% Copyright (C) 2013-2015 Dynare Team % % This file is part of Dynare. % @@ -29,6 +29,10 @@ function o = addVspace(o, varargin) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. +assert(length(o.pages) > 0, ... + '@report.addVspace: Before adding a vspace, you must add a page and a section.'); +assert(length(o.pages{end}.sections) > 0, ... + '@report.addVspace: Before adding a vspace, you must add a section.'); o.pages{end}.sections{end} = ... o.pages{end}.sections{end}.addVspace(varargin{:}); end