本文整理汇总了C++中DynamicStringSettingOptions::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicStringSettingOptions::begin方法的具体用法?C++ DynamicStringSettingOptions::begin怎么用?C++ DynamicStringSettingOptions::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynamicStringSettingOptions
的用法示例。
在下文中一共展示了DynamicStringSettingOptions::begin方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetStringItems
bool CGUIControlListSetting::GetStringItems(const CSetting *setting, CFileItemList &items)
{
const CSettingString *pSettingString = NULL;
std::set<std::string> values;
if (setting->GetType() == SettingTypeString)
{
pSettingString = static_cast<const CSettingString*>(setting);
values.insert(pSettingString->GetValue());
}
else if (setting->GetType() == SettingTypeList)
{
const CSettingList *settingList = static_cast<const CSettingList*>(setting);
if (settingList->GetElementType() != SettingTypeString)
return false;
pSettingString = static_cast<const CSettingString*>(settingList->GetDefinition());
std::vector<CVariant> list = CSettingUtils::GetList(settingList);
for (std::vector<CVariant>::const_iterator itValue = list.begin(); itValue != list.end(); ++itValue)
{
if (!itValue->isString())
return false;
values.insert(itValue->asString());
}
}
else
return false;
if (pSettingString->GetOptionsType() == SettingOptionsTypeDynamic)
{
DynamicStringSettingOptions options = const_cast<CSettingString*>(pSettingString)->UpdateDynamicOptions();
for (DynamicStringSettingOptions::const_iterator option = options.begin(); option != options.end(); ++option)
{
CFileItemPtr pItem = GetItem(option->first, option->second);
if (values.find(option->second) != values.end())
pItem->Select(true);
items.Add(pItem);
}
}
else
return false;
return true;
}
示例2: GetItems
bool CGUIControlListSetting::GetItems(CSetting *setting, CFileItemList &items)
{
switch (setting->GetControl().GetFormat())
{
case SettingControlFormatInteger:
return GetIntegerItems(setting, items);
case SettingControlFormatString:
{
if (setting->GetType() == SettingTypeInteger)
return GetIntegerItems(setting, items);
else if (setting->GetType() == SettingTypeString)
{
CSettingString *pSettingString = (CSettingString *)setting;
if (pSettingString->GetOptionsType() == SettingOptionsTypeDynamic)
{
DynamicStringSettingOptions options = pSettingString->UpdateDynamicOptions();
for (DynamicStringSettingOptions::const_iterator option = options.begin(); option != options.end(); ++option)
{
CFileItemPtr pItem = GetItem(option->first, option->second);
if (StringUtils::EqualsNoCase(option->second, pSettingString->GetValue()))
pItem->Select(true);
items.Add(pItem);
}
}
}
break;
}
default:
return false;
}
return true;
}
示例3: SerializeSettingString
bool CSettingsOperations::SerializeSettingString(const CSettingString* setting, CVariant &obj)
{
if (setting == NULL)
return false;
obj["value"] = setting->GetValue();
obj["default"] = setting->GetDefault();
obj["allowempty"] = setting->AllowEmpty();
if (setting->GetOptionsType() == SettingOptionsTypeDynamic)
{
obj["options"] = CVariant(CVariant::VariantTypeArray);
DynamicStringSettingOptions options = const_cast<CSettingString*>(setting)->UpdateDynamicOptions();
for (DynamicStringSettingOptions::const_iterator itOption = options.begin(); itOption != options.end(); ++itOption)
{
CVariant varOption(CVariant::VariantTypeObject);
varOption["label"] = itOption->first;
varOption["value"] = itOption->second;
obj["options"].push_back(varOption);
}
}
const ISettingControl* control = setting->GetControl();
if (control->GetFormat() == "path")
{
if (!SerializeSettingPath(static_cast<const CSettingPath*>(setting), obj))
return false;
}
if (control->GetFormat() == "addon")
{
if (!SerializeSettingAddon(static_cast<const CSettingAddon*>(setting), obj))
return false;
}
return true;
}
示例4: GetStringOptions
static bool GetStringOptions(const CSetting* setting, DynamicStringSettingOptions& options, std::set<std::string>& selectedOptions)
{
const CSettingString *pSettingString = NULL;
if (setting->GetType() == SettingTypeString)
{
pSettingString = static_cast<const CSettingString*>(setting);
selectedOptions.insert(pSettingString->GetValue());
}
else if (setting->GetType() == SettingTypeList)
{
const CSettingList *settingList = static_cast<const CSettingList*>(setting);
if (settingList->GetElementType() != SettingTypeString)
return false;
pSettingString = static_cast<const CSettingString*>(settingList->GetDefinition());
std::vector<CVariant> list = CSettingUtils::GetList(settingList);
for (const auto& itValue : list)
{
if (!itValue.isString())
return false;
selectedOptions.insert(itValue.asString());
}
}
else
return false;
if (pSettingString->GetOptionsType() == SettingOptionsTypeDynamic)
{
DynamicStringSettingOptions settingOptions = const_cast<CSettingString*>(pSettingString)->UpdateDynamicOptions();
options.insert(options.end(), settingOptions.begin(), settingOptions.end());
}
else
return false;
return true;
}
示例5: FillControl
void CGUIControlSpinExSetting::FillControl()
{
m_pSpin->Clear();
switch (m_pSetting->GetControl().GetFormat())
{
case SettingControlFormatNumber:
{
CSettingNumber *pSettingNumber = (CSettingNumber *)m_pSetting;
m_pSpin->SetType(SPIN_CONTROL_TYPE_FLOAT);
m_pSpin->SetFloatRange((float)pSettingNumber->GetMinimum(), (float)pSettingNumber->GetMaximum());
m_pSpin->SetFloatInterval((float)pSettingNumber->GetStep());
m_pSpin->SetFloatValue((float)pSettingNumber->GetValue());
break;
}
case SettingControlFormatInteger:
{
m_pSpin->SetType(SPIN_CONTROL_TYPE_TEXT);
FillIntegerSettingControl();
break;
}
case SettingControlFormatString:
{
m_pSpin->SetType(SPIN_CONTROL_TYPE_TEXT);
if (m_pSetting->GetType() == SettingTypeInteger)
FillIntegerSettingControl();
else if (m_pSetting->GetType() == SettingTypeString)
{
CSettingString *pSettingString = (CSettingString *)m_pSetting;
if (pSettingString->GetOptionsType() == SettingOptionsTypeDynamic)
{
DynamicStringSettingOptions options = pSettingString->UpdateDynamicOptions();
for (std::vector< std::pair<std::string, std::string> >::const_iterator option = options.begin(); option != options.end(); ++option)
m_pSpin->AddLabel(option->first, option->second);
m_pSpin->SetStringValue(pSettingString->GetValue());
}
}
break;
}
default:
break;
}
}