コード例 #1
0
ファイル: KURL.cpp プロジェクト: ollie314/chromium
bool isValidProtocol(const String& protocol) {
  // RFC3986: ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
  if (protocol.isEmpty())
    return false;
  if (!isSchemeFirstChar(protocol[0]))
    return false;
  unsigned protocolLength = protocol.length();
  for (unsigned i = 1; i < protocolLength; i++) {
    if (!isSchemeChar(protocol[i]))
      return false;
  }
  return true;
}
コード例 #2
0
ファイル: KURL.cpp プロジェクト: 335969568/Blink-1
static bool isSchemeChar(char c)
{
    return isSchemeFirstChar(c) || (c >= '0' && c <= '9') || c == '.' || c == '-' || c == '+';
}