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


C++ DynamicIntegerSettingOptions::begin方法代码示例

本文整理汇总了C++中DynamicIntegerSettingOptions::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicIntegerSettingOptions::begin方法的具体用法?C++ DynamicIntegerSettingOptions::begin怎么用?C++ DynamicIntegerSettingOptions::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DynamicIntegerSettingOptions的用法示例。


在下文中一共展示了DynamicIntegerSettingOptions::begin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FillIntegerSettingControl

void CGUIControlSpinExSetting::FillIntegerSettingControl()
{
  CSettingInt *pSettingInt = (CSettingInt *)m_pSetting;
  switch (pSettingInt->GetOptionsType())
  {
    case SettingOptionsTypeStatic:
    {
      const StaticIntegerSettingOptions& options = pSettingInt->GetOptions();
      for (StaticIntegerSettingOptions::const_iterator it = options.begin(); it != options.end(); ++it)
        m_pSpin->AddLabel(g_localizeStrings.Get(it->first), it->second);

      break;
    }

    case SettingOptionsTypeDynamic:
    {
      DynamicIntegerSettingOptions options = pSettingInt->UpdateDynamicOptions();
      for (DynamicIntegerSettingOptions::const_iterator option = options.begin(); option != options.end(); ++option)
        m_pSpin->AddLabel(option->first, option->second);

      break;
    }

    case SettingOptionsTypeNone:
    default:
    {
      std::string strLabel;
      int i = pSettingInt->GetMinimum();
      const CSettingControlSpinner *control = static_cast<const CSettingControlSpinner*>(pSettingInt->GetControl());
      if (control->GetMinimumLabel() > -1)
      {
        strLabel = g_localizeStrings.Get(control->GetMinimumLabel());
        m_pSpin->AddLabel(strLabel, pSettingInt->GetMinimum());
        i += pSettingInt->GetStep();
      }

      for (; i <= pSettingInt->GetMaximum(); i += pSettingInt->GetStep())
      {
        if (control->GetFormatLabel() > -1)
          strLabel = StringUtils::Format(g_localizeStrings.Get(control->GetFormatLabel()).c_str(), i);
        else
          strLabel = StringUtils::Format(control->GetFormatString().c_str(), i);
        m_pSpin->AddLabel(strLabel, i);
      }

      break;
    }
  }

  m_pSpin->SetValue(pSettingInt->GetValue());
}
开发者ID:gellis12,项目名称:xbmc,代码行数:51,代码来源:GUIControlSettings.cpp

示例2: SerializeSettingInt

bool CSettingsOperations::SerializeSettingInt(const CSettingInt* setting, CVariant &obj)
{
  if (setting == NULL)
    return false;

  obj["value"] = setting->GetValue();
  obj["default"] = setting->GetDefault();

  switch (setting->GetOptionsType())
  {
    case SettingOptionsTypeStatic:
    {
      obj["options"] = CVariant(CVariant::VariantTypeArray);
      const StaticIntegerSettingOptions& options = setting->GetOptions();
      for (StaticIntegerSettingOptions::const_iterator itOption = options.begin(); itOption != options.end(); ++itOption)
      {
        CVariant varOption(CVariant::VariantTypeObject);
        varOption["label"] = g_localizeStrings.Get(itOption->first);
        varOption["value"] = itOption->second;
        obj["options"].push_back(varOption);
      }
      break;
    }

    case SettingOptionsTypeDynamic:
    {
      obj["options"] = CVariant(CVariant::VariantTypeArray);
      DynamicIntegerSettingOptions options = const_cast<CSettingInt*>(setting)->UpdateDynamicOptions();
      for (DynamicIntegerSettingOptions::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);
      }
      break;
    }

    case SettingOptionsTypeNone:
    default:
      obj["minimum"] = setting->GetMinimum();
      obj["step"] = setting->GetStep();
      obj["maximum"] = setting->GetMaximum();
      break;
  }

  return true;
}
开发者ID:CEikermann,项目名称:xbmc,代码行数:48,代码来源:SettingsOperations.cpp

示例3: GetIntegerItems

bool CGUIControlListSetting::GetIntegerItems(CSetting *setting, CFileItemList &items)
{
  CSettingInt *pSettingInt = (CSettingInt *)setting;
  switch (pSettingInt->GetOptionsType())
  {
    case SettingOptionsTypeStatic:
    {
      const StaticIntegerSettingOptions& options = pSettingInt->GetOptions();
      for (StaticIntegerSettingOptions::const_iterator it = options.begin(); it != options.end(); ++it)
      {
        CFileItemPtr pItem = GetItem(g_localizeStrings.Get(it->first), it->second);

        if (it->second == pSettingInt->GetValue())
          pItem->Select(true);

        items.Add(pItem);
      }
      break;
    }

    case SettingOptionsTypeDynamic:
    {
      DynamicIntegerSettingOptions options = pSettingInt->UpdateDynamicOptions();
      for (DynamicIntegerSettingOptions::const_iterator option = options.begin(); option != options.end(); ++option)
      {
        CFileItemPtr pItem = GetItem(option->first, option->second);

        if (option->second == pSettingInt->GetValue())
          pItem->Select(true);

        items.Add(pItem);
      }
      break;
    }

    case SettingOptionsTypeNone:
    default:
      return false;
  }

  return true;
}
开发者ID:Micromax-56,项目名称:xbmc,代码行数:42,代码来源:GUIControlSettings.cpp

示例4: GetIntegerItems

bool CGUIControlListSetting::GetIntegerItems(const CSetting *setting, CFileItemList &items)
{
  const CSettingInt *pSettingInt = NULL;
  std::set<int> values;
  if (setting->GetType() == SettingTypeInteger)
  {
    pSettingInt = static_cast<const CSettingInt*>(setting);
    values.insert(pSettingInt->GetValue());
  }
  else if (setting->GetType() == SettingTypeList)
  {
    const CSettingList *settingList = static_cast<const CSettingList*>(setting);
    if (settingList->GetElementType() != SettingTypeInteger)
      return false;

    pSettingInt = static_cast<const CSettingInt*>(settingList->GetDefinition());
    std::vector<CVariant> list = CSettingUtils::GetList(settingList);
    for (std::vector<CVariant>::const_iterator itValue = list.begin(); itValue != list.end(); ++itValue)
    {
      if (!itValue->isInteger())
        return false;
      values.insert((int)itValue->asInteger());
    }
  }
  else
    return false;

  switch (pSettingInt->GetOptionsType())
  {
    case SettingOptionsTypeStatic:
    {
      const StaticIntegerSettingOptions& options = pSettingInt->GetOptions();
      for (StaticIntegerSettingOptions::const_iterator it = options.begin(); it != options.end(); ++it)
      {
        CFileItemPtr pItem = GetItem(g_localizeStrings.Get(it->first), it->second);

        if (values.find(it->second) != values.end())
          pItem->Select(true);

        items.Add(pItem);
      }
      break;
    }

    case SettingOptionsTypeDynamic:
    {
      DynamicIntegerSettingOptions options = const_cast<CSettingInt*>(pSettingInt)->UpdateDynamicOptions();
      for (DynamicIntegerSettingOptions::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);
      }
      break;
    }

    case SettingOptionsTypeNone:
    default:
      return false;
  }

  return true;
}
开发者ID:gellis12,项目名称:xbmc,代码行数:66,代码来源:GUIControlSettings.cpp


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