diff options
author | David Wagner <david.wagner@intel.com> | 2014-12-04 11:40:00 +0100 |
---|---|---|
committer | David Wagner <david.wagner@intel.com> | 2015-01-22 11:53:51 +0100 |
commit | 12de2f264c693736a0157847578f6231309cf395 (patch) | |
tree | f6bea10ead6a09eca6da849717c9f8c6cd5096eb /parameter | |
parent | 8cb5d8815da673747b729d5e0a05a5cdc11a9081 (diff) | |
download | external_parameter-framework-12de2f264c693736a0157847578f6231309cf395.zip external_parameter-framework-12de2f264c693736a0157847578f6231309cf395.tar.gz external_parameter-framework-12de2f264c693736a0157847578f6231309cf395.tar.bz2 |
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 <david.wagner@intel.com>
Diffstat (limited to 'parameter')
-rw-r--r-- | parameter/ConfigurableDomains.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
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<CConfigurableDomain*>(findChild(strDomain)); - - if (!pConfigurableDomain) { - - strError = "Configurable domain " + strDomain + " not found"; - - return NULL; - } - - return pConfigurableDomain; + // Call the const equivalent + return const_cast<CConfigurableDomain*>( + static_cast<const CConfigurableDomains*>(this)->findConfigurableDomain(strDomain, strError) + ); } const CConfigurableDomain* CConfigurableDomains::findConfigurableDomain(const string& strDomain, string& strError) const |