void PFMSceneryPreset::setExternValue(rapidjson::GenericValue<rapidjson::UTF8<>>& value,std::string key)
{
    if(key == "route")
    {
        routeStrategy = value.GetString();
    }
    else if(key == "shoot")
    {
        shootStrategy = value.GetString();
    }
    else if(key == "composition")
    {
        compositionStrategy = value.GetString();
    }
    else if(key == "health")
    {
        health = value.GetDouble();
    }
}
Esempio n. 2
0
void JSObject::FillRecursive(const rapidjson::GenericValue<rapidjson::UTF8<wchar_t>> &val)
{
  using namespace rapidjson;
  /**/
  switch(val.GetType())
  {
  case kNullType:		//!< null
    value = JSValue();
    break;
  case kFalseType:		//!< false
    value = JSValue(false);
    break;
  case kTrueType:		//!< true
    value = JSValue(true);
    break;
  case kObjectType:	//!< object
    value.type = JSTypeObject;
    for(GenericValue<UTF8<wchar_t>>::ConstMemberIterator itr2 = val.MemberBegin(); itr2 != val.MemberEnd(); ++itr2)
    {
      children.push_back(std::make_pair(itr2->name.GetString(), JSObject()));
      children.back().second.FillRecursive(itr2->value);
    }
    break;
  case kArrayType:		//!< array 
    value.type = JSTypeObject;
    children.resize(val.Size());
    for(SizeType i = 0; i < val.Size(); i++)
    {
      children[i].second.FillRecursive(val[i]);
    }
    break;
  case kStringType:	//!< string
    value.str = val.GetString();
    value.type = JSTypeString;
    break;
  case kNumberType:	//!< number
    value = val.GetDouble();
    break;
  }

}