本文整理汇总了C++中TCHAR_TO_UTF8函数的典型用法代码示例。如果您正苦于以下问题:C++ TCHAR_TO_UTF8函数的具体用法?C++ TCHAR_TO_UTF8怎么用?C++ TCHAR_TO_UTF8使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TCHAR_TO_UTF8函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitCommandLine
static void InitCommandLine()
{
static const uint32 CMD_LINE_MAX = 16384u;
// initialize the command line to an empty string
FCommandLine::Set(TEXT(""));
// read in the command line text file from the sdcard if it exists
FString CommandLineFilePath = GFilePathBase + FString("/UE4Game/") + (!FApp::IsGameNameEmpty() ? FApp::GetGameName() : FPlatformProcess::ExecutableName()) + FString("/UE4CommandLine.txt");
FILE* CommandLineFile = fopen(TCHAR_TO_UTF8(*CommandLineFilePath), "r");
if(CommandLineFile == NULL)
{
// if that failed, try the lowercase version
CommandLineFilePath = CommandLineFilePath.Replace(TEXT("UE4CommandLine.txt"), TEXT("ue4commandline.txt"));
CommandLineFile = fopen(TCHAR_TO_UTF8(*CommandLineFilePath), "r");
}
if(CommandLineFile)
{
char CommandLine[CMD_LINE_MAX];
fgets(CommandLine, ARRAY_COUNT(CommandLine) - 1, CommandLineFile);
fclose(CommandLineFile);
// chop off trailing spaces
while (*CommandLine && isspace(CommandLine[strlen(CommandLine) - 1]))
{
CommandLine[strlen(CommandLine) - 1] = 0;
}
FCommandLine::Append(UTF8_TO_TCHAR(CommandLine));
}
}
示例2: TCHAR_TO_UTF8
bool FDesktopPlatformLinux::OpenDirectoryDialog(const void* ParentWindowHandle, const FString& DialogTitle, const FString& DefaultPath, FString& OutFolderName)
{
#if WITH_LINUX_NATIVE_DIALOGS
bool bSuccess;
struct UFileDialogHints hints = DEFAULT_UFILEDIALOGHINTS;
LinuxApplication->SetCapture(NULL);
hints.Action = UFileDialogActionOpenDirectory;
hints.WindowTitle = TCHAR_TO_UTF8(*DialogTitle);
hints.InitialDirectory = TCHAR_TO_UTF8(*DefaultPath);
UFileDialog* dialog = UFileDialog_Create(&hints);
while(UFileDialog_ProcessEvents(dialog))
{
FPlatformMisc::PumpMessages(true); // pretend that we're the main loop
}
const UFileDialogResult* result = UFileDialog_Result(dialog);
if (result)
{
if (result->count == 1)
{
OutFolderName = UTF8_TO_TCHAR(result->selection[0]);
//OutFolderName = IFileManager::Get().ConvertToRelativePath(*OutFolderName); // @todo (amigo): converting to relative path ends up without ../...
FPaths::NormalizeFilename(OutFolderName);
bSuccess = true;
}
else
{
bSuccess = false;
}
// Todo like in Windows, normalize files here instead of above
}
else
{
bSuccess = false;
}
UFileDialog_Destroy(dialog);
return bSuccess;
#else
if (!FModuleManager::Get().IsModuleLoaded("SlateFileDialogs"))
{
FModuleManager::Get().LoadModule("SlateFileDialogs");
}
ISlateFileDialogsModule *FileDialog = FModuleManager::GetModulePtr<ISlateFileDialogsModule>("SlateFileDialogs");
if (FileDialog)
{
return FileDialog->OpenDirectoryDialog(ParentWindowHandle, DialogTitle, DefaultPath, OutFolderName);
}
return false;
#endif // WITH_LINUX_NATIVE_DIALOGS
}
示例3: CreateRPCPrototype
/**
* Create a message definition for a given function
* @param Function function to extract parameters from to create a message buffer
*/
const google::protobuf::Message* CreateRPCPrototype(UFunction* Function)
{
google::protobuf::FileDescriptorProto FunctionProtoDesc;
FString FunctionName = Function->GetName();
FString FunctionFileName = FString::Printf(TEXT("%s.proto"), *FunctionName);
FunctionProtoDesc.set_package(TCHAR_TO_UTF8(*FunctionName));
FunctionProtoDesc.set_name(TCHAR_TO_UTF8(*FunctionFileName));
google::protobuf::DescriptorProto* MsgProtDesc = FunctionProtoDesc.add_message_type();
MsgProtDesc->set_name(TCHAR_TO_UTF8(*FunctionName));
if (CreateProtoDeclaration(MsgProtDesc, Function, CPF_Parm))
{
google::protobuf::string proto = FunctionProtoDesc.DebugString();
const google::protobuf::FileDescriptor* FD = DscrPool.BuildFile(FunctionProtoDesc);
const google::protobuf::Descriptor* MsgDescriptor = FD->message_type(0);
return ProtoFactory.GetPrototype(MsgDescriptor);
}
else
{
FunctionProtoDesc.Clear();
}
return NULL;
}
示例4: UE_LOG
void UTangoDevice::ExportCurrentArea(FString UUID, FString Filepath, bool& IsSuccessful)
{
UE_LOG(ProjectTangoPlugin, Log, TEXT("TangoDeviceAreaLearning::ExportCurrentArea: Starting export"));
//Make the call to Java
#if PLATFORM_ANDROID
jobject AppContext = NULL;
if (JNIEnv* Env = FAndroidApplication::GetJavaEnv())
{
//Prepare the arguments
jstring TangoExportUUIDArg = Env->NewStringUTF(TCHAR_TO_UTF8(*UUID));
jstring TangoExportFilenameArg = Env->NewStringUTF(TCHAR_TO_UTF8(*Filepath));
static jmethodID ADFExportIntentMethod = FJavaWrapper::FindMethod(Env, FJavaWrapper::GameActivityClassID, "AndroidThunkJava_RequestExportPermission", "(Ljava/lang/String;Ljava/lang/String;)V", false);
FJavaWrapper::CallVoidMethod(Env, FJavaWrapper::GameActivityThis, ADFExportIntentMethod, TangoExportUUIDArg, TangoExportFilenameArg);
}
else
{
UE_LOG(ProjectTangoPlugin, Log, TEXT("TangoDeviceAreaLearning::ExportCurrentArea: Error: Could not get Java environment!"));
}
#endif
UE_LOG(ProjectTangoPlugin, Log, TEXT("TangoDeviceAreaLearning::ExportCurrentArea: Finished export"));
}
示例5: TCHAR_TO_UTF8
// Writes all metrics to file under the given section header.
void MetricTracker::WriteMetricsToFile()
{
if (!File.is_open())
{
File.open(*(FullPath), std::fstream::app);
}
File << '[' << TCHAR_TO_UTF8(*(SectionName)) << ']' << '\n';
if (!DiscreteValues.empty() && File.is_open())
{
for (auto& e : DiscreteValues)
{
File << TCHAR_TO_UTF8(*(e.first)) << '=' << e.second << '\n';
}
}
if (!ContinuousValues.empty())
{
for (auto& e : ContinuousValues)
{
File << TCHAR_TO_UTF8(*(e.first)) << ",\n" << TCHAR_TO_UTF8(*(e.second)) << '\n';
}
}
File.close();
}
示例6: TCHAR_TO_UTF8
bool USQLiteDatabase::ExecSql(const FString DatabaseName, const FString Query) {
//LOGSQLITE(Warning, *query);
bool execStatus = false;
char *zErrMsg = 0;
sqlite3 *db;
ANSICHAR* dbNameAsUtf8 = TCHAR_TO_UTF8(*Databases[DatabaseName]);
int32 i = sqlite3_open(dbNameAsUtf8, &db);
if (i == SQLITE_OK){
int32 k = sqlite3_exec(db, TCHAR_TO_UTF8(*Query), NULL, 0, &zErrMsg);
if (i == SQLITE_OK){
execStatus = true;
}
else {
LOGSQLITE(Warning, TEXT("CreateTable - Query Exec Failed.."));
}
}
else {
LOGSQLITE(Warning, TEXT("CreateTable - DB Open failed.."));
}
sqlite3_close(db);
return execStatus;
}
示例7: switch
void FXmppPresenceJingle::ConvertFromPresence(buzz::PresenceStatus& OutStatus, const FXmppUserPresence& InPresence)
{
OutStatus.set_available(InPresence.bIsAvailable);
OutStatus.set_sent_time(TCHAR_TO_UTF8(*InPresence.SentTime.ToIso8601()));
OutStatus.set_show(buzz::PresenceStatus::SHOW_OFFLINE);
if (InPresence.bIsAvailable)
{
switch (InPresence.Status)
{
case EXmppPresenceStatus::Online:
OutStatus.set_show(buzz::PresenceStatus::SHOW_ONLINE);
break;
case EXmppPresenceStatus::Offline:
OutStatus.set_show(buzz::PresenceStatus::SHOW_OFFLINE);
break;
case EXmppPresenceStatus::Away:
OutStatus.set_show(buzz::PresenceStatus::SHOW_AWAY);
break;
case EXmppPresenceStatus::ExtendedAway:
OutStatus.set_show(buzz::PresenceStatus::SHOW_XA);
break;
case EXmppPresenceStatus::DoNotDisturb:
OutStatus.set_show(buzz::PresenceStatus::SHOW_DND);
break;
case EXmppPresenceStatus::Chat:
OutStatus.set_show(buzz::PresenceStatus::SHOW_CHAT);
break;
}
}
OutStatus.set_status(TCHAR_TO_UTF8(*InPresence.StatusStr));
}
示例8: UE_LOG
/**
* Downloads the save file from CloudyWeb.
*
* @param Filename Filename of the save game file.
* @param PlayerControllerId Player controller ID of the player who requested the file.
*
* @return Returns true if the file download was successful. Else, returns false.
*
*/
bool CloudyWebConnectorImpl::DownloadFile(FString Filename, int32 PlayerControllerId)
{
CURL *curl;
FILE *fp;
CURLcode res;
errno_t err;
std::string SaveFileURLCString;
if (GetGameId() == -1 || GetUsername(PlayerControllerId).Equals("") ||
PlayerControllerId < 0 || SaveFileUrls.Num() <= PlayerControllerId)
{
UE_LOG(CloudyWebConnectorLog, Error, TEXT("The game ID, username, or player controller ID is invalid"));
return false;
}
// Use the game id and username of the player to GET the save file URL from CloudyWeb
// Then populate SaveFileUrls (TArray)
GetSaveFileUrl(GetGameId(), GetUsername(PlayerControllerId), PlayerControllerId);
// Read the URL from the SaveFileUrls TArray to download the file and write to disk
FString* SaveFileUrlsData = SaveFileUrls.GetData();
if (!SaveFileUrlsData[PlayerControllerId].Equals(""))
{
UE_LOG(CloudyWebConnectorLog, Log, TEXT("File URL obtained! Writing to disk."));
SaveFileURLCString = TCHAR_TO_UTF8(*SaveFileUrlsData[PlayerControllerId]);
// Filepath of .sav file
FString Filepath = FPaths::GameDir();
Filepath += "Saved/SaveGames/" + Filename + "-" +
FString::FromInt(PlayerControllerId) + ".sav";
std::string filePath(TCHAR_TO_UTF8(*Filepath));
curl = curl_easy_init();
if (curl) {
if ((err = fopen_s(&fp, filePath.c_str(), "wb")) == 0)
{
curl_easy_setopt(curl, CURLOPT_URL, SaveFileURLCString.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
fclose(fp);
}
else
{
UE_LOG(CloudyWebConnectorLog, Error, TEXT("Could not create save file!"));
}
}
return true;
}
else
{
UE_LOG(CloudyWebConnectorLog, Warning, TEXT("There was no save file URL!"));
return false;
}
}
示例9: PyUnicode_FromString
static PyObject *py_ue_edgraphpin_get_name(ue_PyEdGraphPin *self, void *closure)
{
#if ENGINE_MINOR_VERSION > 18
return PyUnicode_FromString(TCHAR_TO_UTF8(*(self->pin->PinName.ToString())));
#else
return PyUnicode_FromString(TCHAR_TO_UTF8(*(self->pin->PinName)));
#endif
}
示例10: PyUnicode_FromFormat
static PyObject *ue_PyEdGraphPin_str(ue_PyEdGraphPin *self)
{
return PyUnicode_FromFormat("<unreal_engine.EdGraphPin {'name': '%s', 'type': '%s'}>",
#if ENGINE_MINOR_VERSION > 18
TCHAR_TO_UTF8(*self->pin->PinName.ToString()), TCHAR_TO_UTF8(*self->pin->PinType.PinCategory.ToString()));
#else
TCHAR_TO_UTF8(*self->pin->PinName), TCHAR_TO_UTF8(*self->pin->PinType.PinCategory));
#endif
}
示例11: PyUnicode_FromFormat
static PyObject *ue_PySWidget_str(ue_PySWidget *self)
{
#if PY_MAJOR_VERSION >= 3
return PyUnicode_FromFormat("<unreal_engine.%s '%p' (slate ref count: %d, py ref count: %d)>",
TCHAR_TO_UTF8(*self->Widget->GetTypeAsString()), &self->Widget.Get(), self->Widget.GetSharedReferenceCount(), self->ob_base.ob_refcnt);
#else
return PyUnicode_FromFormat("<unreal_engine.%s '%p' (slate ref count: %d)>",
TCHAR_TO_UTF8(*self->Widget->GetTypeAsString()), &self->Widget.Get(), self->Widget.GetSharedReferenceCount());
#endif
}
示例12: TCHAR_TO_UTF8
SpatialOSLocator FWorkerConnection::CreateLocator(const FString& ProjectName,
const FString& LocatorHost,
const FString& LoginToken)
{
worker::LocatorParameters LocatorParams;
LocatorParams.ProjectName = TCHAR_TO_UTF8(*ProjectName);
LocatorParams.CredentialsType = worker::LocatorCredentialsType::kLoginToken;
LocatorParams.LoginToken = worker::LoginTokenCredentials{TCHAR_TO_UTF8(*LoginToken)};
return SpatialOSLocator{TCHAR_TO_UTF8(*LocatorHost), LocatorParams};
}
示例13: TCHAR_TO_UTF8
bool ULevelDBPluginBPLibrary::WriteStringToLevelDB(ULevelDBObject* DatabaseObject, FString Key, FString Value)
{
leveldb::WriteOptions writeOptions;
if (DatabaseObject->db != NULL)
DatabaseObject->db->Put(writeOptions, TCHAR_TO_UTF8(*Key), TCHAR_TO_UTF8(*Value));
else
return false;
return true;
}
示例14: CheckState
UTrackEntry* USpineSkeletonAnimationComponent::AddAnimation (int trackIndex, FString animationName, bool loop, float delay) {
CheckState();
if (state && spSkeletonData_findAnimation(skeleton->data, TCHAR_TO_UTF8(*animationName))) {
_spAnimationState_disableQueue(state);
spTrackEntry* entry = spAnimationState_addAnimationByName(state, trackIndex, TCHAR_TO_UTF8(*animationName), loop ? 1 : 0, delay);
_spAnimationState_enableQueue(state);
UTrackEntry* uEntry = NewObject<UTrackEntry>();
uEntry->SetTrackEntry(entry);
trackEntries.Add(uEntry);
return uEntry;
} else return NewObject<UTrackEntry>();
}
示例15: stdSourceDir
void ASmrActor::LoadAnimation(FString path)
{
if (path == "")
{
FString sourceDir = FPaths::GameSourceDir();
std::string stdSourceDir(TCHAR_TO_UTF8(*sourceDir));
std::string motionFilePath = stdSourceDir + "../SMR/data/bvh/benTest.bvh";
m_motion = loadMotionFromBVH(motionFilePath);
return;
}
m_motion = loadMotionFromBVH(getFileName(std::string(TCHAR_TO_UTF8(*path))));
}