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

C++ string16类代码示例

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

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



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

示例1: uri

string IRI::IRIString() const
{
    if ( !_pureIRI.empty() )
        return _pureIRI;
    
    if ( !_url )
        return string::EmptyString;
    
    // we'll have to reverse-engineer it, grr
    string uri(URIString());
    std::string plainHost(_url->host());
    
    url_canon::RawCanonOutputW<256> idnDecoded;
    const string16 idnSrc = string(plainHost).utf16string();
    if ( url_canon::IDNToUnicode(idnSrc.c_str(), static_cast<int>(idnSrc.size()), &idnDecoded) && idnSrc != idnDecoded.data() )
    {
        // swap out the IDN-encoded hostname
        string::size_type pos = uri.find(plainHost);
        if ( pos != string::npos )
        {
            uri.replace(pos, plainHost.size(), idnDecoded.data());
        }
    }
    
    // have to leave it all url-encoded, sadly...
    return uri;
}
开发者ID:HoTaeWang,项目名称:readium-sdk,代码行数:27,代码来源:iri.cpp


示例2: EqualsASCII

bool EqualsASCII(const string16& a, const base::StringPiece& b)
{
    if(a.length() != b.length())
    {
        return false;
    }
    return std::equal(b.begin(), b.end(), a.begin());
}
开发者ID:Strongc,项目名称:Chrome_Library,代码行数:8,代码来源:string_util.cpp


示例3: IDNEncodeHostname

string IRI::IDNEncodeHostname(const string& str)
{
    url_canon::RawCanonOutputW<256> output;
    const string16 src = str.utf16string();
    if ( url_canon::IDNToASCII(src.c_str(), static_cast<int>(src.size()), &output) )
        return output.data();
    return string::EmptyString;
}
开发者ID:aironik,项目名称:readium-sdk,代码行数:8,代码来源:iri.cpp


示例4: WriteBytes

bool Pickle::WriteString16(const string16& value)
{
    if(!WriteInt(static_cast<int>(value.size())))
    {
        return false;
    }

    return WriteBytes(value.data(),
        static_cast<int>(value.size())*sizeof(char16));
}
开发者ID:noodle1983,项目名称:putty-nd3.x,代码行数:10,代码来源:pickle.cpp


示例5: ContainsOnlyWhitespace

bool ContainsOnlyWhitespace(const string16& str)
{
    for(string16::const_iterator i=str.begin(); i!=str.end(); ++i)
    {
        if(!IsWhitespace(*i))
        {
            return false;
        }
    }
    return true;
}
开发者ID:Strongc,项目名称:Chrome_Library,代码行数:11,代码来源:string_util.cpp


示例6: ContentsChanged

void DemoTextfiled::ContentsChanged(view::Textfield* sender,
                                    const string16& new_contents)
{
    if(sender == name_)
    {
        PrintStatus(base::StringPrintf(L"Name [%ls]", new_contents.c_str()));
    }
    else if(sender == password_)
    {
        PrintStatus(base::StringPrintf(L"Password [%ls]",new_contents.c_str()));
    }
}
开发者ID:leer168,项目名称:x-framework,代码行数:12,代码来源:demo_textfield.cpp


示例7: AppendText

 void NativeTextfieldWin::AppendText(const string16& text)
 {
     int text_length = GetWindowTextLength();
     ::SendMessage(m_hWnd, TBM_SETSEL, true, MAKELPARAM(text_length, text_length));
     ::SendMessage(m_hWnd, EM_REPLACESEL, false,
         reinterpret_cast<LPARAM>(text.c_str()));
 }
开发者ID:abyvaltsev,项目名称:putty-nd3.x,代码行数:7,代码来源:native_textfield_win.cpp


示例8: OpenItemWithExternalApp

 // Show the Windows "Open With" dialog box to ask the user to pick an app to
 // open the file with.
 bool OpenItemWithExternalApp(const string16& full_path)
 {
     SHELLEXECUTEINFO sei = { sizeof(sei) };
     sei.fMask = SEE_MASK_FLAG_DDEWAIT;
     sei.nShow = SW_SHOWNORMAL;
     sei.lpVerb = L"openas";
     sei.lpFile = full_path.c_str();
     return (TRUE == ::ShellExecuteExW(&sei));
 }
开发者ID:abyvaltsev,项目名称:putty-nd3.x,代码行数:11,代码来源:shell.cpp


示例9: AdjustStringForLocaleDirection

    bool AdjustStringForLocaleDirection(const string16& text,
        string16* localized_text)
    {
        if(!IsRTL() || text.empty())
        {
            return false;
        }

        // TODO: 根据IsRTL()实际值进行处理.
        *localized_text = text;
        return true;
    }
开发者ID:sharperM,项目名称:UI,代码行数:12,代码来源:rtl.cpp


示例10: SetAppIdForWindow

        void SetAppIdForWindow(const string16& app_id, HWND hwnd)
        {
            // This functionality is only available on Win7+.
            if(base::win::GetVersion() < base::win::VERSION_WIN7)
            {
                return;
            }

            // Load Shell32.dll into memory.
            // TODO(brg): Remove this mechanism when the Win7 SDK is available in trunk.
            std::wstring shell32_filename(kShell32);
            FilePath shell32_filepath(shell32_filename);
            base::NativeLibrary shell32_library = base::LoadNativeLibrary(shell32_filepath);

            if(!shell32_library)
            {
                return;
            }

            // Get the function pointer for SHGetPropertyStoreForWindow.
            void* function = base::GetFunctionPointerFromNativeLibrary(
                shell32_library,
                kSHGetPropertyStoreForWindow);

            if(!function)
            {
                base::UnloadNativeLibrary(shell32_library);
                return;
            }

            // Set the application's name.
            base::win::ScopedComPtr<IPropertyStore> pps;
            SHGPSFW SHGetPropertyStoreForWindow = static_cast<SHGPSFW>(function);
            HRESULT result = SHGetPropertyStoreForWindow(
                hwnd, __uuidof(*pps), reinterpret_cast<void**>(pps.Receive()));
            if(S_OK == result)
            {
                base::win::SetAppIdForPropertyStore(pps, app_id.c_str());
            }

            // Cleanup.
            base::UnloadNativeLibrary(shell32_library);
        }
开发者ID:abyvaltsev,项目名称:putty-nd3.x,代码行数:43,代码来源:shell.cpp


示例11: MatchPattern

bool MatchPattern(const string16& eval, const string16& pattern) {
	return MatchPatternT(eval.c_str(), eval.c_str() + eval.size(),
		pattern.c_str(), pattern.c_str() + pattern.size(),
		0, NextCharUTF16());
}
开发者ID:623442733,项目名称:cef,代码行数:5,代码来源:string_util.cpp


示例12: LowerCaseEqualsASCII

bool LowerCaseEqualsASCII(const string16& a, const char* b) {
	return DoLowerCaseEqualsASCII(a.begin(), a.end(), b);
}
开发者ID:623442733,项目名称:cef,代码行数:3,代码来源:string_util.cpp


示例13: UTF16ToASCII

std::string UTF16ToASCII(const string16& utf16)
{
    DCHECK(IsStringASCII(utf16)) << utf16;
    return std::string(utf16.begin(), utf16.end());
}
开发者ID:Strongc,项目名称:Chrome_Library,代码行数:5,代码来源:string_util.cpp


示例14: searchNext

	void PuttyView::searchNext(const string16& str)
	{
		return term_find(puttyController_->term, str.c_str(), 0);
	}
开发者ID:abyvaltsev,项目名称:putty-nd3.x,代码行数:4,代码来源:putty_view.cpp


示例15: searchPrevious

	void PuttyView::searchPrevious(const string16& str)
	{
		return term_find(puttyController_->term, str.c_str(), 1);
	}
开发者ID:abyvaltsev,项目名称:putty-nd3.x,代码行数:4,代码来源:putty_view.cpp


示例16: LaunchProcess

    bool LaunchProcess(const string16& cmdline,
        const LaunchOptions& options,
        ProcessHandle* process_handle)
    {
        STARTUPINFO startup_info = {};
        startup_info.cb = sizeof(startup_info);
        if(options.empty_desktop_name)
        {
            startup_info.lpDesktop = L"";
        }
        startup_info.dwFlags = STARTF_USESHOWWINDOW;
        startup_info.wShowWindow = options.start_hidden ? SW_HIDE : SW_SHOW;
        PROCESS_INFORMATION process_info;

        DWORD flags = 0;

        if(options.job_handle)
        {
            flags |= CREATE_SUSPENDED;

            // If this code is run under a debugger, the launched process is
            // automatically associated with a job object created by the debugger.
            // The CREATE_BREAKAWAY_FROM_JOB flag is used to prevent this.
            flags |= CREATE_BREAKAWAY_FROM_JOB;
        }

        if(options.as_user)
        {
            flags |= CREATE_UNICODE_ENVIRONMENT;
            void* enviroment_block = NULL;

            if(!CreateEnvironmentBlock(&enviroment_block, options.as_user, FALSE))
            {
                return false;
            }

            BOOL launched = CreateProcessAsUser(options.as_user, NULL,
                const_cast<wchar_t*>(cmdline.c_str()),
                NULL, NULL, options.inherit_handles, flags,
                enviroment_block, NULL, &startup_info,
                &process_info);
            DestroyEnvironmentBlock(enviroment_block);
            if(!launched)
            {
                return false;
            }
        }
        else
        {
            if(!CreateProcess(NULL,
                const_cast<wchar_t*>(cmdline.c_str()), NULL, NULL,
                options.inherit_handles, flags, NULL, NULL,
                &startup_info, &process_info))
            {
                return false;
            }
        }

        if(options.job_handle)
        {
            if(0 == AssignProcessToJobObject(options.job_handle, process_info.hProcess))
            {
                LOG(ERROR) << "Could not AssignProcessToObject.";
                KillProcess(process_info.hProcess, kProcessKilledExitCode, true);
                return false;
            }

            ResumeThread(process_info.hThread);
        }

        // Handles must be closed or they will leak.
        CloseHandle(process_info.hThread);

        if(options.wait)
        {
            WaitForSingleObject(process_info.hProcess, INFINITE);
        }

        // If the caller wants the process handle, we won't close it.
        if(process_handle)
        {
            *process_handle = process_info.hProcess;
        }
        else
        {
            CloseHandle(process_info.hProcess);
        }
        return true;
    }
开发者ID:abyvaltsev,项目名称:putty-nd3.x,代码行数:89,代码来源:process_util.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ stringT类代码示例发布时间:2022-05-31
下一篇:
C++ string类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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