本文整理汇总了C++中kurlgoogleprivate::Replacements::SetPort方法的典型用法代码示例。如果您正苦于以下问题:C++ Replacements::SetPort方法的具体用法?C++ Replacements::SetPort怎么用?C++ Replacements::SetPort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kurlgoogleprivate::Replacements
的用法示例。
在下文中一共展示了Replacements::SetPort方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setPort
void KURL::setPort(unsigned short i)
{
KURLGooglePrivate::Replacements replacements;
String portStr;
portStr = String::number(i);
replacements.SetPort(
reinterpret_cast<const url_parse::UTF16Char*>(portStr.characters()),
url_parse::Component(0, portStr.length()));
m_url.replaceComponents(replacements);
}
示例2: setPort
void KURL::setPort(unsigned short i)
{
KURLGooglePrivate::Replacements replacements;
String portStr;
if (i) {
portStr = String::number(static_cast<int>(i));
replacements.SetPort(
reinterpret_cast<const url_parse::UTF16Char*>(portStr.characters()),
url_parse::Component(0, portStr.length()));
} else {
// Clear any existing port when it is set to 0.
replacements.ClearPort();
}
m_url.replaceComponents(replacements);
}
示例3: setHostAndPort
// This function is used only in the JSC build.
void KURL::setHostAndPort(const String& s)
{
String newhost = s.left(s.find(":"));
String newport = s.substring(s.find(":") + 1);
KURLGooglePrivate::Replacements replacements;
// Host can't be removed, so we always set.
replacements.SetHost(CharactersOrEmpty(newhost),
url_parse::Component(0, newhost.length()));
if (newport.isEmpty()) // Port may be removed, so we support clearing.
replacements.ClearPort();
else
replacements.SetPort(CharactersOrEmpty(newport), url_parse::Component(0, newport.length()));
m_url.replaceComponents(replacements);
}
示例4: setHostAndPort
void KURL::setHostAndPort(const String& s)
{
String host = s;
String port;
int hostEnd = s.find(":");
if (hostEnd != -1) {
host = s.left(hostEnd);
port = s.substring(hostEnd + 1);
}
KURLGooglePrivate::Replacements replacements;
// Host can't be removed, so we always set.
replacements.SetHost(CharactersOrEmpty(host),
url_parse::Component(0, host.length()));
if (port.isEmpty()) // Port may be removed, so we support clearing.
replacements.ClearPort();
else
replacements.SetPort(CharactersOrEmpty(port), url_parse::Component(0, port.length()));
m_url.replaceComponents(replacements);
}