2 Copyright (C) 2000-2005 SKYRIX Software AG
4 This file is part of SOPE.
6 SOPE is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with SOPE; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #include "DOMNode+Enum.h"
25 @interface _DOMNodeParentNodeEnumerator : NSEnumerator
29 + (id)enumeratorWithDOMNode:(id)_node;
32 @implementation NSObject(DOMNodeEnum)
34 - (NSEnumerator *)domParentNodeEnumerator {
35 return [_DOMNodeParentNodeEnumerator enumeratorWithDOMNode:
36 [(NGDOMNode *)self parentNode]];
39 @end /* NSObject(DOMNodeEnum) */
41 @implementation NGDOMNode(Enum)
43 - (NSEnumerator *)parentNodeEnumerator {
44 return [self domParentNodeEnumerator];
47 @end /* NGDOMNode(Enum) */
49 @implementation _DOMNodeParentNodeEnumerator
51 + (id)enumeratorWithDOMNode:(id)_node {
52 _DOMNodeParentNodeEnumerator *e;
54 e->currentNode = [_node retain];
55 return [e autorelease];
59 [self->currentNode release];
66 old = self->currentNode;
67 self->currentNode = [[old parentNode] retain];
68 return [old autorelease];
71 @end /* _DOMNodeParentNodeEnumerator */