You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by ca...@apache.org on 2008/02/13 07:37:54 UTC

svn commit: r627283 - in /logging/log4cxx/trunk/src/main: cpp/logger.cpp cpp/propertyresourcebundle.cpp include/log4cxx/helpers/objectptr.h include/log4cxx/logger.h

Author: carnold
Date: Tue Feb 12 22:37:54 2008
New Revision: 627283

URL: http://svn.apache.org/viewvc?rev=627283&view=rev
Log:
LOGCXX-234: Drop ObjectPtrT(const T*) and operator=

Modified:
    logging/log4cxx/trunk/src/main/cpp/logger.cpp
    logging/log4cxx/trunk/src/main/cpp/propertyresourcebundle.cpp
    logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h
    logging/log4cxx/trunk/src/main/include/log4cxx/logger.h

Modified: logging/log4cxx/trunk/src/main/cpp/logger.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/logger.cpp?rev=627283&r1=627282&r2=627283&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/logger.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/logger.cpp Tue Feb 12 22:37:54 2008
@@ -81,7 +81,7 @@
 {
         int writes = 0;
 
-        for(LoggerPtr logger(this); 
+        for(LoggerPtr logger(const_cast<Logger*>(this)); 
           logger != 0; 
          logger = logger->parent)
         {
@@ -101,7 +101,7 @@
 
         if(writes == 0 && repository != 0)
         {
-                repository->emitNoAppenderWarning(this);
+                repository->emitNoAppenderWarning(const_cast<Logger*>(this));
         }
 }
 
@@ -116,11 +116,11 @@
 
 
 void Logger::forcedLog(const LevelPtr& level1, const std::string& message,
-        const LocationInfo& location)
+        const LocationInfo& location) const
 {
         Pool p;
         LOG4CXX_DECODE_CHAR(msg, message);
-        LoggingEventPtr event(new LoggingEvent(this, level1, msg, location));
+        LoggingEventPtr event(new LoggingEvent(const_cast<Logger*>(this), level1, msg, location));
         callAppenders(event, p);
 }
 
@@ -129,16 +129,16 @@
 {
         Pool p;
         LOG4CXX_DECODE_CHAR(msg, message);
-        LoggingEventPtr event(new LoggingEvent(this, level1, msg,
+        LoggingEventPtr event(new LoggingEvent(const_cast<Logger*>(this), level1, msg,
               LocationInfo::getLocationUnavailable()));
         callAppenders(event, p);
 }
 
 void Logger::forcedLogLS(const LevelPtr& level1, const LogString& message,
-        const LocationInfo& location)
+        const LocationInfo& location) const
 {
         Pool p;
-        LoggingEventPtr event(new LoggingEvent(this, level1, message, location));
+        LoggingEventPtr event(new LoggingEvent(const_cast<Logger*>(this), level1, message, location));
         callAppenders(event, p);
 }
 
@@ -197,7 +197,7 @@
 
 ResourceBundlePtr Logger::getResourceBundle() const
 {
-        for (LoggerPtr l = this; l != 0; l = l->parent)
+        for (LoggerPtr l(const_cast<Logger*>(this)); l != 0; l = l->parent)
         {
                 if (l->resourceBundle != 0)
                 {
@@ -629,7 +629,7 @@
 {
         Pool p;
         LOG4CXX_DECODE_WCHAR(msg, message);
-        LoggingEventPtr event(new LoggingEvent(this, level1, msg,
+        LoggingEventPtr event(new LoggingEvent(const_cast<Logger*>(this), level1, msg,
            LocationInfo::getLocationUnavailable()));
         callAppenders(event, p);
 }

Modified: logging/log4cxx/trunk/src/main/cpp/propertyresourcebundle.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/propertyresourcebundle.cpp?rev=627283&r1=627282&r2=627283&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/propertyresourcebundle.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/propertyresourcebundle.cpp Tue Feb 12 22:37:54 2008
@@ -36,7 +36,7 @@
 LogString PropertyResourceBundle::getString(const LogString& key) const
 {
    LogString resource;
-   PropertyResourceBundlePtr resourceBundle(this);
+   PropertyResourceBundlePtr resourceBundle(const_cast<PropertyResourceBundle*>(this));
 
    do
    {

Modified: logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h?rev=627283&r1=627282&r2=627283&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h (original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h Tue Feb 12 22:37:54 2008
@@ -70,13 +70,6 @@
                 }
             }
 
-         ObjectPtrT(const T * p1)
-                _LOG4CXX_OBJECTPTR_INIT(const_cast<T*>(p1))
-                if (this->p != 0)
-                {
-                    this->p->addRef();
-                }
-            }
 
          ObjectPtrT(const ObjectPtrT& p1)
                 _LOG4CXX_OBJECTPTR_INIT(p1.p)
@@ -144,16 +137,6 @@
               return *this;
             }
 
-        ObjectPtrT& operator=(const T* p1) {
-              if (p1 != 0) {
-                p1->addRef();
-              }
-              T* oldPtr = exchange(p1);
-              if (oldPtr != 0) {
-                 oldPtr->releaseRef();
-              }
-              return *this;
-            }
 
       ObjectPtrT& operator=(ObjectPtrBase& p1) {
          T* newPtr = reinterpret_cast<T*>(p1.cast(T::getStaticClass()));

Modified: logging/log4cxx/trunk/src/main/include/log4cxx/logger.h
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/logger.h?rev=627283&r1=627282&r2=627283&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/logger.h (original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/logger.h Tue Feb 12 22:37:54 2008
@@ -255,7 +255,7 @@
         @param location location of the logging statement.
         */
         void forcedLog(const LevelPtr& level, const std::string& message,
-                        const log4cxx::spi::LocationInfo& location);
+                        const log4cxx::spi::LocationInfo& location) const;
         void forcedLog(const LevelPtr& level, const std::string& message) const;
 
 #if LOG4CXX_WCHAR_T_API
@@ -265,12 +265,12 @@
 #endif
 #if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API
         void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message,
-                        const log4cxx::spi::LocationInfo& location);
+                        const log4cxx::spi::LocationInfo& location) const;
         void forcedLog(const LevelPtr& level, const std::basic_string<UniChar>& message) const;
 #endif
 #if LOG4CXX_CFSTRING_API
         void forcedLog(const LevelPtr& level, const CFStringRef& message,
-                        const log4cxx::spi::LocationInfo& location);
+                        const log4cxx::spi::LocationInfo& location) const;
         void forcedLog(const LevelPtr& level, const CFStringRef& message) const;
 #endif
         /**
@@ -281,7 +281,7 @@
         @param location location of the logging statement.
         */
         void forcedLogLS(const LevelPtr& level, const LogString& message,
-                        const log4cxx::spi::LocationInfo& location);
+                        const log4cxx::spi::LocationInfo& location) const;
 
         /**
         Get the additivity flag for this Logger instance.