当前位置: 首页>>代码示例>>C++>>正文


C++ QLibrary::resolve方法代码示例

本文整理汇总了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;
}
开发者ID:multiple1902,项目名称:opencc-gui,代码行数:31,代码来源:converter.cpp

示例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 );
    }
  }
开发者ID:Ariki,项目名称:QGIS,代码行数:35,代码来源:qgsbrowsermodel.cpp

示例3: FindFunction

	virtual Function FindFunction(const char *name) {
		if (lib) {
			void *fnAddress = (void*)lib->resolve(name);
			return static_cast<Function>(fnAddress);
		}
		return NULL;
	}
开发者ID:Nikitaterm,项目名称:rdo_studio,代码行数:7,代码来源:PlatQt.cpp

示例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;
}
开发者ID:Nikoli,项目名称:qlandkartegt,代码行数:59,代码来源:CDeviceGarmin.cpp

示例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;
}
开发者ID:RevReese,项目名称:modorganizer,代码行数:8,代码来源:installationmanager.cpp

示例6: supportsTransaction

bool QgsTransaction::supportsTransaction( const QgsVectorLayer* layer )
{
  QLibrary* lib = QgsProviderRegistry::instance()->providerLibrary( layer->providerType() );
  if ( !lib )
    return false;

  return lib->resolve( "createTransaction" );
}
开发者ID:AM7000000,项目名称:QGIS,代码行数:8,代码来源:qgstransaction.cpp

示例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;
 }
开发者ID:3163504123,项目名称:phantomjs,代码行数:9,代码来源:GamepadsQt.cpp

示例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);
        }
    }
}
开发者ID:bravesheng,项目名称:offroad-navi,代码行数:12,代码来源:ExternalLibrary.cpp

示例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;
}
开发者ID:bravesheng,项目名称:offroad-navi,代码行数:12,代码来源:Nordic.cpp

示例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;
}
开发者ID:bravesheng,项目名称:offroad-navi,代码行数:12,代码来源:Nordic.cpp

示例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;
}
开发者ID:bravesheng,项目名称:offroad-navi,代码行数:12,代码来源:Nordic.cpp

示例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;
}
开发者ID:bravesheng,项目名称:offroad-navi,代码行数:12,代码来源:Nordic.cpp

示例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;
}
开发者ID:bravesheng,项目名称:offroad-navi,代码行数:12,代码来源:Nordic.cpp

示例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;
}
开发者ID:bravesheng,项目名称:offroad-navi,代码行数:12,代码来源:Nordic.cpp

示例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;
}
开发者ID:bravesheng,项目名称:offroad-navi,代码行数:12,代码来源:Nordic.cpp


注:本文中的QLibrary::resolve方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。