本文整理汇总了C++中PropList::append方法的典型用法代码示例。如果您正苦于以下问题:C++ PropList::append方法的具体用法?C++ PropList::append怎么用?C++ PropList::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropList
的用法示例。
在下文中一共展示了PropList::append方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fromString
bool fromString(const QByteArray &str)
{
PropList list;
int at = 0;
while(1) {
int n = str.indexOf('=', at);
if(n == -1)
break;
QByteArray var, val;
var = str.mid(at, n-at);
at = n + 1;
if(str[at] == '\"') {
++at;
n = str.indexOf('\"', at);
if(n == -1)
break;
val = str.mid(at, n-at);
at = n + 1;
}
else {
n = str.indexOf(',', at);
if(n != -1) {
val = str.mid(at, n-at);
at = n;
}
else {
val = str.mid(at);
at = str.length()-1;
}
}
Prop prop;
prop.var = var;
prop.val = val;
list.append(prop);
if(str[at] != ',')
break;
++at;
}
// integrity check
if(list.varCount("nonce") != 1)
return false;
if(list.varCount("algorithm") != 1)
return false;
*this = list;
return true;
}
示例2: fromString
bool fromString(const QByteArray &str)
{
PropList list;
int at = 0;
while(1) {
while (at < str.length() && (str[at] == ',' || str[at] == ' ' || str[at] == '\t'))
++at;
int n = str.indexOf('=', at);
if(n == -1)
break;
QByteArray var, val;
var = str.mid(at, n-at);
at = n + 1;
if(str[at] == '\"') {
++at;
n = str.indexOf('\"', at);
if(n == -1)
break;
val = str.mid(at, n-at);
at = n + 1;
}
else {
n = at;
while (n < str.length() && str[n] != ',' && str[n] != ' ' && str[n] != '\t')
++n;
val = str.mid(at, n-at);
at = n;
}
Prop prop;
prop.var = var;
if (var == "qop" || var == "cipher") {
int a = 0;
while (a < val.length()) {
while (a < val.length() && (val[a] == ',' || val[a] == ' ' || val[a] == '\t'))
++a;
if (a == val.length())
break;
n = a+1;
while (n < val.length() && val[n] != ',' && val[n] != ' ' && val[n] != '\t')
++n;
prop.val = val.mid(a, n-a);
list.append(prop);
a = n+1;
}
}
else {
prop.val = val;
list.append(prop);
}
if(at >= str.size() - 1 || (str[at] != ',' && str[at] != ' ' && str[at] != '\t'))
break;
}
// integrity check
if(list.varCount("nonce") != 1)
return false;
if(list.varCount("algorithm") != 1)
return false;
*this = list;
return true;
}