本文整理汇总了C++中cvariant::const_iterator_array::isString方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator_array::isString方法的具体用法?C++ const_iterator_array::isString怎么用?C++ const_iterator_array::isString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cvariant::const_iterator_array
的用法示例。
在下文中一共展示了const_iterator_array::isString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
bool CDatabaseQueryRule::Load(const CVariant &obj)
{
if (!obj.isObject() ||
!obj.isMember("field") || !obj["field"].isString() ||
!obj.isMember("operator") || !obj["operator"].isString())
return false;
m_field = TranslateField(obj["field"].asString().c_str());
m_operator = TranslateOperator(obj["operator"].asString().c_str());
if (m_operator == OPERATOR_TRUE || m_operator == OPERATOR_FALSE)
return true;
if (!obj.isMember("value") || (!obj["value"].isString() && !obj["value"].isArray()))
return false;
const CVariant &value = obj["value"];
if (value.isString())
m_parameter.push_back(value.asString());
else if (value.isArray())
{
for (CVariant::const_iterator_array val = value.begin_array(); val != value.end_array(); val++)
{
if (val->isString() && !val->asString().empty())
m_parameter.push_back(val->asString());
}
if (m_parameter.empty())
m_parameter.push_back("");
}
else
return false;
return true;
}
示例2: GetCurrentProfile
JSONRPC_STATUS CProfilesOperations::GetCurrentProfile(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
{
const CProfile& currentProfile = CProfilesManager::Get().GetCurrentProfile();
CVariant profileVariant = CVariant(CVariant::VariantTypeObject);
profileVariant["label"] = currentProfile.getName();
for (CVariant::const_iterator_array propertyiter = parameterObject["properties"].begin_array(); propertyiter != parameterObject["properties"].end_array(); ++propertyiter)
{
if (propertyiter->isString())
{
if (propertyiter->asString() == "lockmode")
profileVariant["lockmode"] = currentProfile.getLockMode();
else if (propertyiter->asString() == "thumbnail")
profileVariant["thumbnail"] = currentProfile.getThumb();
}
}
result = profileVariant;
return OK;
}
示例3: CheckForAdditionalProperties
bool CAudioLibrary::CheckForAdditionalProperties(const CVariant &properties, const std::set<std::string> &checkProperties, std::set<std::string> &foundProperties)
{
if (!properties.isArray() || properties.empty())
return false;
std::set<std::string> checkingProperties = checkProperties;
for (CVariant::const_iterator_array itr = properties.begin_array(); itr != properties.end_array() && !checkingProperties.empty(); itr++)
{
if (!itr->isString())
continue;
std::string property = itr->asString();
if (checkingProperties.find(property) != checkingProperties.end())
{
checkingProperties.erase(property);
foundProperties.insert(property);
}
}
return !foundProperties.empty();
}
示例4: GetProfiles
JSONRPC_STATUS CProfilesOperations::GetProfiles(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
{
const std::shared_ptr<CProfileManager> profileManager = CServiceBroker::GetSettingsComponent()->GetProfileManager();
CFileItemList listItems;
for (unsigned int i = 0; i < profileManager->GetNumberOfProfiles(); ++i)
{
const CProfile *profile = profileManager->GetProfile(i);
CFileItemPtr item(new CFileItem(profile->getName()));
item->SetArt("thumb", profile->getThumb());
listItems.Add(item);
}
HandleFileItemList("profileid", false, "profiles", listItems, parameterObject, result);
for (CVariant::const_iterator_array propertyiter = parameterObject["properties"].begin_array(); propertyiter != parameterObject["properties"].end_array(); ++propertyiter)
{
if (propertyiter->isString() &&
propertyiter->asString() == "lockmode")
{
for (CVariant::iterator_array profileiter = result["profiles"].begin_array(); profileiter != result["profiles"].end_array(); ++profileiter)
{
std::string profilename = (*profileiter)["label"].asString();
int index = profileManager->GetProfileIndex(profilename);
const CProfile *profile = profileManager->GetProfile(index);
LockType locktype = LOCK_MODE_UNKNOWN;
if (index == 0)
locktype = profileManager->GetMasterProfile().getLockMode();
else
locktype = profile->getLockMode();
(*profileiter)["lockmode"] = locktype;
}
break;
}
}
return OK;
}