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


C++ CSetting::GetType方法代码示例

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


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

示例1: ResetSettingValue

JSONRPC_STATUS CSettingsOperations::ResetSettingValue(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
{
  string settingId = parameterObject["setting"].asString();

  CSetting* setting = CSettings::Get().GetSetting(settingId);
  if (setting == NULL ||
      !setting->IsVisible())
    return InvalidParams;

  switch (setting->GetType())
  {
  case SettingTypeBool:
  case SettingTypeInteger:
  case SettingTypeNumber:
  case SettingTypeString:
  case SettingTypeList:
    setting->Reset();
    break;

  case SettingTypeNone:
  case SettingTypeAction:
  default:
    return InvalidParams;
  }

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

示例2: GetSettingsGroup

// get all the settings beginning with the term "strGroup"
void CGUISettings::GetSettingsGroup(const char *strGroup, vecSettings &settings)
{
  vecSettings unorderedSettings;
  for (mapIter it = settingsMap.begin(); it != settingsMap.end(); it++)
  {
    if ((*it).first.Left(strlen(strGroup)).Equals(strGroup) && (*it).second->GetOrder() > 0 && !(*it).second->IsAdvanced())
      unorderedSettings.push_back((*it).second);
  }
  // now order them...
  sort(unorderedSettings.begin(), unorderedSettings.end(), sortsettings());

  // remove any instances of 2 separators in a row
  bool lastWasSeparator(false);
  for (vecSettings::iterator it = unorderedSettings.begin(); it != unorderedSettings.end(); it++)
  {
    CSetting *setting = *it;
    // only add separators if we don't have 2 in a row
    if (setting->GetType() == SETTINGS_TYPE_SEPARATOR)
    {
      if (!lastWasSeparator)
        settings.push_back(setting);
      lastWasSeparator = true;
    }
    else
    {
      lastWasSeparator = false;
      settings.push_back(setting);
    }
  }
}
开发者ID:Rocky5,项目名称:XBMC4Kids,代码行数:31,代码来源:GUISettings.cpp

示例3: GetList

std::vector<CVariant> CSettings::GetList(const std::string &id) const
{
  CSetting *setting = m_settingsManager->GetSetting(id);
  if (setting == NULL || setting->GetType() != SettingTypeList)
    return std::vector<CVariant>();

  return CSettingUtils::GetList(static_cast<CSettingList*>(setting));
}
开发者ID:CEikermann,项目名称:xbmc,代码行数:8,代码来源:Settings.cpp

示例4: SetList

bool CSettings::SetList(const std::string &id, const std::vector<CVariant> &value)
{
  CSetting *setting = m_settingsManager->GetSetting(id);
  if (setting == NULL || setting->GetType() != SettingTypeList)
    return false;

  return CSettingUtils::SetList(static_cast<CSettingList*>(setting), value);
}
开发者ID:CEikermann,项目名称:xbmc,代码行数:8,代码来源:Settings.cpp

示例5: SetList

bool CSettings::SetList(const std::string &id, const std::vector<CVariant> &value)
{
  CSetting *setting = m_settingsManager->GetSetting(id);
  if (setting == NULL || setting->GetType() != SettingTypeList)
    return false;

  CSettingList *listSetting = static_cast<CSettingList*>(setting);
  SettingPtrList newValues;
  bool ret = true;
  int index = 0;
  for (std::vector<CVariant>::const_iterator itValue = value.begin(); itValue != value.end(); ++itValue)
  {
    CSetting *settingValue = listSetting->GetDefinition()->Clone(StringUtils::Format("%s.%d", listSetting->GetId().c_str(), index++));
    if (settingValue == NULL)
      return false;

    switch (listSetting->GetElementType())
    {
      case SettingTypeBool:
        if (!itValue->isBoolean())
          return false;
        ret = static_cast<CSettingBool*>(settingValue)->SetValue(itValue->asBoolean());
        break;

      case SettingTypeInteger:
        if (!itValue->isInteger())
          return false;
        ret = static_cast<CSettingInt*>(settingValue)->SetValue((int)itValue->asInteger());
        break;

      case SettingTypeNumber:
        if (!itValue->isDouble())
          return false;
        ret = static_cast<CSettingNumber*>(settingValue)->SetValue(itValue->asDouble());
        break;

      case SettingTypeString:
        if (!itValue->isString())
          return false;
        ret = static_cast<CSettingString*>(settingValue)->SetValue(itValue->asString());
        break;

      default:
        ret = false;
        break;
    }

    if (!ret)
    {
      delete settingValue;
      return false;
    }

    newValues.push_back(SettingPtr(settingValue));
  }

  return listSetting->SetValue(newValues);
}
开发者ID:Anankin,项目名称:xbmc,代码行数:58,代码来源:Settings.cpp

示例6: SetList

bool CSettingsManager::SetList(const std::string &id, const std::vector< boost::shared_ptr<CSetting> > &value)
{
  CSharedLock lock(m_settingsCritical);
  CSetting *setting = GetSetting(id);
  if (setting == NULL || setting->GetType() != SettingTypeList)
    return false;

  return ((CSettingList*)setting)->SetValue(value);
}
开发者ID:Anankin,项目名称:xbmc,代码行数:9,代码来源:SettingsManager.cpp

示例7: SetInt

bool CSettingsManager::SetInt(const std::string &id, int value)
{
  CSingleLock lock(m_critical);
  CSetting *setting = GetSetting(id);
  if (setting == NULL || setting->GetType() != SettingTypeInteger)
    return false;

  return ((CSettingInt*)setting)->SetValue(value);
}
开发者ID:NHellFire,项目名称:xbmc,代码行数:9,代码来源:SettingsManager.cpp

示例8: SetNumber

bool CSettingsManager::SetNumber(const std::string &id, double value)
{
  CSingleLock lock(m_critical);
  CSetting *setting = GetSetting(id);
  if (setting == NULL || setting->GetType() != SettingTypeNumber)
    return false;

  return ((CSettingNumber*)setting)->SetValue(value);
}
开发者ID:NHellFire,项目名称:xbmc,代码行数:9,代码来源:SettingsManager.cpp

示例9: GetInt

int CSettingsManager::GetInt(const std::string &id) const
{
  CSharedLock lock(m_settingsCritical);
  CSetting *setting = GetSetting(id);
  if (setting == NULL || setting->GetType() != SettingTypeInteger)
    return 0;

  return ((CSettingInt*)setting)->GetValue();
}
开发者ID:Anankin,项目名称:xbmc,代码行数:9,代码来源:SettingsManager.cpp

示例10: SetBool

bool CSettingsManager::SetBool(const std::string &id, bool value)
{
  CSingleLock lock(m_critical);
  CSetting *setting = GetSetting(id);
  if (setting == NULL || setting->GetType() != SettingTypeBool)
    return false;

  return ((CSettingBool*)setting)->SetValue(value);
}
开发者ID:NHellFire,项目名称:xbmc,代码行数:9,代码来源:SettingsManager.cpp

示例11: GetString

std::string CSettingsManager::GetString(const std::string &id) const
{
  CSharedLock lock(m_settingsCritical);
  CSetting *setting = GetSetting(id);
  if (setting == NULL || setting->GetType() != SettingTypeString)
    return "";

  return ((CSettingString*)setting)->GetValue();
}
开发者ID:Anankin,项目名称:xbmc,代码行数:9,代码来源:SettingsManager.cpp

示例12: GetNumber

double CSettingsManager::GetNumber(const std::string &id) const
{
  CSharedLock lock(m_settingsCritical);
  CSetting *setting = GetSetting(id);
  if (setting == NULL || setting->GetType() != SettingTypeNumber)
    return 0.0;

  return ((CSettingNumber*)setting)->GetValue();
}
开发者ID:Anankin,项目名称:xbmc,代码行数:9,代码来源:SettingsManager.cpp

示例13: SetString

bool CSettingsManager::SetString(const std::string &id, const std::string &value)
{
  CSharedLock lock(m_settingsCritical);
  CSetting *setting = GetSetting(id);
  if (setting == NULL || setting->GetType() != SettingTypeString)
    return false;

  return ((CSettingString*)setting)->SetValue(value);
}
开发者ID:Anankin,项目名称:xbmc,代码行数:9,代码来源:SettingsManager.cpp

示例14: lock

std::vector< std::shared_ptr<CSetting> > CSettingsManager::GetList(const std::string &id) const
{
  CSharedLock lock(m_settingsCritical);
  CSetting *setting = GetSetting(id);
  if (setting == NULL || setting->GetType() != SettingTypeList)
    return std::vector< std::shared_ptr<CSetting> >();

  return ((CSettingList*)setting)->GetValue();
}
开发者ID:Distrotech,项目名称:xbmc,代码行数:9,代码来源:SettingsManager.cpp

示例15: ToggleBool

bool CSettingsManager::ToggleBool(const std::string &id)
{
  CSharedLock lock(m_settingsCritical);
  CSetting *setting = GetSetting(id);
  if (setting == NULL || setting->GetType() != SettingTypeBool)
    return false;

  return SetBool(id, !((CSettingBool*)setting)->GetValue());
}
开发者ID:Anankin,项目名称:xbmc,代码行数:9,代码来源:SettingsManager.cpp


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