Qt 4.8
qfunctionsignature_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtXmlPatterns module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 //
43 // W A R N I N G
44 // -------------
45 //
46 // This file is not part of the Qt API. It exists purely as an
47 // implementation detail. This header file may change from version to
48 // version without notice, or even be removed.
49 //
50 // We mean it.
51 
52 #ifndef Patternist_FunctionSignature_H
53 #define Patternist_FunctionSignature_H
54 
55 template<typename Key, typename Value> class QHash;
56 template<typename T> class QList;
57 
58 #include <QSharedData>
59 
61 #include "qexpression_p.h"
62 #include "qfunctionargument_p.h"
63 #include "qpatternistlocale_p.h"
64 #include "qprimitives_p.h"
65 
67 
69 
70 namespace QPatternist
71 {
72 
94  {
95  public:
96  enum
97  {
101  UnlimitedArity = -1
102  };
103 
107 
111  typedef qint16 Arity;
112 
114  const Arity minArgs,
115  const Arity maxArgs,
116  const SequenceType::Ptr &returnType,
119 
120  void setArguments(const FunctionArgument::List &args);
121  FunctionArgument::List arguments() const;
122 
128  void appendArgument(const QXmlName::LocalNameCode name,
129  const SequenceType::Ptr &type);
130 
136  bool isArityValid(const xsInteger arity) const;
137 
138  Arity minimumArguments() const;
139  Arity maximumArguments() const;
140 
145  SequenceType::Ptr returnType() const;
146 
152 
165  bool operator==(const FunctionSignature &other) const;
166 
179  QString displayName(const NamePool::Ptr &np) const;
180 
185  Expression::ID id() const;
186 
187  private:
189 
190  const Arity m_minArgs;
191  const Arity m_maxArgs;
192  const SequenceType::Ptr m_returnType;
193  FunctionArgument::List m_arguments;
194  const Expression::Properties m_props;
195  const Expression::ID m_id;
196  };
197 
201  static inline QString formatFunction(const NamePool::Ptr &np, const FunctionSignature::Ptr &func)
202  {
203  return QLatin1String("<span class='XQuery-function'>") +
204  escape(func->displayName(np)) +
205  QLatin1String("</span>");
206  }
207 }
208 
210 
212 
213 #endif
Contains metadata for a callable component, such as a function or template.
int type
Definition: qmetatype.cpp:239
QString Q_AUTOTEST_EXPORT escape(const QString &input)
Similar to Qt::escape(), but also escapes apostrophes and quotes, such that the result is suitable as...
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
NamespaceCode LocalNameCode
Definition: qxmlname.h:84
Base class for all AST nodes in an XPath/XQuery/XSL-T expression.
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
Store names such as namespace bindings and QNames and allows them to be referenced in efficient ways...
Definition: qnamepool_p.h:87
qint64 xsInteger
QExplicitlySharedDataPointer< FunctionSignature > Ptr
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
Definition: qglobal.h:2523
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QHash class is a template class that provides a hash-table-based dictionary.
Definition: qdatastream.h:66
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
static QString formatFunction(const NamePool::Ptr &np, const FunctionSignature::Ptr &func)
Formats FunctionSignature.
A SequenceType instance represents the type of a sequence of Item instances.
const char * name
short qint16
Definition: qglobal.h:935
Represents the signature of an XPath function.
The namespace for the internal API of QtXmlPatterns.
Carries meta data for a function argument as found in XPath&#39;s builtin functions and user declared fun...
QHash< QXmlName, FunctionSignature::Ptr > Hash
QList< FunctionSignature::Ptr > List
The QXmlName class represents the name of an XML node, in an efficient, namespace-aware way...
Definition: qxmlname.h:58
Contains functions used for formatting arguments, such as keywords and paths, in translated strings...
#define Q_AUTOTEST_EXPORT
Definition: qglobal.h:1510
static const QCssKnownValue properties[NumProperties - 1]
Definition: qcssparser.cpp:67
Contains enumerators and typedefs applying for Patternist on a global scale, as well as central docum...
The QFlags class provides a type-safe way of storing OR-combinations of enum values.
Definition: qglobal.h:2313
#define QT_END_HEADER
Definition: qglobal.h:137
bool operator==(QBool b1, bool b2)
Definition: qglobal.h:2023
The QList class is a template class that provides lists.
Definition: qdatastream.h:62