本文整理汇总了C++中FString函数的典型用法代码示例。如果您正苦于以下问题:C++ FString函数的具体用法?C++ FString怎么用?C++ FString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CopyFileToPublicStaging
bool CopyFileToPublicStaging(const FString& SourceFile)
{
FString IpaFilename = FPaths::GetCleanFilename(SourceFile);
return CopyFileToDevice(SourceFile, FString(TEXT("/PublicStaging/")) + IpaFilename, 1024*1024);
}
示例2: GetGraph
UK2Node::ERedirectType UK2Node::DoPinsMatchForReconstruction(const UEdGraphPin* NewPin, int32 NewPinIndex, const UEdGraphPin* OldPin, int32 OldPinIndex) const
{
ERedirectType RedirectType = ERedirectType_None;
// if the pin names do match
if (FCString::Stricmp(*(NewPin->PinName), *(OldPin->PinName)) == 0)
{
// Make sure we're not dealing with a menu node
UEdGraph* OuterGraph = GetGraph();
if( OuterGraph && OuterGraph->Schema )
{
const UEdGraphSchema_K2* K2Schema = Cast<const UEdGraphSchema_K2>(GetSchema());
if( !K2Schema || K2Schema->IsSelfPin(*NewPin) || K2Schema->ArePinTypesCompatible(OldPin->PinType, NewPin->PinType) )
{
RedirectType = ERedirectType_Name;
}
else
{
RedirectType = ERedirectType_None;
}
}
}
else
{
// try looking for a redirect if it's a K2 node
if (UK2Node* Node = Cast<UK2Node>(NewPin->GetOwningNode()))
{
if (OldPin->ParentPin == NULL)
{
// if you don't have matching pin, now check if there is any redirect param set
TArray<FString> OldPinNames;
GetRedirectPinNames(*OldPin, OldPinNames);
FName NewPinName;
RedirectType = ShouldRedirectParam(OldPinNames, /*out*/ NewPinName, Node);
// make sure they match
if ((RedirectType != ERedirectType_None) && FCString::Stricmp(*(NewPin->PinName), *(NewPinName.ToString())) != 0)
{
RedirectType = ERedirectType_None;
}
}
else
{
struct FPropertyDetails
{
const UEdGraphPin* Pin;
FString PropertyName;
FPropertyDetails(const UEdGraphPin* InPin, const FString& InPropertyName)
: Pin(InPin), PropertyName(InPropertyName)
{
}
};
TArray<FPropertyDetails> ParentHierarchy;
const UEdGraphPin* CurPin = OldPin;
do
{
ParentHierarchy.Add(FPropertyDetails(CurPin, CurPin->PinName.RightChop(CurPin->ParentPin->PinName.Len() + 1)));
CurPin = CurPin->ParentPin;
} while (CurPin->ParentPin);
// if you don't have matching pin, now check if there is any redirect param set
TArray<FString> OldPinNames;
GetRedirectPinNames(*CurPin, OldPinNames);
FString NewPinNameStr;
FName NewPinName;
RedirectType = ShouldRedirectParam(OldPinNames, /*out*/ NewPinName, Node);
NewPinNameStr = (RedirectType == ERedirectType_None ? CurPin->PinName : NewPinName.ToString());
for (int32 ParentIndex = ParentHierarchy.Num() - 1; ParentIndex >= 0; --ParentIndex)
{
const UEdGraphPin* CurPin = ParentHierarchy[ParentIndex].Pin;
const UEdGraphPin* ParentPin = CurPin->ParentPin;
TMap<FName, FName>* StructRedirects = UStruct::TaggedPropertyRedirects.Find(ParentPin->PinType.PinSubCategoryObject->GetFName());
if (StructRedirects)
{
FName* PropertyRedirect = StructRedirects->Find(FName(*ParentHierarchy[ParentIndex].PropertyName));
if (PropertyRedirect)
{
NewPinNameStr += FString("_") + PropertyRedirect->ToString();
}
else
{
NewPinNameStr += FString("_") + ParentHierarchy[ParentIndex].PropertyName;
}
}
else
{
NewPinNameStr += FString("_") + ParentHierarchy[ParentIndex].PropertyName;
}
}
// make sure they match
RedirectType = ((FCString::Stricmp(*(NewPin->PinName), *NewPinNameStr) != 0) ? ERedirectType_None : ERedirectType_Name);
}
//.........这里部分代码省略.........
示例3: TEXT
bool LocalizationCommandletTasks::ReportLoadedAudioAssets(const TArray<ULocalizationTarget*>& Targets, const TOptional<FString>& CultureName)
{
TSet<FString> LoadedDialogueWaveAssets;
TSet<FString> LoadedSoundWaveAssets;
for (const ULocalizationTarget* Target : Targets)
{
const FString RootAssetPath = Target->IsMemberOfEngineTargetSet() ? TEXT("/Engine") : TEXT("/Game");
TArray<FString> CulturesToTest;
{
if (CultureName.IsSet())
{
CulturesToTest.Add(CultureName.GetValue());
}
else
{
CulturesToTest.Reserve(Target->Settings.SupportedCulturesStatistics.Num());
for (const FCultureStatistics& CultureData : Target->Settings.SupportedCulturesStatistics)
{
CulturesToTest.Add(CultureData.CultureName);
}
}
}
TArray<FString> DialogueWavePathsToTest;
TArray<FString> SoundWavePathsToTest;
{
const FString NativeCulture = Target->Settings.SupportedCulturesStatistics.IsValidIndex(Target->Settings.NativeCultureIndex) ? Target->Settings.SupportedCulturesStatistics[Target->Settings.NativeCultureIndex].CultureName : FString();
const bool bImportNativeAsSource = Target->Settings.ImportDialogueSettings.bImportNativeAsSource && !NativeCulture.IsEmpty();
if (bImportNativeAsSource)
{
DialogueWavePathsToTest.Add(RootAssetPath);
SoundWavePathsToTest.Add(RootAssetPath / Target->Settings.ImportDialogueSettings.ImportedDialogueFolder);
}
for (const FString& Culture : CulturesToTest)
{
if (bImportNativeAsSource && Culture == NativeCulture)
{
continue;
}
DialogueWavePathsToTest.Add(RootAssetPath / TEXT("L10N") / Culture);
SoundWavePathsToTest.Add(RootAssetPath / TEXT("L10N") / Culture / Target->Settings.ImportDialogueSettings.ImportedDialogueFolder);
}
}
ForEachObjectOfClass(UDialogueWave::StaticClass(), [&](UObject* InObject)
{
const FString ObjectPath = InObject->GetPathName();
auto FindAssetPathPredicate = [&](const FString& InAssetPath) -> bool
{
return ObjectPath.StartsWith(InAssetPath, ESearchCase::IgnoreCase);
};
if (DialogueWavePathsToTest.ContainsByPredicate(FindAssetPathPredicate))
{
LoadedDialogueWaveAssets.Add(ObjectPath);
}
});
ForEachObjectOfClass(USoundWave::StaticClass(), [&](UObject* InObject)
{
const FString ObjectPath = InObject->GetPathName();
auto FindAssetPathPredicate = [&](const FString& InAssetPath) -> bool
{
return ObjectPath.StartsWith(InAssetPath, ESearchCase::IgnoreCase);
};
if (SoundWavePathsToTest.ContainsByPredicate(FindAssetPathPredicate))
{
LoadedSoundWaveAssets.Add(ObjectPath);
}
});
}
if (LoadedDialogueWaveAssets.Num() > 0 || LoadedSoundWaveAssets.Num() > 0)
{
FTextBuilder MsgBuilder;
MsgBuilder.AppendLine(LOCTEXT("Warning_LoadedAudioAssetsMsg", "The following audio assets have been loaded by the editor and may cause the dialogue import to fail as their files will be read-only."));
MsgBuilder.AppendLine(FText::GetEmpty());
MsgBuilder.AppendLine(LOCTEXT("Warning_LoadedAudioAssetsMsg_Continue", "Do you want to continue?"));
if (LoadedDialogueWaveAssets.Num() > 0)
{
MsgBuilder.AppendLine(FText::GetEmpty());
MsgBuilder.AppendLine(LOCTEXT("Warning_LoadedAudioAssetsMsg_DialogueWaves", "Dialogue Waves:"));
MsgBuilder.Indent();
for (const FString& LoadedDialogueWaveAsset : LoadedDialogueWaveAssets)
{
MsgBuilder.AppendLine(LoadedDialogueWaveAsset);
}
MsgBuilder.Unindent();
}
if (LoadedSoundWaveAssets.Num() > 0)
//.........这里部分代码省略.........
示例4: UE_LOG
FString UpdateManager::HelloWorld() {
UE_LOG(LogTemp, Log, TEXT("Hello, World"));
return FString("Hello, I'm Happy!");
}
示例5: return
FString FLiveEditorWizardBase::GetAdvanceButtonText() const
{
return (IsOnLastStep())? FString( TEXT("Finish") ) : FString( TEXT("Next") );
}
示例6: UE_LOG_ONLINE
/**
* Create a search result from a server response
*
* @param ServerDetails Steam server details
*/
void FOnlineAsyncTaskSteamFindServerBase::ParseSearchResult(class gameserveritem_t* ServerDetails)
{
TSharedRef<FInternetAddr> ServerAddr = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->CreateInternetAddr();
ServerAddr->SetIp(ServerDetails->m_NetAdr.GetIP());
ServerAddr->SetPort(ServerDetails->m_NetAdr.GetConnectionPort());
int32 ServerQueryPort = ServerDetails->m_NetAdr.GetQueryPort();
UE_LOG_ONLINE(Warning, TEXT("Server response IP:%s"), *ServerAddr->ToString(false));
if (ServerDetails->m_bHadSuccessfulResponse)
{
FString GameTags(UTF8_TO_TCHAR(ServerDetails->m_szGameTags));
// Check for build compatibility
int32 ServerBuildId = 0;
int32 BuildUniqueId = GetBuildUniqueId();
TArray<FString> TagArray;
GameTags.ParseIntoArray(TagArray, TEXT(","), true);
if (TagArray.Num() > 0 && TagArray[0].StartsWith(STEAMKEY_BUILDUNIQUEID))
{
ServerBuildId = FCString::Atoi(*TagArray[0].Mid(ARRAY_COUNT(STEAMKEY_BUILDUNIQUEID)));
}
if (ServerBuildId != 0 && ServerBuildId == BuildUniqueId)
{
// Create a new pending search result
FPendingSearchResultSteam* NewPendingSearch = new (PendingSearchResults) FPendingSearchResultSteam(this);
NewPendingSearch->ServerId = FUniqueNetIdSteam(ServerDetails->m_steamID);
NewPendingSearch->HostAddr = ServerAddr;
// Fill search result members
FOnlineSessionSearchResult* NewSearchResult = &NewPendingSearch->PendingSearchResult;
NewSearchResult->PingInMs = FMath::Clamp(ServerDetails->m_nPing, 0, MAX_QUERY_PING);
// Fill session members
FOnlineSession* NewSession = &NewSearchResult->Session;
//NewSession->OwningUserId = ;
NewSession->OwningUserName = UTF8_TO_TCHAR(ServerDetails->GetName());
NewSession->NumOpenPublicConnections = ServerDetails->m_nMaxPlayers - ServerDetails->m_nPlayers;
NewSession->NumOpenPrivateConnections = 0;
// Fill session settings members
NewSession->SessionSettings.NumPublicConnections = ServerDetails->m_nMaxPlayers;
NewSession->SessionSettings.NumPrivateConnections = 0;
NewSession->SessionSettings.bAntiCheatProtected = ServerDetails->m_bSecure ? true : false;
NewSession->SessionSettings.Set(SETTING_MAPNAME, FString(UTF8_TO_TCHAR(ServerDetails->m_szMap)), EOnlineDataAdvertisementType::ViaOnlineService);
// Start a rules request for this new result
NewPendingSearch->ServerQueryHandle = SteamMatchmakingServersPtr->ServerRules(ServerDetails->m_NetAdr.GetIP(), ServerQueryPort, NewPendingSearch);
if (NewPendingSearch->ServerQueryHandle == HSERVERQUERY_INVALID)
{
// Remove the failed element
PendingSearchResults.RemoveAtSwap(PendingSearchResults.Num() - 1);
}
}
else
{
UE_LOG_ONLINE(Warning, TEXT("Removed incompatible build: ServerBuildUniqueId = 0x%08x, GetBuildUniqueId() = 0x%08x"),
ServerBuildId, BuildUniqueId);
}
}
}
示例7: FString
FString UBlackboardKeyType_NativeEnum::DescribeValue(const uint8* RawData) const
{
return EnumType ? EnumType->GetEnumName(GetValue(RawData)) : FString("UNKNOWN!");
}
示例8: MakeShareable
void FTODAssetPropertyDetails::CustomizeDetails(IDetailLayoutBuilder& DetailLayout)
{
const IDetailsView& DetailView = DetailLayout.GetDetailsView();
//first find asset we are going to edit.
TWeakObjectPtr<UObject> InspectedObject;
for (TWeakObjectPtr<UObject> inspObj : DetailView.GetSelectedObjects())
{
InspectedObject = inspObj;
break;
}
UTODAsset* TODAsset = Cast<UTODAsset>(InspectedObject.Get());
CurrentTODAsset = Cast<UTODAsset>(InspectedObject.Get());
if (TODAsset)
{
for (TFieldIterator<UProperty> PropIt(TODAsset->GetClass()); PropIt; ++PropIt)
{
UProperty* prop = *PropIt;
DetailLayout.HideProperty(prop->GetFName());
//PropertyHandles.Add(DetailLayout.GetProperty(prop->GetFName()));
UStructProperty* structProp = Cast<UStructProperty>(prop);
if (structProp)
{
FRuntimeFloatCurve* floatCurve = structProp->ContainerPtrToValuePtr<FRuntimeFloatCurve>(TODAsset);
if (floatCurve)
{
TSharedPtr<FTODFloatCurveProperty> tempFloatProp = MakeShareable(new FTODFloatCurveProperty());
tempFloatProp->PropertyHandle = DetailLayout.GetProperty(prop->GetFName());
tempFloatProp->TODAsset = TODAsset;
tempFloatProp->CategoryName = tempFloatProp->PropertyHandle->GetMetaData(TEXT("Category"));
FloatCurves.Add(tempFloatProp);
}
}
}
}
IDetailCategoryBuilder& DetailCategoryBuilder = DetailLayout.EditCategory("Property Detail");
FDetailWidgetRow& DetailRow = DetailCategoryBuilder.AddCustomRow(FString("Custom Row"));
////now customize each property
//FRuntimeFloatCurve* floatCurve;
TSharedPtr<IPropertyHandle> hour = DetailLayout.GetProperty(TEXT("Hour"));
DetailCategoryBuilder.AddProperty(hour);
IDetailCategoryBuilder& SunCategoryBuilder = DetailLayout.EditCategory("Sun");
IDetailCategoryBuilder& AFCategoryBuilder = DetailLayout.EditCategory("Atmospheric Fog");
IDetailCategoryBuilder& HFCategoryBuilder = DetailLayout.EditCategory("Height Fog");
IDetailCategoryBuilder& PPCategoryBuilder = DetailLayout.EditCategory("Post Process");
IDetailCategoryBuilder& SkyLightCategoryBuilder = DetailLayout.EditCategory("SkyLight");
IDetailCategoryBuilder& MoonCategoryBuilder = DetailLayout.EditCategory("Moon");
for (TSharedPtr<FTODFloatCurveProperty> floatCurves : FloatCurves)
{
if (floatCurves->CategoryName == FString("Sun"))
floatCurves->ConstructWidget(SunCategoryBuilder);
if (floatCurves->CategoryName == FString("Atmospheric Fog"))
floatCurves->ConstructWidget(AFCategoryBuilder);
if (floatCurves->CategoryName == FString("Height Fog"))
floatCurves->ConstructWidget(HFCategoryBuilder);
if (floatCurves->CategoryName == FString("Post Process"))
floatCurves->ConstructWidget(PPCategoryBuilder);
if (floatCurves->CategoryName == FString("SkyLight"))
floatCurves->ConstructWidget(SkyLightCategoryBuilder);
if (floatCurves->CategoryName == FString("Moon"))
floatCurves->ConstructWidget(MoonCategoryBuilder);
}
}
示例9: MessageHandler
FOculusInput::FOculusInput( const TSharedRef< FGenericApplicationMessageHandler >& InMessageHandler )
: MessageHandler( InMessageHandler )
, ControllerPairs()
, TriggerThreshold(0.8f)
{
// Initializes LibOVR.
ovrInitParams initParams;
FMemory::Memset(initParams, 0);
initParams.Flags = ovrInit_RequestVersion;
initParams.RequestedMinorVersion = OVR_MINOR_VERSION;
#if !UE_BUILD_SHIPPING
// initParams.LogCallback = OvrLogCallback;
#endif
ovrResult initStatus = ovr_Initialize(&initParams);
if (!OVR_SUCCESS(initStatus) && initStatus == ovrError_LibLoad)
{
// fatal errors: can't load library
UE_LOG(LogOcInput, Log, TEXT("Can't find Oculus library %s: is proper Runtime installed? Version: %s"),
TEXT(OVR_FILE_DESCRIPTION_STRING), TEXT(OVR_VERSION_STRING));
return;
}
FOculusTouchControllerPair& ControllerPair = *new(ControllerPairs) FOculusTouchControllerPair();
// @todo: Unreal controller index should be assigned to us by the engine to ensure we don't contest with other devices
ControllerPair.UnrealControllerIndex = 0; //???? NextUnrealControllerIndex++;
// Load the config, even if we failed to initialize a controller
LoadConfig();
IModularFeatures::Get().RegisterModularFeature( GetModularFeatureName(), this );
GEngine->MotionControllerDevices.AddUnique(this);
// Register the FKeys
EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Left_Thumbstick, LOCTEXT("OculusTouch_Left_Thumbstick", "Oculus Touch (L) Thumbstick CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Left_FaceButton1, LOCTEXT("OculusTouch_Left_FaceButton1", "Oculus Touch (L) X Button CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Left_Trigger, LOCTEXT("OculusTouch_Left_Trigger", "Oculus Touch (L) Trigger CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Left_FaceButton2, LOCTEXT("OculusTouch_Left_FaceButton2", "Oculus Touch (L) Y Button CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Left_IndexPointing, LOCTEXT("OculusTouch_Left_IndexPointing", "Oculus Touch (L) Pointing CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Left_ThumbUp, LOCTEXT("OculusTouch_Left_ThumbUp", "Oculus Touch (L) Thumb Up CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Right_Thumbstick, LOCTEXT("OculusTouch_Right_Thumbstick", "Oculus Touch (R) Thumbstick CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Right_FaceButton1, LOCTEXT("OculusTouch_Right_FaceButton1", "Oculus Touch (R) A Button CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Right_Trigger, LOCTEXT("OculusTouch_Right_Trigger", "Oculus Touch (R) Trigger CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Right_FaceButton2, LOCTEXT("OculusTouch_Right_FaceButton2", "Oculus Touch (R) B Button CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Right_IndexPointing, LOCTEXT("OculusTouch_Right_IndexPointing", "Oculus Touch (R) Pointing CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
EKeys::AddKey(FKeyDetails(FOculusTouchCapacitiveKey::OculusTouch_Right_ThumbUp, LOCTEXT("OculusTouch_Right_ThumbUp", "Oculus Touch (R) Thumb Up CapTouch"), FKeyDetails::GamepadKey | FKeyDetails::FloatAxis));
UE_LOG(LogOcInput, Log, TEXT("OculusInput is initialized. Init status %d. Runtime version: %s"), int(initStatus), *FString(ANSI_TO_TCHAR(ovr_GetVersionString())));
}
示例10: cstr
//Rama's String From Binary Array
//This function requires #include <string>
FString CloudyWebAPIImpl::StringFromBinaryArray(const TArray<uint8>& BinaryArray)
{
//Create a string from a byte array!
std::string cstr(reinterpret_cast<const char*>(BinaryArray.GetData()), BinaryArray.Num());
return FString(cstr.c_str());
}
示例11: TestBasicStringExpression
virtual bool TestBasicStringExpression(const FTextFilterString& InValue, const ETextFilterTextComparisonMode InTextComparisonMode) const override
{
const TCHAR* Ptr = AssetFullPath.GetCharArray().GetData();
if (Ptr)
{
// Test each piece of the path name, apart from the first
bool bIsFirst = true;
while (const TCHAR* Delimiter = FCString::Strchr(Ptr, '/'))
{
const int32 Length = Delimiter - Ptr;
if (Length > 0)
{
if (bIsFirst)
{
bIsFirst = false;
}
else
{
if (TextFilterUtils::TestBasicStringExpression(FString(Length, Ptr), InValue, InTextComparisonMode))
{
return true;
}
}
}
Ptr += (Length + 1);
}
if (*Ptr != 0)
{
if (TextFilterUtils::TestBasicStringExpression(Ptr, InValue, InTextComparisonMode))
{
return true;
}
}
}
if (bIncludeClassName)
{
if (TextFilterUtils::TestBasicStringExpression(AssetPtr->AssetClass, InValue, InTextComparisonMode))
{
return true;
}
// Only test this if we're searching the class name too, as the exported text contains the type in the string
if (TextFilterUtils::TestBasicStringExpression(AssetExportTextName, InValue, InTextComparisonMode))
{
return true;
}
}
for (const FName& AssetCollectionName : AssetCollectionNames)
{
if (TextFilterUtils::TestBasicStringExpression(AssetCollectionName, InValue, InTextComparisonMode))
{
return true;
}
}
return false;
}
示例12: check
void FDirectoryWatchRequestWindows::ProcessChange(uint32 Error, uint32 NumBytes)
{
if (Error == ERROR_OPERATION_ABORTED || NumBytes == 0 )
{
// The operation was aborted, likely due to EndWatchRequest canceling it.
// Mark the request for delete so it can be cleaned up next tick.
bPendingDelete = true;
return;
}
bool bValidNotification = (Error != ERROR_OPERATION_ABORTED && Error != ERROR_IO_INCOMPLETE && NumBytes > 0 );
// Copy the change to the backbuffer so we can start a new read as soon as possible
if ( bValidNotification )
{
check(BackBuffer);
FMemory::Memcpy(BackBuffer, Buffer, NumBytes);
}
// Start up another read
const bool bSuccess = !!::ReadDirectoryChangesW(
DirectoryHandle,
Buffer,
BufferLength,
bWatchSubtree,
NotifyFilter,
NULL,
&Overlapped,
&FDirectoryWatchRequestWindows::ChangeNotification);
if ( !bValidNotification )
{
UE_LOG(LogDirectoryWatcher, Warning, TEXT("A directory notification failed for '%s' because it was aborted or there was a buffer overflow."), *Directory);
return;
}
// No need to process the change if we can not execute any delegates
if ( !HasDelegates() )
{
return;
}
// Process the change
uint8* InfoBase = BackBuffer;
do
{
FILE_NOTIFY_INFORMATION* NotifyInfo = (FILE_NOTIFY_INFORMATION*)InfoBase;
// Copy the WCHAR out of the NotifyInfo so we can put a NULL terminator on it and convert it to a FString
const int32 Len = NotifyInfo->FileNameLength / sizeof(WCHAR);
WCHAR* RawFilename = new WCHAR[Len + 1];
FMemory::Memcpy(RawFilename, NotifyInfo->FileName, NotifyInfo->FileNameLength);
RawFilename[Len] = 0;
FFileChangeData::EFileChangeAction Action;
switch(NotifyInfo->Action)
{
case FILE_ACTION_ADDED:
case FILE_ACTION_RENAMED_NEW_NAME:
Action = FFileChangeData::FCA_Added;
break;
case FILE_ACTION_REMOVED:
case FILE_ACTION_RENAMED_OLD_NAME:
Action = FFileChangeData::FCA_Removed;
break;
case FILE_ACTION_MODIFIED:
Action = FFileChangeData::FCA_Modified;
break;
default:
Action = FFileChangeData::FCA_Unknown;
break;
}
// WCHAR to TCHAR conversion. In windows this is probably okay.
const FString Filename = Directory / FString(RawFilename);
new (FileChanges) FFileChangeData(Filename, Action);
// Delete the scratch WCHAR*
delete[] RawFilename;
// If there is not another entry, break the loop
if ( NotifyInfo->NextEntryOffset == 0 )
{
break;
}
// Adjust the offset and update the NotifyInfo pointer
InfoBase += NotifyInfo->NextEntryOffset;
}
while(true);
}
示例13: return
FString UKismetStringLibrary::Conv_ObjectToString(class UObject* InObj)
{
return (InObj != NULL) ? InObj->GetName() : FString(TEXT("None"));
}
示例14: ifile
int CSVParser::ReadPropertyDataCSV(const char* FileName, Utils::FHashMap<SongDetails>& OutputMap, bool FirstRowDiscarded, char elem_delim, char row_delim)
{
int lineNumber = 0;
std::string line, linetoken;
std::ifstream ifile(FileName);
if (!ifile) { //file can't be opened
return -1;
}
/* before going on I want to point out one thing:
* I HATE std::getline
* and obviously std::getline hates me.
* It is important you remember that
* if you touch std::getline code
* std::getline will take its revenge on you. */
if (FirstRowDiscarded)
{
if (!std::getline(ifile, line, row_delim))
return 0;
}
while (std::getline(ifile, line, row_delim))
{
#ifdef DEBUG_CSV_CONTENT
UE_LOG(LogTemp, Log, TEXT("new line: \n%s\ntokenized as"), *FString(line.c_str()));
//DEBUG(line.c_str())
#endif
std::istringstream str_parser;
bool found = false;
str_parser.str(line);
TArray<FString> SeparatedLine = TArray<FString>();
FString ElementID; //first column is Element ID.
FString DimensionID = ""; //second column is Dimension ID
std::getline(str_parser, linetoken, elem_delim);
ElementID = Utils::CustomUnquote(FString(linetoken.c_str()));
try {
OutputMap.at(ElementID);
found = true;
}
catch (std::out_of_range e) {
found = false;
}
if (found) { //if failed to load line, jump to next line
FSongProperty property;
std::getline(str_parser, linetoken, elem_delim);
DimensionID = Utils::CustomUnquote(FString(linetoken.c_str()));
while (std::getline(str_parser, linetoken, elem_delim)) { //from third element to end of line
SeparatedLine.Add(Utils::CustomUnquote(FString(linetoken.c_str()))); //append
#ifdef DEBUG_CSV_CONTENT
UE_LOG(LogTemp, Log, TEXT("%s"), *Utils::CustomUnquote(FString(linetoken.c_str())));
//DEBUG(linetoken.c_str())
#endif
}
property << SeparatedLine;
if (DimensionID.Len() > 0)
{
OutputMap[ElementID].Properties[DimensionID] = property;
}
lineNumber++;
}
#ifdef DEBUG_CSV_CONTENT
UE_LOG(LogTemp, Log, TEXT(" . . . . . . ."));
#endif
}
ifile.close();
return lineNumber;
}
示例15: TEXT
/** Create a tokenized message record from a message containing @@ indicating where each UObject* in the ArgPtr list goes and place it in the MessageLog. */
void FCompilerResultsLog::InternalLogMessage(const EMessageSeverity::Type& Severity, const TCHAR* Message, va_list ArgPtr)
{
UEdGraphNode* OwnerNode = nullptr;
// Create the tokenized message
TSharedRef<FTokenizedMessage> Line = FTokenizedMessage::Create( Severity );
Messages.Add(Line);
const TCHAR* DelimiterStr = TEXT("@@");
int32 DelimLength = FCString::Strlen(DelimiterStr);
const TCHAR* Start = Message;
if (Start && DelimLength)
{
while (const TCHAR* At = FCString::Strstr(Start, DelimiterStr))
{
// Found a delimiter, create a token from the preceding text
Line->AddToken( FTextToken::Create( FText::FromString( FString(At - Start, Start) ) ) );
Start += DelimLength + (At - Start);
// And read the object and add another token for the object
UObject* ObjectArgument = va_arg(ArgPtr, UObject*);
FText ObjText;
if (ObjectArgument)
{
// Remap object references to the source nodes
ObjectArgument = FindSourceObject(ObjectArgument);
if (ObjectArgument)
{
UEdGraphNode* Node = Cast<UEdGraphNode>(ObjectArgument);
const UEdGraphPin* Pin = (Node? nullptr : Cast<UEdGraphPin>(ObjectArgument));
//Get owner node reference, consider the first
if (OwnerNode == nullptr)
{
OwnerNode = (Pin ? Pin->GetOwningNodeUnchecked() : Node);
}
if (ObjectArgument->GetOutermost() == GetTransientPackage())
{
ObjText = LOCTEXT("Transient", "(transient)");
}
else if (Node != NULL)
{
ObjText = Node->GetNodeTitle(ENodeTitleType::ListView);
}
else if (Pin != NULL)
{
ObjText = Pin->GetDisplayName();
}
else
{
ObjText = FText::FromString( ObjectArgument->GetName() );
}
}
else
{
ObjText = LOCTEXT("None", "(none)");
}
}
else
{
ObjText = LOCTEXT("None", "(none)");
}
Line->AddToken( FUObjectToken::Create( ObjectArgument, ObjText ) );
}
Line->AddToken( FTextToken::Create( FText::FromString( Start ) ) );
}
va_end(ArgPtr);
// Register node error/warning.
AnnotateNode(OwnerNode, Line);
if( !bSilentMode && (!bLogInfoOnly || (Severity == EMessageSeverity::Info)) )
{
if(Severity == EMessageSeverity::CriticalError || Severity == EMessageSeverity::Error)
{
UE_LOG(LogBlueprint, Error, TEXT("[compiler] %s"), *Line->ToText().ToString());
}
else if(Severity == EMessageSeverity::Warning || Severity == EMessageSeverity::PerformanceWarning)
{
UE_LOG(LogBlueprint, Warning, TEXT("[compiler] %s"), *Line->ToText().ToString());
}
else
{
UE_LOG(LogBlueprint, Log, TEXT("[compiler] %s"), *Line->ToText().ToString());
}
}
}