本文整理汇总了C++中stringlist::iterator::size方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::size方法的具体用法?C++ iterator::size怎么用?C++ iterator::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stringlist::iterator
的用法示例。
在下文中一共展示了iterator::size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serializeStrList
ustring DataValue::serializeStrList(void *value) {
ustring result("#");
StringList list;
list = *(ustring*)value;
for(StringList::iterator line = list.begin(); line != list.end(); line++)
result += int_to_str(line->size()) + ":" + *line + "|";
return result;
}
示例2: parse_error
Command::Command(const char* first, const char* last) throw(parse_error)
: from(INVALID_SID), to(INVALID_SID), dirty(false), full(first, last)
{
initNumPosParams();
// optimize later
// this is lazy due to a DC++ bug that sends empty parameters...
// ideally, we should not be using it
StringList sl = Util::lazyStringTokenize(full);
full += '\n';
if(full.size() < 5 || sl[0].size() != 4)
throw parse_error("invalid message type");
action = sl[0][0];
cmd = (CmdInt)(stringToFourCC(sl[0]) & 0xFFFFFF00);
StringList::size_type loc; // message parameters start at this index
switch(action) {
case 'F':
from = ADC::toSid(sl[1]);
features = sl[2];
checkFeatures();
loc = 3;
break;
case 'D':
case 'E':
from = ADC::toSid(sl[1]);
to = ADC::toSid(sl[2]);
loc = 3;
break;
case 'B':
case 'S':
from = ADC::toSid(sl[1]);
loc = 2;
break;
case 'I':
case 'H':
case 'L':
loc = 1;
break;
default:
throw parse_error(string("invalid action type '") + action + '\'');
}
if (loc >= sl.size())
throw parse_error("not enough tokens for message type");
if (numPosParams.count(cmd)) {
// known command -- check that positional and named params are correct
if (loc + numPosParams[cmd] > sl.size())
throw parse_error("missing parameters");
for (StringList::iterator i = sl.begin() + loc + numPosParams[cmd]; i != sl.end(); ++i) {
// param name parts can't be escaped chars
if (i->size() < 2 || ADC::CSE(i->substr(0, 2)).size() != 2)
throw parse_error("invalid named parameter: " + *i);
}
}
params.resize(sl.size() - loc);
transform(sl.begin() + loc, sl.end(), params.begin(), &ADC::CSE);
}