Qt 4.8
Public Types | Public Functions | Static Public Functions | Static Private Functions | Properties | List of all members
QPatternist::CallTargetDescription Class Reference

Contains metadata for a callable component, such as a function or template. More...

#include <qcalltargetdescription_p.h>

Inheritance diagram for QPatternist::CallTargetDescription:
QSharedData QPatternist::FunctionSignature

Public Types

typedef QList< PtrList
 
typedef QExplicitlySharedDataPointer< CallTargetDescriptionPtr
 

Public Functions

 CallTargetDescription (const QXmlName &name)
 
QXmlName name () const
 
- Public Functions inherited from QSharedData
 QSharedData ()
 Constructs a QSharedData object with a reference count of 0. More...
 
 QSharedData (const QSharedData &)
 Constructs a QSharedData object with reference count 0. More...
 

Static Public Functions

static void checkCallsiteCircularity (CallTargetDescription::List &signList, const Expression::Ptr expr)
 

Static Private Functions

static void checkArgumentsCircularity (CallTargetDescription::List &signList, const Expression::Ptr callsite)
 

Properties

const QXmlName m_name
 

Additional Inherited Members

- Public Variables inherited from QSharedData
QAtomicInt ref
 

Detailed Description

Contains metadata for a callable component, such as a function or template.

CallTargetDescription can be used directly and is so for templates, but can also be sub-classed which FunctionSignature do.

Author
Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com

Definition at line 80 of file qcalltargetdescription_p.h.

Typedefs

◆ List

Definition at line 84 of file qcalltargetdescription_p.h.

◆ Ptr

Definition at line 83 of file qcalltargetdescription_p.h.

Constructors and Destructors

◆ CallTargetDescription()

CallTargetDescription::CallTargetDescription ( const QXmlName name)

Definition at line 50 of file qcalltargetdescription.cpp.

50  : m_name(name)
51 {
53 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
bool isNull() const
Returns true if this QXmlName is not initialized with a valid combination of {namespace URI}...
Definition: qxmlname.cpp:224

Functions

◆ checkArgumentsCircularity()

void CallTargetDescription::checkArgumentsCircularity ( CallTargetDescription::List signList,
const Expression::Ptr  callsite 
)
staticprivate

Helper function for checkCallsiteCircularity(). If C++ allowed it, it would have been local to it.

Definition at line 60 of file qcalltargetdescription.cpp.

Referenced by checkCallsiteCircularity().

62 {
63  /* Check the arguments. */
64  const Expression::List ops(callsite->operands());
65  const Expression::List::const_iterator end(ops.constEnd());
66  Expression::List::const_iterator it(ops.constBegin());
67 
68  for(; it != end; ++it)
69  checkCallsiteCircularity(signList, *it);
70 }
#define it(className, varName)
friend class const_iterator
Definition: qlist.h:264
static void checkCallsiteCircularity(CallTargetDescription::List &signList, const Expression::Ptr expr)
virtual Expression::List operands() const =0
static const KeyPair *const end

◆ checkCallsiteCircularity()

void CallTargetDescription::checkCallsiteCircularity ( CallTargetDescription::List signList,
const Expression::Ptr  expr 
)
static

Flags callsites to be aware of their recursion by calling UserFunctionCallsite::configureRecursion(), if that is the case.

Note
We pass expr by value here intentionally.

Definition at line 72 of file qcalltargetdescription.cpp.

Referenced by checkArgumentsCircularity(), and QPatternist::yyparse().

74 {
75  Q_ASSERT(expr);
76 
78  {
81  CallSite *const callsite = static_cast<CallSite *>(expr.data());
82 
83  for(; it != end; ++it)
84  {
85  if(callsite->configureRecursion(*it))
86  {
87  /* A callsite inside the function body to the function. This user function
88  * is recursive if it's to the same function, in other words. Which it was
89  * if configureRecursion() returned true. */
90 
91  /* Now we continue and check the arguments of the callsite. That is, the arguments.
92  * This catches for instance local:foo(local:foo(3)). */
93  checkArgumentsCircularity(signList, expr);
94  return;
95  }
96  }
97  /* Check the body of the function so this callsite isn't "indirectly" a
98  * recursive call to the function we're checking. XQTS test case
99  * default_namespace-011 is an example of this. */
100  signList.append(callsite->callTargetDescription());
101  checkCallsiteCircularity(signList, callsite->body());
102  }
103 
104  checkArgumentsCircularity(signList, expr); /* We're done in this case. */
105 }
Abstract base-class for Expression instances that are callsites to other components, such as templates or user functions.
Definition: qcallsite_p.h:72
#define it(className, varName)
static void checkArgumentsCircularity(CallTargetDescription::List &signList, const Expression::Ptr callsite)
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
Definition: qlist.h:269
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
friend class const_iterator
Definition: qlist.h:264
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
T * data() const
Returns a pointer to the shared data object.
Definition: qshareddata.h:145
static void checkCallsiteCircularity(CallTargetDescription::List &signList, const Expression::Ptr expr)
static const KeyPair *const end
bool is(const ID id) const
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:272

◆ name()

QXmlName CallTargetDescription::name ( ) const

The function's name. For example, the name of the signature fn:string() as xs:string is fn:string.

Definition at line 55 of file qcalltargetdescription.cpp.

Referenced by QPatternist::FunctionSignature::displayName(), QPatternist::UserFunctionCallsite::isSignatureValid(), QPatternist::FunctionSignature::operator==(), and QPatternist::ErrorFN::signature().

56 {
57  return m_name;
58 }

Properties

◆ m_name

const QXmlName QPatternist::CallTargetDescription::m_name
private

Definition at line 111 of file qcalltargetdescription_p.h.

Referenced by CallTargetDescription(), and name().


The documentation for this class was generated from the following files: