OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> | 2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> |
3 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } | 178 } |
179 | 179 |
180 Node* XPathResult::iterateNext(ExceptionCode& ec) | 180 Node* XPathResult::iterateNext(ExceptionCode& ec) |
181 { | 181 { |
182 if (resultType() != UNORDERED_NODE_ITERATOR_TYPE && resultType() != ORDERED_
NODE_ITERATOR_TYPE) { | 182 if (resultType() != UNORDERED_NODE_ITERATOR_TYPE && resultType() != ORDERED_
NODE_ITERATOR_TYPE) { |
183 ec = TypeError; | 183 ec = TypeError; |
184 return 0; | 184 return 0; |
185 } | 185 } |
186 | 186 |
187 if (invalidIteratorState()) { | 187 if (invalidIteratorState()) { |
188 ec = INVALID_STATE_ERR; | 188 ec = InvalidStateError; |
189 return 0; | 189 return 0; |
190 } | 190 } |
191 | 191 |
192 if (m_nodeSetPosition + 1 > m_nodeSet.size()) | 192 if (m_nodeSetPosition + 1 > m_nodeSet.size()) |
193 return 0; | 193 return 0; |
194 | 194 |
195 Node* node = m_nodeSet[m_nodeSetPosition]; | 195 Node* node = m_nodeSet[m_nodeSetPosition]; |
196 | 196 |
197 m_nodeSetPosition++; | 197 m_nodeSetPosition++; |
198 | 198 |
199 return node; | 199 return node; |
200 } | 200 } |
201 | 201 |
202 Node* XPathResult::snapshotItem(unsigned long index, ExceptionCode& ec) | 202 Node* XPathResult::snapshotItem(unsigned long index, ExceptionCode& ec) |
203 { | 203 { |
204 if (resultType() != UNORDERED_NODE_SNAPSHOT_TYPE && resultType() != ORDERED_
NODE_SNAPSHOT_TYPE) { | 204 if (resultType() != UNORDERED_NODE_SNAPSHOT_TYPE && resultType() != ORDERED_
NODE_SNAPSHOT_TYPE) { |
205 ec = TypeError; | 205 ec = TypeError; |
206 return 0; | 206 return 0; |
207 } | 207 } |
208 | 208 |
209 const NodeSet& nodes = m_value.toNodeSet(); | 209 const NodeSet& nodes = m_value.toNodeSet(); |
210 if (index >= nodes.size()) | 210 if (index >= nodes.size()) |
211 return 0; | 211 return 0; |
212 | 212 |
213 return nodes[index]; | 213 return nodes[index]; |
214 } | 214 } |
215 | 215 |
216 } | 216 } |
OLD | NEW |