Files
UnrealEngineUWP/Engine/Source/Developer/Mac/MacTargetPlatform/Private/MacTargetPlatformModule.cpp
Jaroslaw Palczynski ebce413232 UE4 Refactoring. Changed OVERRIDE and FINAL macros to keywords override and final.
[CL 2104397 by Jaroslaw Palczynski in Main branch]
2014-06-13 06:14:46 -04:00

108 lines
2.1 KiB
C++

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
/*=============================================================================
MacTargetPlatformModule.cpp: Implements the FMacTargetPlatformModule class.
=============================================================================*/
#include "MacTargetPlatformPrivatePCH.h"
#define LOCTEXT_NAMESPACE "FMacTargetPlatformModule"
/**
* Holds the target platform singleton.
*/
static ITargetPlatform* Singleton = NULL;
/**
* Module for Mac as a target platform
*/
class FMacTargetPlatformModule
: public ITargetPlatformModule
{
public:
/**
* Destructor.
*/
~FMacTargetPlatformModule()
{
Singleton = NULL;
}
public:
// Begin ITargetPlatformModule interface
virtual ITargetPlatform* GetTargetPlatform() override
{
if (Singleton == NULL)
{
Singleton = new TGenericMacTargetPlatform<true, false, false>();
}
return Singleton;
}
// End ITargetPlatformModule interface
public:
// Begin IModuleInterface interface
virtual void StartupModule() override
{
TargetSettings = ConstructObject<UMacTargetSettings>(UMacTargetSettings::StaticClass(), GetTransientPackage(), "MacTargetSettings", RF_Standalone);
TargetSettings->AddToRoot();
ISettingsModule* SettingsModule = ISettingsModule::Get();
if (SettingsModule != nullptr)
{
SettingsModule->RegisterSettings("Project", "Platforms", "Mac",
LOCTEXT("TargetSettingsName", "Mac"),
LOCTEXT("TargetSettingsDescription", "Mac platform settings description text here"),
TargetSettings
);
}
}
virtual void ShutdownModule() override
{
ISettingsModule* SettingsModule = ISettingsModule::Get();
if (SettingsModule != nullptr)
{
SettingsModule->UnregisterSettings("Project", "Platforms", "Mac");
}
if (!GExitPurge)
{
// If we're in exit purge, this object has already been destroyed
TargetSettings->RemoveFromRoot();
}
else
{
TargetSettings = NULL;
}
}
// End IModuleInterface interface
private:
// Holds the target settings.
UMacTargetSettings* TargetSettings;
};
#undef LOCTEXT_NAMESPACE
IMPLEMENT_MODULE( FMacTargetPlatformModule, MacTargetPlatform);