/src/logging-log4cxx/src/main/include/log4cxx/helpers/xml.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Licensed to the Apache Software Foundation (ASF) under one or more |
3 | | * contributor license agreements. See the NOTICE file distributed with |
4 | | * this work for additional information regarding copyright ownership. |
5 | | * The ASF licenses this file to You under the Apache License, Version 2.0 |
6 | | * (the "License"); you may not use this file except in compliance with |
7 | | * the License. You may obtain a copy of the License at |
8 | | * |
9 | | * http://www.apache.org/licenses/LICENSE-2.0 |
10 | | * |
11 | | * Unless required by applicable law or agreed to in writing, software |
12 | | * distributed under the License is distributed on an "AS IS" BASIS, |
13 | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
14 | | * See the License for the specific language governing permissions and |
15 | | * limitations under the License. |
16 | | */ |
17 | | |
18 | | #ifndef _LOG4CXX_HELPERS_XML_H |
19 | | #define _LOG4CXX_HELPERS_XML_H |
20 | | |
21 | | #include <log4cxx/logstring.h> |
22 | | #include <log4cxx/helpers/object.h> |
23 | | #include <log4cxx/helpers/exception.h> |
24 | | |
25 | | namespace LOG4CXX_NS |
26 | | { |
27 | | class File; |
28 | | namespace helpers |
29 | | { |
30 | | class XMLDOMNode; |
31 | | typedef std::shared_ptr<XMLDOMNode> XMLDOMNodePtr; |
32 | | |
33 | | class XMLDOMDocument; |
34 | | typedef std::shared_ptr<XMLDOMDocument> XMLDOMDocumentPtr; |
35 | | |
36 | | class XMLDOMNodeList; |
37 | | typedef std::shared_ptr<XMLDOMNodeList> XMLDOMNodeListPtr; |
38 | | |
39 | | class LOG4CXX_EXPORT DOMException : public RuntimeException |
40 | | { |
41 | | public: |
42 | 0 | DOMException() : RuntimeException(LOG4CXX_STR("DOM exception")) {} |
43 | | }; |
44 | | |
45 | | |
46 | | /** |
47 | | The XMLDOMNode interface is the primary datatype for the entire Document |
48 | | Object Model. |
49 | | */ |
50 | | class LOG4CXX_EXPORT XMLDOMNode : virtual public Object |
51 | | { |
52 | | public: |
53 | | DECLARE_ABSTRACT_LOG4CXX_OBJECT(XMLDOMNode) |
54 | | enum XMLDOMNodeType |
55 | | { |
56 | | NOT_IMPLEMENTED_NODE = 0, |
57 | | ELEMENT_NODE = 1, |
58 | | DOCUMENT_NODE = 9 |
59 | | }; |
60 | | |
61 | | virtual XMLDOMNodeListPtr getChildNodes() = 0; |
62 | | virtual XMLDOMNodeType getNodeType() = 0; |
63 | | virtual XMLDOMDocumentPtr getOwnerDocument() = 0; |
64 | | }; |
65 | | LOG4CXX_PTR_DEF(XMLDOMNode); |
66 | | |
67 | | |
68 | | /** |
69 | | The XMLDOMElement interface represents an element in an XML document |
70 | | */ |
71 | | class LOG4CXX_EXPORT XMLDOMElement : virtual public XMLDOMNode |
72 | | { |
73 | | public: |
74 | | DECLARE_ABSTRACT_LOG4CXX_OBJECT(XMLDOMElement) |
75 | | virtual LogString getTagName() = 0; |
76 | | virtual LogString getAttribute(const LogString& name) = 0; |
77 | | }; |
78 | | LOG4CXX_PTR_DEF(XMLDOMElement); |
79 | | |
80 | | /** |
81 | | The XMLDOMDocument interface represents an entire XML document. |
82 | | |
83 | | Conceptually, it is the root of the document tree, and provides the |
84 | | primary access to the document's data. |
85 | | */ |
86 | | class LOG4CXX_EXPORT XMLDOMDocument : virtual public XMLDOMNode |
87 | | { |
88 | | public: |
89 | | DECLARE_ABSTRACT_LOG4CXX_OBJECT(XMLDOMDocument) |
90 | | virtual void load(const File& fileName) = 0; |
91 | | virtual XMLDOMElementPtr getDocumentElement() = 0; |
92 | | virtual XMLDOMElementPtr getElementById(const LogString& tagName, |
93 | | const LogString& elementId) = 0; |
94 | | }; |
95 | | LOG4CXX_PTR_DEF(XMLDOMDocument); |
96 | | |
97 | | /** |
98 | | The XMLDOMNodeList interface provides the abstraction of an ordered |
99 | | collection of nodes, without defining or constraining how this |
100 | | collection is implemented. |
101 | | |
102 | | XMLDOMNodeList objects in the DOM are live. |
103 | | |
104 | | The items in the XMLDOMNodeList are accessible via an integral index, |
105 | | starting from 0. |
106 | | */ |
107 | | class LOG4CXX_EXPORT XMLDOMNodeList : virtual public Object |
108 | | { |
109 | | public: |
110 | | DECLARE_ABSTRACT_LOG4CXX_OBJECT(XMLDOMNodeList) |
111 | | virtual int getLength() = 0; |
112 | | virtual XMLDOMNodePtr item(int index) = 0; |
113 | | }; |
114 | | LOG4CXX_PTR_DEF(XMLDOMNodeList); |
115 | | } // namespace helpers |
116 | | } // namespace log4cxx |
117 | | |
118 | | #endif // _LOG4CXX_HELPERS_XML_H |
119 | | |