本文整理汇总了C++中QLibrary::resolve方法的典型用法代码示例。如果您正苦于以下问题:C++ QLibrary::resolve方法的具体用法?C++ QLibrary::resolve怎么用?C++ QLibrary::resolve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLibrary
的用法示例。
在下文中一共展示了QLibrary::resolve方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
void Converter::initialize()
{
initialized = true;
QLibrary libopencc;
libopencc.setFileNameAndVersion("opencc", "1.0.0");
if (!libopencc.load())
return;
opencc_open = (opencc_t (*)(const char *))libopencc.resolve("opencc_open");
if (opencc_open == NULL)
return;
opencc_close = (int (*)(opencc_t))libopencc.resolve("opencc_close");
if (opencc_close == NULL)
return;
opencc_convert_utf8 = (char * (*)(opencc_t, const char *, size_t))libopencc.resolve("opencc_convert_utf8");
if (opencc_convert_utf8 == NULL)
return;
opencc_errno = (opencc_error (*)(void))libopencc.resolve("opencc_errno");
if (opencc_errno == NULL)
return;
opencc_perror = (void (*)(const char *))libopencc.resolve("opencc_perror");
if (opencc_perror == NULL)
return;
s_loaded = true;
}
示例2: foreach
foreach ( QString key, providersList )
{
QLibrary *library = QgsProviderRegistry::instance()->providerLibrary( key );
if ( !library )
continue;
dataCapabilities_t * dataCapabilities = ( dataCapabilities_t * ) cast_to_fptr( library->resolve( "dataCapabilities" ) );
if ( !dataCapabilities )
{
QgsDebugMsg( library->fileName() + " does not have dataCapabilities" );
continue;
}
int capabilities = dataCapabilities();
if ( capabilities == QgsDataProvider::NoDataCapabilities )
{
QgsDebugMsg( library->fileName() + " does not have any dataCapabilities" );
continue;
}
dataItem_t *dataItem = ( dataItem_t * ) cast_to_fptr( library->resolve( "dataItem" ) );
if ( !dataItem )
{
QgsDebugMsg( library->fileName() + " does not have dataItem" );
continue;
}
QgsDataItem *item = dataItem( "", NULL ); // empty path -> top level
if ( item )
{
QgsDebugMsg( "Add new top level item : " + item->name() );
connectItem( item );
providerMap.insertMulti( capabilities, item );
}
}
示例3: FindFunction
virtual Function FindFunction(const char *name) {
if (lib) {
void *fnAddress = (void*)lib->resolve(name);
return static_cast<Function>(fnAddress);
}
return NULL;
}
示例4: defined
Garmin::IDevice * CDeviceGarmin::getDevice()
{
Garmin::IDevice * (*func)(const char*) = 0;
Garmin::IDevice * dev = 0;
#if defined(Q_OS_MAC)
// MacOS X: plug-ins are stored in the bundle folder
QString libname = QString("%1/lib%2" XSTR(SHARED_LIB_EXT))
.arg(QCoreApplication::applicationDirPath().replace(QRegExp("MacOS$"), "Resources/Drivers"))
.arg(devkey);
#else
QString libname = QString("%1/lib%2" XSTR(SHARED_LIB_EXT)).arg(XSTR(PLUGINDIR)).arg(devkey);
#endif
QString funcname = QString("init%1").arg(devkey);
QLibrary lib;
lib.setFileName(libname);
bool lib_loaded = lib.load();
if (lib_loaded)
{
func = (Garmin::IDevice * (*)(const char*))lib.resolve(funcname.toLatin1());
}
if(!lib_loaded || func == 0)
{
QMessageBox warn;
warn.setIcon(QMessageBox::Warning);
warn.setWindowTitle(tr("Error ..."));
warn.setText(tr("Failed to load driver."));
warn.setDetailedText(lib.errorString());
warn.setStandardButtons(QMessageBox::Ok);
warn.exec();
return 0;
}
dev = func(INTERFACE_VERSION);
if(dev == 0)
{
QMessageBox warn;
warn.setIcon(QMessageBox::Warning);
warn.setWindowTitle(tr("Error ..."));
warn.setText(tr("Driver version mismatch."));
QString detail = QString(
tr("The version of your driver plugin \"%1\" does not match the version QLandkarteGT expects (\"%2\").")
).arg(libname).arg(INTERFACE_VERSION);
warn.setDetailedText(detail);
warn.setStandardButtons(QMessageBox::Ok);
warn.exec();
func = 0;
}
if(dev)
{
dev->setPort(port.toLatin1());
dev->setGuiCallback(GUICallback,this);
}
return dev;
}
示例5: resolveFunction
static T resolveFunction(QLibrary &lib, const char *name)
{
T temp = reinterpret_cast<T>(lib.resolve(name));
if (temp == nullptr) {
throw std::runtime_error(QObject::tr("invalid 7-zip32.dll: %1").arg(lib.errorString()).toLatin1().constData());
}
return temp;
}
示例6: supportsTransaction
bool QgsTransaction::supportsTransaction( const QgsVectorLayer* layer )
{
QLibrary* lib = QgsProviderRegistry::instance()->providerLibrary( layer->providerType() );
if ( !lib )
return false;
return lib->resolve( "createTransaction" );
}
示例7: resolve
QFunctionPointer resolve(const char* name)
{
QFunctionPointer ptr = m_libUdev.resolve(name);
if (!ptr) {
qWarning("libudev could not resolve expected symbol %s", name);
m_loaded = false;
}
return ptr;
}
示例8: eCompass_GetVersion
//eComnpass libray funcitons
void eCompass_GetVersion(int *pMajorVer, int *pMinorVer)
{
if(eCompass.isLoaded())
{
pFuncGetVersion eCompass_GetVersion = (pFuncGetVersion) eCompass.resolve("eCompass_GetVersion");
if(eCompass_GetVersion)
{
eCompass_GetVersion(pMajorVer, pMinorVer);
}
}
}
示例9: CAD_Stop
BOOL CAD_Stop(void)
{
if(Nordic.isLoaded())
{
pFuncGetBool CAD_Stop = (pFuncGetBool)Nordic.resolve("CAD_Stop");
if(CAD_Stop)
{
return CAD_Stop();
}
}
return FALSE;
}
示例10: NOR_Open
BOOL NOR_Open(void)
{
if(Nordic.isLoaded())
{
pFuncGetBool NOR_Open = (pFuncGetBool)Nordic.resolve("NOR_Open");
if(NOR_Open)
{
return NOR_Open();
}
}
return FALSE;
}
示例11: CAD_GetCandence
USHORT CAD_GetCandence(void)
{
if(Nordic.isLoaded())
{
pFuncGetUShort CAD_GetCandence = (pFuncGetUShort)Nordic.resolve("CAD_GetCandence");
if(CAD_GetCandence)
{
return CAD_GetCandence();
}
}
return NULL;
}
示例12: HRS_Stop
BOOL HRS_Stop(void)
{
if(Nordic.isLoaded())
{
pFuncGetBool HRS_Stop = (pFuncGetBool)Nordic.resolve("HRS_Stop");
if(HRS_Stop)
{
return HRS_Stop();
}
}
return FALSE;
}
示例13: RTK_GetRxBuf
UCHAR* RTK_GetRxBuf(void)
{
if(Nordic.isLoaded())
{
pFuncGetUCHARPt RTK_GetRxBuf = (pFuncGetUCHARPt)Nordic.resolve("RTK_GetRxBuf");
if(RTK_GetRxBuf)
{
return RTK_GetRxBuf();
}
}
return NULL;
}
示例14: SND_SendTxBuf
BOOL SND_SendTxBuf(UCHAR *ucTxBuf)
{
if(Nordic.isLoaded())
{
pFuncGetBoolParamUCharPt SND_SendTxBuf = (pFuncGetBoolParamUCharPt)Nordic.resolve("SND_SendTxBuf");
if(SND_SendTxBuf)
{
return SND_SendTxBuf(ucTxBuf);
}
}
return FALSE;
}
示例15: RTK_Stop
BOOL RTK_Stop(void)
{
if(Nordic.isLoaded())
{
pFuncGetBool RTK_Stop = (pFuncGetBool)Nordic.resolve("RTK_Stop");
if(RTK_Stop)
{
return RTK_Stop();
}
}
return FALSE;
}