当前位置: 首页>>代码示例>>C++>>正文


C++ String::ascii方法代码示例

本文整理汇总了C++中wtf::String::ascii方法的典型用法代码示例。如果您正苦于以下问题:C++ String::ascii方法的具体用法?C++ String::ascii怎么用?C++ String::ascii使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wtf::String的用法示例。


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

示例1: adoptPtr

PassOwnPtr<ScheduledAction> ScheduledAction::create(ExecState* exec, DOMWrapperWorld* isolatedWorld, ContentSecurityPolicy* policy)
{
    JSValue v = exec->argument(0);
    CallData callData;
    CallType callType = getCallData(v, callData);
    if (callType == CallTypeNone) {
        if (policy && !policy->allowEval())
            return nullptr;
        UString string = v.toString(exec)->value(exec);
        if (exec->hadException())
            return nullptr;
        return adoptPtr(new ScheduledAction(ustringToString(string), isolatedWorld));
    }

    // WebERA this calculates a unique indification of the called function scheduled in this action.

    if (callType == CallTypeJS) {
        const SourceCode source = callData.js.functionExecutable->source();
        WTF::String url = WebCore::decodeURLEscapeSequences(WTF::String(source.provider()->url().utf8().data()));

        uint calledLine = source.firstLine();

        return adoptPtr(new ScheduledAction(exec, v, isolatedWorld, url.ascii().data(), calledLine));
    }

    return adoptPtr(new ScheduledAction(exec, v, isolatedWorld, "<native-function>", -1));
}
开发者ID:christofferqa,项目名称:R4,代码行数:27,代码来源:ScheduledAction.cpp

示例2: supportsType

MediaPlayer::SupportsType MediaPlayerPrivate::supportsType(const WTF::String& type, const WTF::String& codecs, const KURL& url)
{
    bool isRTSP = url.protocolIs("rtsp");

    if (!isRTSP && (type.isNull() || type.isEmpty())) {
        LOG(Media, "MediaPlayer does not support type; type is null or empty.");
        return MediaPlayer::IsNotSupported;
    }

    // spec says we should not return "probably" if the codecs string is empty
    if (isRTSP || PlatformPlayer::mimeTypeSupported(type.ascii().data())) {
        LOG(Media, "MediaPlayer supports type %s.", isRTSP ? "rtsp" : type.ascii().data());
        return codecs.isEmpty() ? MediaPlayer::MayBeSupported : MediaPlayer::IsSupported;
    }
    LOG(Media, "MediaPlayer does not support type %s.", type.ascii().data());
    return MediaPlayer::IsNotSupported;
}
开发者ID:kcomkar,项目名称:webkit,代码行数:17,代码来源:MediaPlayerPrivateBlackBerry.cpp

示例3: sourceParsed

// because the debugger can be attached at any time, and also because other
// methods will be called on this debugger for sources that have already been
// detached, we make fake entries for unknown source entries as they are
// encountered, and we retain old sourceID entries until they are replaced
// by new data.  fake entries are handled by the Source constructor.
void DebuggerShell::sourceParsed(ExecState* execState,
                                 SourceProvider* sourceProvider,
                                 int errorLineNumber,
                                 const WTF::String& errorMessage) {
  intptr_t sourceID = sourceProvider->asID();
  Source source = Source(fromWTFString(sourceProvider->url()));
  source.parseID = nextParseID_++;
  source_map_[sourceID] = source;

  // The URL map is used in setting breakpoints.
  // Therefore, it's okay if we overwrite one entry with another.
  // This might happen if we parse both http://a.tld/foo.js and http://b.tld/foo.js ,
  // both of which would clobber the spot occupied by the filename foo.js .
  // This means if you want to break on one or the other, you'll have to
  // specify the full URL.  The convenient mapping for filename won't be useful.
  // But for the common case, filename is very very useful.
  url_map_[source.url] = sourceID;
  url_map_[source.filename] = sourceID;
  parse_id_map_[source.parseID] = sourceID;

  if (errorLineNumber >= 0) {
    WTF::CString error = errorMessage.ascii();
    WTF::CString f = WTF::String::format("Parse failed in %s on line %d: %s",
        source.url.c_str(), errorLineNumber, error.data()).ascii();
    dumpToTTY(f);
  } else {
    if (tracing_ || dumping_source_) {
      WTF::CString f = WTF::String::format("Parsed %s", source.url.c_str()).ascii();
      dumpToTTY(f);
    }
    if (dumping_source_) {
      // NOTE: We only dump first 100 bytes of source.  The point is to know
      // more or less what's in it, not to see all 2MB of JavaScript.
      // It's really most useful for seeing the source of evals full of JSON.
      WTF::CString code = sourceProvider->source().ascii();
      WTF::CString code_clipped(code.data(), code.length() > 100 ? 100 : code.length());
      WTF::CString f = WTF::String::format("Source of %s[%d]: %s", source.url.c_str(), source.parseID, code_clipped.data()).ascii();
      dumpToTTY(f);
    }
  }
}
开发者ID:,项目名称:,代码行数:46,代码来源:

示例4: string

static inline std::string fromWTFString(const WTF::String& wtf_string) {
  if (wtf_string.isNull()) return std::string();
  WTF::CString cstring = wtf_string.ascii();
  return std::string(cstring.data(), cstring.length());
}
开发者ID:,项目名称:,代码行数:5,代码来源:


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