void PlayFab::MatchmakerModels::FPlayerLeftResponse::writeJSON(JsonWriter& writer) const
{
    writer->WriteObjectStart();
    
    
    writer->WriteObjectEnd();
}
bool NodeConfigManager::saveUserConfig(UserId userId)
{
   // FIXME: do we need locking for load/save/get/remove?
   bool rval;
   string path;
   rval = getUserConfigPath(this, userId, path);
   if(rval)
   {
      MO_CAT_DEBUG(BM_NODE_CAT,
         "NodeConfigManager: save user config: id=%" PRIu64 ", path=%s",
         userId, path.c_str());
      // FIXME: how to check if config is "empty" of useful data?
      Config c = getUserConfig(userId, true);
      File file(path.c_str());
      rval = file->mkdirs();
      if(rval)
      {
         FileOutputStream fos(file);
         JsonWriter writer;
         writer.setCompact(false);
         rval = writer.write(c, &fos);
         fos.close();
      }
   }
   return true;
}
示例#3
0
文件: picture.cpp 项目: timbod7/adl
 void toJson( JsonWriter &json, const _T & v ) const
 {
     json.startObject();
     writeField<double>( json, width_s, "width", v.width );
     writeField<double>( json, height_s, "height", v.height );
     json.endObject();
 }
示例#4
0
bool Id3v2TagFrameIO::getContractData(
   ByteBuffer* b, uint32_t* uncompressed, uint32_t* compressed)
{
   bool rval;

   // create output stream
   OutputStream* os = (b == NULL) ?
      static_cast<OutputStream*>(new NullOutputStream()) :
      static_cast<OutputStream*>(new ByteArrayOutputStream(b, false));

   // zlib-compress data
   Deflater def;
   def.startDeflating(-1, false);
   MutatorOutputStream mos(os, true, &def, false);

   // produce JSON-formatted contract data
   JsonWriter writer;
   writer.setCompact(true);
   rval = writer.write(mContract, &mos);
   mos.close();

   // store uncompressed bytes
   if(uncompressed != NULL)
   {
      *uncompressed = def.getTotalInputBytes();
   }

   // store compressed bytes
   if(compressed != NULL)
   {
      *compressed = def.getTotalOutputBytes();
   }

   return rval;
}
void PlayFab::MatchmakerModels::FRegisterGameResponse::writeJSON(JsonWriter& writer) const
{
    writer->WriteObjectStart();
    
    if(LobbyId.IsEmpty() == false) { writer->WriteIdentifierPrefix(TEXT("LobbyId")); writer->WriteValue(LobbyId); }
	
    
    writer->WriteObjectEnd();
}
void PlayFab::MatchmakerModels::FDeregisterGameRequest::writeJSON(JsonWriter& writer) const
{
    writer->WriteObjectStart();
    
    writer->WriteIdentifierPrefix(TEXT("LobbyId")); writer->WriteValue(LobbyId);
	
    
    writer->WriteObjectEnd();
}
void PlayFab::MatchmakerModels::FAuthUserRequest::writeJSON(JsonWriter& writer) const
{
    writer->WriteObjectStart();
    
    writer->WriteIdentifierPrefix(TEXT("AuthorizationTicket")); writer->WriteValue(AuthorizationTicket);
	
    
    writer->WriteObjectEnd();
}
示例#8
0
文件: picture.cpp 项目: timbod7/adl
 void toJson( JsonWriter &json, const _T & v ) const
 {
     switch( v.d() )
     {
         case ADL::picture::Picture::CIRCLE: json.startObject(); writeField( json, circle_s(), "circle", v.circle() ); json.endObject(); break;
         case ADL::picture::Picture::RECTANGLE: json.startObject(); writeField( json, rectangle_s(), "rectangle", v.rectangle() ); json.endObject(); break;
         case ADL::picture::Picture::COMPOSED: json.startObject(); writeField( json, composed_s(), "composed", v.composed() ); json.endObject(); break;
         case ADL::picture::Picture::TRANSLATED: json.startObject(); writeField( json, translated_s(), "translated", v.translated() ); json.endObject(); break;
     }
 }
void PlayFab::MatchmakerModels::FAuthUserResponse::writeJSON(JsonWriter& writer) const
{
    writer->WriteObjectStart();
    
    writer->WriteIdentifierPrefix(TEXT("Authorized")); writer->WriteValue(Authorized);
	
    if(PlayFabId.IsEmpty() == false) { writer->WriteIdentifierPrefix(TEXT("PlayFabId")); writer->WriteValue(PlayFabId); }
	
    
    writer->WriteObjectEnd();
}
示例#10
0
void Backend::writeJSON(JsonWriter& json) const
{
	json.beginObject()
		.name("name")(name_)
		.name("capacity")(capacity_)
		.name("terminate-protection")(terminateProtection_)
		.name("enabled")(enabled_)
		.name("protocol")(protocol());

	if (socketSpec_.isInet()) {
		json.name("hostname")(socketSpec_.ipaddr().str())
			.name("port")(socketSpec_.port());
	} else {
		json.name("path")(socketSpec_.local());
	}

    json.beginObject("stats");
	json.name("load")(load_);
    json.endObject();

	if (healthMonitor_) {
		json.name("health")(*healthMonitor_);
	}

	if (jsonWriteCallback_)
		jsonWriteCallback_(this, json);

	json.endObject();
}
示例#11
0
void GameLevel::save(const std::string &levelFile) {
  JsonWriter jsonWriter;
  jsonWriter.writeTime();
  jsonWriter.writeAuthor();

  auto &writer = jsonWriter.getWriter();
  writer.String(LEVEL_PALETTE_FILE);
  writer.String(mPalette->getFileName());

  writer.String(LEVEL_SPAWN_POS);
  writer.Vec2(mHeroSpawnPos);

  // Shadow groups.
  writer.String(SHADOW_GROUP);
  writer.StartArray();
  for (auto sm : mShadows) {
    sm->save(writer);
  }
  writer.EndArray();

  // Sprites.
  writer.String(GAME_SPRITES);
  writer.StartArray();
  for (auto sp : mSpriteList) {
    sp->save(writer);
  }
  writer.EndArray();

  // Effects.
  writer.String(GAME_FX);
  writer.StartArray();
  for (auto sp : mEffects) {
    writer.String(sp);
  }
  writer.EndArray();

  // Blocks.
  writer.String(LEVEL_BLOCK_ARRAY);
  writer.StartArray();
  for (auto &obj : mObjectManager->mObjects) {
    if (obj.second->getID() == 0) {
      continue;
    }
    obj.second->save(writer);
  }
  writer.EndArray();

  jsonWriter.save(levelFile);
}
示例#12
0
void JsonArray::writeTo(JsonWriter &writer) const {
  writer.beginArray();

  const node_type *child = _firstNode;
  while (child) {
    child->content.writeTo(writer);

    child = child->next;
    if (!child) break;

    writer.writeComma();
  }

  writer.endArray();
}
示例#13
0
static void JsonWriteNonce(JsonWriter& writer, int nonce)
{
    WriteKey(writer, "nonce");
    char nonceBuffer[32];
    NumberToString(nonceBuffer, nonce);
    writer.String(nonceBuffer);
}
void PlayFab::MatchmakerModels::FStartGameRequest::writeJSON(JsonWriter& writer) const
{
    writer->WriteObjectStart();
    
    writer->WriteIdentifierPrefix(TEXT("Build")); writer->WriteValue(Build);
	
    writer->WriteIdentifierPrefix(TEXT("Region")); writeRegionEnumJSON(pfRegion, writer);
	
    writer->WriteIdentifierPrefix(TEXT("GameMode")); writer->WriteValue(GameMode);
	
    if(CustomCommandLineData.IsEmpty() == false) { writer->WriteIdentifierPrefix(TEXT("CustomCommandLineData")); writer->WriteValue(CustomCommandLineData); }
	
    writer->WriteIdentifierPrefix(TEXT("ExternalMatchmakerEventEndpoint")); writer->WriteValue(ExternalMatchmakerEventEndpoint);
	
    
    writer->WriteObjectEnd();
}
示例#15
0
void JsonVariant::writeTo(JsonWriter &writer) const {
  if (is<const JsonArray &>())
    as<const JsonArray &>().writeTo(writer);
  else if (is<const JsonObject &>())
    as<const JsonObject &>().writeTo(writer);
  else if (is<const char *>())
    writer.writeString(as<const char *>());
  else if (is<const String *>())
    writer.writeString(as<const String *>()->c_str());
  else if (is<long>())
    writer.writeLong(as<long>());
  else if (is<bool>())
    writer.writeBoolean(as<bool>());
  else if (is<double>()) {
    uint8_t decimals = static_cast<uint8_t>(_type - JSON_DOUBLE_0_DECIMALS);
    writer.writeDouble(as<double>(), decimals);
  }
}
示例#16
0
size_t JsonArray::writeTo(JsonWriter &writer) const {
  size_t written = 0;
  if((written = writer.beginArray()) == 0)
    return 0;

  const node_type *child = _firstNode;
  size_t total = written;
  while (child) {
    if((written = child->content.writeTo(writer)) == 0) break;
    total += written;

    child = child->next;
    if (!child) break;

    if((written = writer.writeComma()) == 0) break;
    total += written;
  }

  if(written)
    total += writer.endArray();
  return total;
}
void PlayFab::MatchmakerModels::FVirtualCurrencyRechargeTime::writeJSON(JsonWriter& writer) const
{
    writer->WriteObjectStart();
    
    writer->WriteIdentifierPrefix(TEXT("SecondsToRecharge")); writer->WriteValue(SecondsToRecharge);
	
    writer->WriteIdentifierPrefix(TEXT("RechargeTime")); writeDatetime(RechargeTime, writer);
	
    writer->WriteIdentifierPrefix(TEXT("RechargeMax")); writer->WriteValue(RechargeMax);
	
    
    writer->WriteObjectEnd();
}
void PlayFab::MatchmakerModels::FStartGameResponse::writeJSON(JsonWriter& writer) const
{
    writer->WriteObjectStart();
    
    if(GameID.IsEmpty() == false) { writer->WriteIdentifierPrefix(TEXT("GameID")); writer->WriteValue(GameID); }
	
    if(ServerHostname.IsEmpty() == false) { writer->WriteIdentifierPrefix(TEXT("ServerHostname")); writer->WriteValue(ServerHostname); }
	
    writer->WriteIdentifierPrefix(TEXT("ServerPort")); writer->WriteValue(static_cast<int64>(ServerPort));
	
    
    writer->WriteObjectEnd();
}
void JsonVariant::writeTo(JsonWriter &writer) const {
  if (_type == JSON_ARRAY)
    _content.asArray->writeTo(writer);

  else if (_type == JSON_OBJECT)
    _content.asObject->writeTo(writer);

  else if (_type == JSON_STRING)
    writer.writeString(_content.asString);

  else if (_type == JSON_UNPARSED)
    writer.writeRaw(_content.asString);

  else if (_type == JSON_INTEGER)
    writer.writeInteger(_content.asInteger);

  else if (_type == JSON_BOOLEAN)
    writer.writeBoolean(_content.asInteger != 0);

  else if (_type >= JSON_FLOAT_0_DECIMALS) {
    uint8_t decimals = static_cast<uint8_t>(_type - JSON_FLOAT_0_DECIMALS);
    writer.writeFloat(_content.asFloat, decimals);
  }
}
示例#20
0
void CopyJsonValueToWriter( JsonWriter &Json, const FString& ValueName, const TSharedPtr<FJsonValue>& JsonValue )
{
	if ( JsonValue->Type == EJson::String )
	{
		Json->WriteValue( ValueName, JsonValue->AsString() );
	}
	else if ( JsonValue->Type == EJson::Array )
	{
		if (ValueName.IsEmpty())
		{
			Json->WriteArrayStart();
		}
		else
		{
			Json->WriteArrayStart(ValueName);
		}
		
		const TArray<TSharedPtr<FJsonValue>>& Array = JsonValue->AsArray();
		for ( const auto& ArrayValue : Array )
		{
			CopyJsonValueToWriter(Json, FString(), ArrayValue);
		}

		Json->WriteArrayEnd();
	}
	else if ( JsonValue->Type == EJson::Object )
	{
		if (ValueName.IsEmpty())
		{
			Json->WriteObjectStart();
		}
		else
		{
			Json->WriteObjectStart(ValueName);
		}

		const TSharedPtr<FJsonObject>& Object = JsonValue->AsObject();
		for ( const auto& ObjectProperty : Object->Values)
		{
			CopyJsonValueToWriter(Json, ObjectProperty.Key, ObjectProperty.Value );
		}

		Json->WriteObjectEnd();
	}
	else
	{
		
		UE_LOG(LogChunkManifestGenerator, Warning, TEXT("Unrecognized json value type %d in object %s"), *UEnum::GetValueAsString(TEXT("Json.EJson"), JsonValue->Type), *ValueName)
	}
}
void PlayFab::MatchmakerModels::FUserInfoRequest::writeJSON(JsonWriter& writer) const
{
    writer->WriteObjectStart();
    
    writer->WriteIdentifierPrefix(TEXT("PlayFabId")); writer->WriteValue(PlayFabId);
	
    writer->WriteIdentifierPrefix(TEXT("MinCatalogVersion")); writer->WriteValue(MinCatalogVersion);
	
    
    writer->WriteObjectEnd();
}
void PlayFab::MatchmakerModels::writeRegionEnumJSON(Region enumVal, JsonWriter& writer)
{
    switch(enumVal)
    {
        
        case RegionUSCentral: writer->WriteValue(TEXT("USCentral")); break;
        case RegionUSEast: writer->WriteValue(TEXT("USEast")); break;
        case RegionEUWest: writer->WriteValue(TEXT("EUWest")); break;
        case RegionSingapore: writer->WriteValue(TEXT("Singapore")); break;
        case RegionJapan: writer->WriteValue(TEXT("Japan")); break;
        case RegionBrazil: writer->WriteValue(TEXT("Brazil")); break;
        case RegionAustralia: writer->WriteValue(TEXT("Australia")); break;
    }
}
void JsonVariant::writeTo(JsonWriter &writer) const {
  switch (_type) {
    case JSON_UNDEFINED:
      return;

    case JSON_ARRAY:
      _content.asArray->writeTo(writer);
      return;

    case JSON_OBJECT:
      _content.asObject->writeTo(writer);
      return;

    case JSON_STRING:
      writer.writeString(_content.asString);
      return;

    case JSON_UNPARSED:
      writer.writeRaw(_content.asString);
      return;

    case JSON_NEGATIVE_INTEGER:
      writer.writeRaw('-');
    case JSON_POSITIVE_INTEGER:
      writer.writeInteger(_content.asInteger);
      return;

    case JSON_BOOLEAN:
      writer.writeBoolean(_content.asInteger != 0);
      return;

    default:
      uint8_t decimals = static_cast<uint8_t>(_type - JSON_FLOAT_0_DECIMALS);
      writer.writeFloat(_content.asFloat, decimals);
  }
}
示例#24
0
// cooked package asset registry saves information about all the cooked packages and assets contained within for stats purposes
// in json format
bool FChunkManifestGenerator::SaveCookedPackageAssetRegistry( const FString& SandboxCookedRegistryFilename, const bool Append )
{
	bool bSuccess = false;
	for ( const auto& Platform : Platforms )
	{
		TSet<FName> CookedPackages;

		// save the file 
		const FString CookedAssetRegistryFilename = SandboxCookedRegistryFilename.Replace(TEXT("[Platform]"), *Platform->PlatformName());

		FString JsonOutString;
		JsonWriter Json = TJsonWriterFactory<TCHAR, TPrettyJsonPrintPolicy<TCHAR> >::Create(&JsonOutString);

		Json->WriteObjectStart();
		Json->WriteArrayStart(TEXT("Packages"));

		for ( const auto& Package : AllCookedPackages )
		{
			Json->WriteObjectStart(); // unnamed package start
			const FName& PackageName = Package.Key;
			const FString& SandboxPath = Package.Value;

			CookedPackages.Add( PackageName );

			FString PlatformSandboxPath = SandboxPath.Replace(TEXT("[Platform]"), *Platform->PlatformName());
			
			FDateTime TimeStamp = IFileManager::Get().GetTimeStamp( *PlatformSandboxPath );

			Json->WriteValue( "SourcePackageName", PackageName.ToString() );
			Json->WriteValue( "CookedPackageName", PlatformSandboxPath );
			Json->WriteValue( "CookedPackageTimeStamp", TimeStamp.ToString() );
			
			Json->WriteArrayStart("AssetData");
			for (const auto& AssetData : AssetRegistryData)
			{	// Add only assets that have actually been cooked and belong to any chunk
				if (AssetData.ChunkIDs.Num() > 0 && (AssetData.PackageName == PackageName))
				{
					Json->WriteObjectStart();
					// save all their infos 
					Json->WriteValue(TEXT("ObjectPath"), AssetData.ObjectPath.ToString() );
					Json->WriteValue(TEXT("PackageName"), AssetData.PackageName.ToString() );
					Json->WriteValue(TEXT("PackagePath"), AssetData.PackagePath.ToString() );
					Json->WriteValue(TEXT("GroupNames"), AssetData.GroupNames.ToString() );
					Json->WriteValue(TEXT("AssetName"), AssetData.AssetName.ToString() );
					Json->WriteValue(TEXT("AssetClass"), AssetData.AssetClass.ToString() );
					Json->WriteObjectStart("TagsAndValues");
					for ( const auto& Tag : AssetData.TagsAndValues )
					{
						Json->WriteValue( Tag.Key.ToString(), Tag.Value );
					}
					Json->WriteObjectEnd(); // end tags and values object
					Json->WriteObjectEnd(); // end unnamed array object
				}
			}
			Json->WriteArrayEnd();
			Json->WriteObjectEnd(); // unnamed package
		}

		if ( Append )
		{
			FString JsonInString;
			if ( FFileHelper::LoadFileToString(JsonInString, *CookedAssetRegistryFilename) )
			{
				// load up previous package asset registry and fill in any packages which weren't recooked on this run
				JsonReader Reader = TJsonReaderFactory<TCHAR>::Create(JsonInString);
				TSharedPtr<FJsonObject> JsonObject;
				bool shouldRead = FJsonSerializer::Deserialize(Reader, JsonObject) && JsonObject.IsValid() && JsonObject->HasTypedField<EJson::Array>(TEXT("Packages"));
				if ( shouldRead )
				{
					TArray<TSharedPtr<FJsonValue>> PackageList = JsonObject->GetArrayField(TEXT("Packages"));
					for (auto PackageListIt = PackageList.CreateConstIterator(); PackageListIt && shouldRead; ++PackageListIt)
					{
						const TSharedPtr<FJsonValue>& JsonValue = *PackageListIt;
						shouldRead = JsonValue->Type == EJson::Object;
						if ( shouldRead )
						{
							const TSharedPtr<FJsonObject>& JsonPackage = JsonValue->AsObject();

							// get the package name and see if we have already written it out this run
							
							FString CookedPackageName;
							verify( JsonPackage->TryGetStringField(TEXT("SourcePackageName"), CookedPackageName) );

							const FName CookedPackageFName(*CookedPackageName);
							if ( CookedPackages.Contains(CookedPackageFName))
							{
								// don't need to process this package
								continue;
							}


							// check that the on disk version is still valid
							FString SourcePackageName;
							check( JsonPackage->TryGetStringField( TEXT("SourcePackageName"), SourcePackageName) );

							// if our timestamp is different then don't copy the information over
							FDateTime CurrentTimeStamp = IFileManager::Get().GetTimeStamp( *CookedPackageName );

							FString SavedTimeString;
							check( JsonPackage->TryGetStringField(TEXT("CookedPackageTimeStamp"), SavedTimeString) );
							FDateTime SavedTimeStamp;
							FDateTime::Parse(SavedTimeString, SavedTimeStamp);

							if ( SavedTimeStamp != CurrentTimeStamp )
							{
								continue;
							}



							CopyJsonValueToWriter(Json, FString(), JsonValue);
							// read in all the other stuff and copy it over to the new registry
							/*Json->WriteObjectStart(); // open package

							// copy all the values over
							for ( const auto& JsonPackageValue : JsonPackage->Values)
							{
								CopyJsonValueToWriter(Json, JsonPackageValue.Key, JsonPackageValue.Value);
							}

							Json->WriteObjectEnd();*/
						}
						
					}
				}
				else
				{
					UE_LOG(LogChunkManifestGenerator, Warning, TEXT("Unable to read or json is invalid format %s"), *CookedAssetRegistryFilename);
				}
			}
		}


		Json->WriteArrayEnd();
		Json->WriteObjectEnd();

		if (Json->Close())
		{
			FArchive* ItemTemplatesFile = IFileManager::Get().CreateFileWriter(*CookedAssetRegistryFilename);
			if (ItemTemplatesFile)
			{
				// serialize the file contents
				TStringConversion<FTCHARToUTF8_Convert> Convert(*JsonOutString);
				ItemTemplatesFile->Serialize(const_cast<ANSICHAR*>(Convert.Get()), Convert.Length());
				ItemTemplatesFile->Close();
				if ( !ItemTemplatesFile->IsError() )
				{
					bSuccess = true;
				}
				else
				{
					UE_LOG(LogChunkManifestGenerator, Error, TEXT("Unable to write to %s"), *CookedAssetRegistryFilename);
				}
				delete ItemTemplatesFile;
			}
			else
			{
				UE_LOG(LogChunkManifestGenerator, Error, TEXT("Unable to open %s for writing."), *CookedAssetRegistryFilename);
			}
		}
		else
		{
			UE_LOG(LogChunkManifestGenerator, Error, TEXT("Error closing Json Writer"));
		}
	}
	return bSuccess;
}
void PlayFab::MatchmakerModels::FUserInfoResponse::writeJSON(JsonWriter& writer) const
{
    writer->WriteObjectStart();
    
    if(PlayFabId.IsEmpty() == false) { writer->WriteIdentifierPrefix(TEXT("PlayFabId")); writer->WriteValue(PlayFabId); }
	
    if(Username.IsEmpty() == false) { writer->WriteIdentifierPrefix(TEXT("Username")); writer->WriteValue(Username); }
	
    if(TitleDisplayName.IsEmpty() == false) { writer->WriteIdentifierPrefix(TEXT("TitleDisplayName")); writer->WriteValue(TitleDisplayName); }
	
    if(Inventory.Num() != 0) 
    {
        writer->WriteArrayStart(TEXT("Inventory"));
    
        for (const FItemInstance& item : Inventory)
        {
            item.writeJSON(writer);
        }
        writer->WriteArrayEnd();
     }
	
    if(VirtualCurrency.Num() != 0) 
    {
        writer->WriteObjectStart(TEXT("VirtualCurrency"));
        for (TMap<FString, int32>::TConstIterator It(VirtualCurrency); It; ++It)
        {
            writer->WriteIdentifierPrefix((*It).Key);
            writer->WriteValue((*It).Value);
        }
        writer->WriteObjectEnd();
     }
	
    if(VirtualCurrencyRechargeTimes.Num() != 0) 
    {
        writer->WriteObjectStart(TEXT("VirtualCurrencyRechargeTimes"));
        for (TMap<FString, FVirtualCurrencyRechargeTime>::TConstIterator It(VirtualCurrencyRechargeTimes); It; ++It)
        {
            writer->WriteIdentifierPrefix((*It).Key);
            (*It).Value.writeJSON(writer);
        }
        writer->WriteObjectEnd();
     }
	
    writer->WriteIdentifierPrefix(TEXT("IsDeveloper")); writer->WriteValue(IsDeveloper);
	
    if(SteamId.IsEmpty() == false) { writer->WriteIdentifierPrefix(TEXT("SteamId")); writer->WriteValue(SteamId); }
	
    
    writer->WriteObjectEnd();
}
void PlayFab::MatchmakerModels::FRegisterGameRequest::writeJSON(JsonWriter& writer) const
{
    writer->WriteObjectStart();
    
    writer->WriteIdentifierPrefix(TEXT("ServerHost")); writer->WriteValue(ServerHost);
	
    writer->WriteIdentifierPrefix(TEXT("ServerPort")); writer->WriteValue(ServerPort);
	
    writer->WriteIdentifierPrefix(TEXT("Build")); writer->WriteValue(Build);
	
    writer->WriteIdentifierPrefix(TEXT("Region")); writeRegionEnumJSON(pfRegion, writer);
	
    writer->WriteIdentifierPrefix(TEXT("GameMode")); writer->WriteValue(GameMode);
	
    if(Tags.Num() != 0) 
    {
        writer->WriteObjectStart(TEXT("Tags"));
        for (TMap<FString, FString>::TConstIterator It(Tags); It; ++It)
        {
            writer->WriteIdentifierPrefix((*It).Key);
            writer->WriteValue((*It).Value);
        }
        writer->WriteObjectEnd();
     }
	
    
    writer->WriteObjectEnd();
}
示例#27
0
文件: picture.cpp 项目: timbod7/adl
 void toJson( JsonWriter &json, const _T & v ) const
 {
     json.startObject();
     writeField<double>( json, radius_s, "radius", v.radius );
     json.endObject();
 }
void PlayFab::MatchmakerModels::FItemInstance::writeJSON(JsonWriter& writer) const
{
    writer->WriteObjectStart();
    
    if(ItemId.IsEmpty() == false) { writer->WriteIdentifierPrefix(TEXT("ItemId")); writer->WriteValue(ItemId); }
	
    if(ItemInstanceId.IsEmpty() == false) { writer->WriteIdentifierPrefix(TEXT("ItemInstanceId")); writer->WriteValue(ItemInstanceId); }
	
    if(ItemClass.IsEmpty() == false) { writer->WriteIdentifierPrefix(TEXT("ItemClass")); writer->WriteValue(ItemClass); }
	
    if(PurchaseDate.notNull()) { writer->WriteIdentifierPrefix(TEXT("PurchaseDate")); writeDatetime(PurchaseDate, writer); }
	
    if(Expiration.notNull()) { writer->WriteIdentifierPrefix(TEXT("Expiration")); writeDatetime(Expiration, writer); }
	
    if(RemainingUses.notNull()) { writer->WriteIdentifierPrefix(TEXT("RemainingUses")); writer->WriteValue(RemainingUses); }
	
    if(UsesIncrementedBy.notNull()) { writer->WriteIdentifierPrefix(TEXT("UsesIncrementedBy")); writer->WriteValue(UsesIncrementedBy); }
	
    if(Annotation.IsEmpty() == false) { writer->WriteIdentifierPrefix(TEXT("Annotation")); writer->WriteValue(Annotation); }
	
    if(CatalogVersion.IsEmpty() == false) { writer->WriteIdentifierPrefix(TEXT("CatalogVersion")); writer->WriteValue(CatalogVersion); }
	
    if(BundleParent.IsEmpty() == false) { writer->WriteIdentifierPrefix(TEXT("BundleParent")); writer->WriteValue(BundleParent); }
	
    if(DisplayName.IsEmpty() == false) { writer->WriteIdentifierPrefix(TEXT("DisplayName")); writer->WriteValue(DisplayName); }
	
    if(UnitCurrency.IsEmpty() == false) { writer->WriteIdentifierPrefix(TEXT("UnitCurrency")); writer->WriteValue(UnitCurrency); }
	
    writer->WriteIdentifierPrefix(TEXT("UnitPrice")); writer->WriteValue(static_cast<int64>(UnitPrice));
	
    if(BundleContents.Num() != 0) 
    {
        writer->WriteArrayStart(TEXT("BundleContents"));
    
        for (const FString& item : BundleContents)
        {
            writer->WriteValue(item);
        }
        writer->WriteArrayEnd();
     }
	
    if(CustomData.Num() != 0) 
    {
        writer->WriteObjectStart(TEXT("CustomData"));
        for (TMap<FString, FString>::TConstIterator It(CustomData); It; ++It)
        {
            writer->WriteIdentifierPrefix((*It).Key);
            writer->WriteValue((*It).Value);
        }
        writer->WriteObjectEnd();
     }
	
    
    writer->WriteObjectEnd();
}
示例#29
-1
void WriteOptionalString(JsonWriter& w, T& k, const char* value)
{
    if (value && value[0]) {
        w.Key(k, sizeof(T) - 1);
        w.String(value);
    }
}
void PlayFab::MatchmakerModels::FDeregisterGameResponse::writeJSON(JsonWriter& writer) const
{
    writer->WriteObjectStart();
    
    
    writer->WriteObjectEnd();
}