Qt 4.8
Classes | Macros | Functions | Variables
qxlibstatic.cpp File Reference
#include "qxlibstatic.h"
#include "qxlibscreen.h"
#include "qxlibdisplay.h"
#include <qplatformdefs.h>
#include <QtGui/private/qapplication_p.h>
#include <QtCore/QBuffer>
#include <QtCore/QLibrary>
#include <QDebug>

Go to the source code of this file.

Classes

class  QTestLiteStaticInfoPrivate
 

Macros

#define XFIXES_LOAD_RUNTIME(vernum, symbol, symbol_type)   (symbol_type)qt_load_library_runtime("libXfixes", vernum, 4, #symbol);
 
#define XFIXES_LOAD_V1(symbol)   XFIXES_LOAD_RUNTIME(1, symbol, Ptr##symbol)
 
#define XFIXES_LOAD_V2(symbol)   XFIXES_LOAD_RUNTIME(2, symbol, Ptr##symbol)
 

Functions

 Q_GLOBAL_STATIC (QTestLiteStaticInfoPrivate, qTestLiteStaticInfoPrivate)
 
static void * qt_load_library_runtime (const char *library, int vernum, int highestVernum, const char *symbol)
 Try to resolve a symbol from library with the version specified by vernum. More...
 

Variables

static const char * x11_atomnames
 

Macro Definition Documentation

◆ XFIXES_LOAD_RUNTIME

#define XFIXES_LOAD_RUNTIME (   vernum,
  symbol,
  symbol_type 
)    (symbol_type)qt_load_library_runtime("libXfixes", vernum, 4, #symbol);

Definition at line 247 of file qxlibstatic.cpp.

◆ XFIXES_LOAD_V1

#define XFIXES_LOAD_V1 (   symbol)    XFIXES_LOAD_RUNTIME(1, symbol, Ptr##symbol)

Definition at line 249 of file qxlibstatic.cpp.

Referenced by qt_init(), and QTestLiteStaticInfoPrivate::resolveXFixes().

◆ XFIXES_LOAD_V2

#define XFIXES_LOAD_V2 (   symbol)    XFIXES_LOAD_RUNTIME(2, symbol, Ptr##symbol)

Definition at line 251 of file qxlibstatic.cpp.

Referenced by qt_init(), and QTestLiteStaticInfoPrivate::resolveXFixes().

Function Documentation

◆ Q_GLOBAL_STATIC()

Q_GLOBAL_STATIC ( QTestLiteStaticInfoPrivate  ,
qTestLiteStaticInfoPrivate   
)

◆ qt_load_library_runtime()

static void* qt_load_library_runtime ( const char *  library,
int  vernum,
int  highestVernum,
const char *  symbol 
)
static

Try to resolve a symbol from library with the version specified by vernum.

Warning
This function is not part of the public interface.

Note that, in the case of the Xfixes library, vernum is not the same as XFIXES_MAJOR - it is a part of soname and may differ from the Xfixes version.

Definition at line 224 of file qxlibstatic.cpp.

226 {
227  QList<int> versions;
228  // we try to load in the following order:
229  // explicit version -> the default one -> (from the highest (highestVernum) to the lowest (vernum) )
230  if (vernum != -1)
231  versions << vernum;
232  versions << -1;
233  if (vernum != -1) {
234  for(int i = highestVernum; i > vernum; --i)
235  versions << i;
236  }
237  Q_FOREACH(int version, versions) {
238  QLatin1String libName(library);
239  QLibrary xfixesLib(libName, version);
240  void *ptr = xfixesLib.resolve(symbol);
241  if (ptr)
242  return ptr;
243  }
244  return 0;
245 }
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
const T * ptr(const T &t)
#define Q_FOREACH(variable, container)
Same as foreach(variable, container).
Definition: qglobal.h:2435
The QLibrary class loads shared libraries at runtime.
Definition: qlibrary.h:62

Variable Documentation

◆ x11_atomnames

const char* x11_atomnames
static

Definition at line 54 of file qxlibstatic.cpp.

Referenced by QTestLiteStaticInfoPrivate::initializeAllAtoms().