• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FromUTF8函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: FromUTF8

///////////////////////////////////////////////////////////////
//
// DelTree
//
//
//
///////////////////////////////////////////////////////////////
bool SharedUtil::DelTree ( const SString& strPath, const SString& strInsideHere )
{
    // Safety: Make sure strPath is inside strInsideHere
    WString wstrPath = FromUTF8( strPath );
    WString wstrInsideHere = FromUTF8( strInsideHere );
    if ( !wstrPath.BeginsWithI( wstrInsideHere ) )
    {
        assert ( 0 );
        return false;
    }

    DWORD dwBufferSize = ( wstrPath.length() + 3 ) * sizeof( wchar_t );
    wchar_t *szBuffer = static_cast < wchar_t* > ( alloca ( dwBufferSize ) );
    memset ( szBuffer, 0, dwBufferSize );
    wcsncpy ( szBuffer, wstrPath, wstrPath.length() );
    SHFILEOPSTRUCTW sfos;

    sfos.hwnd = NULL;
    sfos.wFunc = FO_DELETE;
    sfos.pFrom = szBuffer;  // Double NULL terminated
    sfos.pTo = NULL;
    sfos.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT | FOF_ALLOWUNDO;

    int status = SHFileOperationW(&sfos);
    return status == 0;
}
开发者ID:Cazomino05,项目名称:Test1,代码行数:33,代码来源:SharedUtil.File.hpp


示例2: BASS_StreamCreateFile

float CBassAudio::GetSoundBPM(void)
{
    if (m_fBPM == 0.0f && !m_bStream)
    {
        float fData = 0.0f;
        // open the same file as played but for bpm decoding detection
        DWORD bpmChan = BASS_StreamCreateFile(false, FromUTF8(m_strPath), 0, 0, BASS_STREAM_DECODE | BASS_UNICODE);
        if (!bpmChan)
        {
            bpmChan = BASS_MusicLoad(false, FromUTF8(m_strPath), 0, 0, BASS_MUSIC_DECODE | BASS_MUSIC_PRESCAN | BASS_UNICODE, 0);
        }
        // detect bpm in background and return progress in GetBPM_ProgressCallback function
        if (bpmChan)
        {
            fData = BASS_FX_BPM_DecodeGet(bpmChan, 0, GetLength(), 0, BASS_FX_FREESOURCE, NULL, NULL);
        }

        if (BASS_ErrorGetCode() != BASS_OK)
        {
            g_pCore->GetConsole()->Printf("BASS ERROR %d in BASS_FX_BPM_DecodeGet  path:%s  3d:%d  loop:%d", BASS_ErrorGetCode(), *m_strPath, m_b3D, m_bLoop);
        }
        else
        {
            m_fBPM = floor(fData);
        }
        BASS_FX_BPM_BeatFree(bpmChan);
    }
    return m_fBPM;
}
开发者ID:Necktrox,项目名称:mtasa-blue,代码行数:29,代码来源:CBassAudio.cpp


示例3: _wrename

int SharedUtil::File::Rename(const char* szOldFilename, const char* szNewFilename)
{
#ifdef WIN32
    return _wrename(FromUTF8(szOldFilename), FromUTF8(szNewFilename));
#else
    return rename(szOldFilename, szNewFilename);
#endif
}
开发者ID:Necktrox,项目名称:mtasa-blue,代码行数:8,代码来源:SharedUtil.File.hpp


示例4: _wfsopen

FILE* SharedUtil::File::Fopen(const char* szFilename, const char* szMode)
{
#ifdef WIN32
    return _wfsopen(FromUTF8(szFilename), FromUTF8(szMode), _SH_DENYNO);
#else
    return fopen(szFilename, szMode);
#endif
}
开发者ID:Necktrox,项目名称:mtasa-blue,代码行数:8,代码来源:SharedUtil.File.hpp


示例5: MyMoveFileA

 BOOL
 WINAPI
 MyMoveFileA(
     __in LPCSTR lpExistingFileName,
     __in LPCSTR lpNewFileName
     )
 {
     return MoveFileW( FromUTF8( lpExistingFileName ), FromUTF8( lpNewFileName ) );
 }
开发者ID:qaisjp,项目名称:mtasa-blue,代码行数:9,代码来源:SharedUtil.Win32Utf8FileHooks.hpp


示例6: MyCopyFileA

 BOOL
 WINAPI
 MyCopyFileA(
     __in LPCSTR lpExistingFileName,
     __in LPCSTR lpNewFileName,
     __in BOOL bFailIfExists
     )
 {
     return CopyFileW( FromUTF8( lpExistingFileName ), FromUTF8( lpNewFileName ), bFailIfExists );
 }
开发者ID:qaisjp,项目名称:mtasa-blue,代码行数:10,代码来源:SharedUtil.Win32Utf8FileHooks.hpp


示例7: GetLongPathNameW

SString SharedUtil::GetSystemLongPathName( const SString& strPath )
{
    wchar_t szBuffer[32000];
    szBuffer[0] = 0;
    GetLongPathNameW( FromUTF8( strPath ), szBuffer, NUMELMS( szBuffer ) - 1 );
    return ToUTF8( szBuffer );
}
开发者ID:Cazomino05,项目名称:Test1,代码行数:7,代码来源:SharedUtil.File.hpp


示例8: attributes

void MeaXMLParser::StartElementHandler(void *userData, const XML_Char *elementName,
                                        const XML_Char **attrs)
{
    MeaXMLParser *ps = static_cast<MeaXMLParser*>(userData);
    
    if (ps->m_haveDTD) {
        ps->m_validator->StartElement(ps->m_parser, elementName, attrs);
    }

    MeaXMLAttributes attributes(attrs, XML_GetSpecifiedAttributeCount(ps->m_parser));
    CString name(FromUTF8(elementName));
    CString container;
    if (!ps->m_elementStack->empty())
        container = ps->m_elementStack->top();
    ps->m_handler->StartElementHandler(container, name, attributes);
    ps->m_elementStack->push(name);

    if (ps->m_buildDOM) {
        MeaXMLNode* node = new MeaXMLNode(name, attributes);
        if (ps->m_nodeStack->empty()) {
            MeaAssert(ps->m_dom == NULL);
            ps->m_dom = node;
        }
        else {
            ps->m_nodeStack->top()->AddChild(node);
        }
        ps->m_nodeStack->push(node);
    }
}
开发者ID:craigshaw,项目名称:Meazure,代码行数:29,代码来源:XMLParser.cpp


示例9: sysId

int MeaXMLParser::ExternalEntityRefHandler(XML_Parser parser,
                                        const XML_Char* context,
                                        const XML_Char* /*base*/,
                                        const XML_Char* systemId,
                                        const XML_Char* /*publicId*/)
{
    if (systemId != NULL) {
        MeaXMLParser *ps = reinterpret_cast<MeaXMLParser*>(parser);
        CString sysId(FromUTF8(systemId));

        if (sysId.Find(MeaXMLParser::m_homeURL) == 0) {
            TCHAR pathname[_MAX_PATH], drive[_MAX_DRIVE], dir[_MAX_DIR];
            GetModuleFileName(NULL, pathname, _MAX_PATH);
            _tsplitpath_s(pathname, drive, _MAX_DRIVE, dir, _MAX_DIR, NULL, 0, NULL, 0);

            sysId = CString(drive) + CString(dir) + sysId.Mid(_tcslen(MeaXMLParser::m_homeURL));
            sysId.Replace(_T('/'), _T('\\'));

            ps->m_pathnameStack->push(sysId);

            ps->m_context = context;
            ps->m_handler->ParseEntity(*ps, sysId);
            ps->m_context = NULL;

            ps->m_pathnameStack->pop();
        }
    }

    return 1;
}
开发者ID:craigshaw,项目名称:Meazure,代码行数:30,代码来源:XMLParser.cpp


示例10: LockCallbackId

void CBassAudio::PlayStreamIntern(void* arguments)
{
    CBassAudio* pBassAudio = LockCallbackId(arguments);
    if (pBassAudio)
    {
        pBassAudio->m_pVars->criticalSection.Lock();
        SString strURL = pBassAudio->m_pVars->strURL;
        long    lFlags = pBassAudio->m_pVars->lFlags;
        pBassAudio->m_pVars->criticalSection.Unlock();
        UnlockCallbackId();

        // This can take a while
        HSTREAM pSound = BASS_StreamCreateURL(FromUTF8(strURL), 0, lFlags | BASS_UNICODE, NULL, NULL);

        CBassAudio* pBassAudio = LockCallbackId(arguments);
        if (pBassAudio)
        {
            pBassAudio->m_pVars->criticalSection.Lock();
            pBassAudio->m_pVars->bStreamCreateResult = true;
            pBassAudio->m_pVars->pSound = pSound;
            pBassAudio->m_pVars->criticalSection.Unlock();
        }
        else
        {
            // Deal with unwanted pSound
            g_pClientGame->GetManager()->GetSoundManager()->QueueChannelStop(pSound);
        }
    }

    UnlockCallbackId();
}
开发者ID:Necktrox,项目名称:mtasa-blue,代码行数:31,代码来源:CBassAudio.cpp


示例11: strScreenShotName

SString CScreenShot::GetScreenShotPath ( int iNumber )
{
    //Create a search string
    SString strScreenShotName ( "%s\\mta-screen*.png", &szScreenShotPath[0] );
    HANDLE hFind;
    SString strReturn = "";
    WIN32_FIND_DATAW fdFindData;
    int i = 1;
    //Find the first match
    hFind = FindFirstFileW(FromUTF8( strScreenShotName ), &fdFindData);
    //Check if the first match failed
    if ( hFind != INVALID_HANDLE_VALUE) {
        if (iNumber == 1) {
            //We wanted the first file
            strReturn = SString("%s\\%s",&szScreenShotPath[0],fdFindData.cFileName);
        }
        else
        {
            //Loop through and find all occurences of the file
            while (FindNextFileW(hFind, &fdFindData)) { 
                //Keep going until we find the last file
                i++;
                if (iNumber == i) {
                    strReturn = SString("%s\\%s",&szScreenShotPath[0], fdFindData.cFileName);
                    break;
                }
            }
        }
    }
    FindClose(hFind); //Close the file handle
    // Get Return the file directory
    return strReturn;
}
开发者ID:AdiBoy,项目名称:mtasa-blue,代码行数:33,代码来源:CScreenShot.cpp


示例12: archive

bool CAudioContainerSA::GetRawAudioData ( eAudioLookupIndex lookupIndex, int bankIndex, int audioIndex, uint8*& dataOut, unsigned int& lengthOut, int& iSampleRateOut )
{
    int numBanks = m_pLookupTable->CountIndex ( lookupIndex );
    if ( numBanks == 0 )
        return false;

    // Get archive file size
    std::ifstream archive ( FromUTF8( GetAudioArchiveName ( lookupIndex ) ), std::ios::binary );

    SAudioLookupEntrySA* lookupEntry = m_pLookupTable->GetEntry ( lookupIndex, bankIndex );
    if ( !lookupEntry )
        return false;

    // Read audio archive bank header (an audio archieve has multiple bank headers)
    SAudioBankHeaderSA bankHeader;

    // Seek to the bank offset and read the header
    archive.seekg ( lookupEntry->offset );
    if ( !archive.read ( reinterpret_cast<char*> ( &bankHeader ), sizeof ( SAudioBankHeaderSA ) ) )
        return false;

    // Get offsets to calculate the length
    SAudioEntrySA* audioEntry = &bankHeader.sounds[audioIndex];
    if ( !audioEntry )
        return false;

    unsigned int rawLength;
    if ( audioIndex+1 < bankHeader.numSounds ) // hacky fix: audioIndex starts at 0
    {
        SAudioEntrySA* nextAudioEntry = &bankHeader.sounds[audioIndex+1];
        if ( !nextAudioEntry )
            return false;

        rawLength = nextAudioEntry->offset - audioEntry->offset;
    }
    else if ( audioIndex+1 == bankHeader.numSounds )
    {
        rawLength = lookupEntry->length - audioEntry->offset;
    }
    else
        return false;

    // 2MB check in case of user modification errors (Max length of standard audio files is 560KB)
    if ( rawLength > 2 * 1024 * 1024 )
        return false;

    // Now we are ready to read the audio data :)
    uint8* buffer = new uint8[rawLength];

    dataOut = buffer;
    lengthOut = rawLength;
    iSampleRateOut = audioEntry->sampleRate;

    // Seek to the correct offset and read
    archive.seekg ( lookupEntry->offset + sizeof(SAudioBankHeaderSA) + audioEntry->offset ); // Or just archive.seekg ( archive.tellg() + audioEntry->offset )
    archive.read(reinterpret_cast<char*> ( buffer ), rawLength );

    return !archive.fail();
}
开发者ID:Black17,项目名称:gtasa_crashfix,代码行数:59,代码来源:CAudioContainerSA.cpp


示例13: GetSystemShortPathName

SString SharedUtil::GetSystemShortPathName(const SString& strPath)
{
    wchar_t szBuffer[32000];
    szBuffer[0] = 0;
    if (!GetShortPathNameW(FromUTF8(strPath), szBuffer, NUMELMS(szBuffer) - 1))
        return strPath;
    return ToUTF8(szBuffer);
}
开发者ID:Necktrox,项目名称:mtasa-blue,代码行数:8,代码来源:SharedUtil.File.hpp


示例14: _wremove

int SharedUtil::File::Delete(const char* szFilename)
{
#ifdef WIN32
    return _wremove(FromUTF8(szFilename));
#else
    return remove(szFilename);
#endif
}
开发者ID:Necktrox,项目名称:mtasa-blue,代码行数:8,代码来源:SharedUtil.File.hpp


示例15: MySetDllDirectoryA

 BOOL
 WINAPI
 MySetDllDirectoryA(
     __in_opt LPCSTR lpPathName
     )
 {
     return SetDllDirectoryW( FromUTF8( lpPathName ) );
 }
开发者ID:qaisjp,项目名称:mtasa-blue,代码行数:8,代码来源:SharedUtil.Win32Utf8FileHooks.hpp


示例16: PathGetDriveNumberW

// Get drive root from path
SString SharedUtil::GetPathDriveName( const SString& strPath )
{
    wchar_t szDrive[4] = L"";
    int iDriveNumber = PathGetDriveNumberW( FromUTF8( strPath ) );
    if ( iDriveNumber > -1 )
        PathBuildRootW( szDrive, iDriveNumber );
    return ToUTF8( szDrive );
}
开发者ID:Cazomino05,项目名称:Test1,代码行数:9,代码来源:SharedUtil.File.hpp


示例17: _wmkdir

int SharedUtil::File::Mkdir(const char* szPath, int iMode)
{
#ifdef WIN32
    return _wmkdir(FromUTF8(szPath));
#else
    return mkdir(szPath, (mode_t)iMode);
#endif
}
开发者ID:Necktrox,项目名称:mtasa-blue,代码行数:8,代码来源:SharedUtil.File.hpp


示例18: MyDeleteFileA

 BOOL
 WINAPI
 MyDeleteFileA(
     __in LPCSTR lpFileName
     )
 {
     return DeleteFileW( FromUTF8( lpFileName ) );
 }
开发者ID:qaisjp,项目名称:mtasa-blue,代码行数:8,代码来源:SharedUtil.Win32Utf8FileHooks.hpp


示例19: MyLoadLibraryA

 HMODULE
 WINAPI
 MyLoadLibraryA(
     __in LPCSTR lpLibFileName
     )
 {
     return LoadLibraryW( FromUTF8( lpLibFileName ) );
 }
开发者ID:qaisjp,项目名称:mtasa-blue,代码行数:8,代码来源:SharedUtil.Win32Utf8FileHooks.hpp


示例20: _wrmdir

int SharedUtil::File::Rmdir(const char* szPath)
{
#ifdef WIN32
    return _wrmdir(FromUTF8(szPath));
#else
    return rmdir(szPath);
#endif
}
开发者ID:Necktrox,项目名称:mtasa-blue,代码行数:8,代码来源:SharedUtil.File.hpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FsRtlEnterFileSystem函数代码示例发布时间:2022-05-30
下一篇:
C++ FromHere函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap