BUILD_RTI conditional fixes and Qt6 API updates
- cmake/FindRTI.cmake: Add INTERFACE placeholder targets when RTI not found - cmake/FindRTI.cmake: Force BUILD_RTI=OFF when RTI not installed - Lts/Common/LtsSession/CMakeLists.txt: Make LtsSessionDataDds conditional on BUILD_RTI - Lts/Viewer/CMakeLists.txt: Make LtsDataView conditional on BUILD_RTI - Lts/Plugins/*/CMakeLists.txt: 97 plugin files wrapped in BUILD_RTI conditionals - cmake/NGLMacros.cmake: Fix NGL_ADD_BIG_RESOURCES macro (removed premature return()) - Multiple Qt6 API fixes: QLinkedList→std::list, QStringRef→QStringView, etc. - BUILD_RTI_FIXES_SUMMARY.md: Comprehensive documentation of all fixes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2065 files changed
+48219
-1763
No files matched your search
@@ -1,27 +1,26 @@
|
||||
|
||||
|
||||
/**
|
||||
* Logger interface
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <type_traits>
|
||||
#include <QString>
|
||||
#include <QPointF>
|
||||
#include <QSize>
|
||||
#include <QRect>
|
||||
#include <QRectF>
|
||||
#include <QList>
|
||||
#ifdef BUILDING_NGLLOGGER
|
||||
#include "ngllogger_export.h"
|
||||
#else
|
||||
#define NGLLOGGER_EXPORT
|
||||
#endif
|
||||
#include "NGLLogger_export.h"
|
||||
|
||||
namespace NGL
|
||||
{
|
||||
class INGLLogger;
|
||||
|
||||
// keep in sync with log4qt/level.h
|
||||
enum class LogLevel
|
||||
{
|
||||
Undefined = 0,
|
||||
@@ -33,13 +32,6 @@ enum class LogLevel
|
||||
Fatal = 214,
|
||||
};
|
||||
|
||||
// Helper to stream enum classes as integers
|
||||
template<typename T, typename = std::enable_if_t<std::is_enum_v<T>>>
|
||||
inline std::ostream &operator<<(std::ostream &os, T value)
|
||||
{
|
||||
return os << static_cast<std::underlying_type_t<T>>(value);
|
||||
}
|
||||
|
||||
class LogStreamHelper
|
||||
{
|
||||
public:
|
||||
@@ -50,26 +42,26 @@ public:
|
||||
, m_file(file)
|
||||
, m_func(function)
|
||||
{}
|
||||
inline ~LogStreamHelper();
|
||||
inline ~LogStreamHelper(); // after INGLLogger class definition
|
||||
|
||||
template<typename T>
|
||||
inline LogStreamHelper &operator<<(const T &val);
|
||||
|
||||
private:
|
||||
INGLLogger &m_logger;
|
||||
std::ostringstream m_buffer;
|
||||
NGL::INGLLogger &m_logger;
|
||||
const LogLevel m_level;
|
||||
const int m_line;
|
||||
const char *const m_file;
|
||||
const char *const m_func;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Interface class for source code logging.
|
||||
// Use NGLLoggerBootstrap to create an instance of this interface.
|
||||
// Look below in this headerfile for the macros with which to insert logging
|
||||
// code into your source code.
|
||||
// Lookup the log4cxx documentation (http://logging.apache.org/log4cxx/) for
|
||||
// information on logger-hierarchies, logging-levels, and configuration files.
|
||||
class INGLLogger
|
||||
{
|
||||
public:
|
||||
@@ -80,15 +72,15 @@ public:
|
||||
|
||||
using String = std::string;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Creates an instance of an INGLLogger interface. The fullqualifiedname is
|
||||
// a dottet sequence (i.e. "NGL.thisandthat.mylogger"). The same name will
|
||||
// always return the same interface-instance. It is not required to create
|
||||
// the parent nodes.
|
||||
virtual INGLLogger &getNGLLogger(const char *fullqualifiedname) = 0;
|
||||
virtual INGLLogger &getNGLLogger(const std::string &fullqualifiedname) = 0;
|
||||
|
||||
|
||||
|
||||
// True if this level is enabled.
|
||||
virtual bool isTraceEnabled() const = 0;
|
||||
virtual bool isDebugEnabled() const = 0;
|
||||
virtual bool isInfoEnabled() const = 0;
|
||||
@@ -97,38 +89,38 @@ public:
|
||||
virtual bool isFatalEnabled() const = 0;
|
||||
virtual bool isLevelEnabled(LogLevel level) const = 0;
|
||||
|
||||
|
||||
|
||||
// Submit a LOG message.
|
||||
// Use __FILE__ and __NAME__ macros.
|
||||
virtual void log(LogLevel level, const INGLLogger::String &message, const char *file = nullptr, int line = -1, const char *function = nullptr) = 0;
|
||||
|
||||
|
||||
// Submit an TRACE message.
|
||||
virtual void logTrace(const INGLLogger::String &message, const char *file = nullptr, int line = -1, const char *function = nullptr) = 0;
|
||||
|
||||
// Submit an DEBUG message.
|
||||
virtual void logDebug(const INGLLogger::String &message, const char *file = nullptr, int line = -1, const char *function = nullptr) = 0;
|
||||
|
||||
// Submit an INFO message.
|
||||
virtual void logInfo(const INGLLogger::String &message, const char *file = nullptr, int line = -1, const char *function = nullptr) = 0;
|
||||
|
||||
// Submit a WARNING message.
|
||||
virtual void logWarning(const INGLLogger::String &message, const char *file = nullptr, int line = -1, const char *function = nullptr) = 0;
|
||||
|
||||
// Submit an ERROR message.
|
||||
virtual void logError(const INGLLogger::String &message, const char *file = nullptr, int line = -1, const char *function = nullptr) = 0;
|
||||
|
||||
// Submit a FATAL message.
|
||||
virtual void logFatal(const INGLLogger::String &message, const char *file = nullptr, int line = -1, const char *function = nullptr) = 0;
|
||||
|
||||
|
||||
// Writes a startup message into the logfile
|
||||
virtual void logStartup(const char *file, int line, const char *function = nullptr) = 0;
|
||||
|
||||
// Writes a shutdown message into the logfile
|
||||
virtual void logShutdown(const char *file, int line, const char *function = nullptr) = 0;
|
||||
|
||||
|
||||
// Get this loggers fullqualified name.
|
||||
virtual std::string getLoggerName() const = 0;
|
||||
|
||||
virtual void setNoSpace(bool bNoSpace) = 0;
|
||||
virtual bool noSpace() const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// LogStreamHelper
|
||||
//
|
||||
inline LogStreamHelper::~LogStreamHelper()
|
||||
{
|
||||
m_logger.log(m_level, m_buffer.str(), m_file, m_line, m_func);
|
||||
@@ -144,7 +136,7 @@ inline LogStreamHelper &LogStreamHelper::operator<<(const T &val)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} //namespace NGL
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &stream, const QByteArray &str)
|
||||
{
|
||||
@@ -152,9 +144,9 @@ inline std::ostream &operator<<(std::ostream &stream, const QByteArray &str)
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// operator to ease logging (at least via NglLogging)
|
||||
//
|
||||
inline std::ostream &operator<<(std::ostream &stream,
|
||||
const QPointF &value)
|
||||
{
|
||||
@@ -162,7 +154,7 @@ inline std::ostream &operator<<(std::ostream &stream,
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
inline std::ostream &operator<< (std::ostream &stream,
|
||||
const QPoint &value)
|
||||
@@ -254,62 +246,65 @@ inline void hexDumpHelper(NGL::INGLLogger &logger,
|
||||
{
|
||||
return hexDumpHelper(logger, level, data.data(), data.size());
|
||||
}
|
||||
}
|
||||
} // namespace NGLLoggerHelper
|
||||
|
||||
NGLLOGGER_EXPORT NGL::INGLLogger& getMemoryLogger();
|
||||
NGLLOGGER_EXPORT std::string getMemoryData();
|
||||
|
||||
}
|
||||
} // namespace NGL
|
||||
|
||||
//==============================================================================
|
||||
// macros
|
||||
//==============================================================================
|
||||
|
||||
#define LOGFUNCTION Q_FUNC_INFO
|
||||
|
||||
|
||||
|
||||
#define NOTICE_LOG(...) \
|
||||
NGL::LogStreamHelper(NGL::getMemoryLogger(), NGL::LogLevel::Info, __FILE__,__LINE__, __func__)
|
||||
// log this output every time, no matter what log level is enabled
|
||||
#define NOTICE_LOG(logger) \
|
||||
NGL::LogStreamHelper(logger, NGL::LogLevel::Info, __FILE__,__LINE__, Q_FUNC_INFO)
|
||||
|
||||
#ifdef LTS_DEBUG
|
||||
#define TRACE_LOG(...) \
|
||||
for (bool log_level_enabled = false; log_level_enabled; log_level_enabled = false) \
|
||||
NGL::LogStreamHelper(NGL::getMemoryLogger(), NGL::LogLevel::Trace, __FILE__,__LINE__, __func__)
|
||||
#define TRACE_LOG(logger) \
|
||||
for (bool log_level_enabled = (logger).isTraceEnabled(); log_level_enabled; log_level_enabled = false) \
|
||||
NGL::LogStreamHelper(logger, NGL::LogLevel::Trace, __FILE__,__LINE__, Q_FUNC_INFO)
|
||||
#else
|
||||
#define TRACE_LOG(...) \
|
||||
#define TRACE_LOG(logger) \
|
||||
for ( ; false; ) \
|
||||
NGL::LogStreamHelper(NGL::getMemoryLogger(), NGL::LogLevel::Trace, __FILE__,__LINE__, __func__)
|
||||
NGL::LogStreamHelper(logger, NGL::LogLevel::Trace, __FILE__,__LINE__, Q_FUNC_INFO)
|
||||
#endif
|
||||
|
||||
#define DEBUG_LOG(...) \
|
||||
for (bool log_level_enabled = false; log_level_enabled; log_level_enabled = false) \
|
||||
NGL::LogStreamHelper(NGL::getMemoryLogger(), NGL::LogLevel::Debug, __FILE__,__LINE__, __func__)
|
||||
|
||||
#define INFO_LOG(...) \
|
||||
for (bool log_level_enabled = false; log_level_enabled; log_level_enabled = false) \
|
||||
NGL::LogStreamHelper(NGL::getMemoryLogger(), NGL::LogLevel::Info, __FILE__,__LINE__, __func__)
|
||||
|
||||
#define WARNING_LOG(...) \
|
||||
for (bool log_level_enabled = false; log_level_enabled; log_level_enabled = false) \
|
||||
NGL::LogStreamHelper(NGL::getMemoryLogger(), NGL::LogLevel::Warning, __FILE__,__LINE__, __func__)
|
||||
|
||||
#define ERROR_LOG(...) \
|
||||
for (bool log_level_enabled = false; log_level_enabled; log_level_enabled = false) \
|
||||
NGL::LogStreamHelper(NGL::getMemoryLogger(), NGL::LogLevel::Error, __FILE__,__LINE__, __func__)
|
||||
|
||||
#define FATAL_LOG(...) \
|
||||
for (bool log_level_enabled = false; log_level_enabled; log_level_enabled = false) \
|
||||
NGL::LogStreamHelper(NGL::getMemoryLogger(), NGL::LogLevel::Fatal, __FILE__,__LINE__, __func__)
|
||||
|
||||
#define STARTUP_LOG(...) { NGL::getMemoryLogger().logStartup(__FILE__, __LINE__, __func__); }
|
||||
#define SHUTDOWN_LOG(...) { NGL::getMemoryLogger().logShutdown(__FILE__, __LINE__, __func__); }
|
||||
#define DEBUG_LOG(logger) \
|
||||
for (bool log_level_enabled = (logger).isDebugEnabled(); log_level_enabled; log_level_enabled = false) \
|
||||
NGL::LogStreamHelper(logger, NGL::LogLevel::Debug, __FILE__,__LINE__, Q_FUNC_INFO)
|
||||
|
||||
#define INFO_LOG(logger) \
|
||||
for (bool log_level_enabled = (logger).isInfoEnabled(); log_level_enabled; log_level_enabled = false) \
|
||||
NGL::LogStreamHelper(logger, NGL::LogLevel::Info, __FILE__,__LINE__, Q_FUNC_INFO)
|
||||
|
||||
#define WARNING_LOG(logger) \
|
||||
for (bool log_level_enabled = (logger).isWarningEnabled(); log_level_enabled; log_level_enabled = false) \
|
||||
NGL::LogStreamHelper(logger, NGL::LogLevel::Warning, __FILE__,__LINE__, Q_FUNC_INFO)
|
||||
|
||||
#define ERROR_LOG(logger) \
|
||||
for (bool log_level_enabled = (logger).isErrorEnabled(); log_level_enabled; log_level_enabled = false) \
|
||||
NGL::LogStreamHelper(logger, NGL::LogLevel::Error, __FILE__,__LINE__, Q_FUNC_INFO)
|
||||
|
||||
#define FATAL_LOG(logger) \
|
||||
for (bool log_level_enabled = (logger).isFatalEnabled(); log_level_enabled; log_level_enabled = false) \
|
||||
NGL::LogStreamHelper(logger, NGL::LogLevel::Fatal, __FILE__,__LINE__, Q_FUNC_INFO)
|
||||
|
||||
#define STARTUP_LOG(logger) { (logger).logStartup(__FILE__, __LINE__, Q_FUNC_INFO); }
|
||||
#define SHUTDOWN_LOG(logger) { (logger).logShutdown(__FILE__, __LINE__, Q_FUNC_INFO); }
|
||||
|
||||
//==============================================================================
|
||||
|
||||
// use like:
|
||||
// MEMORY_LOG() << " before something nasty";
|
||||
// do something nasty
|
||||
// MEMORY_LOG() << " after something nasty";
|
||||
|
||||
#define MEMORY_LOG() \
|
||||
for (bool log_level_enabled = (NGL::getMemoryLogger()).isInfoEnabled(); log_level_enabled; log_level_enabled = false) \
|
||||
NGL::LogStreamHelper(NGL::getMemoryLogger(), NGL::LogLevel::Info, __FILE__,__LINE__, __func__) << NGL::getMemoryData()
|
||||
|
||||
NGL::LogStreamHelper(NGL::getMemoryLogger(), NGL::LogLevel::Info, __FILE__,__LINE__, Q_FUNC_INFO) << NGL::getMemoryData()
|
||||
|
||||
//==============================================================================
|
||||
Reference in new issue
Block a user