From 7f1729aa56b52afad1ac2c390582bdc41145de9e Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Wed, 10 Jul 2013 18:45:10 +0200 Subject: Add default element fallback BZ: 122982 The element library class is a factory that receives an xml node and instanciates the corresponding element. In some case, it would be usefull not to fail if no matching builder is found but use a default one. Add a setDefaultElementBuilder method to set the default builder to fallback to, in case no matching builder is found. Change-Id: I58f0ada3450195a3ca7d878e4b666b0a9359b499 Signed-off-by: Kevin Rocard Reviewed-on: http://android.intel.com:8080/118042 Reviewed-by: Centelles, Sylvain Tested-by: Barthes, FabienX Reviewed-by: cactus Tested-by: cactus --- parameter/ElementLibrary.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'parameter/ElementLibrary.h') diff --git a/parameter/ElementLibrary.h b/parameter/ElementLibrary.h index 0de6056..8f9337e 100644 --- a/parameter/ElementLibrary.h +++ b/parameter/ElementLibrary.h @@ -29,13 +29,11 @@ #include "Element.h" -using namespace std; - class CElementBuilder; class CElementLibrary { - typedef map ElementBuilderMap; + typedef std::map ElementBuilderMap; typedef ElementBuilderMap::iterator ElementBuilderMapIterator; typedef ElementBuilderMap::const_iterator ElementBuilderMapConstIterator; @@ -49,7 +47,7 @@ public: * create a new element. * @param[in] pElementBuilder is the tag associated element builder. */ - void addElementBuilder(string type, const CElementBuilder *pElementBuilder); + void addElementBuilder(const std::string& type, const CElementBuilder *pElementBuilder); void clean(); // Instantiation @@ -57,7 +55,7 @@ public: private: // Builder type - virtual string getBuilderType(const CXmlElement& xmlElement) const; + virtual std::string getBuilderType(const CXmlElement& xmlElement) const; // Builders ElementBuilderMap _elementBuilderMap; -- cgit v1.1