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


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

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


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

示例1: setDataToClipBoard

void setDataToClipBoard(WTF::String& format , WTF::String& data){

    LOGD("   setDataToClipBoard :  Enter");	
	
    JNIEnv* env = JSC::Bindings::getJNIEnv();
    if(env == NULL || format.isEmpty() || data.isEmpty())
    	return;


    jstring jFormat = env->NewString((jchar*) format.characters(), format.length());	
    jstring jData = env->NewString((jchar*) data.characters(), data.length());

    if((m_javaGlueForPasteBoard.object(env).get() == NULL )||(m_javaGlueForPasteBoard.m_setDataToClipBoard  ==  0 ))
    {
       LOGD("   setDataToClipBoard :  return with out copy");	
	return;
    }
    env->CallVoidMethod(m_javaGlueForPasteBoard.object(env).get(),
        	 m_javaGlueForPasteBoard.m_setDataToClipBoard , jFormat , jData);


    env->DeleteLocalRef(jFormat); 
    env->DeleteLocalRef(jData);
    checkException(env);
}
开发者ID:johnwpoliver,项目名称:Samsung-GT-P3113-AOSP-CM-Kernel-and-Ramdisk,代码行数:25,代码来源:PasteBoardAndroid.cpp

示例2: load

void MediaPlayerPrivate::load(const WTF::String& url)
{
    WTF::String modifiedUrl(url);

    if (modifiedUrl.startsWith("local://")) {
        KURL kurl = KURL(KURL(), modifiedUrl);
        kurl.setProtocol("file");
        WTF::String tempPath(BlackBerry::Platform::Settings::instance()->applicationLocalDirectory().c_str());
        tempPath.append(kurl.path());
        kurl.setPath(tempPath);
        modifiedUrl = kurl.string();
    }
    if (modifiedUrl.startsWith("file://")) {
        // The QNX Multimedia Framework cannot handle filenames containing URL escape sequences.
        modifiedUrl = decodeURLEscapeSequences(modifiedUrl);
    }

    void* tabId = m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient();
    int playerID = m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient()->playerID();

    deleteGuardedObject(m_platformPlayer);
#if USE(ACCELERATED_COMPOSITING)
    m_platformPlayer = PlatformPlayer::create(this, tabId, true, modifiedUrl.utf8().data());
#else
    m_platformPlayer = PlatformPlayer::create(this, tabId, false, modifiedUrl.utf8().data());
#endif

    WTF::String cookiePairs;
    if (!url.isEmpty())
        cookiePairs = cookieManager().getCookie(KURL(ParsedURLString, url.utf8().data()), WithHttpOnlyCookies);
    if (!cookiePairs.isEmpty() && cookiePairs.utf8().data())
        m_platformPlayer->load(playerID, modifiedUrl.utf8().data(), m_webCorePlayer->userAgent().utf8().data(), cookiePairs.utf8().data());
    else
        m_platformPlayer->load(playerID, modifiedUrl.utf8().data(), m_webCorePlayer->userAgent().utf8().data(), 0);
}
开发者ID:kcomkar,项目名称:webkit,代码行数:35,代码来源:MediaPlayerPrivateBlackBerry.cpp

示例3: if

PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context, bool allowPlainText, bool& chosePlainText)
{
	LOGD("documentFragment");
	chosePlainText = false;
	String dataFormat = "HTML";
	String imageFormat = "IMAGE";
	String markup;
	KURL srcURL;
	
	markup = android::getHTML();
	if(!markup.isEmpty()) {	
		RefPtr<DocumentFragment> fragment =
			createFragmentFromMarkup(frame->document(), markup, srcURL, FragmentScriptingNotAllowed);
		if (fragment)
			return fragment.release();
	}
	else if (allowPlainText) {
		WTF::String markup = android::getText();//ChromiumBridge::clipboardReadPlainText(buffer);
		if (!markup.isEmpty()) {
			chosePlainText = true;

			RefPtr<DocumentFragment> fragment =
				createFragmentFromText(context.get(), markup);
			if (fragment)
				return fragment.release();
		}
	}

	return 0;
}
开发者ID:johnwpoliver,项目名称:Samsung-GT-P3113-AOSP-CM-Kernel-and-Ramdisk,代码行数:30,代码来源:PasteBoardAndroid.cpp

示例4: sendResponseIfNeeded

void QNetworkReplyHandler::sendResponseIfNeeded()
{
    ASSERT(m_replyWrapper && m_replyWrapper->reply() && !wasAborted());

    if (m_replyWrapper->reply()->error() && m_replyWrapper->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).isNull())
        return;

    ResourceHandleClient* client = m_resourceHandle->client();
    if (!client)
        return;

    WTF::String mimeType = m_replyWrapper->mimeType();

    if (mimeType.isEmpty()) {
        // let's try to guess from the extension
        mimeType = MIMETypeRegistry::getMIMETypeForPath(m_replyWrapper->reply()->url().path());
    }

    KURL url(m_replyWrapper->reply()->url());
    ResourceResponse response(url, mimeType.lower(),
                              m_replyWrapper->reply()->header(QNetworkRequest::ContentLengthHeader).toLongLong(),
                              m_replyWrapper->encoding(), String());

    if (url.isLocalFile()) {
        client->didReceiveResponse(m_resourceHandle, response);
        return;
    }

    // The status code is equal to 0 for protocols not in the HTTP family.
    int statusCode = m_replyWrapper->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();

    if (url.protocolIsInHTTPFamily()) {
        String suggestedFilename = filenameFromHTTPContentDisposition(QString::fromLatin1(m_replyWrapper->reply()->rawHeader("Content-Disposition")));

        if (!suggestedFilename.isEmpty())
            response.setSuggestedFilename(suggestedFilename);
        else {
            Vector<String> extensions = MIMETypeRegistry::getExtensionsForMIMEType(mimeType);
            if (extensions.isEmpty())
                response.setSuggestedFilename(url.lastPathComponent());
            else {
                // If the suffix doesn't match the MIME type, correct the suffix.
                QString filename = url.lastPathComponent();
                const String suffix = QMimeDatabase().suffixForFileName(filename);
                if (!extensions.contains(suffix)) {
                    filename.chop(suffix.length());
                    filename += MIMETypeRegistry::getPreferredExtensionForMIMEType(mimeType);
                }
                response.setSuggestedFilename(filename);
            }
        }

        response.setHTTPStatusCode(statusCode);
        response.setHTTPStatusText(m_replyWrapper->reply()->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray().constData());

        // Add remaining headers.
        foreach (const QNetworkReply::RawHeaderPair& pair, m_replyWrapper->reply()->rawHeaderPairs())
            response.setHTTPHeaderField(QString::fromLatin1(pair.first), QString::fromLatin1(pair.second));
    }
开发者ID:RobinWuDev,项目名称:Qt,代码行数:59,代码来源:QNetworkReplyHandler.cpp

示例5: 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

示例6: urlSuitableForTestResult

static WTF::String urlSuitableForTestResult(const WTF::String& uriString)
{
    if (uriString.isEmpty() || !uriString.startsWith("file://"))
        return uriString;

    const size_t index = uriString.reverseFind('/');
    return (index == WTF::notFound) ? uriString : uriString.substring(index + 1);
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:8,代码来源:DumpRenderTreeView.cpp

示例7: isSupportedObjectMIMEType

bool WebSettings::isSupportedObjectMIMEType(const WTF::String& mimeType)
{
    if (mimeType.isEmpty())
        return false;
    if (!s_supportedObjectMIMETypes)
        return false;

    return s_supportedObjectMIMETypes->contains(getNormalizedMIMEType(mimeType));
}
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:9,代码来源:WebSettings.cpp

示例8: webkit_get_web_database_directory_path

/**
 * webkit_get_web_database_directory_path:
 *
 * Returns the current path to the directory WebKit will write Web 
 * Database databases. By default this path will be in the user data
 * directory.
 *
 * Returns: the current database directory path
 *
 * Since: 1.1.14
 **/
G_CONST_RETURN gchar* webkit_get_web_database_directory_path()
{
#if ENABLE(DATABASE)
    WTF::String path = WebCore::DatabaseTracker::tracker().databaseDirectoryPath();

    if (path.isEmpty())
        return "";

    g_free(webkit_database_directory_path);
    webkit_database_directory_path = g_strdup(path.utf8().data());
    return webkit_database_directory_path;
#else
    return "";
#endif
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例9: webkit_web_database_get_display_name

/**
 * webkit_web_database_get_display_name:
 * @webDatabase: a #WebKitWebDatabase
 *
 * Returns the name of the #WebKitWebDatabase as seen by the user.
 *
 * Returns: the name of the database as seen by the user.
 *
 * Since: 1.1.14
 **/
G_CONST_RETURN gchar* webkit_web_database_get_display_name(WebKitWebDatabase* webDatabase)
{
    g_return_val_if_fail(WEBKIT_IS_WEB_DATABASE(webDatabase), NULL);

#if ENABLE(DATABASE)
    WebKitWebDatabasePrivate* priv = webDatabase->priv;
    WebCore::DatabaseDetails details = WebCore::DatabaseTracker::tracker().detailsForNameAndOrigin(priv->name, core(priv->origin));
    WTF::String displayName =  details.displayName();

    if (displayName.isEmpty())
        return "";

    g_free(priv->displayName);
    priv->displayName = g_strdup(displayName.utf8().data());
    return priv->displayName;
#else
    return "";
#endif
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例10: onConsoleMessage

static void onConsoleMessage(Ewk_View_Smart_Data*, const char* message, unsigned int lineNumber, const char*)
{
    // Tests expect only the filename part of local URIs
    WTF::String newMessage = message;
    if (!newMessage.isEmpty()) {
        const size_t fileProtocol = newMessage.find("file://");
        if (fileProtocol != WTF::notFound)
            newMessage = newMessage.left(fileProtocol) + urlSuitableForTestResult(newMessage.substring(fileProtocol));
    }

    // Ignore simple translation-related messages and unnecessary messages
    if (newMessage.contains("Localized string") || newMessage.contains("Protocol Error: the message is for non-existing domain 'Profiler'"))
        return;

    printf("CONSOLE MESSAGE: ");
    if (lineNumber)
        printf("line %u: ", lineNumber);
    printf("%s\n", newMessage.utf8().data());
}
开发者ID:,项目名称:,代码行数:19,代码来源:

示例11: webkit_web_database_get_filename

/**
 * webkit_web_database_get_filename:
 * @webDatabase: a #WebKitWebDatabase
 *
 * Returns the absolute filename to the #WebKitWebDatabase file on disk.
 *
 * Returns: the absolute filename of the database
 *
 * Since: 1.1.14
 **/
G_CONST_RETURN gchar* webkit_web_database_get_filename(WebKitWebDatabase* webDatabase)
{
    g_return_val_if_fail(WEBKIT_IS_WEB_DATABASE(webDatabase), NULL);

#if ENABLE(DATABASE)
    WebKitWebDatabasePrivate* priv = webDatabase->priv;
    WTF::String coreName = WTF::String::fromUTF8(priv->name);
    WTF::String corePath = WebCore::DatabaseTracker::tracker().fullPathForDatabase(core(priv->origin), coreName);

    if (corePath.isEmpty())
        return"";

    g_free(priv->filename);
    priv->filename = g_strdup(corePath.utf8().data());
    return priv->filename;

#else
    return "";
#endif
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例12: resolveMimeType

const string WebResponse::resolveMimeType(const string& url, const string& old_mime)
{
    // Use "text/html" as a default (matching the behaviour of the Apache
    // HTTP stack -- see guessMimeType() in LoadListener.java).
    string mimeType = old_mime.length() ? old_mime : "text/html";
    // Try to guess a better MIME type from the URL. We call
    // getMIMETypeForExtension rather than getMIMETypeForPath because the
    // latter defaults to "application/octet-stream" on failure.
    WebCore::KURL kurl(WebCore::ParsedURLString, url.c_str());
    WTF::String path = kurl.path();
    size_t extensionPos = path.reverseFind('.');
    if (extensionPos != WTF::notFound) {
        // We found a file extension.
        path.remove(0, extensionPos + 1);
        // TODO: Should use content-disposition instead of url if it is there
        WTF::String mime = WebCore::MIMETypeRegistry::getMIMETypeForExtension(path);
        if (!mime.isEmpty()) {
            // Great, we found a MIME type.
            mimeType = std::string(mime.utf8().data(), mime.length());
        }
    }
    return mimeType;
}
开发者ID:,项目名称:,代码行数:23,代码来源:

示例13: findNextString

bool SelectionHandler::findNextString(const WTF::String& searchString)
{
    if (searchString.isEmpty()) {
        cancelSelection();
        return false;
    }

    ASSERT(m_webPage->m_page);

    m_webPage->m_page->unmarkAllTextMatches();

    bool result = m_webPage->m_page->findString(searchString, WTF::TextCaseInsensitive, WebCore::FindDirectionForward, true /*should wrap*/);
    if (result && m_webPage->focusedOrMainFrame()->selection()->selectionType() == VisibleSelection::NoSelection) {
        // Word was found but could not be selected on this page.
        result = m_webPage->m_page->markAllMatchesForText(searchString, WTF::TextCaseInsensitive, true /*should highlight*/, 0 /*limit to match 0 = unlimited*/);
    }

    // Defocus the input field if one is active.
    if (m_webPage->m_inputHandler->isInputMode())
        m_webPage->m_inputHandler->nodeFocused(0);

    return result;
}
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:23,代码来源:SelectionHandler.cpp

示例14: load

void MediaPlayerPrivate::load(const WTF::String& url)
{
    WTF::String modifiedUrl(url);

    if (modifiedUrl.startsWith("local://")) {
        KURL kurl = KURL(KURL(), modifiedUrl);
        kurl.setProtocol("file");
        WTF::String tempPath(BlackBerry::Platform::Settings::instance()->applicationLocalDirectory().c_str());
        tempPath.append(kurl.path());
        kurl.setPath(tempPath);
        modifiedUrl = kurl.string();
    }
    // filesystem: URLs refer to entities in the Web File System (WFS) and are
    // intended to be useable by HTML 5 media elements directly. Unfortunately
    // the loader for our media player is implemented in a separate process and
    // does not have access to WFS, so we translate to a file:// URL. Normally
    // this would be a security violation, but since the MediaElement has
    // already done a security check on the filesystem: URL as part of the
    // media resource selection algorithm, we should be OK here.
    if (modifiedUrl.startsWith("filesystem:")) {
        KURL kurl = KURL(KURL(), modifiedUrl);
        KURL mediaURL;
        WTF::String fsPath;
        FileSystemType fsType;
        WebFileSystem::Type type;

        // Extract the root and file paths from WFS
        DOMFileSystemBase::crackFileSystemURL(kurl, fsType, fsPath);
        if (fsType == FileSystemTypeTemporary)
            type = WebFileSystem::Temporary;
        else
            type = WebFileSystem::Persistent;
        WTF::String fsRoot = BlackBerry::Platform::WebFileSystem::rootPathForWebFileSystem(type);

        // Build a BlackBerry::Platform::SecurityOrigin from the document's 
        // WebCore::SecurityOrigin and serialize it to build the last
        // path component
        WebCore::SecurityOrigin* wkOrigin = m_webCorePlayer->mediaPlayerClient()->mediaPlayerOwningDocument()->securityOrigin();
        BlackBerry::Platform::SecurityOrigin bbOrigin(wkOrigin->protocol(), wkOrigin->host(), wkOrigin->port());
        WTF::String secOrigin(bbOrigin.serialize('_'));

        // Build a file:// URL from the path components and extract it to 
        // a string for further processing
        mediaURL.setProtocol("file");
        mediaURL.setPath(fsRoot + "/" + secOrigin + "/" + fsPath);
        modifiedUrl = mediaURL.string();
    } else if (modifiedUrl.startsWith("file://") || modifiedUrl.startsWith("data:")) {
        // The QNX Multimedia Framework cannot handle filenames or data containing URL escape sequences.
        modifiedUrl = decodeURLEscapeSequences(modifiedUrl);
    }

    void* tabId = m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient();
    int playerID = m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient()->playerID();
    bool isVideo = m_webCorePlayer->mediaPlayerClient()->mediaPlayerIsVideo();

    deleteGuardedObject(m_platformPlayer);
#if USE(ACCELERATED_COMPOSITING)
    m_platformPlayer = PlatformPlayer::create(this, tabId, isVideo, true, modifiedUrl);
#else
    m_platformPlayer = PlatformPlayer::create(this, tabId, isVideo, false, modifiedUrl);
#endif

    WTF::String cookiePairs;
    if (!url.isEmpty())
        cookiePairs = cookieManager().getCookie(KURL(ParsedURLString, url), WithHttpOnlyCookies);
    m_platformPlayer->load(playerID, modifiedUrl, m_webCorePlayer->userAgent(), cookiePairs);
}
开发者ID:Wellington475,项目名称:phantomjs,代码行数:67,代码来源:MediaPlayerPrivateBlackBerry.cpp

示例15: writeItem

static void writeItem(WTF::Vector<char>& vector, WebCore::HistoryItem* item)
{
    // Original url
    writeString(vector, item->originalURLString());

    // Url
    writeString(vector, item->urlString());

    // Title
    writeString(vector, item->title());

    // Form content type
    writeString(vector, item->formContentType());

    // Form data
    const WebCore::FormData* formData = item->formData();
    if (formData) {
        WTF::String flattenedFormData = formData->flattenToString();
        writeString(vector, flattenedFormData);
        if (!flattenedFormData.isEmpty()) {
            // save the identifier as it is not included in the flatten data
            int64_t id = formData->identifier();
            vector.append((char*)&id, sizeof(int64_t));
        }
    } else
        writeString(vector, WTF::String()); // Empty constructor does not allocate a buffer.

    // Target
    writeString(vector, item->target());

    AndroidWebHistoryBridge* bridge = item->bridge();
    ALOG_ASSERT(bridge, "We should have a bridge here!");
    // Screen scale
    const float scale = bridge->scale();
    ALOGV("Writing scale           %f", scale);
    vector.append((char*)&scale, sizeof(float));
    const float textWrapScale = bridge->textWrapScale();
    ALOGV("Writing text wrap scale %f", textWrapScale);
    vector.append((char*)&textWrapScale, sizeof(float));

    // Scroll position.
    const int scrollX = item->scrollPoint().x();
    vector.append((char*)&scrollX, sizeof(int));
    const int scrollY = item->scrollPoint().y();
    vector.append((char*)&scrollY, sizeof(int));

    // Document state
    const WTF::Vector<WTF::String>& docState = item->documentState();
    WTF::Vector<WTF::String>::const_iterator end = docState.end();
    unsigned stateSize = docState.size();
    ALOGV("Writing docState        %d", stateSize);
    vector.append((char*)&stateSize, sizeof(unsigned));
    for (WTF::Vector<WTF::String>::const_iterator i = docState.begin(); i != end; ++i) {
        writeString(vector, *i);
    }

    // Is target item
    ALOGV("Writing isTargetItem    %d", item->isTargetItem());
    vector.append((char)item->isTargetItem());

    // Children count
    unsigned childCount = item->children().size();
    ALOGV("Writing childCount      %d", childCount);
    vector.append((char*)&childCount, sizeof(unsigned));
}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:65,代码来源:WebHistory.cpp


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