File indexing completed on 2024-04-28 15:22:56
0001 /* 0002 * dom3_xpath.h - Copyright 2005 Frerich Raabe <raabe@kde.org> 0003 * Copyright 2010 Maksim Orlovich <maksim@kde.org> 0004 * Copyright 1999 Lars Knoll (knoll@kde.org) 0005 * 0006 * This library is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU Library General Public 0008 * License as published by the Free Software Foundation; either 0009 * version 2 of the License, or (at your option) any later version. 0010 * 0011 * This library is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 * Library General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU Library General Public License 0017 * along with this library; see the file COPYING.LIB. If not, write to 0018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0019 * Boston, MA 02110-1301, USA. 0020 * 0021 * Based on kdomxpath.h, which was licensed as follows: 0022 * Redistribution and use in source and binary forms, with or without 0023 * modification, are permitted provided that the following conditions 0024 * are met: 0025 * 0026 * 1. Redistributions of source code must retain the above copyright 0027 * notice, this list of conditions and the following disclaimer. 0028 * 2. Redistributions in binary form must reproduce the above copyright 0029 * notice, this list of conditions and the following disclaimer in the 0030 * documentation and/or other materials provided with the distribution. 0031 * 0032 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 0033 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 0034 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 0035 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 0036 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 0037 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 0038 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 0039 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0040 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 0041 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0042 * 0043 */ 0044 #ifndef DOM3_XPATH_H 0045 #define DOM3_XPATH_H 0046 0047 #include <dom_string.h> 0048 0049 namespace DOM 0050 { 0051 0052 enum XPathExceptionCode { 0053 INVALID_EXPRESSION_ERR = 51, 0054 TYPE_ERR = 52 0055 }; 0056 0057 namespace XPath 0058 { 0059 enum XPathResultType { 0060 ANY_TYPE = 0, 0061 NUMBER_TYPE = 1, 0062 STRING_TYPE = 2, 0063 BOOLEAN_TYPE = 3, 0064 UNORDERED_NODE_ITERATOR_TYPE = 4, 0065 ORDERED_NODE_ITERATOR_TYPE = 5, 0066 UNORDERED_NODE_SNAPSHOT_TYPE = 6, 0067 ORDERED_NODE_SNAPSHOT_TYPE = 7, 0068 ANY_UNORDERED_NODE_TYPE = 8, 0069 FIRST_ORDERED_NODE_TYPE = 9 0070 }; 0071 } 0072 0073 class KHTML_EXPORT XPathException 0074 { 0075 public: 0076 XPathException(unsigned short _code) 0077 { 0078 code = _code; 0079 } 0080 XPathException(const XPathException &other) 0081 { 0082 code = other.code; 0083 } 0084 0085 XPathException &operator = (const XPathException &other) 0086 { 0087 code = other.code; 0088 return *this; 0089 } 0090 0091 virtual ~XPathException() {} 0092 0093 /** 0094 * An integer indicating the type of error generated, as given by DOM L3 XPath 0095 * 0096 */ 0097 unsigned short code; 0098 0099 enum XPathExceptionCode { 0100 INVALID_EXPRESSION_ERR = 51, 0101 TYPE_ERR = 52, 0102 0103 _EXCEPTION_OFFSET = 4000, 0104 _EXCEPTION_MAX = 4999 0105 }; 0106 0107 DOMString codeAsString() const; 0108 static DOMString codeAsString(int xpathCode); 0109 0110 /** @internal - converts XPath exception code to internal code */ 0111 static int toCode(int xpathCode); 0112 0113 /** @internal - checks to see whether internal code is an XPath one */ 0114 static bool isXPathExceptionCode(int exceptioncode); 0115 }; 0116 0117 } 0118 0119 #endif // DOM3_XPATH_H 0120