33 #ifndef OBJTOOLS_READERS___MESSAGELISTENER__HPP
34 #define OBJTOOLS_READERS___MESSAGELISTENER__HPP
69 return this->GetError(index);
75 virtual size_t Count()
const = 0;
86 Uint8 total) { PutProgress(message, current, total); }
90 const string& sMessage,
91 const Uint8 iNumDone = 0,
92 const Uint8 iNumTotal = 0) = 0;
115 size_t Count()
const override {
return m_Errors.size(); }
120 for (
size_t u = 0; u <
Count(); ++u) {
121 if (m_Errors[u]->GetSeverity() == eSev)
131 return *
dynamic_cast<ILineError*
>(m_Errors[uPos].get());
136 if (m_pProgressOstrm)
137 Dump(*m_pProgressOstrm);
142 if (m_Errors.size()) {
143 TLineErrVec::iterator it;
144 for (it = m_Errors.begin(); it != m_Errors.end(); ++it) {
149 out <<
"(( no errors ))" << endl;
155 if (m_Errors.size()) {
156 TLineErrVec::iterator it;
157 for (it = m_Errors.begin(); it != m_Errors.end(); ++it) {
158 (*it)->DumpAsXML(
out);
162 out <<
"(( no errors ))" << endl;
167 const string& sMessage,
168 const Uint8 iNumDone,
169 const Uint8 iNumTotal)
override;
183 m_pProgressOstrm = pProgressOstrm;
185 m_progressOstrmDestroyer.reset(pProgressOstrm);
187 m_progressOstrmDestroyer.reset();
214 m_Errors.emplace_back(err.
Clone());
219 m_Errors.emplace_back(message.
Clone());
Incapsulate compile time information such as __FILE__, __LINE__, NCBI_MODULE, current function.
virtual void SetProgressOstream(CNcbiOstream *pProgressOstrm, ENcbiOwnership eNcbiOwnership=eNoOwnership)
This sets the stream to which progress messages are written.
virtual void Dump(std::ostream &out)
size_t LevelCount(EDiagSev eSev) override
Returns the number of errors seen so far at the given severity.
size_t Count() const override
void ClearAll() override
Clear all accumulated messages.
void StoreError(const ILineError &err)
virtual void DumpAsXML(std::ostream &out)
~CMessageListenerBase() override
vector< unique_ptr< IObjtoolsMessage > > TLineErrVec
CNcbiOstream * m_pProgressOstrm
const ILineError & GetError(size_t uPos) const override
0-based error retrieval.
void StoreMessage(const IObjtoolsMessage &message)
unique_ptr< CNcbiOstream > m_progressOstrmDestroyer
CMessageListenerCount(size_t uMaxCount)
bool PutMessage(const IObjtoolsMessage &message) override
~CMessageListenerCount() override
bool PutError(const ILineError &err) override
Store error in the container, and return true if error was stored fine, and return false if the calle...
bool PutError(const ILineError &err) override
Store error in the container, and return true if error was stored fine, and return false if the calle...
~CMessageListenerLenient() override
bool PutMessage(const IObjtoolsMessage &message) override
CMessageListenerLenient()
bool PutError(const ILineError &err) override
Store error in the container, and return true if error was stored fine, and return false if the calle...
~CMessageListenerLevel() override
bool PutMessage(const IObjtoolsMessage &message) override
CMessageListenerLevel(int iLevel)
bool PutError(const ILineError &err) override
Store error in the container, and return true if error was stored fine, and return false if the calle...
bool PutMessage(const IObjtoolsMessage &message) override
~CMessageListenerStrict() override
bool PutError(const ILineError &err) override
Store error in the container, and return true if error was stored fine, and return false if the calle...
CMessageListenerWithLog(const CDiagCompileInfo &info)
const CDiagCompileInfo m_Info
~CMessageListenerWithLog() override
virtual bool PutError(const ILineError &)=0
Store error in the container, and return true if error was stored fine, and return false if the calle...
virtual void ClearAll()=0
Clear all accumulated messages.
virtual const ILineError & GetMessage(size_t index) const
virtual size_t LevelCount(EDiagSev)=0
Returns the number of errors seen so far at the given severity.
virtual void Progress(const string &message, Uint8 current, Uint8 total)
virtual size_t Count() const =0
virtual const ILineError & Get(size_t index) const
~ILineErrorListener() override
virtual const ILineError & GetError(size_t) const =0
0-based error retrieval.
bool PutMessage(const IObjtoolsMessage &message) override
virtual void PutProgress(const string &sMessage, const Uint8 iNumDone=0, const Uint8 iNumTotal=0)=0
This is used for processing progress messages.
virtual ILineError * Clone(void) const =0
This is here because the copy constructor may be protected eventually.
virtual EDiagSev Severity(void) const
virtual string Message() const
Include a standard set of the NCBI C++ Toolkit most basic headers.
std::ofstream out("events_result.xml")
main entry point for tests
@ eTakeOwnership
An object can take ownership of another.
@ eNoOwnership
No ownership is assumed.
const CNcbiDiag & GetRef(void) const
Some compilers (e.g.
EDiagSev
Severity level for the posted diagnostics.
@ eDPF_Log
Print the posted message only; without severity, location, prefix, etc.
uint64_t Uint8
8-byte (64-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
ENcbiOwnership
Ownership relations between objects.
#define NCBI_XOBJREAD_EXPORT
const TYPE & Get(const CNamedParameterList *param)
IMessage/IMessageListener interfaces and basic implementations.
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
bool le(T x_, T y_, T round_)
void Dump(CSplitCacheApp *app, const C &obj, ESerialDataFormat format, const string &key, const string &suffix=kEmptyStr)