当前位置: 首页>>代码示例>>C++>>正文


C++ TCHAR_TO_ANSI函数代码示例

本文整理汇总了C++中TCHAR_TO_ANSI函数的典型用法代码示例。如果您正苦于以下问题:C++ TCHAR_TO_ANSI函数的具体用法?C++ TCHAR_TO_ANSI怎么用?C++ TCHAR_TO_ANSI使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TCHAR_TO_ANSI函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PreprocessShaderFile

/**
 * Preprocess a shader.
 * @param OutPreprocessedShader - Upon return contains the preprocessed source code.
 * @param ShaderOutput - ShaderOutput to which errors can be added.
 * @param ShaderInput - The shader compiler input.
 * @param AdditionalDefines - Additional defines with which to preprocess the shader.
 * @returns true if the shader is preprocessed without error.
 */
bool PreprocessShaderFile(FString& OutPreprocessedShader, TArray<FShaderCompilerError>& OutShaderErrors, const FString& InShaderFile)
{
	FString McppOptions;
	FString McppOutput, McppErrors;
	ANSICHAR* McppOutAnsi = nullptr;
	ANSICHAR* McppErrAnsi = nullptr;
	bool bSuccess = false;

	// MCPP is not threadsafe.
	static FCriticalSection McppCriticalSection;
	FScopeLock McppLock(&McppCriticalSection);

	FSimpleMcppFileLoader FileLoader(InShaderFile);

	int32 Result = mcpp_run(
		TCHAR_TO_ANSI(*McppOptions),
		TCHAR_TO_ANSI(*FileLoader.GetInputShaderFilename()),
		&McppOutAnsi,
		&McppErrAnsi,
		FileLoader.GetMcppInterface()
		);

	McppOutput = McppOutAnsi;
	McppErrors = McppErrAnsi;

	if (ParseMcppErrors(OutShaderErrors, McppErrors, false))
	{
		// exchange strings
		FMemory::Memswap( &OutPreprocessedShader, &McppOutput, sizeof(FString) );
		bSuccess = true;
	}

	return bSuccess;
}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:42,代码来源:PreprocessorFile.cpp

示例2: TestFString

void TestFString()
{
	FString s1("s1");
	FText t1 = FText::FromString(s1);
	s1 = t1.ToString();

	// 转化成FString
	s1 = FString::SanitizeFloat(0.1f);
	s1 = FString::FromInt(1);
	s1 = true ? TEXT("true") : TEXT("false");
	s1 = FVector::ZeroVector.ToString();
	s1 = FVector2D::ZeroVector.ToString();
	s1 = FLinearColor::Red.ToString();
	s1 = ((UObject*)(NULL))->GetFullName();

	// 转化为基础类型
	bool b1 = FString(TEXT("true")).ToBool();
	b1 = FCString::ToBool(*FString(TEXT("true")));
	float f1 = FCString::Atof(*FString(TEXT("0.1f")));
	int i1 = FCString::Atoi(*FString(TEXT("1")));

	if (s1.Equals(TEXT("1111"), ESearchCase::IgnoreCase))
	{
		Debug(TEXT("11111"));
	}

	s1 = FString(ANSI_TO_TCHAR("s1"));
	s1 = FString(ANSI_TO_TCHAR(TCHAR_TO_ANSI(TEXT("s1"))));
	Debug(TCHAR_TO_ANSI(*s1));
}
开发者ID:badforlabor,项目名称:UE4_Primer,代码行数:30,代码来源:TestLocalTextActorComponent.cpp

示例3: Shutdown

bool UNdiMediaFinder::Initialize()
{
	Shutdown();

	if (!FNdi::IsInitialized())
	{
		return false;
	}

	FString ExtraAddressesString = FString::Join(ExtraAddresses, TEXT(","));
	FString GroupsString = FString::Join(GroupFilters, TEXT(","));

	NDIlib_find_create_t FindCreate;
	{
		FindCreate.show_local_sources = ShowLocalSources;
		FindCreate.p_extra_ips = TCHAR_TO_ANSI(*ExtraAddressesString);
		FindCreate.p_groups = TCHAR_TO_ANSI(*GroupsString);
	}

	FindInstance = FNdi::Lib->NDIlib_find_create_v2(&FindCreate);

	if (FindInstance == nullptr)
	{
		UE_LOG(LogNdiMedia, Warning, TEXT("Failed to create NDI Find instance"));
		return false;
	}

	return true;
}
开发者ID:ue4plugins,项目名称:NdiMedia,代码行数:29,代码来源:NdiMediaFinder.cpp

示例4: TCHAR_TO_ANSI

void FWebSocket::Connect(){
#if !PLATFORM_HTML5
	struct lws_client_connect_info ConnectInfo = {
			Context, TCHAR_TO_ANSI(*StrInetAddress), InetPort, false, "/", TCHAR_TO_ANSI(*StrInetAddress), TCHAR_TO_ANSI(*StrInetAddress), Protocols[1].name, -1, this
	};
	Wsi = lws_client_connect_via_info(&ConnectInfo);
	check(Wsi);

#else // PLATFORM_HTML5

	SockFd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
	if (SockFd == -1) {
		UE_LOG(LogHTML5Networking, Error, TEXT("Socket creationg failed "));
	}
	else
	{
		UE_LOG(LogHTML5Networking, Warning, TEXT(" Socked %d created "), SockFd);
	}

	fcntl(SockFd, F_SETFL, O_NONBLOCK);

#endif

	// Windows XP does not have support for inet_pton
#if PLATFORM_WINDOWS && _WIN32_WINNT <= 0x0502
	memset(&RemoteAddr, 0, sizeof(RemoteAddr));
	int32 SizeOfRemoteAddr = sizeof(RemoteAddr);

	// Force ServerAddress into non-const array. API doesn't modify contents but old API still requires non-const string
	if (WSAStringToAddress(StrInetAddress.GetCharArray().GetData(), AF_INET, NULL, (sockaddr*)&RemoteAddr, &SizeOfRemoteAddr) != 0)
	{
		UE_LOG(LogHTML5Networking, Warning, TEXT("WSAStringToAddress failed "));
		return;
	}

	RemoteAddr.sin_family = AF_INET;
	RemoteAddr.sin_port = htons(InetPort);
#else
	memset(&RemoteAddr, 0, sizeof(RemoteAddr));
	RemoteAddr.sin_family = AF_INET;
	RemoteAddr.sin_port = htons(InetPort);

	if (inet_pton(AF_INET, TCHAR_TO_ANSI(*StrInetAddress), &RemoteAddr.sin_addr) != 1)
	{
		UE_LOG(LogHTML5Networking, Warning, TEXT("inet_pton failed "));
		return;
	}
#endif

#if PLATFORM_HTML5
	int Ret = connect(SockFd, (struct sockaddr *)&RemoteAddr, sizeof(RemoteAddr));
	UE_LOG(LogHTML5Networking, Warning, TEXT(" Connect socket returned %d"), Ret);
#endif

	IsDestroyed = false; 
}
开发者ID:robcog-iai,项目名称:UROSBridge,代码行数:56,代码来源:WebSocket.cpp

示例5: fork

void FLinuxPlatformProcess::LaunchURL(const TCHAR* URL, const TCHAR* Parms, FString* Error)
{
	// @todo This ignores params and error; mostly a stub
	pid_t pid = fork();
	UE_LOG(LogHAL, Verbose, TEXT("FLinuxPlatformProcess::LaunchURL: '%s'"), TCHAR_TO_ANSI(URL));
	if (pid == 0)
	{
		exit(execl("/usr/bin/xdg-open", "xdg-open", TCHAR_TO_ANSI(URL), (char *)0));
	}
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:10,代码来源:LinuxPlatformProcess.cpp

示例6: Process

	void Process()
	{
		UE_LOG(LogMapPakDownloader, Warning, TEXT("Starting Download for %s"), *FileName);

		emscripten_async_wget2(
			TCHAR_TO_ANSI(*(Url + FString(TEXT("?rand=")) + FGuid::NewGuid().ToString())),
			TCHAR_TO_ANSI(*FileName),
			TCHAR_TO_ANSI(TEXT("GET")),
			TCHAR_TO_ANSI(TEXT("")),
			this,
			&FEmscriptenHttpFileRequest::OnLoad,
			&FEmscriptenHttpFileRequest::OnError,
			&FEmscriptenHttpFileRequest::OnProgress
			);
	}
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:15,代码来源:MapPakDownloader.cpp

示例7: WriteSteamAppIdToDisk

/** 
 * Write out the steam app id to the steam_appid.txt file before initializing the API
 * @param SteamAppId id assigned to the application by Steam
 */
static void WriteSteamAppIdToDisk(int32 SteamAppId)
{
	if (SteamAppId > 0)
	{
		// Turn off sandbox temporarily to make sure file is where it's always expected
		FScopeSandboxContext ScopedSandbox(false);

		// Access the physical file writer directly so that we still write next to the executable in CotF builds.
		FString SteamAppIdFilename = GetSteamAppIdFilename();
		IFileHandle* Handle = IPlatformFile::GetPlatformPhysical().OpenWrite(*SteamAppIdFilename, false, false);
		if (!Handle)
		{
			UE_LOG_ONLINE(Fatal, TEXT("Failed to create file: %s"), *SteamAppIdFilename);
		}
		else
		{
			FString AppId = FString::Printf(TEXT("%d"), SteamAppId);

			FBufferArchive Archive;
			Archive.Serialize((void*)TCHAR_TO_ANSI(*AppId), AppId.Len());

			Handle->Write(Archive.GetData(), Archive.Num());
			delete Handle;
			Handle = nullptr;
		}
	}
}
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:31,代码来源:OnlineSubsystemSteam.cpp

示例8: atof

void SDistributionCurveEditor::KeyTimeCommitted(const FText& CommentText, ETextCommit::Type CommitInfo)
{
	if (CommitInfo == ETextCommit::OnEnter)
	{
		FCurveEditorSelectedKey& SelKey = SharedData->SelectedKeys[0];
		FCurveEdEntry& Entry = SharedData->EdSetup->Tabs[SharedData->EdSetup->ActiveTab].Curves[SelKey.CurveIndex];
		FCurveEdInterface* EdInterface = UInterpCurveEdSetup::GetCurveEdInterfacePointer(Entry);
		
		if (SharedData->NotifyObject)
		{
			// Make a list of all curves we are going to remove keys from.
			TArray<UObject*> CurvesAboutToChange;
			if(Entry.CurveObject)
			{
				CurvesAboutToChange.AddUnique(Entry.CurveObject);
				// Notify a containing tool that keys are about to be removed
				SharedData->NotifyObject->PreEditCurve(CurvesAboutToChange);
			}
		}

		// Set then set using EdInterface.
		EdInterface->SetKeyIn(SelKey.KeyIndex, atof(TCHAR_TO_ANSI( *CommentText.ToString() )));

		if (SharedData->NotifyObject)
		{
			SharedData->NotifyObject->PostEditCurve();
		}

		Viewport->RefreshViewport();
	}

	CloseEntryPopup();
}
开发者ID:johndpope,项目名称:UE4,代码行数:33,代码来源:SDistributionCurveEditor.cpp

示例9: UE_LOG

bool FCodeLiteSourceCodeAccessor::OpenSolution()
{

	FString Filename = FPaths::GetBaseFilename(GetSolutionPath()) + ".workspace";
	FString Directory = FPaths::GetPath(GetSolutionPath());
	FString Solution = "\"" + Directory + "/" + Filename + "\"";
	FString CodeLitePath;
	if(!CanRunCodeLite(CodeLitePath))
	{
		UE_LOG(LogCodeLiteAccessor, Warning, TEXT("FCodeLiteSourceCodeAccessor::OpenSolution: Cannot find CodeLite binary"));
		return false;
	}

	UE_LOG(LogCodeLiteAccessor, Warning, TEXT("FCodeLiteSourceCodeAccessor::OpenSolution: %s %s"), *CodeLitePath, *Solution);
	
#ifdef USE_DBUS

	//
	// TODO Somehow codelite is not opening the workspace using GetWorkspace()->Open(...)
	//
	DBusMessage* message = nullptr;
	DBusMessageIter args;
		
	// Create new message.
	message = dbus_message_new_signal ("/org/codelite/command", "org.codelite.command", "OpenWorkSpace");

	char* fileName = TCHAR_TO_ANSI(*Solution);

	// Add parameters to the message.
	dbus_message_iter_init_append(message, &args);
	if(!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &fileName)) {
		UE_LOG(LogCodeLiteAccessor, Warning, TEXT("Sdbus_message_iter_append_basic failed."));
		return false;
	}
	
	// Send the message.
	dbus_connection_send(DBusConnection, message, nullptr);
	if(dbus_error_is_set(&DBusError))
	{
		UE_LOG(LogCodeLiteAccessor, Warning, TEXT("dbus_connection_send failed: %s"), DBusError.message);
		return false;
	}
	// Free the message resources.
	dbus_message_unref(message);
	
	return true;

#else

	FProcHandle Proc = FPlatformProcess::CreateProc(*CodeLitePath, *Solution, true, false, false, nullptr, 0, nullptr, nullptr);
	if(Proc.IsValid())
	{
		FPlatformProcess::CloseProc(Proc);
		return true;
	}
	return false;

#endif

}
开发者ID:Slasher006,项目名称:CodeLiteSourceCodeAccess,代码行数:60,代码来源:CodeLiteSourceCodeAccessor.cpp

示例10: InitBase

void UIpConnection::InitLocalConnection(UNetDriver* InDriver, class FSocket* InSocket, const FURL& InURL, EConnectionState InState, int32 InMaxPacket, int32 InPacketOverhead)
{
	InitBase(InDriver, InSocket, InURL, InState, 
		// Use the default packet size/overhead unless overridden by a child class
		(InMaxPacket == 0 || InMaxPacket > MAX_PACKET_SIZE) ? MAX_PACKET_SIZE : InMaxPacket,
		InPacketOverhead == 0 ? UDP_HEADER_SIZE : InPacketOverhead);

	// Figure out IP address from the host URL
	bool bIsValid = false;
	// Get numerical address directly.
	RemoteAddr = InDriver->GetSocketSubsystem()->CreateInternetAddr();
	RemoteAddr->SetIp(*InURL.Host, bIsValid);
	RemoteAddr->SetPort(InURL.Port);

	// Try to resolve it if it failed
	if (bIsValid == false)
	{
		// Create thread to resolve the address.
		ResolveInfo = InDriver->GetSocketSubsystem()->GetHostByName(TCHAR_TO_ANSI(*InURL.Host));
		if (ResolveInfo == NULL)
		{
			Close();
			UE_LOG(LogNet, Verbose, TEXT("IpConnection::InitConnection: Unable to resolve %s"), *InURL.Host);
		}
	}

	// Initialize our send bunch
	InitSendBuffer();
}
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:29,代码来源:IpConnection.cpp

示例11: TEXT

bool FLinuxPlatformProcess::IsApplicationRunning( const TCHAR* ProcName )
{
	FString Commandline = TEXT("pidof '");
	Commandline += ProcName;
	Commandline += TEXT("'  > /dev/null");
	return !system(TCHAR_TO_ANSI(*Commandline));
}
开发者ID:johndpope,项目名称:UE4,代码行数:7,代码来源:LinuxPlatformProcess.cpp

示例12: Decode

/**
 * Decodes a Base64 string into a FString
 *
 * @param Source the stringified data to convert
 * @param Dest the out buffer that will be filled with the decoded data
 */
bool FBase64::Decode(const FString& Source, FString& Dest)
{
	uint32 Length = Source.Len();
	// Size must be a multiple of 4
	if (Length % 4)
	{
		return false;
	}
	// Each 4 uint8 chunk of characters is 3 bytes of data
	uint32 ExpectedLength = Length / 4 * 3;
	TArray<ANSICHAR> TempDest;
	TempDest.AddZeroed(ExpectedLength);
	uint8* Buffer = (uint8*)TempDest.GetData();
	uint32 PadCount = 0;

	bool bWasSuccessful = Decode(TCHAR_TO_ANSI(*Source), Length, Buffer, PadCount);
	if (bWasSuccessful)
	{
		if (PadCount > 0)
		{
			Buffer[ExpectedLength - PadCount] = 0;
		}
		else
		{
			TempDest.Add('\0');
		}
		Dest = ANSI_TO_TCHAR(TempDest.GetData());
	}
	return bWasSuccessful;
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:36,代码来源:Base64.cpp

示例13: check

int32 FInternationalization::GetCultureIndex(const FString& Name)
{
#if UE_ENABLE_ICU
	static const int32 MaximumNameLength = 64;
	const int32 NameLength = Name.Len();
	check(NameLength < MaximumNameLength);
	char CanonicalName[MaximumNameLength];

	UErrorCode ICUStatus = U_ZERO_ERROR;
	uloc_canonicalize(TCHAR_TO_ANSI( *Name ), CanonicalName, MaximumNameLength, &ICUStatus);
#endif	

	const int32 CultureCount = AllCultures.Num();
	int32 i;
	for (i = 0; i < CultureCount; ++i)
	{
#if UE_ENABLE_ICU
		if( AllCultures[i]->GetName() == CanonicalName )
#else
		if( AllCultures[i]->GetName() == Name )
#endif
		{
			break;
		}
	}
	if(i >= CultureCount)
	{
		i = -1;
	}
	return i;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:31,代码来源:Internationalization.cpp

示例14: fork

void FLinuxPlatformProcess::LaunchFileInDefaultExternalApplication( const TCHAR* FileName, const TCHAR* Parms, ELaunchVerb::Type Verb )
{
	// TODO This ignores parms and verb
	pid_t pid = fork();
	if (pid == 0)
	{
		exit(execl("/usr/bin/xdg-open", "xdg-open", TCHAR_TO_ANSI(FileName), (char *)0));
	}
}
开发者ID:johndpope,项目名称:UE4,代码行数:9,代码来源:LinuxPlatformProcess.cpp

示例15: TCHAR_TO_ANSI

EAppReturnType::Type FHTML5Misc::MessageBoxExt(EAppMsgType::Type MsgType, const TCHAR* Text, const TCHAR* Caption)
{

#if PLATFORM_HTML5_BROWSER 

	ANSICHAR* AText = TCHAR_TO_ANSI(Text);
	ANSICHAR* ACaption = TCHAR_TO_ANSI(Caption);
	return static_cast<EAppReturnType::Type>(UE_MessageBox(MsgType,AText,ACaption));

#endif 

#if PLATFORM_HTML5_WIN32

	return FGenericPlatformMisc::MessageBoxExt(MsgType, Text, Caption); 

#endif 

}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:18,代码来源:HTML5PlatformMisc.cpp


注:本文中的TCHAR_TO_ANSI函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。