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


C++ JSONValue::isObject方法代码示例

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


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

示例1: FromJSON

/*--------------------------------------------------------------------------------*/
bool AudioObjectParameters::FromJSON(const JSONValue& obj, bool reset)
{
  Position     pval;
  ParameterSet sval;
  std::string  str;
  double       dval;
  sint64_t     i64val;
  float        fval;
  uint_t       uval;
  int          ival;
  bool         bval;
  bool         success = true;
    
  success &= SetFromJSON<>(Parameter_channel, values.channel, ival, obj, reset, 0U, &Limit0u);
  success &= SetFromJSON<>(Parameter_duration, values.duration, i64val, obj, reset, (uint64_t)0);
  success &= SetFromJSON<>(Parameter_cartesian, values.cartesian, bval, obj, reset);
  success &= SetFromJSON<>(Parameter_position, position, pval, obj, reset);
  success &= SetFromJSON<>(Parameter_minposition, &minposition, pval, obj, reset);
  success &= SetFromJSON<>(Parameter_maxposition, &maxposition, pval, obj, reset);
  success &= SetFromJSON<>(Parameter_gain, values.gain, dval, obj, reset, 1.0);
  success &= SetFromJSON<>(Parameter_width, values.width, fval, obj, reset, 0.f, &Limit0f);
  success &= SetFromJSON<>(Parameter_depth, values.depth, fval, obj, reset, 0.f, &Limit0f);
  success &= SetFromJSON<>(Parameter_height, values.height, fval, obj, reset, 0.f, &Limit0f);
  success &= SetFromJSON<>(Parameter_divergencebalance, values.divergencebalance, fval, obj, reset, 0.f, &Limit0to1f);
  success &= SetFromJSON<>(Parameter_divergenceazimuth, values.divergenceazimuth, fval, obj, reset, 0.f, &Limit0f);
  success &= SetFromJSON<>(Parameter_diffuseness, values.diffuseness, fval, obj, reset, 0.f, &Limit0to1f);
  success &= SetFromJSON<>(Parameter_delay, values.delay, fval, obj, reset, 0.f, &Limit0f);
  success &= SetFromJSON<>(Parameter_objectimportance, values.objectimportance, uval, obj, reset, (uint8_t)GetObjectImportanceDefault(), &LimitImportance);
  success &= SetFromJSON<>(Parameter_channelimportance, values.channelimportance, uval, obj, reset, (uint8_t)GetChannelImportanceDefault(), &LimitImportance);
  success &= SetFromJSON<>(Parameter_dialogue, values.dialogue, uval, obj, reset, (uint8_t)GetDialogueDefault(), &LimitDialogue);
  success &= SetFromJSON<>(Parameter_channellock, values.channellock, bval, obj, reset);
  success &= SetFromJSON<>(Parameter_channellockmaxdistance, values.channellockmaxdistance, fval, obj, reset, 0.f, &LimitMaxDistance);
  success &= SetFromJSON<>(Parameter_interact, values.interact, bval, obj, reset, (uint8_t)GetInteractDefault());
  success &= SetFromJSON<>(Parameter_interpolate, values.interpolate, bval, obj, reset, (uint8_t)1);
  success &= SetFromJSON<>(Parameter_interpolationtime, values.interpolationtime, i64val, obj, reset, (uint64_t)0);
  success &= SetFromJSON<>(Parameter_onscreen, values.onscreen, bval, obj, reset);
  success &= SetFromJSON<>(Parameter_disableducking, values.disableducking, bval, obj, reset, (uint8_t)GetDisableDuckingDefault());
  success &= SetFromJSON<>(Parameter_othervalues, othervalues, sval, obj, reset);
  
  // support legacy 'importance' parameter name for channel importance
  if (obj.isObject() && obj.isMember("importance"))
  {
    // read value from JSON into intermediate value
    if (json::FromJSON(obj["importance"], uval))
    {
      // use intermediate value to set parameter
      SetParameter<>(Parameter_channelimportance, values.channelimportance, uval, &LimitImportance);
    }
    else success = false;
  }

  // delete existing list of excluded zones
  if (excludedZones)
  {
    delete excludedZones;
    excludedZones = NULL;
  }

  {
    // try and find zoneExclusion item in object
    if (obj.isObject() && obj.isMember("excludedzones") && obj["excludedzones"].isArray())
    {
      const JSONValue& zones = obj["excludedzones"];

      for (uint_t i = 0; i < zones.size(); i++)
      {
        if (zones[i].isObject())
        {
          const JSONValue& obj = zones[i];
          std::string name;
          float minx, miny, minz, maxx, maxy, maxz;

          // extract name and limits of excluded zone
          if (json::FromJSON(obj, "name", name) &&
              json::FromJSON(obj, "minx", minx) &&
              json::FromJSON(obj, "miny", miny) &&
              json::FromJSON(obj, "minz", minz) &&
              json::FromJSON(obj, "maxx", maxx) &&
              json::FromJSON(obj, "maxy", maxy) &&
              json::FromJSON(obj, "maxz", maxz))
          {
            AddExcludedZone(name, minx, miny, minz, maxx, maxy, maxz);
          }
          else
          {
            BBCERROR("Unable to extract excluded zones from JSON '%s'", json::ToJSONString(obj).c_str());
            success = false;
          }
        }
      }
    }
  }
  
  return success;
}
开发者ID:Dysonics,项目名称:bbcat-adm,代码行数:96,代码来源:AudioObjectParameters.cpp


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