KHtml

functions.h
1 /*
2  * functions.h - Copyright 2005 Frerich Raabe <[email protected]>
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 #ifndef FUNCTIONS_H
26 #define FUNCTIONS_H
27 
28 #include "expression.h"
29 
30 #include <QHash>
31 #include <QList>
32 
33 #include "dom/dom_string.h"
34 #include "xml/dom_stringimpl.h"
35 
36 namespace khtml
37 {
38 namespace XPath
39 {
40 
41 class Function : public Expression
42 {
43 public:
44  void setArguments(const QList<Expression *> &args);
45  void setName(const DOM::DOMString &name);
46 
47  QString dump() const override;
48 
49 protected:
50  Expression *arg(int pos);
51  const Expression *arg(int pos) const;
52  unsigned int argCount() const;
53  DOM::DOMString name() const;
54 
55 private:
56  DOM::DOMString m_name;
57 };
58 
59 class FunctionLibrary
60 {
61  friend struct FunctionMapping;
62 public:
63  static FunctionLibrary &self();
64 
65  Function *getFunction(const DOM::DOMString &name,
66  const QList<Expression *> &args = QList<Expression *>()) const;
67 
68 private:
69  struct FunctionRec;
70 
71  FunctionLibrary();
72  FunctionLibrary(const FunctionLibrary &rhs);
73  FunctionLibrary &operator=(const FunctionLibrary &rhs);
74 
76 };
77 
78 } // namespace XPath
79 
80 } // namespace khtml
81 
82 #endif // FUNCTIONS_H
83 
QString name(const QVariant &location)
This file is part of the HTML rendering engine for KDE.
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Oct 25 2021 22:48:14 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.