Microsoft Information Protection (MIP) SDK for C++: Reference 1.15
Doxygen-generated documentation for MIP SDK written in C++
Loading...
Searching...
No Matches
xml_delegate.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (c) Microsoft Corporation.
4 * All rights reserved.
5 *
6 * This code is licensed under the MIT License.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files(the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions :
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 *
26 */
27/**
28 * @brief Contains XmlDelegate interface definition used to parse xml recieved by mip
29 *
30 * @file xml_delegate.h
31 */
32
33#ifndef API_MIP_XML_DELEGATE_H_
34#define API_MIP_XML_DELEGATE_H_
35
37#include "mip/xml_document.h"
38#include "mip/xml_reader.h"
39
40MIP_NAMESPACE_BEGIN
41
42namespace xml {
43
44typedef mip::DelegateResponse<mip::xml::XmlDocument> XmlDocumentResult;
45typedef mip::DelegateResponse<mip::xml::XmlReader> XmlReaderResult;
46
47/**
48 * @brief Interface for overriding XML handling (must be capable of handling multiple threads)
49*/
51public:
52 /**
53 * @brief Create an xml reader that can transverse the input. This method will throw an XmlLoadException
54 * if it cannot initialize an XML reader, if the input is invalid, or if the input is too large to handle.
55 *
56 * @param xmlParserInput Input containing either xml in string format or a uri to xml
57 *
58 * @return A delegate response that contains either a shared pointer to a reader
59 * that can look at each node of the xml sequentially, or an XmlLoadException
60 */
61 virtual XmlReaderResult CreateXmlReader(const std::string& xmlParserInput) const = 0;
62
63 /**
64 * @brief Parse an xml formatted buffer into an XmlDocument
65 *
66 * @param data A string that should be in xml format
67 *
68 * @warning The XmlDocument returned should memory manage itself. That is, when it goes out of scope,
69 * it should take care of any free functions needed to release memory. In our native implementation, this is achieved with
70 * a unique_ptr with a specialized deleter function.
71 *
72 * @return A delegate response that contains either a shared_ptr to an XmlDocument or an exception
73 * if parsing fails
74 */
75 virtual XmlDocumentResult ParseData(const std::string& data) const = 0;
76
77 /** @cond DOXYGEN_HIDE */
78 virtual ~XmlDelegate() {}
79 /** @endcond */
80};
81
82} // xml
83
84MIP_NAMESPACE_END
85#endif // API_MIP_XML_DELEGATE_H_
86
Interface for overriding XML handling (must be capable of handling multiple threads)
virtual XmlReaderResult CreateXmlReader(const std::string &xmlParserInput) const =0
Create an xml reader that can transverse the input.
virtual XmlDocumentResult ParseData(const std::string &data) const =0
Parse an xml formatted buffer into an XmlDocument.
A simple framework to create a response to delegate calls that can result in error.
mip::DelegateResponse< mip::xml::XmlReader > XmlReaderResult
mip::DelegateResponse< mip::xml::XmlDocument > XmlDocumentResult
Contains XmlDocument interface definition used to interact with xml parsers.
A file containing the XmlReader interface.