本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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());
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}