You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
* Moved dllexport from type to methods/staticvar in all Engine runtime code. This improves compile times, memory and performance in dll builds [CL 26082288 by henrik karlsson in 5.3 branch]
95 lines
3.7 KiB
C++
95 lines
3.7 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "Containers/Array.h"
|
|
#include "Containers/UnrealString.h"
|
|
#include "CoreMinimal.h"
|
|
#include "HAL/Platform.h"
|
|
#include "Serialization/JsonWriter.h"
|
|
|
|
class FJsonObject;
|
|
class FText;
|
|
|
|
/**
|
|
* Policy by which the localization data associated with a target should be loaded.
|
|
*/
|
|
namespace ELocalizationTargetDescriptorLoadingPolicy
|
|
{
|
|
enum Type
|
|
{
|
|
/** The localization data will never be loaded automatically. */
|
|
Never,
|
|
/** The localization data will always be loaded automatically. */
|
|
Always,
|
|
/** The localization data will only be loaded when running the editor. Use if the target localizes the editor. */
|
|
Editor,
|
|
/** The localization data will only be loaded when running the game. Use if the target localizes your game. */
|
|
Game,
|
|
/** The localization data will only be loaded if the editor is displaying localized property names. */
|
|
PropertyNames,
|
|
/** The localization data will only be loaded if the editor is displaying localized tool tips. */
|
|
ToolTips,
|
|
/** NOTE: If you add a new value, make sure to update the ToString() method below!. */
|
|
Max,
|
|
};
|
|
|
|
/**
|
|
* Converts a string to a ELocalizationTargetDescriptorLoadingPolicy::Type value
|
|
*
|
|
* @param The string to convert to a value
|
|
* @return The corresponding value, or 'Max' if the string is not valid.
|
|
*/
|
|
PROJECTS_API ELocalizationTargetDescriptorLoadingPolicy::Type FromString(const TCHAR *Text);
|
|
|
|
/**
|
|
* Returns the name of a localization loading policy.
|
|
*
|
|
* @param The value to convert to a string
|
|
* @return The string representation of this enum value
|
|
*/
|
|
PROJECTS_API const TCHAR* ToString(const ELocalizationTargetDescriptorLoadingPolicy::Type Value);
|
|
};
|
|
|
|
/**
|
|
* Description of a localization target.
|
|
*/
|
|
struct FLocalizationTargetDescriptor
|
|
{
|
|
/** Name of this target */
|
|
FString Name;
|
|
|
|
/** When should the localization data associated with a target should be loaded? */
|
|
ELocalizationTargetDescriptorLoadingPolicy::Type LoadingPolicy;
|
|
|
|
/** Normal constructor */
|
|
PROJECTS_API FLocalizationTargetDescriptor(FString InName = FString(), ELocalizationTargetDescriptorLoadingPolicy::Type InLoadingPolicy = ELocalizationTargetDescriptorLoadingPolicy::Never);
|
|
|
|
/** Reads a descriptor from the given JSON object */
|
|
PROJECTS_API bool Read(const FJsonObject& InObject, FText* OutFailReason = nullptr);
|
|
|
|
/** Reads a descriptor from the given JSON object */
|
|
PROJECTS_API bool Read(const FJsonObject& InObject, FText& OutFailReason);
|
|
|
|
/** Reads an array of targets from the given JSON object */
|
|
static PROJECTS_API bool ReadArray(const FJsonObject& InObject, const TCHAR* InName, TArray<FLocalizationTargetDescriptor>& OutTargets, FText* OutFailReason = nullptr);
|
|
|
|
/** Reads an array of targets from the given JSON object */
|
|
static PROJECTS_API bool ReadArray(const FJsonObject& InObject, const TCHAR* InName, TArray<FLocalizationTargetDescriptor>& OutTargets, FText& OutFailReason);
|
|
|
|
/** Writes a descriptor to JSON */
|
|
PROJECTS_API void Write(TJsonWriter<>& Writer) const;
|
|
|
|
/** Updates the given json object with values in this descriptor */
|
|
PROJECTS_API void UpdateJson(FJsonObject& JsonObject) const;
|
|
|
|
/** Writes an array of targets to JSON */
|
|
static PROJECTS_API void WriteArray(TJsonWriter<>& Writer, const TCHAR* ArrayName, const TArray<FLocalizationTargetDescriptor>& Descriptors);
|
|
|
|
/** Updates an array of descriptors in the specified JSON field (indexed by name) */
|
|
static PROJECTS_API void UpdateArray(FJsonObject& JsonObject, const TCHAR* ArrayName, const TArray<FLocalizationTargetDescriptor>& Descriptors);
|
|
|
|
/** Returns true if we should load this localization target based upon the current runtime environment */
|
|
PROJECTS_API bool ShouldLoadLocalizationTarget() const;
|
|
};
|