You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by sw...@apache.org on 2025/10/30 05:11:14 UTC

(logging-log4cxx) 01/01: Improve consistancy and clarity in the macros enabling Log4cxx extensions

This is an automated email from the ASF dual-hosted git repository.

swebb2066 pushed a commit to branch simplify_extension_support_macros
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git

commit 96fadbe9daee29d84392a3ff0ef09e5da08220f8
Author: Stephen Webb <sw...@gmail.com>
AuthorDate: Thu Oct 30 16:10:55 2025 +1100

    Improve consistancy and clarity in the macros enabling Log4cxx extensions
---
 src/main/include/log4cxx/helpers/object.h | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/src/main/include/log4cxx/helpers/object.h b/src/main/include/log4cxx/helpers/object.h
index 6dc9f049..566d1eaa 100644
--- a/src/main/include/log4cxx/helpers/object.h
+++ b/src/main/include/log4cxx/helpers/object.h
@@ -26,15 +26,13 @@
 
 #define DECLARE_LOG4CXX_CLAZZ_OBJECT(object)\
 	public:\
-	class Clazz##object : public helpers::Class\
+	class Clazz##object : public LOG4CXX_NS::helpers::Class\
 	{\
 		public:\
-			Clazz##object() : helpers::Class() {}\
-			virtual ~Clazz##object() {}\
-			virtual LOG4CXX_NS::LogString getName() const { return LOG4CXX_STR(#object); } \
+			LogString getName() const override { return LOG4CXX_STR(#object); }\
 	};\
-	static const helpers::Class& getStaticClass(); \
-	static const LOG4CXX_NS::helpers::ClassRegistration& registerClass();
+	static const helpers::Class& getStaticClass();\
+	static const helpers::ClassRegistration& registerClass();
 
 #define DECLARE_ABSTRACT_LOG4CXX_OBJECT(object)\
 	DECLARE_LOG4CXX_CLAZZ_OBJECT(object)\
@@ -42,26 +40,24 @@
 
 #define DECLARE_LOG4CXX_OBJECT(object)\
 	public:\
-	class Clazz##object : public helpers::Class\
+	class Clazz##object : public LOG4CXX_NS::helpers::Class\
 	{\
 		public:\
-			Clazz##object() : helpers::Class() {}\
-			virtual ~Clazz##object() {}\
-			virtual LOG4CXX_NS::LogString getName() const { return LOG4CXX_STR(#object); } \
-			virtual object* newInstance() const\
+			LogString getName() const override { return LOG4CXX_STR(#object); }\
+			object* newInstance() const override\
 			{\
 				return new object();\
 			}\
 	};\
 	const helpers::Class& getClass() const override;\
 	static const helpers::Class& getStaticClass(); \
-	static const LOG4CXX_NS::helpers::ClassRegistration& registerClass();
+	static const helpers::ClassRegistration& registerClass();
 
 #define DECLARE_LOG4CXX_OBJECT_WITH_CUSTOM_CLASS(object, class)\
 	public:\
 	const helpers::Class& getClass() const override;\
 	static const helpers::Class& getStaticClass();\
-	static const LOG4CXX_NS::helpers::ClassRegistration&  registerClass();
+	static const helpers::ClassRegistration& registerClass();
 
 #define IMPLEMENT_LOG4CXX_OBJECT(object)\
 	const ::LOG4CXX_NS::helpers::Class& object::getClass() const { return getStaticClass(); }\
@@ -74,7 +70,7 @@
 		return classReg; \
 	}\
 	namespace LOG4CXX_NS { namespace classes { \
-	const ::LOG4CXX_NS::helpers::ClassRegistration& object##Registration = object::registerClass(); \
+	const helpers::ClassRegistration& object##Registration = object::registerClass(); \
 	} }
 
 
@@ -89,7 +85,7 @@
 		return classReg; \
 	}\
 	namespace LOG4CXX_NS { namespace classes { \
-	const LOG4CXX_NS::helpers::ClassRegistration& object##Registration = object::registerClass(); \
+	const helpers::ClassRegistration& object##Registration = object::registerClass(); \
 	} }
 
 namespace LOG4CXX_NS