blob: ffa651327de44ae55bbe0f9fac61ff7ac50640e5 [file] [log] [blame]
Georges-Henri Baron326a31d2012-06-28 12:05:09 +02001/*
2 * INTEL CONFIDENTIAL
Georges-Henri Baroncec86c12012-09-04 17:30:28 +02003 * Copyright © 2013 Intel
Georges-Henri Baron326a31d2012-06-28 12:05:09 +02004 * Corporation All Rights Reserved.
5 *
6 * The source code contained or described herein and all documents related to
7 * the source code ("Material") are owned by Intel Corporation or its suppliers
8 * or licensors. Title to the Material remains with Intel Corporation or its
9 * suppliers and licensors. The Material contains trade secrets and proprietary
10 * and confidential information of Intel or its suppliers and licensors. The
11 * Material is protected by worldwide copyright and trade secret laws and
12 * treaty provisions. No part of the Material may be used, copied, reproduced,
13 * modified, published, uploaded, posted, transmitted, distributed, or
14 * disclosed in any way without Intel’s prior express written permission.
15 *
16 * No license under any patent, copyright, trade secret or other intellectual
17 * property right is granted to or conferred upon you by disclosure or delivery
18 * of the Materials, either expressly, by implication, inducement, estoppel or
19 * otherwise. Any license under such intellectual property rights must be
20 * express and approved by Intel in writing.
21 *
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020022 */
23
24#pragma once
Georges-Henri Baroncec86c12012-09-04 17:30:28 +020025#include <string>
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020026#include "XmlDocSource.h"
27#include "XmlSource.h"
28
Georges-Henri Baroncec86c12012-09-04 17:30:28 +020029using std::string;
30
31/**
32 * Source class that uses parameter-framework's structures to create an xml document
33 */
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020034class CXmlMemoryDocSource : public CXmlDocSource
35{
36public:
Georges-Henri Baroncec86c12012-09-04 17:30:28 +020037 /**
38 * Constructor
39 *
40 * @param[in] pXmlSource a pointer to a parameter-framework structure that can generate
41 * an xml description of itself
42 * @param[in] strRootElementType a string containing the root element type
43 * @param[in] strXmlSchemaFile a string containing the path to the schema file
44 * @param[in] strProduct a string containing the product name
45 * @param[in] strVersion a string containing the version number
46 */
47 CXmlMemoryDocSource(const IXmlSource* pXmlSource, const string& strRootElementType,
48 const string& strXmlSchemaFile, const string& strProduct,
49 const string& strVersion);
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020050
Georges-Henri Baroncec86c12012-09-04 17:30:28 +020051 /**
52 * Constructor
53 *
54 * @param[in] pXmlSource a pointer to a parameter-framework structure that can generate
55 * an xml description of itself
56 * @param[in] strRootElementType a string containing the root element type
57 */
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020058 CXmlMemoryDocSource(const IXmlSource* pXmlSource, const string& strRootElementType);
59
Georges-Henri Baroncec86c12012-09-04 17:30:28 +020060 /**
61 * Implementation of CXmlDocSource::populate() method.
62 * Method that popuplates the Xml document using the IXmlSource given in the constructor.
63 *
64 * @param[out] serializingContext is used as error output
65 *
66 * @return false if any error occurs
67 */
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020068 virtual bool populate(CXmlSerializingContext& serializingContext);
69private:
70
Georges-Henri Baroncec86c12012-09-04 17:30:28 +020071 /**
72 * Initialize root element
73 */
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020074 void init();
75
Georges-Henri Baroncec86c12012-09-04 17:30:28 +020076 /**
77 * Xml Source
78 */
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020079 const IXmlSource* _pXmlSource;
80
Georges-Henri Baroncec86c12012-09-04 17:30:28 +020081 /**
82 * Schema file
83 */
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020084 string _strXmlSchemaFile;
85
Georges-Henri Baroncec86c12012-09-04 17:30:28 +020086 /**
87 * Boolean used to specify if a header should be added in the Xml Doc
88 */
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020089 bool _bWithHeader;
90
91 // Product and version info
92 string _strProduct;
93 string _strVersion;
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020094};