| # khtml Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kjs_traversal.h

    00001 // -*- c-basic-offset: 2 -*-
    00002 /*
    00003  *  This file is part of the KDE libraries
    00004  *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
    00005  *
    00006  *  This library is free software; you can redistribute it and/or
    00007  *  modify it under the terms of the GNU Library General Public
    00008  *  License as published by the Free Software Foundation; either
    00009  *  version 2 of the License, or (at your option) any later version.
    00010  *
    00011  *  This library is distributed in the hope that it will be useful,
    00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00014  *  Library General Public License for more details.
    00015  *
    00016  *  You should have received a copy of the GNU Library General Public
    00017  *  License along with this library; if not, write to the Free Software
    00018  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00019  */
    00020
    00021 #ifndef _KJS_TRAVERSAL_H_
    00022 #define _KJS_TRAVERSAL_H_
    00023
    00024 #include "ecma/kjs_dom.h"
    00025 #include "dom/dom2_traversal.h"
    00026
    00027 namespace KJS {
    00028
    00029   class DOMNodeIterator : public DOMObject {
    00030   public:
    00031     DOMNodeIterator(ExecState *exec, DOM::NodeIterator ni);
    00032     ~DOMNodeIterator();
    00033     virtual Value tryGet(ExecState *exec,const Identifier &p) const;
    00034     Value getValueProperty(ExecState *exec, int token) const;
    00035     // no put - all read-only
    00036     virtual const ClassInfo* classInfo() const { return &info; }
    00037     static const ClassInfo info;
    00038     enum { Filter, Root, WhatToShow, ExpandEntityReferences,
    00039            NextNode, PreviousNode, Detach };
    00040     DOM::NodeIterator toNodeIterator() const { return nodeIterator; }
    00041   protected:
    00042     DOM::NodeIterator nodeIterator;
    00043   };
    00044
    00045   // Constructor object NodeFilter
    00046   class NodeFilterConstructor : public DOMObject {
    00047   public:
    00048     NodeFilterConstructor(ExecState *);
    00049     virtual Value tryGet(ExecState *exec,const Identifier &p) const;
    00050     Value getValueProperty(ExecState *exec, int token) const;
    00051     // no put - all read-only
    00052     virtual const ClassInfo* classInfo() const { return &info; }
    00053     static const ClassInfo info;
    00054   };
    00055
    00056   class DOMNodeFilter : public DOMObject {
    00057   public:
    00058     DOMNodeFilter(ExecState *exec, DOM::NodeFilter nf);
    00059     ~DOMNodeFilter();
    00060     // no put - all read-only
    00061     virtual const ClassInfo* classInfo() const { return &info; }
    00062     static const ClassInfo info;
    00063     virtual DOM::NodeFilter toNodeFilter() const { return nodeFilter; }
    00064     enum { AcceptNode };
    00065   protected:
    00066     DOM::NodeFilter nodeFilter;
    00067   };
    00068
    00069   class DOMTreeWalker : public DOMObject {
    00070   public:
    00071     DOMTreeWalker(ExecState *exec, DOM::TreeWalker tw);
    00072     ~DOMTreeWalker();
    00073     virtual Value tryGet(ExecState *exec,const Identifier &p) const;
    00074     Value getValueProperty(ExecState *exec, int token) const;
    00075     virtual void tryPut(ExecState *exec, const Identifier &propertyName,
    00076                         const Value& value, int attr = None);
    00077     virtual const ClassInfo* classInfo() const { return &info; }
    00078     static const ClassInfo info;
    00079     enum { Root, WhatToShow, Filter, ExpandEntityReferences, CurrentNode,
    00080            ParentNode, FirstChild, LastChild, PreviousSibling, NextSibling,
    00081            PreviousNode, NextNode };
    00082     DOM::TreeWalker toTreeWalker() const { return treeWalker; }
    00083   protected:
    00084     DOM::TreeWalker treeWalker;
    00085   };
    00086
    00087   Value getDOMNodeIterator(ExecState *exec, DOM::NodeIterator ni);
    00088   Value getNodeFilterConstructor(ExecState *exec);
    00089   Value getDOMNodeFilter(ExecState *exec, DOM::NodeFilter nf);
    00090   Value getDOMTreeWalker(ExecState *exec, DOM::TreeWalker tw);
    00091
    00095   DOM::NodeFilter toNodeFilter(const Value&);
    00096
    00097   class JSNodeFilter : public DOM::CustomNodeFilter {
    00098   public:
    00099     JSNodeFilter(Object & _filter);
    00100     virtual ~JSNodeFilter();
    00101     virtual short acceptNode (const DOM::Node &n);
    00102   protected:
    00103     Object filter;
    00104   };
    00105
    00106 } // namespace
    00107
    00108 #endif

This file is part of the documentation for khtml Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:33:19 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003