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


C++ ConvertUTF8ToWString函数代码示例

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


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

示例1: DeleteDir

// Deletes a directory filename, returns true on success
bool DeleteDir(const std::string &filename)
{
	INFO_LOG(COMMON, "DeleteDir: directory %s", filename.c_str());

	// check if a directory
	if (!File::IsDirectory(filename))
	{
		ERROR_LOG(COMMON, "DeleteDir: Not a directory %s", filename.c_str());
		return false;
	}

#ifdef _WIN32
	if (::RemoveDirectory(ConvertUTF8ToWString(filename).c_str()))
		return true;
#else
	if (rmdir(filename.c_str()) == 0)
		return true;
#endif
	ERROR_LOG(COMMON, "DeleteDir: %s: %s", filename.c_str(), GetLastErrorMsg());

	return false;
}
开发者ID:Alceris,项目名称:ppsspp,代码行数:23,代码来源:FileUtil.cpp

示例2: switch

void CtrlModuleList::GetColumnText(wchar_t* dest, int row, int col)
{
	if (row < 0 || row >= (int)modules.size()) {
		return;
	}

	switch (col)
	{
	case ML_NAME:
		wcscpy(dest,ConvertUTF8ToWString(modules[row].name).c_str());
		break;
	case ML_ADDRESS:
		wsprintf(dest,L"%08X",modules[row].address);
		break;
	case ML_SIZE:
		wsprintf(dest,L"%08X",modules[row].size);
		break;
	case ML_ACTIVE:
		wcscpy(dest,modules[row].active ? L"true" : L"false");
		break;
	}
}
开发者ID:18859966862,项目名称:ppsspp,代码行数:22,代码来源:Debugger_Lists.cpp

示例3: list

std::vector<std::string> CWCheatEngine::GetCodesList() { //Reads the entire cheat list from the appropriate .ini.
	std::string line;
	std::vector<std::string> codesList;  // Read from INI here
#ifdef _WIN32
	std::ifstream list(ConvertUTF8ToWString(activeCheatFile));
#else
	std::ifstream list(activeCheatFile.c_str());
#endif
	if (!list) {
		return codesList;
	}
	for (int i = 0; !list.eof(); i ++) {
		getline(list, line, '\n');
		if (line.length() > 3 && (line.substr(0,1) == "_"||line.substr(0,2) == "//")){
			codesList.push_back(line);
		}
	}
	for(size_t i = 0; i < codesList.size(); i++) {
		trim2(codesList[i]);
	}
	return codesList;
}
开发者ID:Bigpet,项目名称:ppsspp,代码行数:22,代码来源:CwCheat.cpp

示例4: IsDirectory

// Returns true if filename is a directory
bool IsDirectory(const std::string &filename)
{
	struct stat64 file_info;
#if defined(_WIN32) && defined(UNICODE) && !defined(__MINGW32__)
	std::wstring copy = ConvertUTF8ToWString(filename);
	StripTailDirSlashes(copy);

	int result = _wstat64(copy.c_str(), &file_info);
#else
	std::string copy(filename);
	StripTailDirSlashes(copy);

	int result = stat64(copy.c_str(), &file_info);
#endif
	if (result < 0) {
		WARN_LOG(COMMON, "IsDirectory: stat failed on %s: %s", 
				 filename.c_str(), GetLastErrorMsg());
		return false;
	}

	return IsDirectory(file_info);
}
开发者ID:BrainDamage,项目名称:libretro-ppsspp,代码行数:23,代码来源:FileUtil.cpp

示例5: GetLocalPath

PSPFileInfo DirectoryFileSystem::GetFileInfo(std::string filename) {
    PSPFileInfo x;
    x.name = filename;

    std::string fullName = GetLocalPath(filename);
    if (! File::Exists(fullName)) {
#if HOST_IS_CASE_SENSITIVE
        if (! FixPathCase(basePath,filename, FPC_FILE_MUST_EXIST))
            return x;
        fullName = GetLocalPath(filename);

        if (! File::Exists(fullName))
            return x;
#else
        return x;
#endif
    }
    x.type = File::IsDirectory(fullName) ? FILETYPE_DIRECTORY : FILETYPE_NORMAL;
    x.exists = true;

    if (x.type != FILETYPE_DIRECTORY)
    {
#ifdef _WIN32
        struct _stat64i32 s;
        _wstat64i32(ConvertUTF8ToWString(fullName).c_str(), &s);
#else
        struct stat s;
        stat(fullName.c_str(), &s);
#endif

        x.size = File::GetSize(fullName);
        x.access = s.st_mode & 0x1FF;
        localtime_r((time_t*)&s.st_atime,&x.atime);
        localtime_r((time_t*)&s.st_ctime,&x.ctime);
        localtime_r((time_t*)&s.st_mtime,&x.mtime);
    }

    return x;
}
开发者ID:ravenue,项目名称:ppsspp,代码行数:39,代码来源:DirectoryFileSystem.cpp

示例6: CreateDir

// Returns true if successful, or path already exists.
bool CreateDir(const std::string &path)
{
	INFO_LOG(COMMON, "CreateDir: directory %s", path.c_str());
#ifdef _WIN32	
#ifdef UNICODE
	if (::CreateDirectory(ConvertUTF8ToWString(path).c_str(), NULL))
#else
	if (::CreateDirectory(path.c_str(), NULL))
#endif
		return true;
	DWORD error = GetLastError();
	if (error == ERROR_ALREADY_EXISTS)
	{
		WARN_LOG(COMMON, "CreateDir: CreateDirectory failed on %s: already exists", path.c_str());
		return true;
	}
	ERROR_LOG(COMMON, "CreateDir: CreateDirectory failed on %s: %i", path.c_str(), error);
	return false;
#else
#ifdef BLACKBERRY
	if (mkdir(path.c_str(), 0775) == 0)
#else
	if (mkdir(path.c_str(), 0755) == 0)
#endif
		return true;

	int err = errno;

	if (err == EEXIST)
	{
		WARN_LOG(COMMON, "CreateDir: mkdir failed on %s: already exists", path.c_str());
		return true;
	}

	ERROR_LOG(COMMON, "CreateDir: mkdir failed on %s: %s", path.c_str(), strerror(err));
	return false;
#endif
}
开发者ID:metalex10,项目名称:PPSSPP-X360,代码行数:39,代码来源:FileUtil.cpp

示例7: GetSize

// Returns the size of filename (64bit)
u64 GetSize(const std::string &filename)
{
	struct stat64 file_info;
#if defined(_WIN32) && defined(UNICODE)
	int result = _wstat64(ConvertUTF8ToWString(filename).c_str(), &file_info);
#else
	int result = stat64(filename.c_str(), &file_info);
#endif
	if (result != 0)
	{
		WARN_LOG(COMMON, "GetSize: failed %s: No such file", filename.c_str());
		return 0;
	}

	if (IsDirectory(file_info))
	{
		WARN_LOG(COMMON, "GetSize: failed %s: is a directory", filename.c_str());
		return 0;
	}

	DEBUG_LOG(COMMON, "GetSize: %s: %lld", filename.c_str(), (long long)file_info.st_size);
	return file_info.st_size;
}
开发者ID:BrainDamage,项目名称:libretro-ppsspp,代码行数:24,代码来源:FileUtil.cpp

示例8: GetFileSize

// Returns the size of file (64bit)
// TODO: Add a way to return an error.
u64 GetFileSize(const std::string &filename) {
#if defined(_WIN32) && defined(UNICODE)
	WIN32_FILE_ATTRIBUTE_DATA attr;
	if (!GetFileAttributesEx(ConvertUTF8ToWString(filename).c_str(), GetFileExInfoStandard, &attr))
		return 0;
	if (attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
		return 0;
	return ((u64)attr.nFileSizeHigh << 32) | (u64)attr.nFileSizeLow;
#else
	struct stat64 file_info;
	int result = stat64(filename.c_str(), &file_info);
	if (result != 0) {
		WARN_LOG(COMMON, "GetSize: failed %s: No such file", filename.c_str());
		return 0;
	}
	if (S_ISDIR(file_info.st_mode)) {
		WARN_LOG(COMMON, "GetSize: failed %s: is a directory", filename.c_str());
		return 0;
	}
	DEBUG_LOG(COMMON, "GetSize: %s: %lld", filename.c_str(), (long long)file_info.st_size);
	return file_info.st_size;
#endif
}
开发者ID:AdmiralCurtiss,项目名称:ppsspp,代码行数:25,代码来源:FileUtil.cpp

示例9: GetFileDetails

// Returns file attributes.
bool GetFileDetails(const std::string &filename, FileDetails *details) {
#ifdef _WIN32
	WIN32_FILE_ATTRIBUTE_DATA attr;
	if (!GetFileAttributesEx(ConvertUTF8ToWString(filename).c_str(), GetFileExInfoStandard, &attr))
		return false;
	details->isDirectory = (attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
	details->size = ((u64)attr.nFileSizeHigh << 32) | (u64)attr.nFileSizeLow;
	details->atime = FiletimeToStatTime(attr.ftLastAccessTime);
	details->mtime = FiletimeToStatTime(attr.ftLastWriteTime);
	details->ctime = FiletimeToStatTime(attr.ftCreationTime);
	if (attr.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
		details->access = 0444;  // Read
	} else {
		details->access = 0666;  // Read/Write
	}
	if (attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
		details->access |= 0111;  // Execute
	}
	return true;
#else
	if (!Exists(filename)) {
		return false;
	}
	struct stat64 buf;
	if (stat64(filename.c_str(), &buf) == 0) {
		details->size = buf.st_size;
		details->isDirectory = S_ISDIR(buf.st_mode);
		details->atime = buf.st_atime;
		details->mtime = buf.st_mtime;
		details->ctime = buf.st_ctime;
		details->access = buf.st_mode & 0x1ff;
		return true;
	} else {
		return false;
	}
#endif
}
开发者ID:AdmiralCurtiss,项目名称:ppsspp,代码行数:38,代码来源:FileUtil.cpp

示例10: MipsAssembleOpcode

bool MipsAssembleOpcode(const char* line, DebugInterface* cpu, u32 address)
{
#if defined(_WIN32) || defined(ANDROID)
	PspAssemblerFile file;
	StringList errors;

	wchar_t str[64];
	swprintf(str,64,L".psp\n.org 0x%08X\n",address);

	ArmipsArguments args;
	args.mode = ArmipsMode::Memory;
	args.content = str + ConvertUTF8ToWString(line);
	args.silent = true;
	args.memoryFile = &file;
	args.errorsResult = &errors;
	
	symbolMap.GetLabels(args.labels);

	errorText = L"";
	if (!runArmips(args))
	{
		for (size_t i = 0; i < errors.size(); i++)
		{
			errorText += errors[i];
			if (i != errors.size()-1)
				errorText += L"\n";
		}

		return false;
	}

	return true;
#else
	errorText = L"Unsupported platform";
	return false;
#endif
}
开发者ID:David-Justin,项目名称:ppsspp,代码行数:37,代码来源:MIPSAsm.cpp

示例11: Delete

// Deletes a given filename, return true on success
// Doesn't supports deleting a directory
bool Delete(const std::string &filename)
{
	INFO_LOG(COMMON, "Delete: file %s", filename.c_str());

	// Return true because we care about the file no 
	// being there, not the actual delete.
	if (!Exists(filename))
	{
		WARN_LOG(COMMON, "Delete: %s does not exists", filename.c_str());
		return true;
	}

	// We can't delete a directory
	if (IsDirectory(filename))
	{
		WARN_LOG(COMMON, "Delete failed: %s is a directory", filename.c_str());
		return false;
	}

#ifdef _WIN32
	if (!DeleteFile(ConvertUTF8ToWString(filename).c_str()))
	{
		WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", 
				 filename.c_str(), GetLastErrorMsg());
		return false;
	}
#else
	if (unlink(filename.c_str()) == -1) {
		WARN_LOG(COMMON, "Delete: unlink failed on %s: %s", 
				 filename.c_str(), GetLastErrorMsg());
		return false;
	}
#endif

	return true;
}
开发者ID:AdmiralCurtiss,项目名称:ppsspp,代码行数:38,代码来源:FileUtil.cpp

示例12: ConvertUTF8ToWString

u64 DirectoryFileSystem::FreeSpace(const std::string &path) {
#ifdef _WIN32
	const std::wstring w32path = ConvertUTF8ToWString(GetLocalPath(path));
	ULARGE_INTEGER free;
	if (GetDiskFreeSpaceExW(w32path.c_str(), &free, nullptr, nullptr))
		return free.QuadPart;
#elif defined(__SYMBIAN32__)
	QSystemStorageInfo storageInfo;
	return (u64)storageInfo.availableDiskSpace("E");
#else
	std::string localPath = GetLocalPath(path);
	struct statvfs diskstat;
	int res = statvfs(localPath.c_str(), &diskstat);

#if HOST_IS_CASE_SENSITIVE
	std::string fixedCase = path;
	if (res != 0 && FixPathCase(basePath, fixedCase, FPC_FILE_MUST_EXIST)) {
		// May have failed due to case sensitivity, try again.
		localPath = GetLocalPath(fixedCase);
		res = statvfs(localPath.c_str(), &diskstat);
	}
#endif

	if (res == 0) {
#ifndef ANDROID
		if (diskstat.f_flag & ST_RDONLY) {
			return 0;
		}
#endif
		return (u64)diskstat.f_bavail * (u64)diskstat.f_frsize;
	}
#endif

	// Just assume they're swimming in free disk space if we don't know otherwise.
	return std::numeric_limits<u64>::max();
}
开发者ID:VOID001,项目名称:ppsspp,代码行数:36,代码来源:DirectoryFileSystem.cpp

示例13: Exists

// Returns true if file filename exists. Will return true on directories.
bool Exists(const std::string &filename) {
	std::string fn = filename;
	StripTailDirSlashes(fn);

#if defined(_WIN32)
	std::wstring copy = ConvertUTF8ToWString(fn);

	// Make sure Windows will no longer handle critical errors, which means no annoying "No disk" dialog
#if !PPSSPP_PLATFORM(UWP)
	int OldMode = SetErrorMode(SEM_FAILCRITICALERRORS);
#endif
	WIN32_FILE_ATTRIBUTE_DATA data{};
	if (!GetFileAttributesEx(copy.c_str(), GetFileExInfoStandard, &data) || data.dwFileAttributes == INVALID_FILE_ATTRIBUTES) {
		return false;
	}
#if !PPSSPP_PLATFORM(UWP)
	SetErrorMode(OldMode);
#endif
	return true;
#else
	struct stat file_info;
	return stat(fn.c_str(), &file_info) == 0;
#endif
}
开发者ID:mailwl,项目名称:ppsspp,代码行数:25,代码来源:FileUtil.cpp

示例14: Clear

bool SymbolMap::LoadSymbolMap(const char *filename) {
	Clear();  // let's not recurse the lock

	lock_guard guard(lock_);

#if defined(_WIN32) && defined(UNICODE)
	gzFile f = gzopen_w(ConvertUTF8ToWString(filename).c_str(), "r");
#else
	gzFile f = gzopen(filename, "r");
#endif

	if (f == Z_NULL)
		return false;

	//char temp[256];
	//fgets(temp,255,f); //.text section layout
	//fgets(temp,255,f); //  Starting        Virtual
	//fgets(temp,255,f); //  address  Size   address
	//fgets(temp,255,f); //  -----------------------

	bool started = false;
	bool hasModules = false;

	while (!gzeof(f)) {
		char line[512], temp[256] = {0};
		char *p = gzgets(f, line, 512);
		if (p == NULL)
			break;

		// Chop any newlines off.
		for (size_t i = strlen(line) - 1; i > 0; i--) {
			if (line[i] == '\r' || line[i] == '\n') {
				line[i] = '\0';
			}
		}

		if (strlen(line) < 4 || sscanf(line, "%s", temp) != 1)
			continue;

		if (strcmp(temp,"UNUSED")==0) continue;
		if (strcmp(temp,".text")==0)  {started=true;continue;};
		if (strcmp(temp,".init")==0)  {started=true;continue;};
		if (strcmp(temp,"Starting")==0) continue;
		if (strcmp(temp,"extab")==0) continue;
		if (strcmp(temp,".ctors")==0) break;
		if (strcmp(temp,".dtors")==0) break;
		if (strcmp(temp,".rodata")==0) continue;
		if (strcmp(temp,".data")==0) continue;
		if (strcmp(temp,".sbss")==0) continue;
		if (strcmp(temp,".sdata")==0) continue;
		if (strcmp(temp,".sdata2")==0) continue;
		if (strcmp(temp,"address")==0)  continue;
		if (strcmp(temp,"-----------------------")==0)  continue;
		if (strcmp(temp,".sbss2")==0) break;
		if (temp[1]==']') continue;

		if (!started) continue;

		u32 address = -1, size, vaddress = -1;
		int moduleIndex = 0;
		int typeInt;
		SymbolType type;
		char name[128] = {0};

		if (sscanf(line, ".module %x %08x %08x %127c", &moduleIndex, &address, &size, name) == 4) {
			// Found a module definition.
			ModuleEntry mod;
			mod.index = moduleIndex;
			strcpy(mod.name, name);
			mod.start = address;
			mod.size = size;
			modules.push_back(mod);
			hasModules = true;
			continue;
		}

		sscanf(line, "%08x %08x %x %i %127c", &address, &size, &vaddress, &typeInt, name);
		type = (SymbolType) typeInt;
		if (!hasModules) {
			if (!Memory::IsValidAddress(vaddress)) {
				ERROR_LOG(LOADER, "Invalid address in symbol file: %08x (%s)", vaddress, name);
				continue;
			}
		} else {
			// The 3rd field is now used for the module index.
			moduleIndex = vaddress;
			vaddress = GetModuleAbsoluteAddr(address, moduleIndex);
			if (!Memory::IsValidAddress(vaddress)) {
				ERROR_LOG(LOADER, "Invalid address in symbol file: %08x (%s)", vaddress, name);
				continue;
			}
		}

		if (type == ST_DATA && size == 0)
			size = 4;

		if (!strcmp(name, ".text") || !strcmp(name, ".init") || strlen(name) <= 1) {

		} else {
			switch (type)
//.........这里部分代码省略.........
开发者ID:18859966862,项目名称:ppsspp,代码行数:101,代码来源:SymbolMap.cpp

示例15: LaunchBrowser

void LaunchBrowser(const char *url) {
	ShellExecute(NULL, L"open", ConvertUTF8ToWString(url).c_str(), NULL, NULL, SW_SHOWNORMAL);
}
开发者ID:YosephHaryanto,项目名称:ppsspp,代码行数:3,代码来源:main.cpp


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