Console: rename PascalCase named methods to camelCase

This commit is contained in:
bofdahof
2025-03-30 00:50:27 +10:00
committed by Kacper Donat
parent d4ecf95ca5
commit 998f4e4d45
497 changed files with 2423 additions and 2425 deletions

View File

@@ -1002,7 +1002,7 @@ void Builder3D::clear()
}
/**
* Save the resulting inventor 3D representation to the Console().Log() facility.
* Save the resulting inventor 3D representation to the Console().log() facility.
* In DEBUG mode the Gui (if running) will trigger on that and show the representation in
* the active Viewer/Document. It shows only one representation on time. If you need to
* show more then one representation use saveToFile() instead.
@@ -1010,9 +1010,9 @@ void Builder3D::clear()
*/
void Builder3D::saveToLog()
{
ILogger* obs = Base::Console().Get("StatusBar");
ILogger* obs = Base::Console().get("StatusBar");
if (obs) {
obs->SendLog("Builder3D",
obs->sendLog("Builder3D",
result.str(),
Base::LogStyle::Log,
Base::IntendedRecipient::Developer,

View File

@@ -185,11 +185,11 @@ ConsoleSingleton::~ConsoleSingleton()
* switches off warnings and error messages and restore the state before the modification.
* If the observer \a sObs doesn't exist then nothing happens.
*/
ConsoleMsgFlags ConsoleSingleton::SetEnabledMsgType(const char* sObs,
ConsoleMsgFlags ConsoleSingleton::setEnabledMsgType(const char* sObs,
const ConsoleMsgFlags type,
const bool on) const
{
if (ILogger* pObs = Get(sObs)) {
if (ILogger* pObs = get(sObs)) {
ConsoleMsgFlags flags = 0;
if (type & MsgType_Err) {
@@ -235,9 +235,9 @@ ConsoleMsgFlags ConsoleSingleton::SetEnabledMsgType(const char* sObs,
return 0;
}
bool ConsoleSingleton::IsMsgTypeEnabled(const char* sObs, const FreeCAD_ConsoleMsgType type) const
bool ConsoleSingleton::isMsgTypeEnabled(const char* sObs, const FreeCAD_ConsoleMsgType type) const
{
if (const ILogger* pObs = Get(sObs)) {
if (const ILogger* pObs = get(sObs)) {
switch (type) {
case MsgType_Txt:
return pObs->bMsg;
@@ -259,7 +259,7 @@ bool ConsoleSingleton::IsMsgTypeEnabled(const char* sObs, const FreeCAD_ConsoleM
return false;
}
void ConsoleSingleton::SetConnectionMode(const ConnectionMode mode)
void ConsoleSingleton::setConnectionMode(const ConnectionMode mode)
{
connectionMode = mode;
@@ -278,7 +278,7 @@ void ConsoleSingleton::SetConnectionMode(const ConnectionMode mode)
* be forwarded to it.
* @see ILogger
*/
void ConsoleSingleton::AttachObserver(ILogger* pcObserver)
void ConsoleSingleton::attachObserver(ILogger* pcObserver)
{
// double insert !!
assert(!_aclObservers.contains(pcObserver));
@@ -291,7 +291,7 @@ void ConsoleSingleton::AttachObserver(ILogger* pcObserver)
* After detaching you can destruct the Observer or reinsert it later.
* @see ILogger
*/
void ConsoleSingleton::DetachObserver(ILogger* pcObserver)
void ConsoleSingleton::detachObserver(ILogger* pcObserver)
{
_aclObservers.erase(pcObserver);
}
@@ -304,7 +304,7 @@ void ConsoleSingleton::notifyPrivate(const LogStyle category,
{
for (ILogger* Iter : _aclObservers) {
if (Iter->isActive(category)) {
Iter->SendLog(notifiername,
Iter->sendLog(notifiername,
msg,
category,
recipient,
@@ -323,11 +323,11 @@ void ConsoleSingleton::postEvent(const FreeCAD_ConsoleMsgType type,
new ConsoleEvent(type, recipient, content, notifiername, msg));
}
ILogger* ConsoleSingleton::Get(const char* Name) const
ILogger* ConsoleSingleton::get(const char* Name) const
{
const char* OName {};
for (ILogger* Iter : _aclObservers) {
OName = Iter->Name(); // get the name
OName = Iter->name(); // get the name
if (OName && strcmp(OName, Name) == 0) {
return Iter;
}
@@ -335,7 +335,7 @@ ILogger* ConsoleSingleton::Get(const char* Name) const
return nullptr;
}
int* ConsoleSingleton::GetLogLevel(const char* tag, const bool create)
int* ConsoleSingleton::getLogLevel(const char* tag, const bool create)
{
if (!tag) {
tag = "";
@@ -351,14 +351,14 @@ int* ConsoleSingleton::GetLogLevel(const char* tag, const bool create)
return &ret;
}
void ConsoleSingleton::Refresh() const
void ConsoleSingleton::refresh() const
{
if (_bCanRefresh) {
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
}
}
void ConsoleSingleton::EnableRefresh(const bool enable)
void ConsoleSingleton::enableRefresh(const bool enable)
{
_bCanRefresh = enable;
}
@@ -376,7 +376,7 @@ void ConsoleSingleton::Destruct()
_pcSingleton = nullptr;
}
ConsoleSingleton& ConsoleSingleton::Instance()
ConsoleSingleton& ConsoleSingleton::instance()
{
// not initialized?
if (!_pcSingleton) {
@@ -552,8 +552,8 @@ PyObject* ConsoleSingleton::sPyMessage(PyObject* /*self*/, PyObject* args)
{
return FC_PYCONSOLE_MSG(
[](const std::string& notifier, const char* msg) {
Instance()
.Send<LogStyle::Message, IntendedRecipient::Developer, ContentType::Untranslatable>(
instance()
.send<LogStyle::Message, IntendedRecipient::Developer, ContentType::Untranslatable>(
notifier,
"%s",
msg);
@@ -565,7 +565,7 @@ PyObject* ConsoleSingleton::sPyWarning(PyObject* /*self*/, PyObject* args)
{
return FC_PYCONSOLE_MSG(
[](const std::string& notifier, const char* msg) {
Instance().Warning(notifier, "%s", msg);
instance().warning(notifier, "%s", msg);
},
args);
}
@@ -574,8 +574,8 @@ PyObject* ConsoleSingleton::sPyDeveloperWarning(PyObject* /*self*/, PyObject* ar
{
return FC_PYCONSOLE_MSG(
[](const std::string& notifier, const char* msg) {
Instance()
.Send<LogStyle::Warning, IntendedRecipient::Developer, ContentType::Untranslatable>(
instance()
.send<LogStyle::Warning, IntendedRecipient::Developer, ContentType::Untranslatable>(
notifier,
"%s",
msg);
@@ -587,7 +587,7 @@ PyObject* ConsoleSingleton::sPyUserWarning(PyObject* /*self*/, PyObject* args)
{
return FC_PYCONSOLE_MSG(
[](const std::string& notifier, const char* msg) {
Instance().Send<LogStyle::Warning, IntendedRecipient::User, ContentType::Untranslated>(
instance().send<LogStyle::Warning, IntendedRecipient::User, ContentType::Untranslated>(
notifier,
"%s",
msg);
@@ -599,7 +599,7 @@ PyObject* ConsoleSingleton::sPyTranslatedUserWarning(PyObject* /*self*/, PyObjec
{
return FC_PYCONSOLE_MSG(
[](const std::string& notifier, const char* msg) {
Instance().Send<LogStyle::Warning, IntendedRecipient::User, ContentType::Translated>(
instance().send<LogStyle::Warning, IntendedRecipient::User, ContentType::Translated>(
notifier,
"%s",
msg);
@@ -611,7 +611,7 @@ PyObject* ConsoleSingleton::sPyError(PyObject* /*self*/, PyObject* args)
{
return FC_PYCONSOLE_MSG(
[](const std::string& notifier, const char* msg) {
Instance().Send<LogStyle::Error, IntendedRecipient::All, ContentType::Untranslated>(
instance().send<LogStyle::Error, IntendedRecipient::All, ContentType::Untranslated>(
notifier,
"%s",
msg);
@@ -623,8 +623,8 @@ PyObject* ConsoleSingleton::sPyDeveloperError(PyObject* /*self*/, PyObject* args
{
return FC_PYCONSOLE_MSG(
[](const std::string& notifier, const char* msg) {
Instance()
.Send<LogStyle::Error, IntendedRecipient::Developer, ContentType::Untranslatable>(
instance()
.send<LogStyle::Error, IntendedRecipient::Developer, ContentType::Untranslatable>(
notifier,
"%s",
msg);
@@ -636,7 +636,7 @@ PyObject* ConsoleSingleton::sPyUserError(PyObject* /*self*/, PyObject* args)
{
return FC_PYCONSOLE_MSG(
[](const std::string& notifier, const char* msg) {
Instance().Send<LogStyle::Error, IntendedRecipient::User, ContentType::Untranslated>(
instance().send<LogStyle::Error, IntendedRecipient::User, ContentType::Untranslated>(
notifier,
"%s",
msg);
@@ -648,7 +648,7 @@ PyObject* ConsoleSingleton::sPyTranslatedUserError(PyObject* /*self*/, PyObject*
{
return FC_PYCONSOLE_MSG(
[](const std::string& notifier, const char* msg) {
Instance().Send<LogStyle::Error, IntendedRecipient::User, ContentType::Translated>(
instance().send<LogStyle::Error, IntendedRecipient::User, ContentType::Translated>(
notifier,
"%s",
msg);
@@ -660,8 +660,8 @@ PyObject* ConsoleSingleton::sPyLog(PyObject* /*self*/, PyObject* args)
{
return FC_PYCONSOLE_MSG(
[](const std::string& notifier, const char* msg) {
Instance()
.Send<LogStyle::Log, IntendedRecipient::Developer, ContentType::Untranslatable>(
instance()
.send<LogStyle::Log, IntendedRecipient::Developer, ContentType::Untranslatable>(
notifier,
"%s",
msg);
@@ -673,7 +673,7 @@ PyObject* ConsoleSingleton::sPyCritical(PyObject* /*self*/, PyObject* args)
{
return FC_PYCONSOLE_MSG(
[](const std::string& notifier, const char* msg) {
Instance().Send<LogStyle::Critical, IntendedRecipient::All, ContentType::Untranslated>(
instance().send<LogStyle::Critical, IntendedRecipient::All, ContentType::Untranslated>(
notifier,
"%s",
msg);
@@ -685,8 +685,8 @@ PyObject* ConsoleSingleton::sPyNotification(PyObject* /*self*/, PyObject* args)
{
return FC_PYCONSOLE_MSG(
[](const std::string& notifier, const char* msg) {
Instance()
.Send<LogStyle::Notification, IntendedRecipient::User, ContentType::Untranslated>(
instance()
.send<LogStyle::Notification, IntendedRecipient::User, ContentType::Untranslated>(
notifier,
"%s",
msg);
@@ -698,8 +698,8 @@ PyObject* ConsoleSingleton::sPyTranslatedNotification(PyObject* /*self*/, PyObje
{
return FC_PYCONSOLE_MSG(
[](const std::string& notifier, const char* msg) {
Instance()
.Send<LogStyle::Notification, IntendedRecipient::User, ContentType::Translated>(
instance()
.send<LogStyle::Notification, IntendedRecipient::User, ContentType::Translated>(
notifier,
"%s",
msg);
@@ -718,7 +718,7 @@ PyObject* ConsoleSingleton::sPyGetStatus(PyObject* /*self*/, PyObject* args)
PY_TRY
{
bool b = false;
const ILogger* pObs = Instance().Get(pstr1);
const ILogger* pObs = instance().get(pstr1);
if (!pObs) {
Py_Return;
}
@@ -764,7 +764,7 @@ PyObject* ConsoleSingleton::sPySetStatus(PyObject* /*self*/, PyObject* args)
PY_TRY
{
const bool status = asBoolean(pyStatus);
if (ILogger* pObs = Instance().get(pstr1)) {
if (ILogger* pObs = instance().get(pstr1)) {
if (strcmp(pstr2, "Log") == 0) {
pObs->bLog = status;
}
@@ -806,8 +806,8 @@ PyObject* ConsoleSingleton::sPyGetObservers(PyObject* /*self*/, PyObject* args)
PY_TRY
{
Py::List list;
for (const auto i : Instance()._aclObservers) {
list.append(Py::String(i->Name() ? i->Name() : ""));
for (const auto i : instance()._aclObservers) {
list.append(Py::String(i->name() ? i->name() : ""));
}
return new_reference_to(list);

View File

@@ -368,29 +368,29 @@ using PyMethodDef = struct PyMethodDef;
_str << '\n'; \
Base::Console()._func(_notifier, _str.str().c_str()); \
if (_instance.refresh) \
Base::Console().Refresh(); \
Base::Console().refresh(); \
} \
} while (0)
#define _FC_PRINT(_instance, _l, _func, _msg) \
__FC_PRINT(_instance, _l, _func, std::string(), _msg, __FILE__, __LINE__)
#define FC_MSG(_msg) _FC_PRINT(FC_LOG_INSTANCE, FC_LOGLEVEL_MSG, Message, _msg)
#define FC_WARN(_msg) _FC_PRINT(FC_LOG_INSTANCE, FC_LOGLEVEL_WARN, DeveloperWarning, _msg)
#define FC_ERR(_msg) _FC_PRINT(FC_LOG_INSTANCE, FC_LOGLEVEL_ERR, DeveloperError, _msg)
#define FC_LOG(_msg) _FC_PRINT(FC_LOG_INSTANCE, FC_LOGLEVEL_LOG, Log, _msg)
#define FC_TRACE(_msg) _FC_PRINT(FC_LOG_INSTANCE, FC_LOGLEVEL_TRACE, Log, _msg)
#define FC_MSG(_msg) _FC_PRINT(FC_LOG_INSTANCE, FC_LOGLEVEL_MSG, message, _msg)
#define FC_WARN(_msg) _FC_PRINT(FC_LOG_INSTANCE, FC_LOGLEVEL_WARN, developerWarning, _msg)
#define FC_ERR(_msg) _FC_PRINT(FC_LOG_INSTANCE, FC_LOGLEVEL_ERR, developerError, _msg)
#define FC_LOG(_msg) _FC_PRINT(FC_LOG_INSTANCE, FC_LOGLEVEL_LOG, log, _msg)
#define FC_TRACE(_msg) _FC_PRINT(FC_LOG_INSTANCE, FC_LOGLEVEL_TRACE, log, _msg)
#define _FC_MSG(_file, _line, _msg) \
__FC_PRINT(FC_LOG_INSTANCE, FC_LOGLEVEL_MSG, Message, std::string(), _msg, _file, _line)
__FC_PRINT(FC_LOG_INSTANCE, FC_LOGLEVEL_MSG, message, std::string(), _msg, _file, _line)
#define _FC_WARN(_file, _line, _msg) \
__FC_PRINT(FC_LOG_INSTANCE, FC_LOGLEVEL_WARN, DeveloperWarning, std::string(), _msg, _file, _line)
__FC_PRINT(FC_LOG_INSTANCE, FC_LOGLEVEL_WARN, developerWarning, std::string(), _msg, _file, _line)
#define _FC_ERR(_file, _line, _msg) \
__FC_PRINT(FC_LOG_INSTANCE, FC_LOGLEVEL_ERR, DeveloperError, std::string(), _msg, _file, _line)
__FC_PRINT(FC_LOG_INSTANCE, FC_LOGLEVEL_ERR, developerError, std::string(), _msg, _file, _line)
#define _FC_LOG(_file, _line, _msg) \
__FC_PRINT(FC_LOG_INSTANCE, FC_LOGLEVEL_LOG, Log, std::string(), _msg, _file, _line)
__FC_PRINT(FC_LOG_INSTANCE, FC_LOGLEVEL_LOG, log, std::string(), _msg, _file, _line)
#define _FC_TRACE(_file, _line, _msg) \
__FC_PRINT(FC_LOG_INSTANCE, FC_LOGLEVEL_TRACE, Log, std::string(), _msg, _file, _line)
__FC_PRINT(FC_LOG_INSTANCE, FC_LOGLEVEL_TRACE, log, std::string(), _msg, _file, _line)
#define FC_XYZ(_pt) '(' << (_pt).X() << ", " << (_pt).Y() << ", " << (_pt).Z() << ')'
#define FC_xy(_pt) '(' << (_pt).x << ", " << (_pt).y << ')'
@@ -570,7 +570,7 @@ public:
* translated (are untranslatable). Or conversely, may decide not to process already translated
* notifications. It is up to the intended behaviour of the observer.
*/
virtual void SendLog(const std::string& notifiername,
virtual void sendLog(const std::string& notifiername,
const std::string& msg,
LogStyle level,
IntendedRecipient recipient,
@@ -599,7 +599,7 @@ public:
return false;
}
virtual const char* Name()
virtual const char* name()
{
return nullptr;
}
@@ -622,7 +622,7 @@ public:
* instance of the class from every where in c++ by simply using:
* \code
* #include <Base/Console.h>
* Base::Console().Log("Stage: %d",i);
* Base::Console().log("Stage: %d",i);
* \endcode
* \par
* ConsoleSingleton is able to switch between several modes to, e.g. switch
@@ -654,10 +654,10 @@ public:
* \endcode
*
* These convenience functions cover most common cases:
* - Unqualified convenience functions, such as Error() and Warning(), produce messages intended to
* - Unqualified convenience functions, such as error() and warning(), produce messages intended to
* both User and Developer with an untranslated message.
* - Functions qualified with Developer, such as DeveloperError are intended for a Developer and
* are untranslatable. Functions qualified with User, such as UserError are intended only for the
* are untranslatable. Functions qualified with User, such as userError are intended only for the
* User and a untranslated (leaving the responsibility to the observer to find the translation).
* - Functions qualified with Translated, such as TranslatedError, are intended for the User and
* the message is already translated.
@@ -680,7 +680,7 @@ public:
*
* Example:
* \code
* Base::Console().UserError(this->getFullName(), QT_TRANSLATE_NOOP("Notifications",
* Base::Console().userError(this->getFullName(), QT_TRANSLATE_NOOP("Notifications",
* "Impossible to migrate Parabolas!!\n"));
* \endcode
*
@@ -688,7 +688,7 @@ public:
* often the case in legacy UI code, where localized strings are already available. For these
* cases the solution is to indicate the translated status. For example:
* \code
* Base::Console().TranslatedUserError(
* Base::Console().translatedUserError(
* this->getFullName(),
* QObject::tr("The selected edge already has a Block constraint!"));
* \endcode
@@ -715,79 +715,79 @@ public:
IntendedRecipient = IntendedRecipient::All,
ContentType = ContentType::Untranslated,
typename... Args>
void Send(const std::string& notifiername, const char* pMsg, Args&&... args);
void send(const std::string& notifiername, const char* pMsg, Args&&... args);
/// Prints a Message
template<typename... Args>
void Message(const char* pMsg, Args&&... args);
void message(const char* pMsg, Args&&... args);
/// Prints a warning Message
template<typename... Args>
void Warning(const char* pMsg, Args&&... args);
void warning(const char* pMsg, Args&&... args);
/// Prints a error Message
template<typename... Args>
void Error(const char* pMsg, Args&&... args);
void error(const char* pMsg, Args&&... args);
/// Prints a log Message
template<typename... Args>
void Log(const char* pMsg, Args&&... args);
void log(const char* pMsg, Args&&... args);
/// Prints a Critical Message
template<typename... Args>
void Critical(const char* pMsg, Args&&... args);
void critical(const char* pMsg, Args&&... args);
/// Sends a User Notification
template<typename... Args>
void UserNotification(const char* pMsg, Args&&... args);
void userNotification(const char* pMsg, Args&&... args);
/// Sends an already translated User Notification
template<typename... Args>
void UserTranslatedNotification(const char* pMsg, Args&&... args);
void userTranslatedNotification(const char* pMsg, Args&&... args);
/// Prints a Message with source indication
template<typename... Args>
void Message(const std::string& notifier, const char* pMsg, Args&&... args);
void message(const std::string& notifier, const char* pMsg, Args&&... args);
/// Prints a warning Message with source indication
template<typename... Args>
void Warning(const std::string& notifier, const char* pMsg, Args&&... args);
void warning(const std::string& notifier, const char* pMsg, Args&&... args);
template<typename... Args>
void DeveloperWarning(const std::string& notifier, const char* pMsg, Args&&... args);
void developerWarning(const std::string& notifier, const char* pMsg, Args&&... args);
template<typename... Args>
void UserWarning(const std::string& notifier, const char* pMsg, Args&&... args);
void userWarning(const std::string& notifier, const char* pMsg, Args&&... args);
template<typename... Args>
void TranslatedUserWarning(const std::string& notifier, const char* pMsg, Args&&... args);
void translatedUserWarning(const std::string& notifier, const char* pMsg, Args&&... args);
/// Prints a error Message with source indication
template<typename... Args>
void Error(const std::string& notifier, const char* pMsg, Args&&... args);
void error(const std::string& notifier, const char* pMsg, Args&&... args);
template<typename... Args>
void DeveloperError(const std::string& notifier, const char* pMsg, Args&&... args);
void developerError(const std::string& notifier, const char* pMsg, Args&&... args);
template<typename... Args>
/// A noexcept DeveloperError for use in destructors. When compiled in debug, terminates via an
/// assert. In release, the exception is silently caught and dropped.
void DestructorError(const std::string& notifier, const char* pMsg, Args&&... args) noexcept;
void destructorError(const std::string& notifier, const char* pMsg, Args&&... args) noexcept;
template<typename... Args>
void UserError(const std::string& notifier, const char* pMsg, Args&&... args);
void userError(const std::string& notifier, const char* pMsg, Args&&... args);
template<typename... Args>
void TranslatedUserError(const std::string& notifier, const char* pMsg, Args&&... args);
void translatedUserError(const std::string& notifier, const char* pMsg, Args&&... args);
/// Prints a log Message with source indication
template<typename... Args>
void Log(const std::string& notifier, const char* pMsg, Args&&... args);
void log(const std::string& notifier, const char* pMsg, Args&&... args);
/// Prints a Critical Message with source indication
template<typename... Args>
void Critical(const std::string& notifier, const char* pMsg, Args&&... args);
void critical(const std::string& notifier, const char* pMsg, Args&&... args);
/// Sends a User Notification with source indication
template<typename... Args>
void UserNotification(const std::string& notifier, const char* pMsg, Args&&... args);
void userNotification(const std::string& notifier, const char* pMsg, Args&&... args);
/// Sends an already translated User Notification with source indication
template<typename... Args>
void UserTranslatedNotification(const std::string& notifier, const char* pMsg, Args&&... args);
void userTranslatedNotification(const std::string& notifier, const char* pMsg, Args&&... args);
// Notify a message directly to observers
template<LogStyle,
IntendedRecipient = IntendedRecipient::All,
ContentType = ContentType::Untranslated>
void Notify(const std::string& notifiername, const std::string& msg);
void notify(const std::string& notifiername, const std::string& msg);
/// Attaches an Observer to FCConsole
void AttachObserver(ILogger* pcObserver);
void attachObserver(ILogger* pcObserver);
/// Detaches an Observer from FCConsole
void DetachObserver(ILogger* pcObserver);
void detachObserver(ILogger* pcObserver);
/// enumeration for the console modes
enum ConsoleMode
@@ -811,33 +811,33 @@ public:
};
/// Enables or disables message types of a certain console observer
ConsoleMsgFlags SetEnabledMsgType(const char* sObs, ConsoleMsgFlags type, bool on) const;
ConsoleMsgFlags setEnabledMsgType(const char* sObs, ConsoleMsgFlags type, bool on) const;
/// Checks if message types of a certain console observer are enabled
bool IsMsgTypeEnabled(const char* sObs, FreeCAD_ConsoleMsgType type) const;
void SetConnectionMode(ConnectionMode mode);
bool isMsgTypeEnabled(const char* sObs, FreeCAD_ConsoleMsgType type) const;
void setConnectionMode(ConnectionMode mode);
int* GetLogLevel(const char* tag, bool create = true);
int* getLogLevel(const char* tag, bool create = true);
void SetDefaultLogLevel(const int level)
void setDefaultLogLevel(const int level)
{
_defaultLogLevel = level;
}
int LogLevel(const int level) const
int logLevel(const int level) const
{
return level < 0 ? _defaultLogLevel : level;
}
/// singleton
static ConsoleSingleton& Instance();
static ConsoleSingleton& instance();
// retrieval of an observer by name
ILogger* Get(const char* Name) const;
ILogger* get(const char* Name) const;
static PyMethodDef Methods[];
void Refresh() const;
void EnableRefresh(bool enable);
void refresh() const;
void enableRefresh(bool enable);
constexpr FreeCAD_ConsoleMsgType getConsoleMsg(LogStyle style);
@@ -905,7 +905,7 @@ private:
*/
inline ConsoleSingleton& Console()
{
return ConsoleSingleton::Instance();
return ConsoleSingleton::instance();
}
constexpr ConsoleSingleton::FreeCAD_ConsoleMsgType ConsoleSingleton::getConsoleMsg(LogStyle style)
@@ -926,12 +926,12 @@ class BaseExport ConsoleRefreshDisabler
public:
ConsoleRefreshDisabler()
{
Console().EnableRefresh(false);
Console().enableRefresh(false);
}
~ConsoleRefreshDisabler()
{
Console().EnableRefresh(true);
Console().enableRefresh(true);
}
ConsoleRefreshDisabler(const ConsoleRefreshDisabler&) = delete;
@@ -960,7 +960,7 @@ public:
const bool add_eol = true,
const bool refresh = false)
: tag(tag)
, lvl(*Console().GetLogLevel(tag))
, lvl(*Console().getLogLevel(tag))
, print_tag(print_tag)
, print_src(print_src)
, print_time(print_time)
@@ -975,7 +975,7 @@ public:
int level() const
{
return Console().LogLevel(lvl);
return Console().logLevel(lvl);
}
std::stringstream& prefix(std::stringstream& str, const char* src, int line);
@@ -1000,92 +1000,92 @@ public:
* @see UserTranslatedNotification
*/
template<typename... Args>
void Base::ConsoleSingleton::Message(const char* pMsg, Args&&... args)
void Base::ConsoleSingleton::message(const char* pMsg, Args&&... args)
{
Message(std::string(""), pMsg, std::forward<Args>(args)...);
message(std::string(""), pMsg, std::forward<Args>(args)...);
}
template<typename... Args>
void Base::ConsoleSingleton::Message(const std::string& notifier, const char* pMsg, Args&&... args)
void Base::ConsoleSingleton::message(const std::string& notifier, const char* pMsg, Args&&... args)
{
Send<LogStyle::Message>(notifier, pMsg, std::forward<Args>(args)...);
send<LogStyle::Message>(notifier, pMsg, std::forward<Args>(args)...);
}
template<typename... Args>
void Base::ConsoleSingleton::Warning(const char* pMsg, Args&&... args)
void Base::ConsoleSingleton::warning(const char* pMsg, Args&&... args)
{
Warning(std::string(""), pMsg, std::forward<Args>(args)...);
warning(std::string(""), pMsg, std::forward<Args>(args)...);
}
template<typename... Args>
void Base::ConsoleSingleton::Warning(const std::string& notifier, const char* pMsg, Args&&... args)
void Base::ConsoleSingleton::warning(const std::string& notifier, const char* pMsg, Args&&... args)
{
Send<LogStyle::Warning>(notifier, pMsg, std::forward<Args>(args)...);
send<LogStyle::Warning>(notifier, pMsg, std::forward<Args>(args)...);
}
template<typename... Args>
void Base::ConsoleSingleton::DeveloperWarning(const std::string& notifier,
void Base::ConsoleSingleton::developerWarning(const std::string& notifier,
const char* pMsg,
Args&&... args)
{
Send<LogStyle::Warning, IntendedRecipient::Developer, ContentType::Untranslatable>(
send<LogStyle::Warning, IntendedRecipient::Developer, ContentType::Untranslatable>(
notifier,
pMsg,
std::forward<Args>(args)...);
}
template<typename... Args>
void Base::ConsoleSingleton::UserWarning(const std::string& notifier,
void Base::ConsoleSingleton::userWarning(const std::string& notifier,
const char* pMsg,
Args&&... args)
{
Send<LogStyle::Warning, IntendedRecipient::User, ContentType::Untranslated>(
send<LogStyle::Warning, IntendedRecipient::User, ContentType::Untranslated>(
notifier,
pMsg,
std::forward<Args>(args)...);
}
template<typename... Args>
void Base::ConsoleSingleton::TranslatedUserWarning(const std::string& notifier,
void Base::ConsoleSingleton::translatedUserWarning(const std::string& notifier,
const char* pMsg,
Args&&... args)
{
Send<LogStyle::Warning, IntendedRecipient::User, ContentType::Translated>(
send<LogStyle::Warning, IntendedRecipient::User, ContentType::Translated>(
notifier,
pMsg,
std::forward<Args>(args)...);
}
template<typename... Args>
void Base::ConsoleSingleton::Error(const char* pMsg, Args&&... args)
void Base::ConsoleSingleton::error(const char* pMsg, Args&&... args)
{
Error(std::string(""), pMsg, std::forward<Args>(args)...);
error(std::string(""), pMsg, std::forward<Args>(args)...);
}
template<typename... Args>
void Base::ConsoleSingleton::Error(const std::string& notifier, const char* pMsg, Args&&... args)
void Base::ConsoleSingleton::error(const std::string& notifier, const char* pMsg, Args&&... args)
{
Send<LogStyle::Error>(notifier, pMsg, std::forward<Args>(args)...);
send<LogStyle::Error>(notifier, pMsg, std::forward<Args>(args)...);
}
template<typename... Args>
void Base::ConsoleSingleton::DeveloperError(const std::string& notifier,
void Base::ConsoleSingleton::developerError(const std::string& notifier,
const char* pMsg,
Args&&... args)
{
Send<LogStyle::Error, IntendedRecipient::Developer, ContentType::Untranslatable>(
send<LogStyle::Error, IntendedRecipient::Developer, ContentType::Untranslatable>(
notifier,
pMsg,
std::forward<Args>(args)...);
}
template<typename... Args>
void Base::ConsoleSingleton::DestructorError(const std::string& notifier,
void Base::ConsoleSingleton::destructorError(const std::string& notifier,
const char* pMsg,
Args&&... args) noexcept
{
try {
Send<LogStyle::Error, IntendedRecipient::Developer, ContentType::Untranslatable>(
send<LogStyle::Error, IntendedRecipient::Developer, ContentType::Untranslatable>(
notifier,
pMsg,
std::forward<Args>(args)...);
@@ -1096,90 +1096,90 @@ void Base::ConsoleSingleton::DestructorError(const std::string& notifier,
}
template<typename... Args>
void Base::ConsoleSingleton::UserError(const std::string& notifier,
void Base::ConsoleSingleton::userError(const std::string& notifier,
const char* pMsg,
Args&&... args)
{
Send<LogStyle::Error, IntendedRecipient::User, ContentType::Untranslated>(
send<LogStyle::Error, IntendedRecipient::User, ContentType::Untranslated>(
notifier,
pMsg,
std::forward<Args>(args)...);
}
template<typename... Args>
void Base::ConsoleSingleton::TranslatedUserError(const std::string& notifier,
void Base::ConsoleSingleton::translatedUserError(const std::string& notifier,
const char* pMsg,
Args&&... args)
{
Send<LogStyle::Error, IntendedRecipient::User, ContentType::Translated>(
send<LogStyle::Error, IntendedRecipient::User, ContentType::Translated>(
notifier,
pMsg,
std::forward<Args>(args)...);
}
template<typename... Args>
void Base::ConsoleSingleton::Critical(const char* pMsg, Args&&... args)
void Base::ConsoleSingleton::critical(const char* pMsg, Args&&... args)
{
Critical(std::string(""), pMsg, std::forward<Args>(args)...);
critical(std::string(""), pMsg, std::forward<Args>(args)...);
}
template<typename... Args>
void Base::ConsoleSingleton::Critical(const std::string& notifier, const char* pMsg, Args&&... args)
void Base::ConsoleSingleton::critical(const std::string& notifier, const char* pMsg, Args&&... args)
{
Send<LogStyle::Critical>(notifier, pMsg, std::forward<Args>(args)...);
send<LogStyle::Critical>(notifier, pMsg, std::forward<Args>(args)...);
}
template<typename... Args>
void Base::ConsoleSingleton::UserNotification(const char* pMsg, Args&&... args)
void Base::ConsoleSingleton::userNotification(const char* pMsg, Args&&... args)
{
UserNotification(std::string(""), pMsg, std::forward<Args>(args)...);
userNotification(std::string(""), pMsg, std::forward<Args>(args)...);
}
template<typename... Args>
void Base::ConsoleSingleton::UserNotification(const std::string& notifier,
void Base::ConsoleSingleton::userNotification(const std::string& notifier,
const char* pMsg,
Args&&... args)
{
Send<LogStyle::Notification, IntendedRecipient::User, ContentType::Untranslated>(
send<LogStyle::Notification, IntendedRecipient::User, ContentType::Untranslated>(
notifier,
pMsg,
std::forward<Args>(args)...);
}
template<typename... Args>
void Base::ConsoleSingleton::UserTranslatedNotification(const char* pMsg, Args&&... args)
void Base::ConsoleSingleton::userTranslatedNotification(const char* pMsg, Args&&... args)
{
UserTranslatedNotification(std::string(""), pMsg, std::forward<Args>(args)...);
userTranslatedNotification(std::string(""), pMsg, std::forward<Args>(args)...);
}
template<typename... Args>
void Base::ConsoleSingleton::UserTranslatedNotification(const std::string& notifier,
void Base::ConsoleSingleton::userTranslatedNotification(const std::string& notifier,
const char* pMsg,
Args&&... args)
{
Send<LogStyle::Notification, IntendedRecipient::User, ContentType::Translated>(
send<LogStyle::Notification, IntendedRecipient::User, ContentType::Translated>(
notifier,
pMsg,
std::forward<Args>(args)...);
}
template<typename... Args>
void Base::ConsoleSingleton::Log(const char* pMsg, Args&&... args)
void Base::ConsoleSingleton::log(const char* pMsg, Args&&... args)
{
Log(std::string(""), pMsg, std::forward<Args>(args)...);
log(std::string(""), pMsg, std::forward<Args>(args)...);
}
template<typename... Args>
void Base::ConsoleSingleton::Log(const std::string& notifier, const char* pMsg, Args&&... args)
void Base::ConsoleSingleton::log(const std::string& notifier, const char* pMsg, Args&&... args)
{
Send<LogStyle::Log>(notifier, pMsg, std::forward<Args>(args)...);
send<LogStyle::Log>(notifier, pMsg, std::forward<Args>(args)...);
}
template<Base::LogStyle category,
Base::IntendedRecipient recipient /*= Base::IntendedRecipient::All*/,
Base::ContentType contenttype /*= Base::ContentType::Untranslated*/,
typename... Args>
void Base::ConsoleSingleton::Send(const std::string& notifiername, const char* pMsg, Args&&... args)
void Base::ConsoleSingleton::send(const std::string& notifiername, const char* pMsg, Args&&... args)
{
std::string format;
try {
@@ -1194,7 +1194,7 @@ void Base::ConsoleSingleton::Send(const std::string& notifiername, const char* p
}
if (connectionMode == Direct) {
Notify<category, recipient, contenttype>(notifiername, format);
notify<category, recipient, contenttype>(notifiername, format);
}
else {
@@ -1207,7 +1207,7 @@ void Base::ConsoleSingleton::Send(const std::string& notifiername, const char* p
template<Base::LogStyle category,
Base::IntendedRecipient recipient /*= Base::IntendedRecipient::All*/,
Base::ContentType contenttype /*= Base::ContentType::Untranslated*/>
void Base::ConsoleSingleton::Notify(const std::string& notifiername, const std::string& msg)
void Base::ConsoleSingleton::notify(const std::string& notifiername, const std::string& msg)
{
notifyPrivate(category, recipient, contenttype, notifiername, msg);
}

View File

@@ -48,7 +48,7 @@ ConsoleObserverFile::ConsoleObserverFile(const char* sFileName)
: cFileStream(Base::FileInfo(sFileName)) // can be in UTF8
{
if (!cFileStream.is_open()) {
Console().Warning("Cannot open log file '%s'.\n", sFileName);
Console().warning("Cannot open log file '%s'.\n", sFileName);
}
// mark the file as a UTF-8 encoded file
unsigned char bom[3] = {0xef, 0xbb, 0xbf};
@@ -60,7 +60,7 @@ ConsoleObserverFile::~ConsoleObserverFile()
cFileStream.close();
}
void ConsoleObserverFile::SendLog(const std::string& notifiername,
void ConsoleObserverFile::sendLog(const std::string& notifiername,
const std::string& msg,
LogStyle level,
IntendedRecipient recipient,
@@ -113,7 +113,7 @@ ConsoleObserverStd::ConsoleObserverStd()
ConsoleObserverStd::~ConsoleObserverStd() = default;
void ConsoleObserverStd::SendLog(const std::string& notifiername,
void ConsoleObserverStd::sendLog(const std::string& notifiername,
const std::string& msg,
LogStyle level,
IntendedRecipient recipient,
@@ -261,7 +261,7 @@ int RedirectStdOutput::sync()
{
// Print as log as this might be verbose
if (!buffer.empty() && buffer.back() == '\n') {
Base::Console().Log("%s", buffer.c_str());
Base::Console().log("%s", buffer.c_str());
buffer.clear();
}
return 0;
@@ -284,7 +284,7 @@ int RedirectStdLog::sync()
{
// Print as log as this might be verbose
if (!buffer.empty() && buffer.back() == '\n') {
Base::Console().Log("%s", buffer.c_str());
Base::Console().log("%s", buffer.c_str());
buffer.clear();
}
return 0;
@@ -306,7 +306,7 @@ int RedirectStdError::overflow(int ch)
int RedirectStdError::sync()
{
if (!buffer.empty() && buffer.back() == '\n') {
Base::Console().Error("%s", buffer.c_str());
Base::Console().error("%s", buffer.c_str());
buffer.clear();
}
return 0;

View File

@@ -43,12 +43,12 @@ public:
explicit ConsoleObserverFile(const char* sFileName);
~ConsoleObserverFile() override;
void SendLog(const std::string& notifiername,
void sendLog(const std::string& notifiername,
const std::string& msg,
LogStyle level,
IntendedRecipient recipient,
ContentType content) override;
const char* Name() override
const char* name() override
{
return "File";
}
@@ -70,12 +70,12 @@ class BaseExport ConsoleObserverStd: public ILogger
public:
ConsoleObserverStd();
~ConsoleObserverStd() override;
void SendLog(const std::string& notifiername,
void sendLog(const std::string& notifiername,
const std::string& msg,
LogStyle level,
IntendedRecipient recipient,
ContentType content) override;
const char* Name() override
const char* name() override
{
return "Console";
}
@@ -127,20 +127,20 @@ private:
ILoggerBlocker::ILoggerBlocker(const char* co, ConsoleMsgFlags msgTypes)
: conObs(co)
{
msgTypesBlocked = Console().SetEnabledMsgType(conObs, msgTypes, false);
msgTypesBlocked = Console().setEnabledMsgType(conObs, msgTypes, false);
}
ILoggerBlocker::~ILoggerBlocker()
{
try {
#ifdef FC_DEBUG
auto debug = Console().SetEnabledMsgType(conObs, msgTypesBlocked, true);
auto debug = Console().setEnabledMsgType(conObs, msgTypesBlocked, true);
if (debug != msgTypesBlocked) {
Console().Warning(
Console().warning(
"Enabled message types have been changed while ILoggerBlocker was set\n");
}
#else
Console().SetEnabledMsgType(conObs, msgTypesBlocked, true);
Console().setEnabledMsgType(conObs, msgTypesBlocked, true);
#endif
}
catch (...) {

View File

@@ -66,7 +66,7 @@ bool Debugger::eventFilter(QObject* /*watched*/, QEvent* event)
int Debugger::exec()
{
if (isAttached) {
Base::Console().Message("TO CONTINUE PRESS ANY KEY...\n");
Base::Console().message("TO CONTINUE PRESS ANY KEY...\n");
}
return loop.exec();
}

View File

@@ -130,7 +130,7 @@ public:
// DEBUG
// void print() const {
// Console().Log("%f, %f, %f, %f; %f, %f, %f, %f", x.re,y.re,z.re,w.re, x.du,y.du,z.du,
// Console().log("%f, %f, %f, %f; %f, %f, %f, %f", x.re,y.re,z.re,w.re, x.du,y.du,z.du,
// w.du);
// }
};

View File

@@ -99,7 +99,7 @@ const char* ScriptFactorySingleton::ProduceScript(const char* sScriptName) const
if (!script) {
#ifdef FC_DEBUG
Console().Warning("\"%s\" is not registered\n", sScriptName);
Console().warning("\"%s\" is not registered\n", sScriptName);
#endif
return ""; // no data
}

View File

@@ -130,7 +130,7 @@ void PyException::reportException() const
// set sys.last_vars to make post-mortem debugging work
PyGILStateLocker locker;
PySys_SetObject("last_traceback", PP_last_traceback);
Console().DeveloperError("pyException",
Console().developerError("pyException",
"%s%s: %s\n",
_stackTrace.c_str(),
_errorType.c_str(),

View File

@@ -85,7 +85,7 @@ public:
* and returns the name of the observer. Needed to use the Get
* Method of the Subject.
*/
virtual const char* Name()
virtual const char* name()
{
return nullptr;
}
@@ -122,7 +122,7 @@ public:
virtual ~Subject()
{
if (_ObserverSet.size() > 0) {
Base::Console().DeveloperWarning(std::string("~Subject()"),
Base::Console().developerWarning(std::string("~Subject()"),
"Not detached all observers yet\n");
}
}
@@ -139,7 +139,7 @@ public:
size_t count = _ObserverSet.size();
_ObserverSet.insert(ToObserv);
if (_ObserverSet.size() == count) {
Base::Console().DeveloperWarning(std::string("Subject::Attach"),
Base::Console().developerWarning(std::string("Subject::Attach"),
"Observer %p already attached\n",
static_cast<void*>(ToObserv));
}
@@ -160,7 +160,7 @@ public:
size_t count = _ObserverSet.size();
_ObserverSet.erase(ToObserv);
if (_ObserverSet.size() == count) {
Base::Console().DeveloperWarning(std::string("Subject::Detach"),
Base::Console().developerWarning(std::string("Subject::Detach"),
"Observer %p already detached\n",
static_cast<void*>(ToObserv));
}
@@ -184,17 +184,17 @@ public:
(*Iter)->OnChange(*this, rcReason); // send OnChange-signal
}
catch (Base::Exception& e) {
Base::Console().Error("Unhandled Base::Exception caught when notifying observer.\n"
Base::Console().error("Unhandled Base::Exception caught when notifying observer.\n"
"The error message is: %s\n",
e.what());
}
catch (std::exception& e) {
Base::Console().Error("Unhandled std::exception caught when notifying observer\n"
Base::Console().error("Unhandled std::exception caught when notifying observer\n"
"The error message is: %s\n",
e.what());
}
catch (...) {
Base::Console().Error(
Base::Console().error(
"Unhandled unknown exception caught in when notifying observer.\n");
}
}
@@ -210,7 +210,7 @@ public:
for (typename std::set<Observer<MsgType>*>::iterator Iter = _ObserverSet.begin();
Iter != _ObserverSet.end();
++Iter) {
OName = (*Iter)->Name(); // get the name
OName = (*Iter)->name(); // get the name
if (OName && strcmp(OName, Name) == 0) {
return *Iter;
}

View File

@@ -366,7 +366,7 @@ ParameterGrp::CreateElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMElement* Start,
!= 0
&& XMLString::compareString(Start->getNodeName(), XStrLiteral("FCParameters").unicodeForm())
!= 0) {
Base::Console().Warning("CreateElement: %s cannot have the element %s of type %s\n",
Base::Console().warning("CreateElement: %s cannot have the element %s of type %s\n",
StrX(Start->getNodeName()).c_str(),
Name,
Type);
@@ -1447,7 +1447,7 @@ ParameterGrp::FindElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMElement* Start,
!= 0
&& XMLString::compareString(Start->getNodeName(), XStrLiteral("FCParameters").unicodeForm())
!= 0) {
Base::Console().Warning("FindElement: %s cannot have the element %s of type %s\n",
Base::Console().warning("FindElement: %s cannot have the element %s of type %s\n",
StrX(Start->getNodeName()).c_str(),
Name,
Type);
@@ -2082,7 +2082,7 @@ void ParameterManager::CheckDocument() const
XercesDOMParser parser;
Grammar* grammar = parser.loadGrammar(xsdFile, Grammar::SchemaGrammarType, true);
if (!grammar) {
Base::Console().Error("Grammar file cannot be loaded.\n");
Base::Console().error("Grammar file cannot be loaded.\n");
return;
}
@@ -2099,7 +2099,7 @@ void ParameterManager::CheckDocument() const
parser.parse(xmlFile);
if (parser.getErrorCount() > 0) {
Base::Console().Error("Unexpected XML structure detected: %zu errors\n",
Base::Console().error("Unexpected XML structure detected: %zu errors\n",
parser.getErrorCount());
}
}

View File

@@ -68,7 +68,7 @@ PyObjectBase::PyObjectBase(void* voidp, PyTypeObject *T)
#endif
_Py_NewReference(this);
#ifdef FC_LOGPYOBJECTS
Base::Console().Log("PyO+: %s (%p)\n",T->tp_name, this);
Base::Console().log("PyO+: %s (%p)\n",T->tp_name, this);
#endif
StatusBits.set(Valid); // valid, the second bit is NOT set, i.e. it's mutable
StatusBits.set(Notify);
@@ -79,7 +79,7 @@ PyObjectBase::~PyObjectBase()
{
PyGILStateLocker lock;
#ifdef FC_LOGPYOBJECTS
Base::Console().Log("PyO-: %s (%p)\n",Py_TYPE(this)->tp_name, this);
Base::Console().log("PyO-: %s (%p)\n",Py_TYPE(this)->tp_name, this);
#endif
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
if (baseProxy && reinterpret_cast<PyBaseProxy*>(baseProxy)->baseobject == this) {
@@ -462,7 +462,7 @@ PyObject *PyObjectBase::_repr()
std::stringstream a;
a << "<base object at " << _pcTwinPointer << ">";
# ifdef FCDebug
Console().Log("PyObjectBase::_repr() not overwritten representation!");
Console().log("PyObjectBase::_repr() not overwritten representation!");
# endif
return Py_BuildValue("s", a.str().c_str());
}

View File

@@ -440,7 +440,7 @@ void Base::XMLReader::readFiles(zipios::ZipInputStream& zipstream) const
// less data than the file size would allow.
// All what we need to do is to notify the user about the
// failure.
Base::Console().Error("Reading failed from embedded file: %s\n",
Base::Console().error("Reading failed from embedded file: %s\n",
entry->toString().c_str());
FailedFiles.push_back(jt->FileName);
}

View File

@@ -125,7 +125,7 @@ void Type::importModule(const char* typeName)
// lets load the module
Interpreter().loadModule(mod.c_str());
#ifdef FC_LOGLOADMODULE
Console().Log("Act: Module %s loaded through class %s \n", Mod.c_str(), typeName);
Console().log("Act: Module %s loaded through class %s \n", Mod.c_str(), typeName);
#endif
loadModuleSet.insert(mod);
}

View File

@@ -63,7 +63,7 @@ struct TypeData;
// do something..
}
else {
Base::Console().Warning("getRightFeature", "Unknown feature type %s!\n",
Base::Console().warning("getRightFeature", "Unknown feature type %s!\n",
anode->getTypeId().getName());
}
}