本文整理汇总了C++中QStringMap::keys方法的典型用法代码示例。如果您正苦于以下问题:C++ QStringMap::keys方法的具体用法?C++ QStringMap::keys怎么用?C++ QStringMap::keys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStringMap
的用法示例。
在下文中一共展示了QStringMap::keys方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertToVariant
QVariantMap convertToVariant(const QStringMap &val)
{
QVariantMap ret;
for(const QString &k : val.keys())
{
ret[k] = val[k];
}
return ret;
}
示例2: Invoke
QVariant MethodInfo::Invoke( Service *pService, const QStringMap &reqParams )
{
HttpRedirectException exception;
bool bExceptionThrown = false;
QStringMap lowerParams;
if (!pService)
throw;
// Change params to lower case for case-insensitive comparison
QStringMap::const_iterator it = reqParams.begin();
for (; it != reqParams.end(); ++it)
{
lowerParams[it.key().toLower()] = *it;
}
// --------------------------------------------------------------
// Provide actual parameters received to method
// --------------------------------------------------------------
pService->m_parsedParams = lowerParams.keys();
QList<QByteArray> paramNames = m_oMethod.parameterNames();
QList<QByteArray> paramTypes = m_oMethod.parameterTypes();
// ----------------------------------------------------------------------
// Create Parameter array (Can't have more than _MAX_PARAMS parameters)....
// switched to static array for performance.
// ----------------------------------------------------------------------
void *param[ _MAX_PARAMS ];
int types[ _MAX_PARAMS ];
memset( param, 0, _MAX_PARAMS * sizeof(void *));
memset( types, 0, _MAX_PARAMS * sizeof(int));
try
{
// --------------------------------------------------------------
// Add a place for the Return value
// --------------------------------------------------------------
int nRetIdx = QMetaType::type( m_oMethod.typeName() );
if (nRetIdx != 0)
{
param[ 0 ] = QMetaType::create( nRetIdx );
types[ 0 ] = nRetIdx;
}
else
{
param[ 0 ] = nullptr;
types[ 0 ] = 0;
}
// --------------------------------------------------------------
// Fill in parameters from request values
// --------------------------------------------------------------
for( int nIdx = 0; nIdx < paramNames.length(); nIdx++ )
{
QString sValue = lowerParams[ paramNames[ nIdx ].toLower() ];
QString sParamType = paramTypes[ nIdx ];
int nId = QMetaType::type( paramTypes[ nIdx ] );
void *pParam = nullptr;
if (nId != 0)
{
pParam = QMetaType::create( nId );
}
else
{
LOG(VB_GENERAL, LOG_ERR,
QString("MethodInfo::Invoke - Type unknown '%1'")
.arg(sParamType));
}
types[nIdx+1] = nId;
param[nIdx+1] = pService->ConvertToParameterPtr( nId, sParamType,
pParam, sValue );
}
#if 0
QThread *currentThread = QThread::currentThread();
QThread *objectThread = pService->thread();
if (currentThread == objectThread)
LOG(VB_HTTP, LOG_DEBUG, "*** Threads are same ***");
else
LOG(VB_HTTP, LOG_DEBUG, "*** Threads are Different!!! ***");
#endif
pService->qt_metacall( QMetaObject::InvokeMetaMethod,
m_nMethodIndex,
param );
// --------------------------------------------------------------
// Delete param array, skip return parameter since not dynamically
//.........这里部分代码省略.........