Apr 13, 2026
This seeded news post is a single, deterministic Unreal Engine highlighting specimen. It is meant to exercise the real content pipeline that powers News pages, not a synthetic preview path.
The corpus stays inside one published news post so it can be inspected from the homepage, the news index, search, SEO metadata, and the public News detail template. Every snippet is intentionally valid source text. HLSL is intentionally excluded from this showcase.
csharpjsoninipythoncsvlogcmake, make, bat, powershell, and shellscriptswift, objective-c, java, kotlin, groovy, xml, and ruby 1// InventoryReplicationComponent.h
2// Inventory replication system for multiplayer games
3
4#pragma once
5
6#include "CoreMinimal.h"
7#include "Components/ActorComponent.h"
8#include "GameplayTagContainer.h"
9#include "InventoryReplicationComponent.generated.h"
10
11class UCurveFloat;
12class UInventorySubsystem;
13
14/**
15 * Defines how inventory data is replicated across the network.
16 * Each mode trades off between responsiveness and authority.
17 */
18UENUM(BlueprintType)
19enum class EInventoryReplicationMode : uint8
20{
21 LocalOnly UMETA(DisplayName = "Local Only"), // No replication, client-only
22 ServerAuthoritative UMETA(DisplayName = "Server Authoritative"), // Server owns the data
23 PredictiveClient UMETA(DisplayName = "Predictive Client") // Client predicts, server validates
24};
25
26/* A single inventory slot holding an item reference and quantity. */
27USTRUCT(BlueprintType)
28struct FInventorySlot
29{
30 GENERATED_BODY()
31
32 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Inventory")
33 FName ItemId = NAME_None;
34
35 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Inventory", meta = (ClampMin = "0"))
36 int32 Quantity = 0;
37
38 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Inventory")
39 FGameplayTagContainer GrantedTags;
40
41 // Returns true when the slot has no valid item or zero quantity
42 bool IsEmpty() const
43 {
44 return ItemId.IsNone() || Quantity <= 0;
45 }
46};
47
48/**
49 * Replicates inventory slots to connected clients.
50 *
51 * Supports three replication modes:
52 * - LocalOnly: no network traffic
53 * - ServerAuthoritative: server pushes updates
54 * - PredictiveClient: client predicts changes
55 *
56 * @see EInventoryReplicationMode
57 * @see FInventorySlot
58 */
59UCLASS(BlueprintType, Blueprintable, ClassGroup=(Inventory), meta=(BlueprintSpawnableComponent))
60class HIGHLIGHTINGSHOWCASE_API UInventoryReplicationComponent : public UActorComponent
61{
62 GENERATED_BODY()
63
64public:
65 UInventoryReplicationComponent();
66
67 // TODO: Add support for custom replication filters
68 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Inventory")
69 EInventoryReplicationMode ReplicationMode = EInventoryReplicationMode::ServerAuthoritative;
70
71 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Inventory", meta = (ClampMin = "0.0", Units = "s"))
72 float RefreshIntervalSeconds = 0.25f; // Minimum interval between replication ticks
73
74 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Inventory", meta = (AllowedClasses = "/Script/Engine.CurveFloat"))
75 TObjectPtr<UCurveFloat> PriorityCurve = nullptr;
76
77 UPROPERTY(ReplicatedUsing = OnRep_Slots, VisibleAnywhere, BlueprintReadOnly, Category = "Inventory")
78 TArray<FInventorySlot> Slots;
79
80 /** Add items to inventory. Stacks if the item already exists. */
81 UFUNCTION(BlueprintCallable, Category = "Inventory")
82 void AddItem(FName ItemId, int32 Quantity);
83
84 /* Check whether the inventory contains at least one of the given item. */
85 UFUNCTION(BlueprintPure, Category = "Inventory")
86 bool HasItem(FName ItemId) const;
87
88protected:
89 // Called when the component is first initialized
90 virtual void BeginPlay() override;
91
92 UFUNCTION()
93 void OnRep_Slots(); // Callback when Slots array is replicated
94};
1/**
2 * Developer settings exposed in the Project Settings panel.
3 * Use Config=Game to persist values in DefaultGame.ini.
4 */
5UCLASS(Config = Game, DefaultConfig, BlueprintType)
6class HIGHLIGHTINGSHOWCASE_API UHighlightingDeveloperSettings : public UDeveloperSettings
7{
8 GENERATED_BODY()
9
10public:
11 // Seconds per tick budget for inventory replication processing
12 UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "Inventory|Timing", meta = (ClampMin = "0.016", UIMin = "0.016", Units = "s"))
13 float TickBudgetSeconds = 0.016f;
14
15 // Toggle for the debug overlay (see EditCondition below)
16 UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "Inventory|Debug", meta = (InlineEditConditionToggle))
17 bool bEnableVerboseOverlay = false;
18
19 /* Only visible when bEnableVerboseOverlay is true */
20 UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "Inventory|Debug", meta = (EditCondition = "bEnableVerboseOverlay"))
21 FLinearColor OverlayColor = FLinearColor(0.0f, 0.7f, 1.0f, 1.0f);
22
23 // Hard limit on replicated slots; higher values increase bandwidth
24 UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "Inventory|Limits", meta = (ClampMin = "1", ClampMax = "512", UIMin = "1", UIMax = "256"))
25 int32 MaxReplicatedSlots = 64;
26
27 /** Reset all runtime caches. Authority-only to prevent client desync. */
28 UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category = "Inventory")
29 void ResetRuntimeState();
30
31 /** Build a human-readable label for telemetry events. */
32 UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Inventory")
33 FString BuildTelemetryLabel(const FString& SourceContext) const;
34
35 // Blueprint-implementable hook fired when the overlay is toggled
36 UFUNCTION(BlueprintImplementableEvent, Category = "Inventory")
37 void OnOverlayToggled(bool bEnabled);
38};
1/*
2 * A lightweight request struct passed to the inventory queue.
3 * Supports partial fulfillment for large batch operations.
4 */
5USTRUCT(BlueprintType)
6struct FInventoryRequest
7{
8 GENERATED_BODY()
9
10 // Which item to request
11 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Inventory")
12 FName ItemId = NAME_None;
13
14 // How many of the item; clamped to at least 1
15 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Inventory", meta = (ClampMin = "1"))
16 int32 RequestedQuantity = 1;
17
18 /**
19 * When true, the server may split the request into smaller batches
20 * if the full quantity is not immediately available.
21 */
22 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Inventory", meta = (ToolTip = "When enabled, the server may split the request into smaller batches."))
23 bool bAllowPartialFulfillment = true;
24};
25
26// Queue a request for processing on the next tick
27UFUNCTION(BlueprintCallable, Category = "Inventory", meta = (AutoCreateRefTerm = "Request", DisplayName = "Queue Inventory Request"))
28void QueueInventoryRequest(const FInventoryRequest& Request);
1// InventoryPolicy.h
2// Value-type policy object used by the replication system
3
4#pragma once
5
6#include "CoreMinimal.h"
7
8/**
9 * Encapsulates a named inventory policy.
10 * Policies control how items are validated, stacked, and replicated.
11 */
12class HIGHLIGHTINGSHOWCASE_API FInventoryPolicy
13{
14public:
15 // Construct with a policy name (must not be NAME_None)
16 explicit FInventoryPolicy(FName InPolicyName);
17 ~FInventoryPolicy() = default;
18
19 // Rule of five: allow copy and move
20 FInventoryPolicy(const FInventoryPolicy&) = default;
21 FInventoryPolicy(FInventoryPolicy&&) noexcept = default;
22 FInventoryPolicy& operator=(const FInventoryPolicy&) = default;
23 FInventoryPolicy& operator=(FInventoryPolicy&&) noexcept = default;
24
25 /** Returns the policy name set during construction. */
26 const FName& GetPolicyName() const;
27
28 /** Build a human-readable debug string for logging. */
29 FString ToDebugString() const;
30
31 /**
32 * Clamp a value to be non-negative.
33 * Works for any numeric type (int32, float, double, etc.).
34 */
35 template <typename ValueType>
36 static ValueType ClampNonNegative(ValueType Value)
37 {
38 return Value < static_cast<ValueType>(0) ? static_cast<ValueType>(0) : Value;
39 }
40
41private:
42 FName PolicyName; // Internal storage for the policy identifier
43};
1// InventoryPolicy.cpp
2// Implementation of FInventoryPolicy member functions
3
4#include "InventoryPolicy.h"
5
6// Initializer list delegates to FName copy
7FInventoryPolicy::FInventoryPolicy(FName InPolicyName)
8 : PolicyName(InPolicyName)
9{
10}
11
12const FName& FInventoryPolicy::GetPolicyName() const
13{
14 return PolicyName;
15}
16
17/*
18 * Builds a formatted string that includes the raw template and its length.
19 * Useful for log output and unit test assertions.
20 */
21FString FInventoryPolicy::ToDebugString() const
22{
23 static constexpr int32 MaxPreviewLength = 48; // Truncate long strings for readability
24 const FString RawTemplate = TEXT(R"(Policy={Name}, Preview={"One", "Two", "Three"})");
25
26 return FString::Printf(
27 TEXT("%s | Length=%d"),
28 *RawTemplate.Left(MaxPreviewLength),
29 RawTemplate.Len()
30 );
31}
1// Required tag array: items must have all of these to be replicated
2TArray<FName> RequiredTags = {
3 TEXT("Inventory.Read"),
4 TEXT("Inventory.Write"),
5 TEXT("Inventory.Replicate")
6};
7
8// Item stacks keyed by item name
9TMap<FName, int32> ItemStacks;
10ItemStacks.Add(TEXT("Potion.Small"), 3); // Small potions stack to 10
11ItemStacks.Add(TEXT("Potion.Large"), 1); // Large potions stack to 5
12
13// Track which buckets have pending changes
14TSet<FName> DirtyBuckets;
15DirtyBuckets.Add(TEXT("Weapons"));
16DirtyBuckets.Add(TEXT("Consumables"));
17
18// Various smart pointer and reference types used in inventories
19TWeakObjectPtr<AActor> CachedOwner = GetOwner(); // Weak ref, may become stale
20TSoftObjectPtr<UDataTable> InventoryTable(TEXT("/Game/Data/DT_Inventory.DT_Inventory"));
21TSubclassOf<UObject> ResolverClass = UInventoryResolver::StaticClass();
22TOptional<FName> PendingReservation; // Empty until a reservation is claimed
23
24// Iterate over all item stacks and log their contents
25for (const TPair<FName, int32>& Pair : ItemStacks)
26{
27 UE_LOG(LogTemp, Verbose, TEXT("%s => %d"), *Pair.Key.ToString(), Pair.Value);
28}
1/**
2 * Actor responsible for replicating inventory state to clients.
3 * Uses a version counter to detect stale snapshots.
4 */
5UCLASS()
6class HIGHLIGHTINGSHOWCASE_API AInventoryReplicationActor : public AActor
7{
8 GENERATED_BODY()
9
10public:
11 AInventoryReplicationActor();
12
13 // Register replicated properties with the engine
14 virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
15
16 // Incremented on every inventory mutation; triggers OnRep on clients
17 UPROPERTY(ReplicatedUsing = OnRep_InventoryVersion)
18 int32 InventoryVersion = 0;
19
20 // True when the server has sent at least one full snapshot
21 UPROPERTY(Replicated)
22 bool bHasAuthoritySnapshot = false;
23
24 /** Server RPC: commit a new set of slots from the client. */
25 UFUNCTION(Server, Reliable)
26 void ServerCommitInventory(const TArray<FInventorySlot>& NewSlots);
27
28 /** Client RPC: push a preview label for UI display (unreliable, cosmetic). */
29 UFUNCTION(Client, Unreliable)
30 void ClientPushPreview(const FString& PreviewLabel);
31
32 /** Multicast RPC: notify all clients of a version bump. */
33 UFUNCTION(NetMulticast, Reliable)
34 void MulticastBroadcastInventoryChange(int32 NewVersion);
35
36private:
37 // Called when InventoryVersion is replicated to this client
38 UFUNCTION()
39 void OnRep_InventoryVersion();
40};
1#include "Net/UnrealNetwork.h"
2
3AInventoryReplicationActor::AInventoryReplicationActor()
4{
5 bReplicates = true;
6 NetUpdateFrequency = 30.0f;
7}
8
9void AInventoryReplicationActor::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
10{
11 Super::GetLifetimeReplicatedProps(OutLifetimeProps);
12
13 DOREPLIFETIME(AInventoryReplicationActor, InventoryVersion);
14 DOREPLIFETIME_CONDITION(AInventoryReplicationActor, bHasAuthoritySnapshot, COND_SkipOwner);
15}
16
17void AInventoryReplicationActor::ServerCommitInventory_Implementation(const TArray<FInventorySlot>& NewSlots)
18{
19 InventoryVersion = FMath::Max(InventoryVersion + 1, 1);
20 MulticastBroadcastInventoryChange(InventoryVersion);
21}
22
23void AInventoryReplicationActor::ClientPushPreview_Implementation(const FString& PreviewLabel)
24{
25 UE_LOG(LogTemp, Display, TEXT("Preview => %s"), *PreviewLabel);
26}
27
28void AInventoryReplicationActor::MulticastBroadcastInventoryChange_Implementation(int32 NewVersion)
29{
30 UE_LOG(LogTemp, Log, TEXT("Inventory replicated with version %d"), NewVersion);
31}
1// Delegate declarations for inventory events
2DECLARE_DELEGATE(FOnInventoryFlushed); // Simple delegate, no params
3DECLARE_MULTICAST_DELEGATE_OneParam(FOnBucketDirty, FName); // Multiple listeners, one param
4DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnInventoryPreviewReady, int32, SlotCount, FString, Summary); // Blueprint-bindable
5
6/**
7 * Interface for objects that consume inventory summaries.
8 * Implement in any class that needs to react to inventory changes.
9 */
10UINTERFACE(MinimalAPI, Blueprintable)
11class UInventoryConsumerInterface : public UInterface
12{
13 GENERATED_BODY()
14};
15
16// The actual interface methods live here
17class IInventoryConsumerInterface
18{
19 GENERATED_BODY()
20
21public:
22 /** Called when a new inventory summary is available. */
23 UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Inventory")
24 void ApplyInventorySummary(const FString& Summary);
25};
26
27/**
28 * Game instance subsystem managing inventory previews.
29 * Persists across level transitions; destroyed with the game instance.
30 */
31UCLASS()
32class HIGHLIGHTINGSHOWCASE_API UInventoryPreviewSubsystem : public UGameInstanceSubsystem
33{
34 GENERATED_BODY()
35
36public:
37 // Subsystem lifecycle
38 virtual void Initialize(FSubsystemCollectionBase& Collection) override;
39 virtual void Deinitialize() override;
40
41 // Blueprint-assignable event fired when preview data is ready
42 UPROPERTY(BlueprintAssignable, Category = "Inventory")
43 FOnInventoryPreviewReady OnInventoryPreviewReady;
44
45 // C++ only delegates
46 FOnInventoryFlushed OnInventoryFlushed;
47 FOnBucketDirty OnBucketDirty; // Fired per dirty bucket
48};
1// Module implementation file
2#include "Modules/ModuleManager.h"
3
4/**
5 * Primary module for the HighlightingShowcase plugin.
6 * Handles startup and shutdown logging.
7 */
8class FHighlightingShowcaseModule final : public IModuleInterface
9{
10public:
11 virtual void StartupModule() override
12 {
13 // Log module startup for diagnostics
14 UE_LOG(LogTemp, Log, TEXT("Highlighting showcase module starting"));
15 }
16
17 virtual void ShutdownModule() override
18 {
19 // Clean up any static registrations here
20 UE_LOG(LogTemp, Log, TEXT("Highlighting showcase module shutting down"));
21 }
22};
23
24// Register the module with the engine
25IMPLEMENT_MODULE(FHighlightingShowcaseModule, HighlightingShowcase)
1// Define a static log category scoped to this translation unit
2DEFINE_LOG_CATEGORY_STATIC(LogHighlightingInventory, Log, All);
3
4void UInventoryPreviewSubsystem::Initialize(FSubsystemCollectionBase& Collection)
5{
6 Super::Initialize(Collection);
7
8 UE_LOG(LogHighlightingInventory, Log, TEXT("Preview subsystem initialized"));
9
10 // Fatal if no game instance; subsystem cannot function without it
11 checkf(GetGameInstance() != nullptr, TEXT("Preview subsystem requires a valid game instance"));
12
13 // Non-fatal but important: flag if we initialize off the game thread
14 ensureAlwaysMsgf(IsInGameThread(), TEXT("Preview subsystem should initialize on the game thread"));
15}
1/*
2 * Simple automation test verifying that FInventoryPolicy formats
3 * its debug string correctly and stores the policy name.
4 */
5IMPLEMENT_SIMPLE_AUTOMATION_TEST(
6 FHighlightingShowcaseInventoryPolicyTest,
7 "HighlightingShowcase.Inventory.PolicyFormatsDebugString",
8 EAutomationTestFlags::ApplicationContextMask | EAutomationTestFlags::ProductFilter
9)
10
11bool FHighlightingShowcaseInventoryPolicyTest::RunTest(const FString& Parameters)
12{
13 // Arrange: create a policy with a known name
14 const FInventoryPolicy Policy(TEXT("DefaultPolicy"));
15
16 // Assert: stored name matches constructor argument
17 TestEqual(TEXT("The stored policy name should match the constructor value"), Policy.GetPolicyName(), FName(TEXT("DefaultPolicy")));
18
19 // Assert: debug output includes the policy name somewhere
20 TestTrue(TEXT("Debug output should include the policy name"), Policy.ToDebugString().Contains(TEXT("Policy=")));
21
22 return true;
23}
1// Demonstrates Phiki code annotations: diff markers, highlights, and focus
2void UInventoryReplicationComponent::NormalizeIncomingSlotCount(int32 RequestedCount)
3{
- const int32 NormalizedCount = FMath::Max(RequestedCount, 1);
+ const int32 NormalizedCount = FMath::Clamp(RequestedCount, 1, 128);
6
7 Slots.SetNum(NormalizedCount);
8 UE_LOG(LogTemp, Verbose, TEXT("Normalized slots => %d"), NormalizedCount);
9}
1// HighlightingShowcase.Build.cs
2// Module build rules for the HighlightingShowcase runtime module
3
4using UnrealBuildTool;
5using System.IO;
6
7public class HighlightingShowcase : ModuleRules
8{
9 public HighlightingShowcase(ReadOnlyTargetRules Target) : base(Target)
10 {
11 // Use explicit PCH to keep compile times predictable
12 PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
13 CppStandard = CppStandardVersion.Cpp20;
14
15 // Modules this plugin depends on publicly (headers exposed to dependents)
16 PublicDependencyModuleNames.AddRange(
17 new[]
18 {
19 "Core",
20 "CoreUObject",
21 "DeveloperSettings",
22 "Engine",
23 "NetCore"
24 }
25 );
26
27 // Modules used only in the implementation (not forwarded to dependents)
28 PrivateDependencyModuleNames.AddRange(
29 new[]
30 {
31 "Projects",
32 "Slate",
33 "SlateCore"
34 }
35 );
36
37 // Platform-specific: inject Android UPL XML for Gradle integration
38 if (Target.Platform == UnrealTargetPlatform.Android)
39 {
40 AdditionalPropertiesForReceipt.Add("AndroidPlugin", Path.Combine(ModuleDirectory, "Android", "HighlightingShowcase_UPL.xml"));
41 }
42 }
43}
1// HighlightingShowcaseEditor.Target.cs
2// Target rules for the editor build configuration
3
4using UnrealBuildTool;
5using System.Collections.Generic;
6
7public class HighlightingShowcaseEditorTarget : TargetRules
8{
9 public HighlightingShowcaseEditorTarget(TargetInfo Target) : base(Target)
10 {
11 Type = TargetType.Editor;
12 DefaultBuildSettings = BuildSettingsVersion.Latest;
13 IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
14
15 // Include our primary module in the editor build
16 ExtraModuleNames.AddRange(new List<string>
17 {
18 "HighlightingShowcase"
19 });
20 }
21}
1// PackageHighlightingShowcase.cs
2// UAT automation command for plugin packaging
3
4using AutomationTool;
5
6[Help("Packages the HighlightingShowcase plugin for distribution.")]
7public class PackageHighlightingShowcase : BuildCommand
8{
9 public override void ExecuteBuild()
10 {
11 // Parse required arguments; throw early on missing values
12 string pluginFile = ParseParamValue("Plugin") ?? throw new AutomationException("Plugin argument is required.");
13 string outputDir = ParseParamValue("Output") ?? CombinePaths(CmdEnv.LocalRoot, "Artifacts", "HighlightingShowcase");
14
15 LogInformation("Packaging plugin: {0}", pluginFile);
16 LogInformation("Output directory: {0}", outputDir);
17 }
18}
1{
2 "FileVersion": 3,
3 "Version": 12,
4 "VersionName": "2.1.0",
5 "FriendlyName": "Highlighting Showcase",
6 "Description": "A deterministic plugin used to exercise syntax highlighting across the full Unreal ecosystem.",
7 "Category": "Scripting",
8 "CreatedBy": "gameDNA",
9 "CreatedByURL": "https://gamedna.studio",
10 "EnabledByDefault": false,
11 "CanContainContent": true,
12 "IsBetaVersion": false,
13 "Installed": false,
14 "Modules": [
15 {
16 "Name": "HighlightingShowcase",
17 "Type": "Runtime",
18 "LoadingPhase": "Default"
19 },
20 {
21 "Name": "HighlightingShowcaseEditor",
22 "Type": "Editor",
23 "LoadingPhase": "PostEngineInit"
24 }
25 ],
26 "Plugins": [
27 {
28 "Name": "GameplayTags",
29 "Enabled": true
30 },
31 {
32 "Name": "EnhancedInput",
33 "Enabled": true
34 }
35 ]
36}
1{
2 "FileVersion": 3,
3 "EngineAssociation": "5.5",
4 "Category": "Games",
5 "Description": "Project used to verify Unreal Engine code highlighting coverage.",
6 "Modules": [
7 {
8 "Name": "HighlightingShowcaseGame",
9 "Type": "Runtime",
10 "LoadingPhase": "Default"
11 }
12 ],
13 "Plugins": [
14 {
15 "Name": "HighlightingShowcase",
16 "Enabled": true
17 }
18 ],
19 "TargetPlatforms": [
20 "Win64",
21 "Linux",
22 "Android",
23 "IOS"
24 ]
25}
1; Developer settings for the inventory system
2[/Script/HighlightingShowcase.HighlightingDeveloperSettings]
3TickBudgetSeconds=0.016
4bEnableVerboseOverlay=True
5OverlayColor=(R=0.000000,G=0.700000,B=1.000000,A=1.000000)
6MaxReplicatedSlots=64
7
8; Net driver configuration for multiplayer
9[/Script/Engine.Engine]
10+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/OnlineSubsystemUtils.IpNetDriver",DriverClassNameFallback="/Script/OnlineSubsystemUtils.IpNetDriver")
11
12; Custom collision profile for inventory probe traces
13[/Script/Engine.CollisionProfile]
14+Profiles=(Name="InventoryProbe",CollisionEnabled=QueryOnly,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="Pawn",Response=ECR_Ignore)))
1RowName,DisplayName,MaxStack,bReplicated,bQuestItem
2PotionSmall,Small Potion,10,true,false
3PotionLarge,Large Potion,5,true,false
4QuestKey,Rusty Key,1,false,true
5AmmoRifle,Rifle Ammo,240,true,false
1LogInit: Display: Running engine for game: HighlightingShowcase
2LogPluginManager: Mounting Engine plugin EnhancedInput
3LogModuleManager: Loaded module HighlightingShowcase
4LogHighlightingInventory: Log: Preview subsystem initialized
5LogNet: Warning: InventoryVersion changed while waiting for acked packet 42
6LogAutomationCommandLine: Display: Found 1 automation tests matching HighlightingShowcase.Inventory.PolicyFormatsDebugString
1# CMakeLists.txt for standalone header audit tool
2cmake_minimum_required(VERSION 3.24)
3project(HighlightingShowcaseTools LANGUAGES CXX)
4
5# Require C++20 to match UE5 compilation settings
6set(CMAKE_CXX_STANDARD 20)
7set(CMAKE_CXX_STANDARD_REQUIRED ON)
8
9# Header audit executable: scans for missing includes
10add_executable(HighlightingHeaderAudit
11 Tools/HeaderAudit/Main.cpp
12 Tools/HeaderAudit/Parser.cpp
13)
14
15# Allow includes from the main source tree
16target_include_directories(HighlightingHeaderAudit PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Source)
1# Makefile for building and testing on Linux
2UE_ROOT ?= /opt/UnrealEngine/5.5
3PROJECT ?= $(CURDIR)/HighlightingShowcase.uproject
4
5.PHONY: build editor test package
6
7build:
8 "$(UE_ROOT)/Engine/Build/BatchFiles/Linux/Build.sh" HighlightingShowcaseEditor Linux Development -project="$(PROJECT)"
9
10editor:
11 "$(UE_ROOT)/Engine/Binaries/Linux/UnrealEditor" "$(PROJECT)"
12
13test:
14 "$(UE_ROOT)/Engine/Binaries/Linux/UnrealEditor-Cmd" "$(PROJECT)" -ExecCmds="Automation RunTests HighlightingShowcase.Inventory; Quit"
15
16package:
17 "$(UE_ROOT)/Engine/Build/BatchFiles/RunUAT.sh" BuildPlugin -Plugin="$(CURDIR)/Plugins/HighlightingShowcase/HighlightingShowcase.uplugin" -Package="$(CURDIR)/Artifacts/HighlightingShowcase"
1# Editor utility script for automated asset creation
2# Run via: Tools > Execute Python Script in the Unreal Editor
3
4import unreal
5
6@unreal.uclass()
7class HighlightingInventoryUtility(unreal.GlobalEditorUtilityBase):
8 """Utility class registered with the editor for inventory asset automation."""
9 pass
10
11# Get the asset tools subsystem
12asset_tools = unreal.AssetToolsHelpers.get_asset_tools()
13editor_asset_lib = unreal.EditorAssetLibrary
14
15# Create destination directory if it does not exist
16destination_path = "/Game/Showcase/Data"
17
18if not editor_asset_lib.does_directory_exist(destination_path):
19 editor_asset_lib.make_directory(destination_path)
20
21# Create a data table factory (struct type set at runtime)
22factory = unreal.DataTableFactory()
23factory.struct = unreal.load_object(None, "/Script/Engine.DataTable")
24
25unreal.log("Highlighting showcase asset automation ran successfully.")
1// ShowcaseInventoryBridge.swift
2// Bridges Unreal inventory sessions to native iOS APIs
3
4import Foundation
5
6@objc final class ShowcaseInventoryBridge: NSObject {
7 // Shared singleton accessible from Objective-C
8 @objc static let shared = ShowcaseInventoryBridge()
9
10 /// Start a new inventory session with the given identifier.
11 @objc func beginSession(identifier: String) {
12 NSLog("Highlighting showcase session started: %@", identifier)
13 }
14}
1// HLSInventoryReceiptValidator.h
2// Validates App Store receipt data for inventory purchases
3
4#import <Foundation/Foundation.h>
5
6@interface HLSInventoryReceiptValidator : NSObject
7
8/// Validate the raw receipt data. Returns NO and sets error on failure.
9- (BOOL)validateReceiptData:(NSData *)receiptData error:(NSError * _Nullable * _Nullable)error;
10
11@end
1// IOSShowcaseSession.mm
2// Mixed Objective-C++ bridge for iOS session management
3
4#import "IOS/IOSAppDelegate.h"
5#include "Containers/UnrealString.h"
6#include "Misc/Paths.h"
7
8// Start a showcase session and log the persistent storage path
9void StartHighlightingShowcaseSession(NSString *sessionIdentifier)
10{
11 FString SessionPath = FPaths::ProjectSavedDir() / TEXT("IOS") / FString(sessionIdentifier.UTF8String);
12 UE_LOG(LogTemp, Log, TEXT("Starting iOS showcase session at %s"), *SessionPath);
13}
1<!-- Info.plist: iOS app metadata and permission descriptions -->
2<?xml version="1.0" encoding="UTF-8"?>
3<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
4<plist version="1.0">
5<dict>
6 <key>CFBundleDisplayName</key>
7 <string>Highlighting Showcase</string>
8 <!-- Required for camera-based inventory thumbnail capture -->
9 <key>NSCameraUsageDescription</key>
10 <string>Used by the showcase to capture inventory preview thumbnails.</string>
11</dict>
12</plist>
1# Podfile: CocoaPods dependency specification for iOS
2platform :ios, '15.0'
3
4target 'HighlightingShowcase' do
5 use_frameworks!
6
7 # Firebase for analytics and crash reporting
8 pod 'Firebase/Core', '~> 11.0'
9end
1// ShowcaseInventoryBridge.java
2// Native Android bridge for inventory session management
3
4package com.gamedna.highlightingshowcase;
5
6import android.app.Activity;
7import android.util.Log;
8
9/**
10 * Bridge between Unreal and native Android inventory features.
11 * Called from JNI via the UPL GameActivity hooks.
12 */
13public final class ShowcaseInventoryBridge {
14 private static final String TAG = "ShowcaseInventoryBridge";
15
16 // Start a showcase session on the Android side
17 public static void beginSession(Activity activity, String sessionId) {
18 Log.i(TAG, "Starting showcase session: " + sessionId);
19 }
20}
1// ShowcaseInventoryAnalytics.kt
2// Lightweight analytics tracker for inventory previews
3
4package com.gamedna.highlightingshowcase
5
6/** Tracks inventory preview events for telemetry. */
7object ShowcaseInventoryAnalytics {
8 // Log a preview event with session and slot count
9 fun trackPreview(sessionId: String, slotCount: Int) {
10 println("Preview[$sessionId] slots=$slotCount")
11 }
12}
1// build.gradle: Android library module configuration
2plugins {
3 id 'com.android.library'
4}
5
6android {
7 namespace 'com.gamedna.highlightingshowcase'
8 compileSdk 35
9
10 defaultConfig {
11 minSdk 26 // Minimum API level for UE5 Android
12 targetSdk 35 // Latest stable API level
13 }
14}
1<!-- AndroidManifest.xml: permissions and activity declarations -->
2<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 package="com.gamedna.highlightingshowcase">
4
5 <!-- Required for replication and telemetry -->
6 <uses-permission android:name="android.permission.INTERNET" />
7
8 <application>
9 <!-- Main game activity launched by UE5 -->
10 <activity android:name="com.epicgames.unreal.GameActivity" android:exported="true" />
11 </application>
12</manifest>
1@echo off
2rem Build.bat: Windows build script for the HighlightingShowcase editor target
3set UE_ROOT=C:\UnrealEngine\5.5
4set PROJECT=%~dp0\HighlightingShowcase.uproject
5
6rem Invoke UBT via the batch file wrapper
7"%UE_ROOT%\Engine\Build\BatchFiles\Build.bat" HighlightingShowcaseEditor Win64 Development -project="%PROJECT%"
1# PackagePlugin.ps1: PowerShell script for plugin packaging on Windows
2$ueRoot = "C:\UnrealEngine\5.5"
3$project = Join-Path $PSScriptRoot "HighlightingShowcase.uproject"
4
5# Run UAT BuildPlugin command with the plugin and output paths
6& "$ueRoot\Engine\Build\BatchFiles\RunUAT.bat" BuildPlugin `
7 -Plugin="$PSScriptRoot\Plugins\HighlightingShowcase\HighlightingShowcase.uplugin" `
8 -Package="$PSScriptRoot\Artifacts\HighlightingShowcase"
1#!/usr/bin/env bash
2# build.sh: Linux build, cook, and stage script
3set -euo pipefail
4
5# Default to system UE installation if UE_ROOT is not set
6ue_root=${UE_ROOT:-/opt/UnrealEngine/5.5}
7project=${1:-"$PWD/HighlightingShowcase.uproject"}
8
9# Full BuildCookRun pipeline for Linux development builds
10"$ue_root/Engine/Build/BatchFiles/RunUAT.sh" BuildCookRun \
11 -project="$project" \
12 -platform=Linux \
13 -clientconfig=Development \
14 -cook -build -stage -pak
1// AdvancedInventoryQuery.h
2// Advanced query system with bitflag filters and metadata-heavy structs
3
4#pragma once
5
6#include "CoreMinimal.h"
7#include "GameplayTagContainer.h"
8#include "AdvancedInventoryQuery.generated.h"
9
10/**
11 * Bitflag enum for filtering inventory queries.
12 * Combine flags using bitwise OR: Equipped | Consumable
13 */
14UENUM(BlueprintType, meta = (Bitflags, UseEnumValuesAsMaskValuesInEditor = "true"))
15enum class EInventoryFilterFlags : uint8
16{
17 None = 0 UMETA(Hidden), // No flags set; hidden from editor dropdowns
18 Equipped = 1 << 0, // Item is currently equipped
19 Consumable = 1 << 1, // Item can be consumed
20 Quest = 1 << 2, // Item is related to a quest
21 Replicated = 1 << 3, // Item is replicated to clients
22};
23ENUM_CLASS_FLAGS(EInventoryFilterFlags); // Enable bitwise operators
24
25/*
26 * Query options struct with rich metadata for Blueprint integration.
27 * Uses HasNativeMake/HasNativeBreak for custom Blueprint construction nodes.
28 */
29USTRUCT(BlueprintType, meta = (HasNativeMake = "/Script/HighlightingShowcase.InventoryBlueprintLibrary.MakeInventoryQueryOptions", HasNativeBreak = "/Script/HighlightingShowcase.InventoryBlueprintLibrary.BreakInventoryQueryOptions"))
30struct FInventoryQueryOptions
31{
32 GENERATED_BODY()
33
34private:
35 // Bitmask field: only accessible via getter/setter in Blueprints
36 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Inventory", meta = (AllowPrivateAccess = "true", Bitmask, BitmaskEnum = "/Script/HighlightingShowcase.EInventoryFilterFlags"))
37 int32 FilterMask = 0;
38
39 // Debug label with custom Blueprint getter and setter
40 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Inventory", meta = (AllowPrivateAccess = "true", BlueprintGetter = "GetDebugLabel", BlueprintSetter = "SetDebugLabel"))
41 FString DebugLabel = TEXT("Default");
42
43public:
44 // SaveGame: persisted in save files. Instanced: per-instance data.
45 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Inventory", SaveGame, Instanced, AdvancedDisplay)
46 TObjectPtr<UObject> UserData = nullptr;
47
48 // FieldNotify: triggers UI binding updates when changed
49 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Inventory", FieldNotify)
50 float Progress = 0.0f;
51
52 // Transient fields: not saved, not duplicated, not exported
53 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Inventory", Transient, DuplicateTransient, TextExportTransient)
54 TArray<uint8> ScratchBuffer;
55
56 /** Returns the current debug label. */
57 UFUNCTION(BlueprintGetter)
58 FString GetDebugLabel() const
59 {
60 return DebugLabel;
61 }
62
63 /** Sets a new debug label. */
64 UFUNCTION(BlueprintSetter)
65 void SetDebugLabel(const FString& InDebugLabel)
66 {
67 DebugLabel = InDebugLabel;
68 }
69};
UPARAM, and Node Metadata 1// Result enum for functions that use ExpandEnumAsExecs
2UENUM(BlueprintType)
3enum class EInventoryBlueprintResult : uint8
4{
5 Success, // Operation completed successfully
6 FailedValidation, // Input validation failed
7 MissingWorld, // No world context available
8};
9
10/**
11 * Static Blueprint function library for inventory operations.
12 * Contains utility functions callable from any Blueprint graph.
13 */
14UCLASS()
15class HIGHLIGHTINGSHOWCASE_API UInventoryBlueprintLibrary : public UBlueprintFunctionLibrary
16{
17 GENERATED_BODY()
18
19public:
20 /**
21 * Spawn preview actors into the world for inventory visualization.
22 *
23 * This function demonstrates many Blueprint metadata specifiers:
24 * - WorldContext + DefaultToSelf for automatic world resolution
25 * - DeterminesOutputType + DynamicOutputParam for type inference
26 * - ExpandEnumAsExecs for execution pin splitting
27 * - AdvancedDisplay for collapsible optional pins
28 * - AutoCreateRefTerm for auto-created reference params
29 * - Keywords and CompactNodeTitle for discoverability
30 */
31 UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Inventory|UI", meta = (WorldContext = "WorldContextObject", DefaultToSelf = "WorldContextObject", DeterminesOutputType = "ActorClass", DynamicOutputParam = "SpawnedActors", ExpandEnumAsExecs = "Result", AdvancedDisplay = "OptionalContext,DebugColor,OptionalFilterTags", AutoCreateRefTerm = "OptionalFilterTags", Keywords = "inventory showcase highlight", CompactNodeTitle = "SpawnInv"))
32 static void SpawnPreviewActors(
33 UObject* WorldContextObject,
34 TSubclassOf<AActor> ActorClass,
35 UPARAM(ref) TArray<AActor*>& SpawnedActors, // Output: spawned actors
36 EInventoryBlueprintResult& Result, // Output: success or failure
37 UObject* OptionalContext,
38 FLinearColor DebugColor,
39 const FGameplayTagContainer& OptionalFilterTags
40 );
41
42 // Array wildcard params with type dependency
43 UFUNCTION(BlueprintCallable, Category = "Inventory|Query", meta = (ArrayParm = "SlotNames,SlotIds", ArrayTypeDependentParams = "SlotIds"))
44 static void BuildSlotPairs(const TArray<FName>& SlotNames, const TArray<int32>& SlotIds);
45
46 // Development-only trace function; stripped from shipping builds
47 UFUNCTION(BlueprintPure = false, BlueprintCallable, Category = "Inventory|Debug", meta = (DevelopmentOnly, UnsafeDuringActorConstruction = "true"))
48 static void EmitInventoryTrace(const FString& Message);
49};
50
51/** Actor with editor-only and console command functions. */
52UCLASS()
53class HIGHLIGHTINGSHOWCASE_API AInventoryDebugActor : public AActor
54{
55 GENERATED_BODY()
56
57public:
58 // Callable from the Details panel in the editor
59 UFUNCTION(CallInEditor, Category = "Inventory|Debug")
60 void RebuildPreviewCache();
61
62 // Callable from the console: "AInventoryDebugActor DumpInventoryState"
63 UFUNCTION(Exec)
64 void DumpInventoryState(const FString& OptionalFilter);
65};
1#include "HAL/IConsoleManager.h"
2
3// Namespace for internal inventory utilities
4namespace HighlightingShowcase::Inventory
5{
6 // Type alias for item-quantity pairs
7 using FInventoryPair = TTuple<FName, int32>;
8
9 /**
10 * A snapshot view into the current inventory state.
11 * Uses every major smart pointer and container variant
12 * to exercise highlighting coverage.
13 */
14 struct FSnapshotView
15 {
16 TConstArrayView<FInventorySlot> Slots; // Read-only view into slot array
17 TArrayView<const uint8> SerializedBytes; // Raw serialized data
18 TScriptInterface<IInventoryConsumerInterface> Consumer; // Interface reference
19 TLazyObjectPtr<AActor> ObservedActor; // Lazy-loaded actor reference
20 TSoftClassPtr<UObject> OptionalResolverClass; // Soft class reference (async load)
21 TSharedPtr<FString> TraceLabel; // Shared heap string
22 TUniquePtr<FString> MutableScratch; // Exclusive ownership string
23 TVariant<FString, int32, bool> DebugValue; // Type-safe union
24 TOptional<FInventoryPair> PrimaryPair; // Optional pair (may be empty)
25 TStrongObjectPtr<UObject> OwnerContext; // Root-set preventing GC
26 };
27}
28
29// Editor-only includes
30#if WITH_EDITOR
31#include "Editor.h"
32#endif
33
34// Console variables for runtime tuning (desktop platforms only)
35#if PLATFORM_WINDOWS || PLATFORM_LINUX
36static TAutoConsoleVariable<int32> CVarHighlightingShowcaseVerbose(
37 TEXT("HighlightingShowcase.Verbose"),
38 0, // Default: disabled
39 TEXT("Enables verbose logging for the highlighting showcase."),
40 ECVF_Default
41);
42
43// Console command registered at static init
44static FAutoConsoleCommand CmdDumpInventoryState(
45 TEXT("HighlightingShowcase.DumpInventoryState"),
46 TEXT("Prints the current inventory state to the log."),
47 FConsoleCommandDelegate::CreateStatic(&FHighlightingShowcaseDebug::DumpState)
48);
49#endif
50
51// Conditional trace macro based on build configuration
52#if UE_BUILD_SHIPPING
53#define HS_TRACE_ENABLED 0 // Disabled in shipping builds
54#else
55#define HS_TRACE_ENABLED 1 // Enabled in all other configurations
56#endif
1// Spec-based test: structured Describe/It blocks with latent commands
2BEGIN_DEFINE_SPEC(
3 FHighlightingShowcaseInventorySpec,
4 "HighlightingShowcase.Inventory.LatentSpec",
5 EAutomationTestFlags::ApplicationContextMask | EAutomationTestFlags::ProductFilter
6)
7
8// Member variables available to all Describe/It blocks
9TStrongObjectPtr<UInventoryPreviewSubsystem> Subsystem;
10
11END_DEFINE_SPEC(FHighlightingShowcaseInventorySpec)
12
13void FHighlightingShowcaseInventorySpec::Define()
14{
15 Describe("refresh scheduling", [this]()
16 {
17 It("supports latent waits before assertions", [this]()
18 {
19 // Wait 100ms before running assertions (simulates async work)
20 ADD_LATENT_AUTOMATION_COMMAND(FWaitLatentCommand(0.1f));
21 TestTrue(TEXT("Latent placeholder"), true);
22 });
23 });
24}
1{
2 "Name": "HighlightingShowcaseRuntime",
3 "Type": "Runtime",
4 "LoadingPhase": "PreDefault",
5 "AdditionalDependencies": [
6 "Core",
7 "CoreUObject",
8 "Engine"
9 ],
10 "PlatformAllowList": [
11 "Win64",
12 "Linux",
13 "PS5",
14 "XSX"
15 ]
16}
1{
2 "Contents": [
3 {
4 "File": "Plugins/HighlightingShowcase/HighlightingShowcase.uplugin",
5 "Descriptor": "HighlightingShowcase",
6 "BuildId": "UE5.5-Linux-CL-00000000"
7 }
8 ]
9}
1// Console platform overrides: disable unity builds for better debugging
2if (Target.Platform == UnrealTargetPlatform.PS5 || Target.Platform == UnrealTargetPlatform.XSX)
3{
4 PublicDefinitions.Add("HIGHLIGHTINGSHOWCASE_CONSOLE_TRACE=1");
5 bUseUnity = false; // Separate compilation units for console debuggers
6}
7
8// iOS: inject platform-specific UPL XML for Xcode integration
9if (Target.Platform == UnrealTargetPlatform.IOS)
10{
11 AdditionalPropertiesForReceipt.Add("IOSPlugin", Path.Combine(ModuleDirectory, "IOS", "HighlightingShowcase_IOS.xml"));
12}
1; iOS runtime settings
2[/Script/IOSRuntimeSettings.IOSRuntimeSettings]
3BundleDisplayName=Highlighting Showcase
4bEnableGameCenterSupport=False
5
6; Android runtime settings
7[/Script/AndroidRuntimeSettings.AndroidRuntimeSettings]
8PackageName=com.gamedna.highlightingshowcase
9StoreVersion=21
10MinSDKVersion=26
1<!-- BuildConfiguration.xml: UBT build settings override -->
2<?xml version="1.0" encoding="utf-8"?>
3<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
4 <BuildConfiguration>
5 <!-- Disable unity builds for precise compile error locations -->
6 <bUseUnityBuild>false</bUseUnityBuild>
7 <bWarningsAsErrors>true</bWarningsAsErrors>
8 </BuildConfiguration>
9 <ParallelExecutor>
10 <!-- Scale parallel compilation to available cores -->
11 <ProcessorCountMultiplier>1.0</ProcessorCountMultiplier>
12 </ParallelExecutor>
13</Configuration>
1<!-- HighlightingShowcase_UPL.xml: Android Unreal Plugin Language hooks -->
2<?xml version="1.0" encoding="utf-8"?>
3<root xmlns:android="http://schemas.android.com/apk/res/android">
4 <init>
5 <!-- Log during UPL initialization -->
6 <log text="Configuring HighlightingShowcase Android plugin" />
7 </init>
8 <gameActivityImportAdditions>
9 <!-- Import the native bridge class into GameActivity -->
10 <insert>
11 import com.gamedna.highlightingshowcase.ShowcaseInventoryBridge;
12 </insert>
13 </gameActivityImportAdditions>
14</root>
1<!-- Entitlements.plist: iOS app capabilities -->
2<?xml version="1.0" encoding="UTF-8"?>
3<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
4<plist version="1.0">
5<dict>
6 <!-- Enable Game Center integration -->
7 <key>com.apple.developer.game-center</key>
8 <true/>
9 <!-- Push notification environment (development or production) -->
10 <key>aps-environment</key>
11 <string>development</string>
12</dict>
13</plist>
1<!-- LaunchScreen.storyboard: iOS launch screen layout -->
2<?xml version="1.0" encoding="UTF-8"?>
3<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" initialViewController="ShowcaseViewController">
4 <scenes>
5 <scene sceneID="ShowcaseScene">
6 <objects>
7 <!-- Root view controller for the launch screen -->
8 <viewController id="ShowcaseViewController" customClass="ShowcaseViewController" sceneMemberID="viewController" />
9 </objects>
10 </scene>
11 </scenes>
12</document>
1// build.gradle.kts: Kotlin DSL variant of the Android build configuration
2plugins {
3 id("com.android.library")
4}
5
6android {
7 namespace = "com.gamedna.highlightingshowcase"
8 compileSdk = 35
9
10 defaultConfig {
11 minSdk = 26 // UE5 minimum supported Android API
12 targetSdk = 35 // Latest stable API
13 }
14}
1<!-- strings.xml: Android string resources for notifications -->
2<resources>
3 <string name="highlighting_showcase_notification_channel">Highlighting Showcase</string>
4 <string name="highlighting_showcase_preview_title">Inventory Preview Ready</string>
5</resources>
This section deliberately stresses every code path in the syntax highlighting transformer and theme override system. Each subsection targets a specific highlighting rule to ensure correctness.
UE types, macros, and enum references inside comments and strings must retain their comment or string color without any type, macro, or enum coloring bleeding through.
1// Comment immunity: types, macros, and constants MUST stay green (comment color)
2// FString is a type but this is a comment
3// TArray<FInventorySlot> is a container but this is a comment
4// UCLASS and UPROPERTY are macros but this is a comment
5// EInventoryReplicationMode::ServerAuthoritative is a qualified enum but this is a comment
6// NAME_None is a constant but this is a comment
7// int32, uint8 are primitive typedefs but this is a comment
8// APlayerController, UObject, IInterface are UE types but this is a comment
9// FORCEINLINE and UE_DEPRECATED are standalone macros but this is a comment
10// DECLARE_DELEGATE and IMPLEMENT_MODULE are prefix macros but this is a comment
11// PLATFORM_WINDOWS, WITH_EDITOR, UE_BUILD_SHIPPING are guards but this is a comment
12// HIGHLIGHTINGSHOWCASE_API is an export macro but this is a comment
13// ECVF_Default and COND_SkipOwner are flag constants but this is a comment
14// Super:: is a type reference but this is a comment
15
16/* Block comment immunity:
17 * FString, TArray, TMap, TSet should all remain comment-colored.
18 * UCLASS, UPROPERTY, UFUNCTION should remain comment-colored.
19 * EInventoryFilterFlags::Equipped should NOT be enum-colored here.
20 * GENERATED_BODY and GENERATED_UCLASS_BODY are just text in this comment.
21 */
22
23/**
24 * Doc comment immunity with GTK-doc-like annotations:
25 * OR: This OR: annotation should stay comment-colored, not blue.
26 * AND: Same for AND: annotations inside doc comments.
27 * NOT: And NOT: annotations should also remain comment-colored.
28 * FInventoryPolicy and UObject are types mentioned in documentation.
29 * UPROPERTY(EditAnywhere) looks like a macro but it is in a doc comment.
30 * Returns an FString containing the result.
31 * @param InSlots A TArray of FInventorySlot items.
32 * @return true if EInventoryReplicationMode is ServerAuthoritative.
33 */
34void DocumentedFunction();
35
36// String literal immunity: types inside strings should be string-colored
37FString TypeInString = TEXT("FString is mentioned inside a string literal");
38FString MacroInString = TEXT("UCLASS() and UPROPERTY() are macros in a string");
39FString EnumInString = TEXT("EInventoryReplicationMode::LocalOnly in a string");
40FString PathString = TEXT("/Script/HighlightingShowcase.UInventoryReplicationComponent");
The #define directive lumps everything into one token. Inline // comments must be detected and colored as comments, not as preprocessor text.
1// All inline comments after #define values must render as gray/green comments
2#define HS_MAX_SLOTS 128 // Maximum inventory slots per player
3#define HS_DEFAULT_STACK 10 // Default stack size for stackable items
4#define HS_REPLICATE_INTERVAL 0.5 // Replication interval in seconds
5#define HS_USE_COMPRESSION 1 // Enable network compression
6#define HS_DISABLE_VALIDATION 0 // Disable input validation in shipping builds
7#define HS_INVENTORY_VERSION 3 // Current serialization version
8
9// #define with UE types in the inline comment
10#define HS_SLOT_TYPE FInventorySlot // The FInventorySlot struct is the primary slot type
11#define HS_OWNER_CLASS AInventoryActor // Owner must be an AInventoryActor subclass
12#define HS_LOG_CATEGORY LogHighlightingInventory // Uses custom log category
Every macro category recognized by the transformer must be exercised.
1// === Reflection macros (all 9) ===
2UCLASS()
3class UEdgeCaseDummy : public UObject { GENERATED_BODY() };
4
5USTRUCT()
6struct FEdgeCaseDummy { GENERATED_BODY() };
7
8UENUM()
9enum class EEdgeCaseDummy : uint8 { None };
10
11UINTERFACE()
12class UEdgeCaseInterfaceDummy : public UInterface { GENERATED_BODY() };
13
14class IEdgeCaseInterfaceDummy { GENERATED_BODY() };
15
16UFUNCTION()
17void EdgeCaseFunction();
18
19UPROPERTY()
20int32 EdgeCaseProperty;
21
22UDELEGATE()
23DECLARE_DELEGATE(FEdgeCaseDelegate);
24
25UMETA(Hidden)
26
27UPARAM(ref)
28
29// === Generated macro variants ===
30// GENERATED_BODY is the standard; these are legacy variants
31// GENERATED_UCLASS_BODY was the pre-4.13 equivalent
32// GENERATED_USTRUCT_BODY and GENERATED_IINTERFACE_BODY are rare but must be recognized
33class ULegacyClassBody : public UObject { GENERATED_UCLASS_BODY() };
34struct FLegacyStructBody { GENERATED_USTRUCT_BODY() };
35class ILegacyInterfaceBody { GENERATED_IINTERFACE_BODY() };
36
37// === Logging macros (all 3) ===
38UE_LOG(LogTemp, Log, TEXT("Standard log macro"));
39UE_CLOG(bShouldLog, LogTemp, Warning, TEXT("Conditional log macro"));
40UE_LOGFMT(LogTemp, Display, "Structured format log macro: {Key}", ("Key", "Value"));
41
42// === Standalone macros (all 9) ===
43FORCEINLINE int32 FastAdd(int32 A, int32 B) { return A + B; }
44FORCENOINLINE void SlowPath() {}
45PURE_VIRTUAL(UEdgeCaseDummy::PureVirtualMethod,);
46UE_DEPRECATED(5.5, "Use NewFunction instead") void OldFunction();
47UE_INLINE_GENERATED_CPP_BY_NAME(EdgeCaseComponent)
48FName CachedName = GET_MEMBER_NAME_CHECKED(FInventorySlot, ItemId);
49FString CachedString = GET_MEMBER_NAME_STRING_CHECKED(FInventorySlot, ItemId);
50ATTRIBUTE_ACCESSORS(UEdgeCaseAttributeSet, Health)
51UE_NODISCARD FString ComputeLabel() const;
52
53// === Assertion macros (all 9) ===
54checkf(Slots.Num() > 0, TEXT("Slot array must not be empty"));
55checkCode(Slots.Num() > 0);
56checkNoEntry();
57checkNoReentry();
58checkNoRecursion();
59verifyf(IsValid(Owner), TEXT("Owner must be valid"));
60ensureMsgf(Index >= 0, TEXT("Index must be non-negative: %d"), Index);
61ensureAlways(bInitialized);
62ensureAlwaysMsgf(bReady, TEXT("Component must be ready before use"));
Every prefix pattern in isPrefixMacro() must be exercised at least once.
1// === DECLARE_* prefix macros ===
2DECLARE_DELEGATE(FOnSimpleAction);
3DECLARE_DELEGATE_OneParam(FOnItemAdded, FName);
4DECLARE_DELEGATE_TwoParams(FOnItemMoved, FName, int32);
5DECLARE_DELEGATE_RetVal(bool, FCanPerformAction);
6DECLARE_MULTICAST_DELEGATE(FOnInventoryCleared);
7DECLARE_MULTICAST_DELEGATE_OneParam(FOnSlotDirty, int32);
8DECLARE_DYNAMIC_DELEGATE(FOnDynamicAction);
9DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnPreviewReady, int32, Count, FString, Label);
10DECLARE_EVENT(UInventoryManager, FOnManagerReady);
11
12// === DEFINE_* prefix macros ===
13DEFINE_LOG_CATEGORY(LogHighlightingInventory);
14DEFINE_LOG_CATEGORY_STATIC(LogEdgeCaseLocal, Log, All);
15
16// === IMPLEMENT_* prefix macros ===
17IMPLEMENT_MODULE(FEdgeCaseModule, EdgeCaseModule)
18
19// === DOREPLIFETIME variants ===
20DOREPLIFETIME(AInventoryActor, Slots);
21DOREPLIFETIME_CONDITION(AInventoryActor, bHasAuthority, COND_OwnerOnly);
22
23// === TEXT and localization macros ===
24FString Plain = TEXT("Plain text macro");
25FStringView View = TEXTVIEW("String view macro");
26FText Localized = LOCTEXT("KeyName", "Localized display text");
27FText NamespaceLocalized = NSLOCTEXT("Namespace", "KeyName", "Namespaced localized text");
28FText Invariant = INVTEXT("Invariant culture text");
29FText TableText = LOCTABLE_FROMFILE_ENTRY("TableId", "EntryKey");
30
31// === PRAGMA_* prefix macros ===
32PRAGMA_DISABLE_DEPRECATION_WARNINGS
33void DeprecatedCodePath() {}
34PRAGMA_ENABLE_DEPRECATION_WARNINGS
35
36// === ENUM_CLASS_FLAGS ===
37ENUM_CLASS_FLAGS(EInventoryFilterFlags);
38
39// === SCOPE_CYCLE_COUNTER ===
40SCOPE_CYCLE_COUNTER(STAT_InventoryUpdate);
41
42// === LLM_* memory tracking ===
43LLM_SCOPE(ELLMTag::Untagged);
44
45// === SLATE_* declarative macros ===
46SLATE_BEGIN_ARGS(SInventorySlotWidget) {}
47 SLATE_ARGUMENT(FText, SlotLabel)
48 SLATE_ATTRIBUTE(FLinearColor, SlotColor)
49 SLATE_EVENT(FOnClicked, OnSlotClicked)
50SLATE_END_ARGS()
51
52// === Automation macros ===
53ADD_LATENT_AUTOMATION_COMMAND(FWaitLatentCommand(0.5f));
54BEGIN_DEFINE_SPEC(FEdgeCaseSpec, "EdgeCase.Spec", EAutomationTestFlags::ProductFilter)
55END_DEFINE_SPEC(FEdgeCaseSpec)
56DEFINE_LATENT_AUTOMATION_COMMAND(FEdgeCaseLatentCommand);
Every UE integer typedef must be highlighted as a type.
1// All 8 primitive typedefs used as variable declarations
2int8 SignedByte = -128;
3int16 SignedShort = -32768;
4int32 SignedInt = -2147483648;
5int64 SignedLong = -9223372036854775807;
6uint8 UnsignedByte = 255;
7uint16 UnsignedShort = 65535;
8uint32 UnsignedInt = 4294967295;
9uint64 UnsignedLong = 18446744073709551615;
10
11// Primitive typedefs in function signatures
12void ProcessData(int8 Small, uint16 Medium, int32 Large, uint64 Huge);
13
14// Primitive typedefs in template parameters
15TArray<uint8> ByteBuffer;
16TMap<int32, uint64> IdToTimestamp;
17TOptional<int16> OptionalShort;
Every platform guard, build configuration, and feature guard tested individually.
1// === WITH_* feature guards ===
2#if WITH_EDITOR
3 // Editor-only code path
4#endif
5
6#if WITH_EDITORONLY_DATA
7 // Editor-only data (stripped in cooked builds)
8#endif
9
10#if WITH_ENGINE
11 // Full engine available
12#endif
13
14#if WITH_SERVER_CODE
15 // Dedicated server code path
16#endif
17
18#if WITH_GAMEPLAY_DEBUGGER
19 // Gameplay debugger integration
20#endif
21
22#if WITH_CEF3
23 // Chromium Embedded Framework available
24#endif
25
26// === PLATFORM_* target guards ===
27#if PLATFORM_WINDOWS
28 // Windows-specific code
29#endif
30
31#if PLATFORM_LINUX
32 // Linux-specific code
33#endif
34
35#if PLATFORM_MAC
36 // macOS-specific code
37#endif
38
39#if PLATFORM_IOS
40 // iOS-specific code
41#endif
42
43#if PLATFORM_ANDROID
44 // Android-specific code
45#endif
46
47#if PLATFORM_SWITCH
48 // Nintendo Switch-specific code
49#endif
50
51#if PLATFORM_XBOXONE
52 // Xbox One-specific code
53#endif
54
55#if PLATFORM_PS5
56 // PlayStation 5-specific code
57#endif
58
59#if PLATFORM_XSX
60 // Xbox Series X|S-specific code
61#endif
62
63// === UE_BUILD_* configuration guards ===
64#if UE_BUILD_SHIPPING
65 // Shipping/release build
66#endif
67
68#if UE_BUILD_DEBUG
69 // Debug build with full checks
70#endif
71
72#if UE_BUILD_DEVELOPMENT
73 // Development build (default in editor)
74#endif
75
76#if UE_BUILD_TEST
77 // Test build (shipping-like with logging)
78#endif
79
80// === UE_* runtime mode guards ===
81#if UE_SERVER
82 // Running as dedicated server
83#endif
84
85#if UE_EDITOR
86 // Running inside the editor
87#endif
88
89#if UE_GAME
90 // Running as standalone game
91#endif
92
93// Compound guard expressions
94#if PLATFORM_WINDOWS || PLATFORM_LINUX || PLATFORM_MAC
95 // Desktop platforms
96#endif
97
98#if WITH_EDITOR && !UE_BUILD_SHIPPING
99 // Editor in non-shipping builds
100#endif
ECVF_* and COND_* flag constants must be recognized as macros.
1// === ECVF_* console variable flags ===
2static TAutoConsoleVariable<int32> CVarEdgeCase1(
3 TEXT("EdgeCase.Flag1"), 0, TEXT("Default flags"),
4 ECVF_Default
5);
6
7static TAutoConsoleVariable<float> CVarEdgeCase2(
8 TEXT("EdgeCase.Flag2"), 1.0f, TEXT("Read-only flag"),
9 ECVF_ReadOnly
10);
11
12static TAutoConsoleVariable<int32> CVarEdgeCase3(
13 TEXT("EdgeCase.Flag3"), 0, TEXT("Cheat flag"),
14 ECVF_Cheat
15);
16
17static TAutoConsoleVariable<int32> CVarEdgeCase4(
18 TEXT("EdgeCase.Flag4"), 0, TEXT("Scalability flag"),
19 ECVF_Scalability
20);
21
22// === COND_* replication conditions ===
23DOREPLIFETIME_CONDITION(AEdgeCaseActor, PropertyA, COND_None);
24DOREPLIFETIME_CONDITION(AEdgeCaseActor, PropertyB, COND_InitialOnly);
25DOREPLIFETIME_CONDITION(AEdgeCaseActor, PropertyC, COND_OwnerOnly);
26DOREPLIFETIME_CONDITION(AEdgeCaseActor, PropertyD, COND_SkipOwner);
27DOREPLIFETIME_CONDITION(AEdgeCaseActor, PropertyE, COND_SimulatedOnly);
28DOREPLIFETIME_CONDITION(AEdgeCaseActor, PropertyF, COND_AutonomousOnly);
29DOREPLIFETIME_CONDITION(AEdgeCaseActor, PropertyG, COND_SimulatedOrPhysics);
30DOREPLIFETIME_CONDITION(AEdgeCaseActor, PropertyH, COND_InitialOrOwner);
31DOREPLIFETIME_CONDITION(AEdgeCaseActor, PropertyI, COND_Custom);
32DOREPLIFETIME_CONDITION(AEdgeCaseActor, PropertyJ, COND_ReplayOrOwner);
33DOREPLIFETIME_CONDITION(AEdgeCaseActor, PropertyK, COND_ReplayOnly);
34DOREPLIFETIME_CONDITION(AEdgeCaseActor, PropertyL, COND_ServerOnly);
Various *_API export macros following the [A-Z][A-Z0-9_]*_API pattern.
1// Different API export macro patterns
2class HIGHLIGHTINGSHOWCASE_API FExportedClass {};
3class ENGINE_API FEngineClass {};
4class CORE_API FCoreClass {};
5class COREUOBJECT_API FCoreUObjectClass {};
6class SLATE_API FSlateClass {};
7class SLATECORE_API FSlateCoreClass {};
8class NETCORE_API FNetCoreClass {};
9class UMG_API FUmgClass {};
10class GAMEPLAYTAGS_API FGameplayTagClass {};
11class ENHANCEDINPUT_API FEnhancedInputClass {};
The & (reference), * (pointer), and bitwise operators must render as white, not blue.
1// & as reference in function parameter declarations (storage.modifier.reference)
2void ProcessSlot(const FInventorySlot& InSlot);
3void ModifySlot(FInventorySlot& OutSlot);
4void SwapSlots(FInventorySlot& SlotA, FInventorySlot& SlotB);
5FString& GetMutableName();
6const TArray<FInventorySlot>& GetAllSlots() const;
7
8// & as bitwise AND in expressions (keyword.operator.bitwise)
9int32 MaskedValue = FilterFlags & 0xFF;
10bool HasFlag = (Flags & EInventoryFilterFlags::Equipped) != EInventoryFilterFlags::None;
11uint32 Combined = FlagA & FlagB & FlagC;
12
13// * as pointer in declarations (storage.modifier.pointer)
14FInventorySlot* FindSlot(FName ItemId);
15const FInventorySlot* FindConstSlot(FName ItemId) const;
16AActor* Owner = GetOwner();
17UObject* WorldContext = nullptr;
18void ProcessItems(FInventorySlot* const LockedSlot);
19
20// * as dereference in expressions
21FString OwnerName = *Owner->GetName();
22int32 SlotCount = *OptionalCount;
23
24// Mixed: references, pointers, and bitwise on the same lines
25void ComplexSignature(const FInventorySlot& InSlot, FInventorySlot* OutResult, int32 Flags);
26bool IsMatch = (InSlot.Quantity & RequiredMask) && (OutResult != nullptr);
Types starting with each valid prefix letter (A, U, F, E, I, S, T) must all be colored as types.
1// A-prefix: Actors
2AActor* GenericActor;
3APlayerController* PlayerController;
4AGameModeBase* GameMode;
5AInventoryReplicationActor* ReplicationActor;
6
7// U-prefix: UObjects
8UObject* GenericObject;
9UActorComponent* Component;
10UGameInstanceSubsystem* Subsystem;
11UInventoryReplicationComponent* InvComponent;
12UBlueprintFunctionLibrary* FuncLib;
13
14// F-prefix: Structs and value types
15FString Name;
16FName Tag;
17FText Label;
18FVector Location;
19FRotator Rotation;
20FTransform Transform;
21FLinearColor Color;
22FGameplayTag SingleTag;
23FGameplayTagContainer TagContainer;
24FInventorySlot Slot;
25FInventoryPolicy Policy;
26FInventoryQueryOptions QueryOptions;
27FLifetimeProperty LifetimeProp;
28FSubsystemCollectionBase* Collection;
29
30// E-prefix: Enums
31EInventoryReplicationMode Mode;
32EInventoryFilterFlags FilterFlags;
33EInventoryBlueprintResult Result;
34ECollisionChannel Channel;
35EAutomationTestFlags TestFlags;
36EObjectFlags ObjectFlags;
37
38// I-prefix: Interfaces
39IInventoryConsumerInterface* Consumer;
40IModuleInterface* Module;
41
42// S-prefix: Slate widgets
43SWidget* GenericWidget;
44SWindow* WindowWidget;
45SInventorySlotWidget* SlotWidget;
46
47// T-prefix: Templates and containers
48TArray<FInventorySlot> SlotArray;
49TMap<FName, int32> ItemStacks;
50TSet<FName> UniqueNames;
51TWeakObjectPtr<AActor> WeakActor;
52TSoftObjectPtr<UDataTable> SoftTable;
53TSubclassOf<AActor> ActorClass;
54TOptional<FName> OptionalName;
55TSharedPtr<FString> SharedString;
56TUniquePtr<FInventoryPolicy> UniquePolicy;
57TObjectPtr<UObject> ObjectPtr;
58TScriptInterface<IInventoryConsumerInterface> ScriptInterface;
59TStrongObjectPtr<UObject> StrongObject;
60TConstArrayView<FInventorySlot> ConstView;
61TArrayView<uint8> MutableView;
62TVariant<FString, int32, bool> VariantValue;
63TSoftClassPtr<UObject> SoftClassPtr;
64TLazyObjectPtr<AActor> LazyObject;
65TPair<FName, int32> NamedPair;
Regular identifiers that happen to start with A, U, F, E, I, S, T but do not follow UE naming conventions must remain default-colored.
1// ALL_CAPS identifiers are macros or constants, not types
2// (these should only be colored if they match macro patterns)
3int32 SOME_VALUE = 42;
4int32 TOTAL_COUNT = 100;
5
6// Single uppercase letter followed by all lowercase is NOT a UE type
7// (must have at least UpperUpper then lowercase)
8int32 Apple = 1; // Not a UE type: no second uppercase
9int32 Umbrella = 2; // Not a UE type: no second uppercase
10int32 Forest = 3; // Not a UE type: no second uppercase
11
12// Identifiers without the required prefix letter
13int32 GameScore = 100; // Not a UE type: starts with G
14int32 PlayerCount = 4; // Not a UE type: starts with P
15int32 WorldSize = 8; // Not a UE type: starts with W
Special identifiers and constructor names must be correctly colored.
1// Super:: must be colored as a type when followed by ::
2void AInventoryReplicationActor::BeginPlay()
3{
4 Super::BeginPlay();
5 Super::GetLifetimeReplicatedProps(OutLifetimeProps);
6}
7
8void UInventoryPreviewSubsystem::Initialize(FSubsystemCollectionBase& Collection)
9{
10 Super::Initialize(Collection);
11 Super::Deinitialize();
12}
13
14// NAME_None must be colored as a constant (white)
15FName EmptyName = NAME_None;
16bool bIsNone = (ItemId == NAME_None);
17if (SlotId == NAME_None) {}
18
19// Constructor initializer lists: constructor name should be teal (type-colored)
20AInventoryReplicationActor::AInventoryReplicationActor()
21 : bReplicates(true)
22 , NetUpdateFrequency(30.0f)
23{
24}
25
26FInventoryPolicy::FInventoryPolicy(FName InPolicyName)
27 : PolicyName(InPolicyName)
28{
29}
Bare numeric literals that the C++ grammar fails to scope must be detected and colored correctly.
1// Numeric literals in struct member initializers (constructor context)
2AInventoryReplicationActor::AInventoryReplicationActor()
3{
4 bReplicates = true;
5 NetUpdateFrequency = 30;
6 NetPriority = 1;
7 MaxSlots = 128;
8 DefaultQuantity = 0;
9}
10
11// Numeric literals in various expressions
12int32 Zero = 0;
13int32 One = 1;
14int32 Max = 999999;
15float Rate = 60;
Specifiers inside reflection macro argument lists must be neutralized to default text color, even when they resemble UE types or keywords.
1// All specifiers inside UCLASS() should be neutralized (default text)
2UCLASS(BlueprintType, Blueprintable, Abstract, Transient, DefaultToInstanced, EditInlineNew, CollapseCategories, HideCategories, ShowCategories, ComponentWrapperClass, Within = UGameInstance, Config = Game, DefaultConfig, PerObjectConfig)
3class UEdgeCaseSettings : public UObject
4{
5 GENERATED_BODY()
6
7 // All specifiers inside UPROPERTY() should be neutralized
8 UPROPERTY(EditAnywhere, BlueprintReadWrite, VisibleAnywhere, BlueprintReadOnly, EditDefaultsOnly, EditInstanceOnly, EditFixedSize, Category = "EdgeCase", meta = (AllowPrivateAccess = "true", ClampMin = "0", ClampMax = "100", UIMin = "0", UIMax = "50", DisplayName = "Edge Case Value", ToolTip = "For testing"))
9 int32 Value = 50;
10
11 // All specifiers inside UFUNCTION() should be neutralized
12 UFUNCTION(BlueprintCallable, BlueprintPure, BlueprintAuthorityOnly, BlueprintCosmetic, Server, Client, NetMulticast, Reliable, Unreliable, WithValidation, Category = "EdgeCase", meta = (WorldContext = "WorldContextObject", DefaultToSelf = "WorldContextObject"))
13 void EdgeCaseFunction(UObject* WorldContextObject);
14
15 // Specifiers that look like UE types but are actually specifier keywords
16 UPROPERTY(Transient, DuplicateTransient, TextExportTransient, NonTransactional, SaveGame, Instanced, Export, NoClear, FieldNotify, AdvancedDisplay)
17 TArray<uint8> Buffer;
18};
Enum body members must be colored as enum members (light green). Qualified references (EEnum::Value) must also be colored.
1// Enum body members: each first identifier per line gets enum member color
2UENUM(BlueprintType)
3enum class EEdgeCaseStatus : uint8
4{
5 Idle, // Simple member
6 Processing UMETA(DisplayName = "In Progress"), // Member with UMETA
7 Complete = 2, // Member with explicit value
8 Failed = 3 UMETA(Hidden), // Member with value and UMETA
9 Cancelled, // Member after explicit values
10 MAX UMETA(Hidden), // Conventional max sentinel
11};
12
13// Qualified enum references: EEnum::Value must color the value as enum member
14EEdgeCaseStatus CurrentStatus = EEdgeCaseStatus::Idle;
15if (CurrentStatus == EEdgeCaseStatus::Processing) {}
16bool bFailed = (CurrentStatus == EEdgeCaseStatus::Failed);
17EEdgeCaseStatus NextStatus = EEdgeCaseStatus::Complete;
18EInventoryReplicationMode Mode = EInventoryReplicationMode::ServerAuthoritative;
19EInventoryFilterFlags Mask = EInventoryFilterFlags::Equipped;
20
21// Enum references inside comments must NOT be colored as enum members
22// EEdgeCaseStatus::Idle should stay comment-colored here
23
24// Enum references inside strings must NOT be colored as enum members
25FString EnumStr = TEXT("EEdgeCaseStatus::Processing");
C# using keyword must be blue, namespace names must be white, and compound UBT types must be merged.
1// Using directives: 'using' keyword blue, namespace names white
2using UnrealBuildTool;
3using System;
4using System.IO;
5using System.Collections.Generic;
6using System.Linq;
7using AutomationTool;
8
9// Compound types: ReadOnlyTargetRules and TargetInfo must be merged as types
10public class EdgeCaseModule : ModuleRules
11{
12 public EdgeCaseModule(ReadOnlyTargetRules Target) : base(Target)
13 {
14 PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
15 }
16}
17
18public class EdgeCaseTarget : TargetRules
19{
20 public EdgeCaseTarget(TargetInfo Target) : base(Target)
21 {
22 Type = TargetType.Game;
23 DefaultBuildSettings = BuildSettingsVersion.Latest;
24 }
25}
A single code block that exercises multiple highlighting rules on the same lines and in adjacent contexts to catch interaction bugs.
1// MixedEdgeCases.h
2// Stress test: multiple highlighting rules interacting on adjacent lines
3
4#pragma once
5
6#include "CoreMinimal.h"
7#include "MixedEdgeCases.generated.h"
8
9// Forward declarations: types immediately following comment lines
10class UObject;
11class AActor;
12struct FVector;
13enum class ENetRole : uint8;
14
15/**
16 * Mixed edge case class combining all highlighting features.
17 * Tests that FString, TArray<FInventorySlot>, and UPROPERTY()
18 * are NOT colored inside this documentation comment.
19 */
20UCLASS(BlueprintType, meta = (DisplayName = "Mixed Edge Cases"))
21class HIGHLIGHTINGSHOWCASE_API UMixedEdgeCases : public UObject
22{
23 GENERATED_BODY()
24
25public:
26 // Type + reference + pointer on the same line
27 static FInventorySlot* FindSlotByRef(const TArray<FInventorySlot>& Slots, const FName& ItemId);
28
29 // Multiple UE types as template parameters
30 TMap<FName, TArray<TWeakObjectPtr<AActor>>> ActorsByCategory;
31
32 // Enum type as return + qualified enum in body
33 EInventoryReplicationMode GetMode() const { return EInventoryReplicationMode::LocalOnly; }
34
35 // Macro on one line, type on the next, comment on the third
36 UPROPERTY(EditAnywhere, Category = "Mixed")
37 TSubclassOf<AActor> SpawnClass;
38 // This comment follows a UPROPERTY declaration
39
40 // NAME_None in a conditional with enum comparison
41 bool IsValid(FName Id, EEdgeCaseStatus Status) const
42 {
43 return Id != NAME_None && Status != EEdgeCaseStatus::Failed;
44 }
45
46 // Super:: in an override chain
47 virtual void BeginPlay() override
48 {
49 Super::BeginPlay();
50 UE_LOG(LogTemp, Log, TEXT("MixedEdgeCases BeginPlay"));
51 }
52
53 // int32 and uint8 as both return types and parameters
54 int32 CalculateScore(uint8 Difficulty, int64 Seed) const;
55
56 // Constructor (should be teal/type colored)
57 UMixedEdgeCases();
58
59 // Pointer, reference, and bitwise all in one function
60 void ComplexOperation(
61 FInventorySlot* InSlot, // pointer: * white
62 const FInventorySlot& RefSlot, // reference: & white
63 int32 Flags // regular parameter
64 )
65 {
66 int32 Masked = Flags & 0xFF; // bitwise: & white
67 FString* NamePtr = &InSlot->ItemId.ToString(); // address-of
68 }
69
70private:
71 // FORCEINLINE on a member function
72 FORCEINLINE bool IsReady() const { return bReady; }
73
74 // Platform guard wrapping a member variable
75#if WITH_EDITOR
76 UPROPERTY()
77 FString EditorOnlyLabel;
78#endif
79
80#if UE_BUILD_SHIPPING
81 #define MIXED_TRACE(msg) // Stripped in shipping: no trace output
82#else
83 #define MIXED_TRACE(msg) UE_LOG(LogTemp, Verbose, TEXT(msg)) // Active trace in non-shipping builds
84#endif
85
86 bool bReady = false;
87};