Changeset 5908 for branches/newapi

Show
Ignore:
Timestamp:
12/02/07 20:04:42 (12 months ago)
Author:
erijo
Message:

Moved static methods to a separate file so that unit-test can provide
their own implementation of e.g. getInstance (to e.g. return a mock
object instance).

Location:
branches/newapi/licq/src
Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • branches/newapi/licq/src/util/log.cpp

    r5896 r5908  
    1919 
    2020#include "licq/interface/logsink.h" 
    21 #include "licq/thread/threadspecific.h" 
    2221#include "util/log.h" 
    23 #include "util/tr.h" 
    2422 
    2523#include <cassert> 
     
    2725#include <time.h> 
    2826 
    29 static Licq::ThreadSpecific<LicqDaemon::Log> ThreadLogs; 
    30  
    3127LicqDaemon::Log::Log(const std::string& owner, Licq::LogSink* sink) 
    3228  : myOwner(owner), mySink(sink) 
    3329{ 
    3430  assert(mySink != NULL); 
    35 } 
    36  
    37 void LicqDaemon::Log::setThreadLog(const Log* log) 
    38 { 
    39   if (ThreadLogs.hasData()) 
    40   { 
    41     ThreadLogs.getData()->fatal() << 
    42         tr("LicqDaemon::Log::setThreadLog called more than once"); 
    43     ::abort(); 
    44   } 
    45   ThreadLogs.setData(log); 
    46 } 
    47  
    48 LicqDaemon::Log* LicqDaemon::Log::getThreadLog() 
    49 { 
    50   assert(ThreadLogs.hasData()); 
    51   return ThreadLogs.getData(); 
    5231} 
    5332 
  • branches/newapi/licq/src/util/log.h

    r5896 r5908  
    5151   * @see getThreadLog() 
    5252   */ 
    53   static void setThreadLog(const Log* log); 
    54  
    55   /** 
    56    * @returns The default log for the calling thread. setThreadLog() 
    57    * must have been called by the calling thread before calling this 
    58    * method. 
    59    * 
    60    * @see setThreadLog() 
    61    */ 
    62   static Log* getThreadLog(); 
     53  static void setThreadLog(const Licq::Log* log); 
    6354 
    6455  // From Licq::Log