Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 1 | /* |
| 2 | * INTEL CONFIDENTIAL |
Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 3 | * Copyright © 2013 Intel |
Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 4 | * 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 Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 22 | */ |
| 23 | |
| 24 | #pragma once |
Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 25 | #include <string> |
Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 26 | #include "XmlDocSource.h" |
| 27 | #include "XmlSource.h" |
| 28 | |
Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 29 | using std::string; |
| 30 | |
| 31 | /** |
| 32 | * Source class that uses parameter-framework's structures to create an xml document |
| 33 | */ |
Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 34 | class CXmlMemoryDocSource : public CXmlDocSource |
| 35 | { |
| 36 | public: |
Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 37 | /** |
| 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 Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 50 | |
Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 51 | /** |
| 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 Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 58 | CXmlMemoryDocSource(const IXmlSource* pXmlSource, const string& strRootElementType); |
| 59 | |
Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 60 | /** |
| 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 Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 68 | virtual bool populate(CXmlSerializingContext& serializingContext); |
| 69 | private: |
| 70 | |
Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 71 | /** |
| 72 | * Initialize root element |
| 73 | */ |
Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 74 | void init(); |
| 75 | |
Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 76 | /** |
| 77 | * Xml Source |
| 78 | */ |
Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 79 | const IXmlSource* _pXmlSource; |
| 80 | |
Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 81 | /** |
| 82 | * Schema file |
| 83 | */ |
Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 84 | string _strXmlSchemaFile; |
| 85 | |
Georges-Henri Baron | cec86c1 | 2012-09-04 17:30:28 +0200 | [diff] [blame] | 86 | /** |
| 87 | * Boolean used to specify if a header should be added in the Xml Doc |
| 88 | */ |
Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 89 | bool _bWithHeader; |
| 90 | |
| 91 | // Product and version info |
| 92 | string _strProduct; |
| 93 | string _strVersion; |
Georges-Henri Baron | 326a31d | 2012-06-28 12:05:09 +0200 | [diff] [blame] | 94 | }; |