Qt 4.8
Public Functions | Protected Functions | List of all members
QGLContextGroupResource< T > Class Template Reference

#include <qgl_p.h>

Inheritance diagram for QGLContextGroupResource< T >:
QGLContextGroupResourceBase

Public Functions

T * value (const QGLContext *context)
 
 ~QGLContextGroupResource ()
 
- Public Functions inherited from QGLContextGroupResourceBase
 QGLContextGroupResourceBase ()
 
virtual ~QGLContextGroupResourceBase ()
 
void insert (const QGLContext *context, void *value)
 
void * value (const QGLContext *context)
 
void cleanup (const QGLContext *context)
 
void cleanup (const QGLContext *context, void *value)
 
virtual void contextDeleted (const QGLContext *ctx)
 

Protected Functions

void freeResource (void *resource)
 

Additional Inherited Members

- Protected Variables inherited from QGLContextGroupResourceBase
QList< QGLContextGroup * > m_groups
 

Detailed Description

template<class T>
class QGLContextGroupResource< T >

Definition at line 761 of file qgl_p.h.

Constructors and Destructors

◆ ~QGLContextGroupResource()

template<class T>
QGLContextGroupResource< T >::~QGLContextGroupResource ( )
inline

Definition at line 764 of file qgl_p.h.

764  {
765  for (int i = 0; i < m_groups.size(); ++i) {
766  const QGLContext *context = m_groups.at(i)->context();
767  T *resource = reinterpret_cast<T *>(QGLContextGroupResourceBase::value(context));
768  if (resource) {
769  QGLShareContextScope scope(context);
770  delete resource;
771  }
772  }
773  }
void * value(const QGLContext *context)
Definition: qgl.cpp:5922
QList< QGLContextGroup * > m_groups
Definition: qgl_p.h:743
The QGLContext class encapsulates an OpenGL rendering context.
Definition: qgl.h:310
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
const QGLContext * context() const
Definition: qgl_p.h:252

Functions

◆ freeResource()

template<class T>
void QGLContextGroupResource< T >::freeResource ( void *  resource)
inlineprotectedvirtual

Implements QGLContextGroupResourceBase.

Definition at line 785 of file qgl_p.h.

785  {
786  delete reinterpret_cast<T *>(resource);
787  }

◆ value()

template<class T>
T* QGLContextGroupResource< T >::value ( const QGLContext context)
inline

Definition at line 775 of file qgl_p.h.

Referenced by QGL2GradientCacheWrapper::cacheForContext(), QGLTextureGlyphCache::createTextureData(), QGLTextureGlyphCache::fillTexture(), QGLTextureGlyphCache::height(), QGLTextureGlyphCache::resizeTextureData(), QGLShaderStorage::shadersForThread(), QGLTextureGlyphCache::texture(), and QGLTextureGlyphCache::width().

775  {
776  T *resource = reinterpret_cast<T *>(QGLContextGroupResourceBase::value(context));
777  if (!resource) {
778  resource = new T(context);
779  insert(context, resource);
780  }
781  return resource;
782  }
void * value(const QGLContext *context)
Definition: qgl.cpp:5922
void insert(const QGLContext *context, void *value)
Definition: qgl.cpp:5910

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