From 7c46bb4f7d020076404a941cf04e39e5280d3972 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 14 Mar 2013 23:52:52 +0100 Subject: [PATCH] Use 'explicit' for constructors. --- lib/base/application.h | 2 +- lib/base/connection.h | 2 +- lib/base/dynamicobject.h | 3 ++- lib/base/fifo.h | 3 --- lib/base/logger.cpp | 6 +++--- lib/base/logger.h | 2 +- lib/base/scriptfunction.h | 2 +- lib/base/stacktrace.h | 2 +- lib/base/streamlogger.h | 2 +- lib/config/configcompiler.h | 2 +- lib/config/configitembuilder.h | 2 +- lib/config/configtype.cpp | 2 +- lib/icinga/checkresultmessage.h | 2 +- lib/icinga/cib.h | 2 ++ lib/icinga/host.cpp | 4 ++-- lib/icinga/host.h | 2 +- lib/icinga/hostgroup.cpp | 4 ++-- lib/icinga/hostgroup.h | 2 +- lib/icinga/icingaapplication.h | 2 +- lib/icinga/macroprocessor.h | 2 ++ lib/icinga/notification.cpp | 4 ++-- lib/icinga/notification.h | 2 +- lib/icinga/notificationrequestmessage.h | 2 +- lib/icinga/nullchecktask.h | 3 +++ lib/icinga/pluginnotificationtask.h | 1 - lib/icinga/service.h | 2 +- lib/icinga/servicegroup.cpp | 4 ++-- lib/icinga/servicegroup.h | 2 +- lib/icinga/timeperiod.h | 2 +- lib/icinga/user.cpp | 4 ++-- lib/icinga/user.h | 2 +- lib/icinga/usergroup.cpp | 4 ++-- lib/icinga/usergroup.h | 2 +- lib/remoting/endpoint.h | 2 +- lib/remoting/jsonrpcconnection.h | 2 +- lib/remoting/messagepart.h | 4 ++-- 36 files changed, 48 insertions(+), 44 deletions(-) diff --git a/lib/base/application.h b/lib/base/application.h index a7c792958..00dbf3ab0 100644 --- a/lib/base/application.h +++ b/lib/base/application.h @@ -34,7 +34,7 @@ public: typedef shared_ptr Ptr; typedef weak_ptr WeakPtr; - Application(const Dictionary::Ptr& serializedUpdate); + explicit Application(const Dictionary::Ptr& serializedUpdate); ~Application(void); static Application::Ptr GetInstance(void); diff --git a/lib/base/connection.h b/lib/base/connection.h index 096da76b5..4c8701c59 100644 --- a/lib/base/connection.h +++ b/lib/base/connection.h @@ -29,7 +29,7 @@ public: typedef shared_ptr Ptr; typedef weak_ptr WeakPtr; - Connection(const Stream::Ptr& stream); + explicit Connection(const Stream::Ptr& stream); Stream::Ptr GetStream(void) const; diff --git a/lib/base/dynamicobject.h b/lib/base/dynamicobject.h index 3e87f04d9..aeee01c39 100644 --- a/lib/base/dynamicobject.h +++ b/lib/base/dynamicobject.h @@ -41,7 +41,6 @@ public: typedef AttributeMap::iterator AttributeIterator; typedef AttributeMap::const_iterator AttributeConstIterator; - DynamicObject(const Dictionary::Ptr& serializedObject); ~DynamicObject(void); static void Initialize(void); @@ -95,6 +94,8 @@ public: static double GetCurrentTx(void); protected: + explicit DynamicObject(const Dictionary::Ptr& serializedObject); + virtual void OnRegistrationCompleted(void); virtual void OnUnregistrationCompleted(void); diff --git a/lib/base/fifo.h b/lib/base/fifo.h index bc31578c5..f654d62bf 100644 --- a/lib/base/fifo.h +++ b/lib/base/fifo.h @@ -41,9 +41,6 @@ public: void Start(void); - /*const void *GetReadBuffer(void) const; - void *GetWriteBuffer(size_t *count);*/ - size_t GetAvailableBytes(void) const; size_t Peek(void *buffer, size_t count); size_t Read(void *buffer, size_t count); diff --git a/lib/base/logger.cpp b/lib/base/logger.cpp index af0eb742d..1c92dce60 100644 --- a/lib/base/logger.cpp +++ b/lib/base/logger.cpp @@ -26,10 +26,10 @@ REGISTER_TYPE(Logger); /** * Constructor for the Logger class. * - * @param properties A serialized dictionary containing attributes. + * @param serializedUpdate A serialized dictionary containing attributes. */ -Logger::Logger(const Dictionary::Ptr& properties) - : DynamicObject(properties) +Logger::Logger(const Dictionary::Ptr& serializedUpdate) + : DynamicObject(serializedUpdate) { RegisterAttribute("type", Attribute_Config, &m_Type); RegisterAttribute("path", Attribute_Config, &m_Path); diff --git a/lib/base/logger.h b/lib/base/logger.h index 5b43a8819..c150bb3e2 100644 --- a/lib/base/logger.h +++ b/lib/base/logger.h @@ -87,7 +87,7 @@ public: typedef shared_ptr Ptr; typedef weak_ptr WeakPtr; - Logger(const Dictionary::Ptr& properties); + explicit Logger(const Dictionary::Ptr& serializedUpdate); static void Write(LogSeverity severity, const String& facility, const String& message); diff --git a/lib/base/scriptfunction.h b/lib/base/scriptfunction.h index 049bee52b..074c2fedc 100644 --- a/lib/base/scriptfunction.h +++ b/lib/base/scriptfunction.h @@ -38,7 +38,7 @@ public: typedef function&, const vector& arguments)> Callback; - ScriptFunction(const Callback& function); + explicit ScriptFunction(const Callback& function); static void Register(const String& name, const ScriptFunction::Ptr& function); static void Unregister(const String& name); diff --git a/lib/base/stacktrace.h b/lib/base/stacktrace.h index 9728b47bc..96d838020 100644 --- a/lib/base/stacktrace.h +++ b/lib/base/stacktrace.h @@ -33,7 +33,7 @@ class StackTrace public: StackTrace(void); #ifdef _WIN32 - StackTrace(PEXCEPTION_POINTERS exi); + explicit StackTrace(PEXCEPTION_POINTERS exi); #endif /* _WIN32 */ void Print(ostream& fp, int ignoreFrames = 0) const; diff --git a/lib/base/streamlogger.h b/lib/base/streamlogger.h index 3d5c8fc16..8bcaa0359 100644 --- a/lib/base/streamlogger.h +++ b/lib/base/streamlogger.h @@ -35,7 +35,7 @@ public: typedef weak_ptr WeakPtr; StreamLogger(void); - StreamLogger(ostream *stream); + explicit StreamLogger(ostream *stream); ~StreamLogger(void); void OpenFile(const String& filename); diff --git a/lib/config/configcompiler.h b/lib/config/configcompiler.h index 04d7468b1..6481a7bb7 100644 --- a/lib/config/configcompiler.h +++ b/lib/config/configcompiler.h @@ -34,7 +34,7 @@ class I2_CONFIG_API ConfigCompiler public: typedef function HandleIncludeFunc; - ConfigCompiler(const String& path, istream *input = &cin, + explicit ConfigCompiler(const String& path, istream *input = &cin, HandleIncludeFunc includeHandler = &ConfigCompiler::HandleFileInclude); virtual ~ConfigCompiler(void); diff --git a/lib/config/configitembuilder.h b/lib/config/configitembuilder.h index 08057baef..2fc3175b3 100644 --- a/lib/config/configitembuilder.h +++ b/lib/config/configitembuilder.h @@ -36,7 +36,7 @@ public: typedef weak_ptr WeakPtr; ConfigItemBuilder(void); - ConfigItemBuilder(const DebugInfo& debugInfo); + explicit ConfigItemBuilder(const DebugInfo& debugInfo); void SetType(const String& type); void SetName(const String& name); diff --git a/lib/config/configtype.cpp b/lib/config/configtype.cpp index 6926419d2..f20041d6c 100644 --- a/lib/config/configtype.cpp +++ b/lib/config/configtype.cpp @@ -188,7 +188,7 @@ void ConfigType::ValidateArray(const Array::Ptr& array, { BOOST_FOREACH(const TypeRuleList::Ptr& ruleList, ruleLists) { BOOST_FOREACH(const String& require, ruleList->GetRequires()) { - long index = Convert::ToLong(require); + size_t index = Convert::ToLong(require); locations.push_back("Attribute '" + require + "'"); diff --git a/lib/icinga/checkresultmessage.h b/lib/icinga/checkresultmessage.h index 4a0ea3954..c3d53fd27 100644 --- a/lib/icinga/checkresultmessage.h +++ b/lib/icinga/checkresultmessage.h @@ -32,7 +32,7 @@ class I2_ICINGA_API CheckResultMessage : public MessagePart { public: CheckResultMessage(void) : MessagePart() { } - CheckResultMessage(const MessagePart& message) : MessagePart(message) { } + explicit CheckResultMessage(const MessagePart& message) : MessagePart(message) { } String GetService(void) const; void SetService(const String& service); diff --git a/lib/icinga/cib.h b/lib/icinga/cib.h index e7d5903dc..3f7e1c036 100644 --- a/lib/icinga/cib.h +++ b/lib/icinga/cib.h @@ -39,6 +39,8 @@ public: static int GetPassiveChecksStatistics(long timespan); private: + CIB(void); + static boost::mutex m_Mutex; static RingBuffer m_ActiveChecksStatistics; static RingBuffer m_PassiveChecksStatistics; diff --git a/lib/icinga/host.cpp b/lib/icinga/host.cpp index 5d1144ee6..229e507d5 100644 --- a/lib/icinga/host.cpp +++ b/lib/icinga/host.cpp @@ -30,8 +30,8 @@ REGISTER_SCRIPTFUNCTION(ValidateServiceDictionary, &Host::ValidateServiceDiction REGISTER_TYPE(Host); -Host::Host(const Dictionary::Ptr& properties) - : DynamicObject(properties) +Host::Host(const Dictionary::Ptr& serializedUpdate) + : DynamicObject(serializedUpdate) { RegisterAttribute("display_name", Attribute_Config, &m_DisplayName); RegisterAttribute("hostgroups", Attribute_Config, &m_HostGroups); diff --git a/lib/icinga/host.h b/lib/icinga/host.h index 1f27487cd..f573b3190 100644 --- a/lib/icinga/host.h +++ b/lib/icinga/host.h @@ -59,7 +59,7 @@ public: typedef shared_ptr Ptr; typedef weak_ptr WeakPtr; - Host(const Dictionary::Ptr& properties); + explicit Host(const Dictionary::Ptr& serializedUpdate); ~Host(void); static Host::Ptr GetByName(const String& name); diff --git a/lib/icinga/hostgroup.cpp b/lib/icinga/hostgroup.cpp index 07c06e8b8..d1dea90c5 100644 --- a/lib/icinga/hostgroup.cpp +++ b/lib/icinga/hostgroup.cpp @@ -28,8 +28,8 @@ Timer::Ptr HostGroup::m_MembersCacheTimer; REGISTER_TYPE(HostGroup); -HostGroup::HostGroup(const Dictionary::Ptr& properties) - : DynamicObject(properties) +HostGroup::HostGroup(const Dictionary::Ptr& serializedUpdate) + : DynamicObject(serializedUpdate) { RegisterAttribute("display_name", Attribute_Config, &m_DisplayName); RegisterAttribute("notes_url", Attribute_Config, &m_NotesUrl); diff --git a/lib/icinga/hostgroup.h b/lib/icinga/hostgroup.h index f51bff919..dd4480019 100644 --- a/lib/icinga/hostgroup.h +++ b/lib/icinga/hostgroup.h @@ -34,7 +34,7 @@ public: typedef shared_ptr Ptr; typedef weak_ptr WeakPtr; - HostGroup(const Dictionary::Ptr& properties); + explicit HostGroup(const Dictionary::Ptr& serializedUpdate); ~HostGroup(void); static HostGroup::Ptr GetByName(const String& name); diff --git a/lib/icinga/icingaapplication.h b/lib/icinga/icingaapplication.h index e6032e647..78c4dc805 100644 --- a/lib/icinga/icingaapplication.h +++ b/lib/icinga/icingaapplication.h @@ -34,7 +34,7 @@ public: typedef shared_ptr Ptr; typedef weak_ptr WeakPtr; - IcingaApplication(const Dictionary::Ptr& serializedUpdate); + explicit IcingaApplication(const Dictionary::Ptr& serializedUpdate); int Main(void); diff --git a/lib/icinga/macroprocessor.h b/lib/icinga/macroprocessor.h index 7b11f4244..e25042eaf 100644 --- a/lib/icinga/macroprocessor.h +++ b/lib/icinga/macroprocessor.h @@ -35,6 +35,8 @@ public: static Dictionary::Ptr MergeMacroDicts(const vector& macroDicts); private: + MacroProcessor(void); + static String InternalResolveMacros(const String& str, const Dictionary::Ptr& macros); }; diff --git a/lib/icinga/notification.cpp b/lib/icinga/notification.cpp index 075f5aeff..52827da87 100644 --- a/lib/icinga/notification.cpp +++ b/lib/icinga/notification.cpp @@ -23,8 +23,8 @@ using namespace icinga; REGISTER_TYPE(Notification); -Notification::Notification(const Dictionary::Ptr& properties) - : DynamicObject(properties) +Notification::Notification(const Dictionary::Ptr& serializedUpdate) + : DynamicObject(serializedUpdate) { RegisterAttribute("notification_command", Attribute_Config, &m_NotificationCommand); RegisterAttribute("macros", Attribute_Config, &m_Macros); diff --git a/lib/icinga/notification.h b/lib/icinga/notification.h index 2fd89a847..f6361a907 100644 --- a/lib/icinga/notification.h +++ b/lib/icinga/notification.h @@ -52,7 +52,7 @@ public: typedef shared_ptr Ptr; typedef weak_ptr WeakPtr; - Notification(const Dictionary::Ptr& properties); + explicit Notification(const Dictionary::Ptr& serializedUpdate); ~Notification(void); static Notification::Ptr GetByName(const String& name); diff --git a/lib/icinga/notificationrequestmessage.h b/lib/icinga/notificationrequestmessage.h index b2ee07af8..f355abd6a 100644 --- a/lib/icinga/notificationrequestmessage.h +++ b/lib/icinga/notificationrequestmessage.h @@ -32,7 +32,7 @@ class I2_ICINGA_API NotificationRequestMessage : public MessagePart { public: NotificationRequestMessage(void) : MessagePart() { } - NotificationRequestMessage(const MessagePart& message) : MessagePart(message) { } + explicit NotificationRequestMessage(const MessagePart& message) : MessagePart(message) { } String GetService(void) const; void SetService(const String& service); diff --git a/lib/icinga/nullchecktask.h b/lib/icinga/nullchecktask.h index a38abaf0f..18c6cc190 100644 --- a/lib/icinga/nullchecktask.h +++ b/lib/icinga/nullchecktask.h @@ -32,6 +32,9 @@ class I2_ICINGA_API NullCheckTask { public: static void ScriptFunc(const ScriptTask::Ptr& task, const vector& arguments); + +private: + NullCheckTask(void); }; } diff --git a/lib/icinga/pluginnotificationtask.h b/lib/icinga/pluginnotificationtask.h index bf39f12c7..f418c71b4 100644 --- a/lib/icinga/pluginnotificationtask.h +++ b/lib/icinga/pluginnotificationtask.h @@ -34,7 +34,6 @@ public: static void ScriptFunc(const ScriptTask::Ptr& task, const vector& arguments); private: - static void ProcessFinishedHandler(PluginNotificationTask ct); PluginNotificationTask(const ScriptTask::Ptr& task, const Process::Ptr& process, diff --git a/lib/icinga/service.h b/lib/icinga/service.h index aa211da3b..328483153 100644 --- a/lib/icinga/service.h +++ b/lib/icinga/service.h @@ -75,7 +75,7 @@ public: typedef shared_ptr Ptr; typedef weak_ptr WeakPtr; - Service(const Dictionary::Ptr& properties); + explicit Service(const Dictionary::Ptr& serializedUpdate); ~Service(void); static Service::Ptr GetByName(const String& name); diff --git a/lib/icinga/servicegroup.cpp b/lib/icinga/servicegroup.cpp index bff6ae77a..a9abdec7e 100644 --- a/lib/icinga/servicegroup.cpp +++ b/lib/icinga/servicegroup.cpp @@ -28,8 +28,8 @@ Timer::Ptr ServiceGroup::m_MembersCacheTimer; REGISTER_TYPE(ServiceGroup); -ServiceGroup::ServiceGroup(const Dictionary::Ptr& properties) - : DynamicObject(properties) +ServiceGroup::ServiceGroup(const Dictionary::Ptr& serializedUpdate) + : DynamicObject(serializedUpdate) { RegisterAttribute("display_name", Attribute_Config, &m_DisplayName); RegisterAttribute("notes_url", Attribute_Config, &m_NotesUrl); diff --git a/lib/icinga/servicegroup.h b/lib/icinga/servicegroup.h index 39d1d210c..fccb6ca71 100644 --- a/lib/icinga/servicegroup.h +++ b/lib/icinga/servicegroup.h @@ -34,7 +34,7 @@ public: typedef shared_ptr Ptr; typedef weak_ptr WeakPtr; - ServiceGroup(const Dictionary::Ptr& properties); + explicit ServiceGroup(const Dictionary::Ptr& serializedUpdate); ~ServiceGroup(void); static ServiceGroup::Ptr GetByName(const String& name); diff --git a/lib/icinga/timeperiod.h b/lib/icinga/timeperiod.h index 50b1d1fe4..d27ee4298 100644 --- a/lib/icinga/timeperiod.h +++ b/lib/icinga/timeperiod.h @@ -34,7 +34,7 @@ public: typedef shared_ptr Ptr; typedef weak_ptr WeakPtr; - TimePeriod(const Dictionary::Ptr& serializedUpdate); + explicit TimePeriod(const Dictionary::Ptr& serializedUpdate); static TimePeriod::Ptr GetByName(const String& name); diff --git a/lib/icinga/user.cpp b/lib/icinga/user.cpp index a77fd6ef4..46d4507f7 100644 --- a/lib/icinga/user.cpp +++ b/lib/icinga/user.cpp @@ -23,8 +23,8 @@ using namespace icinga; REGISTER_TYPE(User); -User::User(const Dictionary::Ptr& properties) - : DynamicObject(properties) +User::User(const Dictionary::Ptr& serializedUpdate) + : DynamicObject(serializedUpdate) { RegisterAttribute("display_name", Attribute_Config, &m_DisplayName); RegisterAttribute("macros", Attribute_Config, &m_Macros); diff --git a/lib/icinga/user.h b/lib/icinga/user.h index 8bb2273b6..56d10de95 100644 --- a/lib/icinga/user.h +++ b/lib/icinga/user.h @@ -34,7 +34,7 @@ public: typedef shared_ptr Ptr; typedef weak_ptr WeakPtr; - User(const Dictionary::Ptr& properties); + explicit User(const Dictionary::Ptr& serializedUpdate); ~User(void); static User::Ptr GetByName(const String& name); diff --git a/lib/icinga/usergroup.cpp b/lib/icinga/usergroup.cpp index d7a5def95..f79976f97 100644 --- a/lib/icinga/usergroup.cpp +++ b/lib/icinga/usergroup.cpp @@ -28,8 +28,8 @@ Timer::Ptr UserGroup::m_MembersCacheTimer; REGISTER_TYPE(UserGroup); -UserGroup::UserGroup(const Dictionary::Ptr& properties) - : DynamicObject(properties) +UserGroup::UserGroup(const Dictionary::Ptr& serializedUpdate) + : DynamicObject(serializedUpdate) { RegisterAttribute("display_name", Attribute_Config, &m_DisplayName); } diff --git a/lib/icinga/usergroup.h b/lib/icinga/usergroup.h index 962bd77f0..39912ee00 100644 --- a/lib/icinga/usergroup.h +++ b/lib/icinga/usergroup.h @@ -34,7 +34,7 @@ public: typedef shared_ptr Ptr; typedef weak_ptr WeakPtr; - UserGroup(const Dictionary::Ptr& properties); + explicit UserGroup(const Dictionary::Ptr& serializedUpdate); ~UserGroup(void); static UserGroup::Ptr GetByName(const String& name); diff --git a/lib/remoting/endpoint.h b/lib/remoting/endpoint.h index 375fc632b..72d04a851 100644 --- a/lib/remoting/endpoint.h +++ b/lib/remoting/endpoint.h @@ -38,7 +38,7 @@ public: typedef void (Callback)(const Endpoint::Ptr&, const Endpoint::Ptr&, const RequestMessage&); - Endpoint(const Dictionary::Ptr& serializedUpdate); + explicit Endpoint(const Dictionary::Ptr& serializedUpdate); ~Endpoint(void); static Endpoint::Ptr GetByName(const String& name); diff --git a/lib/remoting/jsonrpcconnection.h b/lib/remoting/jsonrpcconnection.h index 9473b8951..592a2b01d 100644 --- a/lib/remoting/jsonrpcconnection.h +++ b/lib/remoting/jsonrpcconnection.h @@ -34,7 +34,7 @@ public: typedef shared_ptr Ptr; typedef weak_ptr WeakPtr; - JsonRpcConnection(const Stream::Ptr& stream); + explicit JsonRpcConnection(const Stream::Ptr& stream); void SendMessage(const MessagePart& message); diff --git a/lib/remoting/messagepart.h b/lib/remoting/messagepart.h index 1d0b3da72..385cc9b2a 100644 --- a/lib/remoting/messagepart.h +++ b/lib/remoting/messagepart.h @@ -36,8 +36,8 @@ class I2_REMOTING_API MessagePart { public: MessagePart(void); - MessagePart(const Dictionary::Ptr& dictionary); - MessagePart(const MessagePart& message); + explicit MessagePart(const Dictionary::Ptr& dictionary); + explicit MessagePart(const MessagePart& message); Dictionary::Ptr GetDictionary(void) const; -- 2.40.0