In structure XML files, implement component library files inclusion

BZ: 168727

In the PFW structure file, it is not possible to include a component
library from another XML file.

Implement the possibility to import component from another XML file
that would be included in a structure XML file and that would
describe a component library.

Change-Id: Id6125140de1c8e9882375d01199f695b929f45e2
Signed-off-by: Guillaume Denneulin <guillaume.denneulin@intel.com>
diff --git a/parameter/ComponentLibrary.cpp b/parameter/ComponentLibrary.cpp
index f133213..f3576e8 100644
--- a/parameter/ComponentLibrary.cpp
+++ b/parameter/ComponentLibrary.cpp
@@ -45,3 +45,35 @@
     return static_cast<const CComponentType*>(findChild(strName));
 }
 
+bool CComponentLibrary::fromXml(const CXmlElement& xmlElement,
+                                CXmlSerializingContext& serializingContext)
+{
+    CXmlElement childElement;
+
+    CXmlElement::CChildIterator it(xmlElement);
+
+    // XML populate all component libraries
+    while (it.next(childElement)) {
+
+        // Filter component library/type set elements
+        if (childElement.getType() == "ComponentLibrary" ||
+            childElement.getType() == "ComponentTypeSet") {
+
+            if (!fromXml(childElement, serializingContext)) {
+
+                return false;
+            }
+        } else {
+            // Regular child creation and populating
+            CElement* pChild = createChild(childElement, serializingContext);
+
+            if (!pChild || !pChild->fromXml(childElement, serializingContext)) {
+
+                return false;
+            }
+        }
+    }
+
+    return true;
+}
+