| 1 |
/* |
| 2 |
* Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/> |
| 3 |
* (C) 2020 Vladimir Sadovnikov <[email protected]> |
| 4 |
* |
| 5 |
* This file is part of lsp-runtime-lib |
| 6 |
* Created on: 29 окт. 2019 г. |
| 7 |
* |
| 8 |
* lsp-runtime-lib is free software: you can redistribute it and/or modify |
| 9 |
* it under the terms of the GNU Lesser General Public License as published by |
| 10 |
* the Free Software Foundation, either version 3 of the License, or |
| 11 |
* any later version. |
| 12 |
* |
| 13 |
* lsp-runtime-lib is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU Lesser General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU Lesser General Public License |
| 19 |
* along with lsp-runtime-lib. If not, see <https://www.gnu.org/licenses/>. |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifndef LSP_PLUG_IN_FMT_XML_IXMLHANDLER_H_ |
| 23 |
#define LSP_PLUG_IN_FMT_XML_IXMLHANDLER_H_ |
| 24 |
|
| 25 |
#include <lsp-plug.in/runtime/version.h> |
| 26 |
#include <lsp-plug.in/common/status.h> |
| 27 |
#include <lsp-plug.in/runtime/LSPString.h> |
| 28 |
#include <lsp-plug.in/fmt/xml/const.h> |
| 29 |
|
| 30 |
namespace lsp |
| 31 |
{ |
| 32 |
namespace xml |
| 33 |
{ |
| 34 |
/** |
| 35 |
* Interface for handling XML data |
| 36 |
*/ |
| 37 |
class IXMLHandler |
| 38 |
{ |
| 39 |
private: |
| 40 |
IXMLHandler & operator = (const IXMLHandler &); |
| 41 |
|
| 42 |
public: |
| 43 |
explicit IXMLHandler(); |
| 44 |
virtual ~IXMLHandler(); |
| 45 |
|
| 46 |
public: |
| 47 |
/** |
| 48 |
* Handle start of the document |
| 49 |
* @param xversion the actual XML parser version used |
| 50 |
* @param version the document version, may be NULL |
| 51 |
* @param encoding document encoding, may be NULL |
| 52 |
* @param standalone standalone flag |
| 53 |
* @return status of operation |
| 54 |
*/ |
| 55 |
virtual status_t start_document(xml_version_t xversion, const LSPString *version, const LSPString *encoding, bool standalone); |
| 56 |
|
| 57 |
/** |
| 58 |
* Handle end of the document |
| 59 |
* @return status of operation |
| 60 |
*/ |
| 61 |
virtual status_t end_document(); |
| 62 |
|
| 63 |
/** |
| 64 |
* Handle character data (CDATA) |
| 65 |
* @param cdata character data |
| 66 |
* @return status of operation |
| 67 |
*/ |
| 68 |
virtual status_t cdata(const LSPString *cdata); |
| 69 |
|
| 70 |
/** |
| 71 |
* Handle text data (characters) |
| 72 |
* @param text character data |
| 73 |
* @return status of operation |
| 74 |
*/ |
| 75 |
virtual status_t characters(const LSPString *text); |
| 76 |
|
| 77 |
/** |
| 78 |
* Handle comment |
| 79 |
* @param text text of the comment |
| 80 |
* @return status of operation |
| 81 |
*/ |
| 82 |
virtual status_t comment(const LSPString *text); |
| 83 |
|
| 84 |
/** |
| 85 |
* Handle doctype |
| 86 |
* @param name document type name |
| 87 |
* @param pub public literal |
| 88 |
* @param sys system literal |
| 89 |
* @return status of operation |
| 90 |
*/ |
| 91 |
virtual status_t doctype(const LSPString *name, const LSPString *pub, const LSPString *sys); |
| 92 |
|
| 93 |
/** |
| 94 |
* Resolve entity reference |
| 95 |
* @param value pointer to store the reference value |
| 96 |
* @param name reference name |
| 97 |
* @return status of operation |
| 98 |
*/ |
| 99 |
virtual status_t resolve(LSPString *value, const LSPString *name); |
| 100 |
|
| 101 |
/** |
| 102 |
* Handle start of the element |
| 103 |
* @param name tag name |
| 104 |
* @param atts NULL-terminated list of attributes: even index is name, odd index is value |
| 105 |
* @return status of operation |
| 106 |
*/ |
| 107 |
virtual status_t start_element(const LSPString *name, const LSPString * const *atts); |
| 108 |
|
| 109 |
/** |
| 110 |
* Handle end of the element |
| 111 |
* @param name element name |
| 112 |
* @return status of operation |
| 113 |
*/ |
| 114 |
virtual status_t end_element(const LSPString *name); |
| 115 |
|
| 116 |
/** |
| 117 |
* Processing instruction |
| 118 |
* @param name name of instruction |
| 119 |
* @param args arguments of instruction |
| 120 |
* @return status of operation |
| 121 |
*/ |
| 122 |
virtual status_t processing(const LSPString *name, const LSPString *args); |
| 123 |
}; |
| 124 |
|
| 125 |
} /* namespace xml */ |
| 126 |
} /* namespace lsp */ |
| 127 |
|
| 128 |
#endif /* LSP_PLUG_IN_FMT_XML_IXMLHANDLER_H_ */ |