本文整理汇总了C++中kurlgoogleprivate::Replacements类的典型用法代码示例。如果您正苦于以下问题:C++ Replacements类的具体用法?C++ Replacements怎么用?C++ Replacements使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Replacements类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setHost
void KURL::setHost(const String& host)
{
KURLGooglePrivate::Replacements replacements;
replacements.SetHost(CharactersOrEmpty(host),
url_parse::Component(0, host.length()));
m_url.replaceComponents(replacements);
}
示例2: setProtocol
void KURL::setProtocol(const String& protocol)
{
KURLGooglePrivate::Replacements replacements;
replacements.SetScheme(CharactersOrEmpty(protocol),
url_parse::Component(0, protocol.length()));
m_url.replaceComponents(replacements);
}
示例3: setPath
void KURL::setPath(const String& path)
{
// Empty paths will be canonicalized to "/", so we don't have to worry
// about calling ClearPath().
KURLGooglePrivate::Replacements replacements;
replacements.SetPath(CharactersOrEmpty(path),
url_parse::Component(0, path.length()));
m_url.replaceComponents(replacements);
}
示例4: 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);
}
示例5: setFragmentIdentifier
void KURL::setFragmentIdentifier(const String& s)
{
// This function is commonly called to clear the ref, which we
// normally don't have, so we optimize this case.
if (s.isNull() && !m_url.m_parsed.ref.is_valid())
return;
KURLGooglePrivate::Replacements replacements;
if (s.isNull())
replacements.ClearRef();
else
replacements.SetRef(CharactersOrEmpty(s), url_parse::Component(0, s.length()));
m_url.replaceComponents(replacements);
}
示例6: setPass
void KURL::setPass(const String& pass)
{
// This function is commonly called to clear the password, which we
// normally don't have, so we optimize this case.
if (pass.isEmpty() && !m_url.m_parsed.password.is_valid())
return;
// The canonicalizer will clear any passwords that are empty, so we
// don't have to explicitly call ClearUsername() here.
KURLGooglePrivate::Replacements replacements;
replacements.SetPassword(CharactersOrEmpty(pass),
url_parse::Component(0, pass.length()));
m_url.replaceComponents(replacements);
}
示例7: 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);
}
示例8: 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);
}
示例9: 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);
}
示例10: setQuery
void KURL::setQuery(const String& query)
{
KURLGooglePrivate::Replacements replacements;
if (query.isNull()) {
// KURL.cpp sets to NULL to clear any query.
replacements.ClearQuery();
} else if (query.length() > 0 && query[0] == '?') {
// WebCore expects the query string to begin with a question mark, but
// GoogleURL doesn't. So we trim off the question mark when setting.
replacements.SetQuery(CharactersOrEmpty(query),
url_parse::Component(1, query.length() - 1));
} else {
// When set with the empty string or something that doesn't begin with
// a question mark, KURL.cpp will add a question mark for you. The only
// way this isn't compatible is if you call this function with an empty
// string. KURL.cpp will leave a '?' with nothing following it in the
// URL, whereas we'll clear it.
// FIXME We should eliminate this difference.
replacements.SetQuery(CharactersOrEmpty(query),
url_parse::Component(0, query.length()));
}
m_url.replaceComponents(replacements);
}
示例11: removeFragmentIdentifier
void KURL::removeFragmentIdentifier()
{
KURLGooglePrivate::Replacements replacements;
replacements.ClearRef();
m_url.replaceComponents(replacements);
}