本文整理汇总了C++中Counter::AddCounterValues方法的典型用法代码示例。如果您正苦于以下问题:C++ Counter::AddCounterValues方法的具体用法?C++ Counter::AddCounterValues怎么用?C++ Counter::AddCounterValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Counter
的用法示例。
在下文中一共展示了Counter::AddCounterValues方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddCounterValues
OP_STATUS Counters::AddCounterValues(OpString& counter_str, HTML_Element* element, short counter_type, const uni_char* counter_value)
{
if (counter_value)
{
const uni_char* name = counter_value;
unsigned int name_length = 0;
// The css parser should have stripped off the leading whitespaces.
OP_ASSERT(!css_is_space(*name));
const uni_char* style = name;
unsigned int style_length = 0;
/* 'delimiter' corresponds to the 'string' argument of the
counters function in the CSS 2.1. */
const uni_char* delimiter = NULL;
unsigned int delimiter_length = 0;
if (counter_type == CSS_FUNCTION_COUNTERS)
{
delimiter = name;
while (*delimiter && !css_is_space(*delimiter) && *delimiter != ',')
delimiter++;
BOOL comma_found = (*delimiter == ',');
name_length = delimiter++ - name;
while (css_is_space(*delimiter))
delimiter++;
if (!comma_found)
{
if (*delimiter && *delimiter != ',')
return OpStatus::OK;
while (css_is_space(*++delimiter))
;
}
uni_char quote_char = *delimiter++;
if (quote_char != '"' && quote_char != '\'')
return OpStatus::OK;
style = delimiter;
while (*style && (*style != quote_char || *(style-1) == '\\'))
style++;
if (*style != quote_char)
return OpStatus::OK;
delimiter_length = style++ - delimiter;
}
else
{
while (*style && !css_is_space(*style) && *style != ',')
style++;
name_length = style - name;
}
while (*style && (css_is_space(*style) || *style == ','))
style++;
const uni_char* end = style;
while (*end && !css_is_space(*end) && *end != ',')
end++;
OP_ASSERT(*end == 0);
style_length = end - style;
short style_type = CSS_VALUE_decimal;
if (*style)
{
short keyword = CSS_GetKeyword(style, style_length);
if (CSS_is_list_style_type_val(keyword) || keyword == CSS_VALUE_none)
style_type = keyword;
}
Counter* counter = GetCounter(name, name_length);
if (counter)
return counter->AddCounterValues(counter_str, element, delimiter, delimiter_length, style_type, add_only);
else
{
uni_char number_buf[TMPSTRING_SIZE]; /* ARRAY OK 2009-05-11 davve */
MakeListNumberStr(0, style_type, NULL, number_buf, TMPSTRING_SIZE-1); //FIXME rtl??
return counter_str.Append(number_buf);
}
}
return OpStatus::OK;
}