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


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

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


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

示例1: customCSSText

String CSSShadowValue::customCSSText() const
{
    StringBuilder text;

    if (color)
        text.append(color->cssText());
    if (x) {
        if (!text.isEmpty())
            text.append(' ');
        text.append(x->cssText());
    }
    if (y) {
        if (!text.isEmpty())
            text.append(' ');
        text.append(y->cssText());
    }
    if (blur) {
        if (!text.isEmpty())
            text.append(' ');
        text.append(blur->cssText());
    }
    if (spread) {
        if (!text.isEmpty())
            text.append(' ');
        text.append(spread->cssText());
    }
    if (style) {
        if (!text.isEmpty())
            text.append(' ');
        text.append(style->cssText());
    }

    return text.toString();
}
开发者ID:dstockwell,项目名称:blink,代码行数:34,代码来源:CSSShadowValue.cpp

示例2: borderPropertyValue

String StylePropertySet::borderPropertyValue(CommonValueMode valueMode) const
{
    const StylePropertyShorthand properties[3] = { borderWidthShorthand(), borderStyleShorthand(), borderColorShorthand() };
    String commonValue;
    StringBuilder result;
    for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) {
        String value = getCommonValue(properties[i]);
        if (value.isNull()) {
            if (valueMode == ReturnNullOnUncommonValues)
                return String();
            ASSERT(valueMode == OmitUncommonValues);
            continue;
        }
        if (!i)
            commonValue = value;
        else if (!commonValue.isNull() && commonValue != value)
            commonValue = String();
        if (value == "initial")
            continue;
        if (!result.isEmpty())
            result.append(' ');
        result.append(value);
    }
    if (isInitialOrInherit(commonValue))
        return commonValue;
    return result.isEmpty() ? String() : result.toString();
}
开发者ID:stskeeps,项目名称:qtwebkit5,代码行数:27,代码来源:StylePropertySet.cpp

示例3: customCssText

String CSSLineBoxContainValue::customCssText() const
{
    StringBuilder text;

    if (m_value & LineBoxContainBlock)
        text.appendLiteral("block");
    if (m_value & LineBoxContainInline) {
        if (!text.isEmpty())
            text.append(' ');
        text.appendLiteral("inline");
    }
    if (m_value & LineBoxContainFont) {
        if (!text.isEmpty())
            text.append(' ');
        text.appendLiteral("font");
    }
    if (m_value & LineBoxContainGlyphs) {
        if (!text.isEmpty())
            text.append(' ');
        text.appendLiteral("glyphs");
    }
    if (m_value & LineBoxContainReplaced) {
        if (!text.isEmpty())
            text.append(' ');
        text.appendLiteral("replaced");
    }
    if (m_value & LineBoxContainInlineBox) {
        if (!text.isEmpty())
            text.append(' ');
        text.appendLiteral("inline-box");
    }

    return text.toString();
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:34,代码来源:CSSLineBoxContainValue.cpp

示例4: fontValue

String StylePropertySet::fontValue() const
{
    int fontSizePropertyIndex = findPropertyIndex(CSSPropertyFontSize);
    int fontFamilyPropertyIndex = findPropertyIndex(CSSPropertyFontFamily);
    if (fontSizePropertyIndex == -1 || fontFamilyPropertyIndex == -1)
        return emptyString();

    PropertyReference fontSizeProperty = propertyAt(fontSizePropertyIndex);
    PropertyReference fontFamilyProperty = propertyAt(fontFamilyPropertyIndex);
    if (fontSizeProperty.isImplicit() || fontFamilyProperty.isImplicit())
        return emptyString();

    String commonValue = fontSizeProperty.value()->cssText();
    StringBuilder result;
    appendFontLonghandValueIfExplicit(CSSPropertyFontStyle, result, commonValue);
    appendFontLonghandValueIfExplicit(CSSPropertyFontVariant, result, commonValue);
    appendFontLonghandValueIfExplicit(CSSPropertyFontWeight, result, commonValue);
    if (!result.isEmpty())
        result.append(' ');
    result.append(fontSizeProperty.value()->cssText());
    appendFontLonghandValueIfExplicit(CSSPropertyLineHeight, result, commonValue);
    if (!result.isEmpty())
        result.append(' ');
    result.append(fontFamilyProperty.value()->cssText());
    if (isInitialOrInherit(commonValue))
        return commonValue;
    return result.toString();
}
开发者ID:stskeeps,项目名称:qtwebkit5,代码行数:28,代码来源:StylePropertySet.cpp

示例5: getShorthandValue

String StylePropertySet::getShorthandValue(const StylePropertyShorthand& shorthand) const
{
    String commonValue;
    StringBuilder result;
    for (unsigned i = 0; i < shorthand.length(); ++i) {
        if (!isPropertyImplicit(shorthand.properties()[i])) {
            RefPtr<CSSValue> value = getPropertyCSSValue(shorthand.properties()[i]);
            if (!value)
                return String();
            String valueText = value->cssText();
            if (!i)
                commonValue = valueText;
            else if (!commonValue.isNull() && commonValue != valueText)
                commonValue = String();
            if (value->isInitialValue())
                continue;
            if (!result.isEmpty())
                result.append(' ');
            result.append(valueText);
        } else
            commonValue = String();
    }
    if (isInitialOrInherit(commonValue))
        return commonValue;
    if (result.isEmpty())
        return String();
    return result.toString();
}
开发者ID:stskeeps,项目名称:qtwebkit5,代码行数:28,代码来源:StylePropertySet.cpp

示例6: reasonNotDeletable

String Resource::reasonNotDeletable() const
{
    StringBuilder builder;
    if (hasClients()) {
        builder.append("hasClients(");
        builder.appendNumber(m_clients.size());
        if (!m_clientsAwaitingCallback.isEmpty()) {
            builder.append(", AwaitingCallback=");
            builder.appendNumber(m_clientsAwaitingCallback.size());
        }
        if (!m_finishedClients.isEmpty()) {
            builder.append(", Finished=");
            builder.appendNumber(m_finishedClients.size());
        }
        builder.append(")");
    }
    if (m_loader) {
        if (!builder.isEmpty())
            builder.append(' ');
        builder.append("m_loader");
    }
    if (m_preloadCount) {
        if (!builder.isEmpty())
            builder.append(' ');
        builder.append("m_preloadCount(");
        builder.appendNumber(m_preloadCount);
        builder.append(")");
    }
    if (!hasRightHandleCountApartFromCache(0)) {
        if (!builder.isEmpty())
            builder.append(' ');
        builder.append("m_handleCount(");
        builder.appendNumber(m_handleCount);
        builder.append(")");
    }
    if (m_protectorCount) {
        if (!builder.isEmpty())
            builder.append(' ');
        builder.append("m_protectorCount(");
        builder.appendNumber(m_protectorCount);
        builder.append(")");
    }
    if (memoryCache()->contains(this)) {
        if (!builder.isEmpty())
            builder.append(' ');
        builder.append("in_memory_cache");
    }
    return builder.toString();
}
开发者ID:golden628,项目名称:ChromiumGStreamerBackend,代码行数:49,代码来源:Resource.cpp

示例7: contentsAsString

String WebFrame::contentsAsString() const 
{
    if (!m_coreFrame)
        return String();

    if (isFrameSet()) {
        StringBuilder builder;
        for (Frame* child = m_coreFrame->tree()->firstChild(); child; child = child->tree()->nextSibling()) {
            if (!builder.isEmpty())
                builder.append(' ');
            builder.append(static_cast<WebFrameLoaderClient*>(child->loader()->client())->webFrame()->contentsAsString());
        }
        // FIXME: It may make sense to use toStringPreserveCapacity() here.
        return builder.toString();
    }

    Document* document = m_coreFrame->document();
    if (!document)
        return String();

    RefPtr<Element> documentElement = document->documentElement();
    if (!documentElement)
        return String();

    RefPtr<Range> range = document->createRange();

    ExceptionCode ec = 0;
    range->selectNode(documentElement.get(), ec);
    if (ec)
        return String();

    return plainText(range.get());
}
开发者ID:dankurka,项目名称:webkit_titanium,代码行数:33,代码来源:WebFrame.cpp

示例8: customCSSText

String CSSValueList::customCSSText() const
{
    StringBuilder result;
    String separator;
    switch (m_valueListSeparator) {
    case SpaceSeparator:
        separator = ASCIILiteral(" ");
        break;
    case CommaSeparator:
        separator = ASCIILiteral(", ");
        break;
    case SlashSeparator:
        separator = ASCIILiteral(" / ");
        break;
    default:
        ASSERT_NOT_REACHED();
    }

    for (auto& value : m_values) {
        bool suppressSeparator = false;
        if (m_valueListSeparator == SpaceSeparator && value->isPrimitiveValue()) {
            auto* primitiveValue = &downcast<CSSPrimitiveValue>(*value.ptr());
            if (primitiveValue->parserOperator() == ',')
                suppressSeparator = true;
        }
        if (!suppressSeparator && !result.isEmpty())
            result.append(separator);
        result.append(value.get().cssText());
    }

    return result.toString();
}
开发者ID:edcwconan,项目名称:webkit,代码行数:32,代码来源:CSSValueList.cpp

示例9: customCssText

String CSSValueList::customCssText(CssTextFormattingFlags formattingFlag) const
{
    StringBuilder result;
    String separator;
    switch (m_valueListSeparator) {
    case SpaceSeparator:
        separator = " ";
        break;
    case CommaSeparator:
        separator = ", ";
        break;
    case SlashSeparator:
        separator = " / ";
        break;
    default:
        ASSERT_NOT_REACHED();
    }

    unsigned size = m_values.size();
    for (unsigned i = 0; i < size; i++) {
        if (!result.isEmpty())
            result.append(separator);
        if (formattingFlag == AlwaysQuoteCSSString && m_values[i]->isPrimitiveValue())
            result.append(toCSSPrimitiveValue(m_values[i].get())->customCssText(AlwaysQuoteCSSString));
        else
            result.append(m_values[i]->cssText());
    }

    return result.toString();
}
开发者ID:halton,项目名称:blink-crosswalk,代码行数:30,代码来源:CSSValueList.cpp

示例10: customCSSText

String CSSValueList::customCSSText() const
{
    StringBuilder result;
    String separator;
    switch (m_valueListSeparator) {
    case SpaceSeparator:
        separator = ASCIILiteral(" ");
        break;
    case CommaSeparator:
        separator = ASCIILiteral(", ");
        break;
    case SlashSeparator:
        separator = ASCIILiteral(" / ");
        break;
    default:
        ASSERT_NOT_REACHED();
    }

    for (auto& value : m_values) {
        if (!result.isEmpty())
            result.append(separator);
        result.append(value.get().cssText());
    }

    return result.toString();
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:26,代码来源:CSSValueList.cpp

示例11: customCSSText

String CSSFontValue::customCSSText() const
{
    // font variant weight size / line-height family

    StringBuilder result;

    if (style)
        result.append(style->cssText());
    if (variant) {
        if (!result.isEmpty())
            result.append(' ');
        result.append(variant->cssText());
    }
    if (weight) {
        if (!result.isEmpty())
            result.append(' ');
        result.append(weight->cssText());
    }
    if (stretch) {
        if (!result.isEmpty())
            result.append(' ');
        result.append(stretch->cssText());
    }
    if (size) {
        if (!result.isEmpty())
            result.append(' ');
        result.append(size->cssText());
    }
    if (lineHeight) {
        if (!size)
            result.append(' ');
        result.append('/');
        result.append(lineHeight->cssText());
    }
    if (family) {
        if (!result.isEmpty())
            result.append(' ');
        result.append(family->cssText());
    }

    return result.toString();
}
开发者ID:Jamesducque,项目名称:mojo,代码行数:42,代码来源:CSSFontValue.cpp

示例12: paramString

UString FunctionExecutable::paramString() const
{
    FunctionParameters& parameters = *m_parameters;
    StringBuilder builder;
    for (size_t pos = 0; pos < parameters.size(); ++pos) {
        if (!builder.isEmpty())
            builder.append(", ");
        builder.append(parameters[pos].ustring());
    }
    return builder.build();
}
开发者ID:PioneerLab,项目名称:OpenAphid-AJ,代码行数:11,代码来源:Executable.cpp

示例13: resourceName

static String resourceName(const KURL& url)
{
    StringBuilder name;
    name.append(url.path());
    if (name.isEmpty())
        name.append('/');
    if (!url.query().isNull()) {
        name.append('?');
        name.append(url.query());
    }
    String result = name.toString();
    ASSERT(!result.isEmpty());
    ASSERT(!result.contains(' '));
    return result;
}
开发者ID:jiezh,项目名称:h5vcc,代码行数:15,代码来源:WebSocketHandshake.cpp

示例14: ASSERT

const AtomicString& DOMTokenList::value() const
{
    if (m_cachedValue.isNull()) {
        // https://dom.spec.whatwg.org/#concept-ordered-set-serializer
        StringBuilder builder;
        for (auto& token : m_tokens) {
            if (!builder.isEmpty())
                builder.append(' ');
            builder.append(token);
        }
        m_cachedValue = builder.toAtomicString();
        ASSERT(!m_cachedValue.isNull());
    }
    return m_cachedValue;
}
开发者ID:allsmy,项目名称:webkit,代码行数:15,代码来源:DOMTokenList.cpp

示例15: toString

String WebMediaSessionManager::toString(ConfigurationTasks tasks)
{
    StringBuilder string;
    if (tasks & InitialConfigurationTask)
        string.append("InitialConfigurationTask + ");
    if (tasks & TargetClientsConfigurationTask)
        string.append("TargetClientsConfigurationTask + ");
    if (tasks & TargetMonitoringConfigurationTask)
        string.append("TargetMonitoringConfigurationTask + ");
    if (string.isEmpty())
        string.append("NoTask");
    else
        string.resize(string.length() - 2);
    
    return string.toString();
}
开发者ID:shushanbj,项目名称:webkit,代码行数:16,代码来源:WebMediaSessionManager.cpp


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