Public Member Functions | Private Attributes | List of all members
mf::MaybeLogger_< SEV, VERBATIM > Class Template Reference

#include <MessageLogger.h>

Public Member Functions

 MaybeLogger_ (MaybeLogger_ const &)=delete
 
MaybeLogger_operator= (MaybeLogger_ const &)=delete
 
MaybeLogger_operator= (MaybeLogger_ &&)=delete
 
 ~MaybeLogger_ ()
 
constexpr MaybeLogger_ () noexcept=default
 
 MaybeLogger_ (MaybeLogger_ &&rhs) noexcept=default
 
 MaybeLogger_ (std::string const &category, std::string const &file={}, int const line_number=0)
 
decltype(auto) operator<< (char const *s)
 
template<class T >
decltype(auto) operator<< (T const &t)
 
decltype(auto) operator<< (std::ostream &(*f)(std::ostream &))
 
decltype(auto) operator<< (std::ios_base &(*f)(std::ios_base &))
 

Private Attributes

std::unique_ptr< ErrorObjmsg_ {nullptr}
 

Detailed Description

template<ELseverityLevel::ELsev_ SEV, bool VERBATIM>
class mf::MaybeLogger_< SEV, VERBATIM >

Definition at line 113 of file MessageLogger.h.

Constructor & Destructor Documentation

template<ELseverityLevel::ELsev_ SEV, bool VERBATIM>
mf::MaybeLogger_< SEV, VERBATIM >::MaybeLogger_ ( MaybeLogger_< SEV, VERBATIM > const &  )
delete
template<ELseverityLevel::ELsev_ SEV, bool VERBATIM>
mf::MaybeLogger_< SEV, VERBATIM >::~MaybeLogger_ ( )
inline

Definition at line 119 of file MessageLogger.h.

120  {
121  if (msg_ == nullptr) {
122  return;
123  }
124  try {
125  msg_->setModule(GetModuleName());
126  msg_->setIteration(GetIteration());
127  LogErrorObj(msg_.release());
128  }
129  catch (...) {
130  // FIXME: We should never ignore errors!
131  }
132  }
string const & GetModuleName()
std::unique_ptr< ErrorObj > msg_
string const & GetIteration()
void LogErrorObj(ErrorObj *msg)
template<ELseverityLevel::ELsev_ SEV, bool VERBATIM>
constexpr mf::MaybeLogger_< SEV, VERBATIM >::MaybeLogger_ ( )
defaultnoexcept
template<ELseverityLevel::ELsev_ SEV, bool VERBATIM>
mf::MaybeLogger_< SEV, VERBATIM >::MaybeLogger_ ( MaybeLogger_< SEV, VERBATIM > &&  rhs)
defaultnoexcept
template<ELseverityLevel::ELsev_ SEV, bool VERBATIM>
mf::MaybeLogger_< SEV, VERBATIM >::MaybeLogger_ ( std::string const &  category,
std::string const &  file = {},
int const  line_number = 0 
)
inline

Definition at line 137 of file MessageLogger.h.

138  {},
139  int const line_number = 0)
140  {
141  // Verbatim messages have the full file path, otherwise just the basename.
143  if (!VERBATIM) {
144  auto const lastSlash = file.find_last_of('/');
145  if ((lastSlash != std::string::npos) &&
146  (lastSlash != (file.size() - 1))) {
147  filename = file.substr(lastSlash + 1, file.size() - lastSlash - 1);
148  }
149  }
150  msg_ = std::make_unique<ErrorObj>(
151  SEV, category, VERBATIM, filename, line_number);
152  }
std::string string
Definition: nybbler.cc:12
string filename
Definition: train.py:213
std::unique_ptr< ErrorObj > msg_

Member Function Documentation

template<ELseverityLevel::ELsev_ SEV, bool VERBATIM>
decltype(auto) mf::MaybeLogger_< SEV, VERBATIM >::operator<< ( char const *  s)
inline

Definition at line 158 of file MessageLogger.h.

159  {
160  if (msg_) {
161  (*msg_) << s;
162  }
163  return std::forward<MaybeLogger_>(*this);
164  }
std::unique_ptr< ErrorObj > msg_
static QCString * s
Definition: config.cpp:1042
template<ELseverityLevel::ELsev_ SEV, bool VERBATIM>
template<class T >
decltype(auto) mf::MaybeLogger_< SEV, VERBATIM >::operator<< ( T const &  t)
inline

Definition at line 168 of file MessageLogger.h.

169  {
170  if (msg_) {
171  (*msg_) << t;
172  }
173  return std::forward<MaybeLogger_>(*this);
174  }
std::unique_ptr< ErrorObj > msg_
template<ELseverityLevel::ELsev_ SEV, bool VERBATIM>
decltype(auto) mf::MaybeLogger_< SEV, VERBATIM >::operator<< ( std::ostream &(*)(std::ostream &)  f)
inline

Definition at line 177 of file MessageLogger.h.

178  {
179  if (msg_) {
180  (*msg_) << f;
181  }
182  return std::forward<MaybeLogger_>(*this);
183  }
std::unique_ptr< ErrorObj > msg_
template<ELseverityLevel::ELsev_ SEV, bool VERBATIM>
decltype(auto) mf::MaybeLogger_< SEV, VERBATIM >::operator<< ( std::ios_base &(*)(std::ios_base &)  f)
inline

Definition at line 186 of file MessageLogger.h.

187  {
188  if (msg_) {
189  (*msg_) << f;
190  }
191  return std::forward<MaybeLogger_>(*this);
192  }
std::unique_ptr< ErrorObj > msg_
template<ELseverityLevel::ELsev_ SEV, bool VERBATIM>
MaybeLogger_& mf::MaybeLogger_< SEV, VERBATIM >::operator= ( MaybeLogger_< SEV, VERBATIM > const &  )
delete
template<ELseverityLevel::ELsev_ SEV, bool VERBATIM>
MaybeLogger_& mf::MaybeLogger_< SEV, VERBATIM >::operator= ( MaybeLogger_< SEV, VERBATIM > &&  )
delete

Member Data Documentation

template<ELseverityLevel::ELsev_ SEV, bool VERBATIM>
std::unique_ptr<ErrorObj> mf::MaybeLogger_< SEV, VERBATIM >::msg_ {nullptr}
private

Definition at line 195 of file MessageLogger.h.


The documentation for this class was generated from the following file: