NCBI C++ ToolKit
report_loader_errors.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef GUI_WIDGETS___REPORT_LOADET_ERRORS__HPP
2 #define GUI_WIDGETS___REPORT_LOADET_ERRORS__HPP
3 
4 /* $Id: report_loader_errors.hpp 47660 2024-02-06 03:37:27Z ucko $
5 * ===========================================================================
6 *
7 * PUBLIC DOMAIN NOTICE
8 * National Center for Biotechnology Information
9 *
10 * This software/database is a "United States Government Work" under the
11 * terms of the United States Copyright Act. It was written as part of
12 * the author's official duties as a United States Government employee and
13 * thus cannot be copyrighted. This software/database is freely available
14 * to the public for use. The National Library of Medicine and the U.S.
15 * Government have not placed any restriction on its use or reproduction.
16 *
17 * Although all reasonable efforts have been taken to ensure the accuracy
18 * and reliability of the software and data, the NLM and the U.S.
19 * Government do not and cannot warrant the performance or results that
20 * may be obtained by using this software or data. The NLM and the U.S.
21 * Government disclaim all warranties, express or implied, including
22 * warranties of performance, merchantability or fitness for any particular
23 * purpose.
24 *
25 * Please cite the author in any work or product based on this material.
26 *
27 * ===========================================================================
28 *
29 * Authors: Roman Katargin
30 *
31 * File Description:
32 *
33 */
34 
35 #include <corelib/ncbistd.hpp>
38 #include <gui/gui_export.h>
39 #include <wx/sstream.h>
40 
42 
43 
44 ///////////////////////////////////////////////////////////////////////////////
45 /// CReportLoaderErrors
47 {
48 public:
50  void SetWorkDir(const wxString& workDir) {m_WorkDir = workDir;}
51 protected:
52  void x_UpdateHTMLResults(const wxString& object, objects::ILineErrorListener* errCont, const string& exception = "", const string& error_msg = "", const wxString& objectName = wxT("File:"));
53  void x_ShowErrorsDlg(const wxString& title);
54  wxString x_GetHTMLResults() const { return m_Strstrm.GetString(); }
55 private:
56  wxStringOutputStream m_Strstrm;
57  wxString m_WorkDir;
58 };
59 
60 
61 ///////////////////////////////////////////////////////////////////////////////
62 /// CErrorContainer
63 class CErrorContainer : public objects::CMessageListenerLenient
64 {
65 public:
66  CErrorContainer(size_t maxErrors) : m_MaxErrors(maxErrors) {}
67  virtual bool PutError(const objects::ILineError& err)
68  {
69  if (Count() < m_MaxErrors)
70  objects::CMessageListenerLenient::PutError(err);
71  return true;
72  }
73 
74 private:
75  const size_t m_MaxErrors;
76 };
77 
78 
79 ///////////////////////////////////////////////////////////////////////////////
80 /// CReportLoaderErrorsEx
82 {
83 public:
85  void SetWorkDir(const wxString& workDir) { m_WorkDir = workDir; }
86 protected:
87  void x_UpdateHTMLResults(const wxString& object, objects::CObjtoolsListener* errCont, const string& exception = "", const string& error_msg = "", const wxString& objectName = wxT("File:"));
88  void x_ShowErrorsDlg(const wxString& title);
89  wxString x_GetHTMLResults() const { return m_Strstrm.GetString(); }
90 private:
91  wxStringOutputStream m_Strstrm;
92  wxString m_WorkDir;
93 };
94 
95 
96 // CErrorContainerEx
97 class CErrorContainerEx : public objects::CObjtoolsListener
98 {
99 public:
100  CErrorContainerEx(size_t maxErrors) : m_MaxErrors(maxErrors) {}
101  virtual bool PutMessage(const objects::IObjtoolsMessage& msg)
102  {
103  if (Count() < m_MaxErrors && msg.GetSeverity() >= eDiag_Warning)
104  objects::CObjtoolsListener::PutMessage(msg);
105  return true;
106  }
107 private:
108  const size_t m_MaxErrors;
109 };
110 
111 /* @} */
112 
114 
115 
116 #endif // GUI_WIDGETS___REPORT_LOADET_ERRORS__HPP
CErrorContainerEx(size_t maxErrors)
virtual bool PutMessage(const objects::IObjtoolsMessage &msg)
CErrorContainer.
virtual bool PutError(const objects::ILineError &err)
CErrorContainer(size_t maxErrors)
CReportLoaderErrorsEx.
void SetWorkDir(const wxString &workDir)
wxStringOutputStream m_Strstrm
wxString x_GetHTMLResults() const
CReportLoaderErrors.
wxString x_GetHTMLResults() const
wxStringOutputStream m_Strstrm
void SetWorkDir(const wxString &workDir)
Include a standard set of the NCBI C++ Toolkit most basic headers.
@ eDiag_Warning
Warning message.
Definition: ncbidiag.hpp:652
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_GUIWIDGETS_LOADERS_EXPORT
Definition: gui_export.h:525
Defines to provide correct exporting from DLLs in Windows.
#define wxT(x)
Definition: muParser.cpp:41
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
Modified on Fri Sep 20 14:57:42 2024 by modify_doxy.py rev. 669887