UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ScopedCom.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "HAL/Platform.h"
7
10#include <combaseapi.h>
13
14namespace Audio
15{
16 struct FScopeComString final
17 {
18 LPTSTR StringPtr = nullptr;
19
21
22 const LPTSTR Get() const
23 {
24 return StringPtr;
25 }
26
27 explicit operator bool() const
28 {
29 return Get() != nullptr;
30 }
31
35
37 {
38 if (StringPtr)
39 {
41 }
42 }
43 };
44
46 {
47 public:
49 {
50#if PLATFORM_WINDOWS
51 bCoInitialized = FPlatformMisc::CoInitialize(ECOMModel::Multithreaded);
52#endif
53 }
54
56 {
57#if PLATFORM_WINDOWS
58 if (bCoInitialized)
59 {
60 FPlatformMisc::CoUninitialize();
61 }
62#endif
63 }
64 private:
65 bool bCoInitialized = false;
66 };
67
68}
#define UE_NONCOPYABLE(TypeName)
Definition CoreMiscDefines.h:457
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define THIRD_PARTY_INCLUDES_START
Definition GenericPlatformCompilerPreSetup.h:63
const bool
Definition NetworkReplayStreaming.h:178
@ Multithreaded
Multi-Threaded Apartment (MTA)
Definition ScopedCom.h:46
FScopedCoInitialize()
Definition ScopedCom.h:48
~FScopedCoInitialize()
Definition ScopedCom.h:55
NO_LOGGING.
Definition AudioMixerPlatformAndroid.cpp:53
Definition Voronoi.cpp:10
Definition ScopedCom.h:17
~FScopeComString()
Definition ScopedCom.h:36
const LPTSTR Get() const
Definition ScopedCom.h:22
FScopeComString(LPTSTR InStringPtr=nullptr)
Definition ScopedCom.h:32
LPTSTR StringPtr
Definition ScopedCom.h:18