From 12de2f264c693736a0157847578f6231309cf395 Mon Sep 17 00:00:00 2001 From: David Wagner Date: Thu, 4 Dec 2014 11:40:00 +0100 Subject: Remove const/non-const code duplication in CConfigurableDomains Implement the non-const method of findConfigurableDomain by calling the const version, as described in Effective C++ Item 3. Change-Id: Ib7b58100dc817d02092299923edf2e6c7ce2f117 Signed-off-by: David Wagner --- parameter/ConfigurableDomains.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'parameter/ConfigurableDomains.cpp') diff --git a/parameter/ConfigurableDomains.cpp b/parameter/ConfigurableDomains.cpp index dd7ede3..8dff45a 100644 --- a/parameter/ConfigurableDomains.cpp +++ b/parameter/ConfigurableDomains.cpp @@ -566,17 +566,10 @@ bool CConfigurableDomains::serializeSettings(const string& strBinarySettingsFile // Domain retrieval CConfigurableDomain* CConfigurableDomains::findConfigurableDomain(const string& strDomain, string& strError) { - // Find domain - CConfigurableDomain* pConfigurableDomain = static_cast(findChild(strDomain)); - - if (!pConfigurableDomain) { - - strError = "Configurable domain " + strDomain + " not found"; - - return NULL; - } - - return pConfigurableDomain; + // Call the const equivalent + return const_cast( + static_cast(this)->findConfigurableDomain(strDomain, strError) + ); } const CConfigurableDomain* CConfigurableDomains::findConfigurableDomain(const string& strDomain, string& strError) const -- cgit v1.1