KiCad PCB EDA Suite
reporter.cpp
Go to the documentation of this file.
1 
4 /*
5  * This program source code file is part of KiCad, a free EDA CAD application.
6  *
7  * Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
8  * Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors.
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, you may find one here:
22  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
23  * or you may search the http://www.gnu.org website for the version 2 license,
24  * or you may write to the Free Software Foundation, Inc.,
25  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
26  */
27 
28 #include <macros.h>
29 #include <reporter.h>
30 #include <wx_html_report_panel.h>
31 
32 REPORTER& REPORTER::Report( const char* aText, REPORTER::SEVERITY aSeverity )
33 {
34  Report( FROM_UTF8( aText ) );
35  return *this;
36 }
37 
38 
39 REPORTER& WX_TEXT_CTRL_REPORTER::Report( const wxString& aText, REPORTER::SEVERITY aSeverity )
40 {
41  wxCHECK_MSG( m_textCtrl != NULL, *this,
42  wxT( "No wxTextCtrl object defined in WX_TEXT_CTRL_REPORTER." ) );
43 
44  m_textCtrl->AppendText( aText );
45  return *this;
46 }
47 
48 REPORTER& WX_STRING_REPORTER::Report( const wxString& aText, REPORTER::SEVERITY aSeverity )
49 {
50  wxCHECK_MSG( m_string != NULL, *this,
51  wxT( "No wxString object defined in WX_STRING_REPORTER." ) );
52 
53  *m_string << aText;
54  return *this;
55 }
56 
57 REPORTER& WX_HTML_PANEL_REPORTER::Report( const wxString& aText, SEVERITY aSeverity )
58 {
59  wxCHECK_MSG( m_panel != NULL, *this,
60  wxT( "No WX_HTML_REPORT_PANEL object defined in WX_HTML_PANEL_REPORTER." ) );
61 
62  m_panel->Report( aText, aSeverity );
63  return *this;
64 }
65 
66 REPORTER& NULL_REPORTER::Report( const wxString& aText, SEVERITY aSeverity )
67 {
68  return *this;
69 }
70 
72 {
73  static REPORTER* s_nullReporter = NULL;
74 
75  if( !s_nullReporter )
76  {
77  s_nullReporter = new NULL_REPORTER();
78  }
79 
80  return *s_nullReporter;
81 }
wxTextCtrl * m_textCtrl
Definition: reporter.h:99
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes...
Definition: macros.h:53
WX_HTML_REPORT_PANEL * m_panel
Definition: reporter.h:137
Class REPORTER is a pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:61
This file contains miscellaneous commonly used macros and functions.
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED) override
Function Report is a pure virtual function to override in the derived object.
Definition: reporter.cpp:66
SEVERITY
Severity of the reported messages.
Definition: reporter.h:65
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED) override
Function Report is a pure virtual function to override in the derived object.
Definition: reporter.cpp:48
void Report(const wxString &aText, REPORTER::SEVERITY aSeverity)
reports a string directly.
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED) override
Function Report is a pure virtual function to override in the derived object.
Definition: reporter.cpp:57
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED) override
Function Report is a pure virtual function to override in the derived object.
Definition: reporter.cpp:39
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
wxString * m_string
Definition: reporter.h:118
static REPORTER & GetInstance()
Definition: reporter.cpp:71