Public Types | Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
TemplateVariant::Delegate Class Reference

Helper class to create a delegate that can store a function/method call. More...

#include <template.h>

Public Types

typedef TemplateVariant(* StubType) (const void *obj, const QValueList< TemplateVariant > &args)
 

Public Member Functions

 Delegate ()
 
TemplateVariant operator() (const QValueList< TemplateVariant > &args) const
 

Static Public Member Functions

template<class T , TemplateVariant(T::*)(const QValueList< TemplateVariant > &) const TMethod>
static Delegate fromMethod (const T *objectPtr)
 
static Delegate fromFunction (const void *obj, StubType func)
 

Static Private Member Functions

template<class T , TemplateVariant(T::*)(const QValueList< TemplateVariant > &) const TMethod>
static TemplateVariant methodStub (const void *objectPtr, const QValueList< TemplateVariant > &args)
 

Private Attributes

const void * m_objectPtr
 
StubType m_stubPtr
 

Detailed Description

Helper class to create a delegate that can store a function/method call.

Definition at line 94 of file template.h.

Member Typedef Documentation

typedef TemplateVariant(* TemplateVariant::Delegate::StubType) (const void *obj, const QValueList< TemplateVariant > &args)

Callback type to use when creating a delegate from a function.

Definition at line 98 of file template.h.

Constructor & Destructor Documentation

TemplateVariant::Delegate::Delegate ( )
inline

Definition at line 100 of file template.h.

100 : m_objectPtr(0) , m_stubPtr(0) {}
const void * m_objectPtr
Definition: template.h:127

Member Function Documentation

static Delegate TemplateVariant::Delegate::fromFunction ( const void *  obj,
StubType  func 
)
inlinestatic

Creates a delegate given an object, and a plain function.

Definition at line 112 of file template.h.

113  {
114  Delegate d;
115  d.m_objectPtr = obj;
116  d.m_stubPtr = func;
117  return d;
118  }
def func()
Definition: docstring.py:7
template<class T , TemplateVariant(T::*)(const QValueList< TemplateVariant > &) const TMethod>
static Delegate TemplateVariant::Delegate::fromMethod ( const T *  objectPtr)
inlinestatic

Creates a delegate given an object. The method to call is passed as a template parameter

Definition at line 104 of file template.h.

105  {
106  Delegate d;
107  d.m_objectPtr = objectPtr;
108  d.m_stubPtr = &methodStub<T, TMethod>;
109  return d;
110  }
template<class T , TemplateVariant(T::*)(const QValueList< TemplateVariant > &) const TMethod>
static TemplateVariant TemplateVariant::Delegate::methodStub ( const void *  objectPtr,
const QValueList< TemplateVariant > &  args 
)
inlinestaticprivate

Definition at line 131 of file template.h.

132  {
133  T* p = (T*)(objectPtr);
134  return (p->*TMethod)(args);
135  }
static QCString args
Definition: declinfo.cpp:674
p
Definition: test.py:223
TemplateVariant TemplateVariant::Delegate::operator() ( const QValueList< TemplateVariant > &  args) const
inline

Invokes the function/method stored in the delegate

Definition at line 121 of file template.h.

122  {
123  return (*m_stubPtr)(m_objectPtr, args);
124  }
static QCString args
Definition: declinfo.cpp:674
const void * m_objectPtr
Definition: template.h:127

Member Data Documentation

const void* TemplateVariant::Delegate::m_objectPtr
private

Definition at line 127 of file template.h.

StubType TemplateVariant::Delegate::m_stubPtr
private

Definition at line 128 of file template.h.


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