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 <kevinx.rocard@intel.com>
Reviewed-on: http://android.intel.com:8080/118042
Reviewed-by: Centelles, Sylvain <sylvain.centelles@intel.com>
Tested-by: Barthes, FabienX <fabienx.barthes@intel.com>
Reviewed-by: cactus <cactus@intel.com>
Tested-by: cactus <cactus@intel.com>
diff --git a/parameter/SubsystemLibrary.h b/parameter/SubsystemLibrary.h
index 42ade57..00898ce 100644
--- a/parameter/SubsystemLibrary.h
+++ b/parameter/SubsystemLibrary.h
@@ -24,15 +24,15 @@
*/
#pragma once
-#include "ElementLibrary.h"
+#include "DefaultElementLibrary.h"
+#include "VirtualSubsystem.h"
+#include "NamedElementBuilderTemplate.h"
+#include <string>
-class CSubsystemLibrary : public CElementLibrary
+class CSubsystemLibrary :
+ public CDefaultElementLibrary<TNamedElementBuilderTemplate<CVirtualSubsystem> >
{
-public:
- CSubsystemLibrary();
- virtual ~CSubsystemLibrary();
-
private:
// Builder type (based on element's name attribute)
- virtual string getBuilderType(const CXmlElement& xmlElement) const;
+ virtual std::string getBuilderType(const CXmlElement& xmlElement) const;
};