本文整理汇总了C++中Row::fieldCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Row::fieldCount方法的具体用法?C++ Row::fieldCount怎么用?C++ Row::fieldCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Row
的用法示例。
在下文中一共展示了Row::fieldCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testRow
void DataTest::testRow()
{
Row row;
row.append("field0", 0);
row.append("field1", 1);
row.append("field2", 2);
row.append("field3", 3);
row.append("field4", 4);
assert (row["field0"] == 0);
assert (row["field1"] == 1);
assert (row["field2"] == 2);
assert (row["field3"] == 3);
assert (row["field4"] == 4);
assert (row[0] == 0);
assert (row[1] == 1);
assert (row[2] == 2);
assert (row[3] == 3);
assert (row[4] == 4);
try
{
int i; i = row[5]; // to silence gcc
fail ("must fail");
}catch (RangeException&) {}
try
{
int i; i = row["a bad name"]; // to silence gcc
fail ("must fail");
}catch (NotFoundException&) {}
assert (5 == row.fieldCount());
assert (row[0] == 0);
assert (row["field0"] == 0);
assert (row[1] == 1);
assert (row["field1"] == 1);
assert (row[2] == 2);
assert (row["field2"] == 2);
assert (row[3] == 3);
assert (row["field3"] == 3);
assert (row[4] == 4);
assert (row["field4"] == 4);
Row row2;
row2.append("field0", 5);
row2.append("field1", 4);
row2.append("field2", 3);
row2.append("field3", 2);
row2.append("field4", 1);
assert (row != row2);
Row row3;
row3.append("field0", 0);
row3.append("field1", 1);
row3.append("field2", 2);
row3.append("field3", 3);
row3.append("field4", 4);
assert (row3 == row);
assert (!(row < row3 | row3 < row));
Row row4(row3.names());
try
{
row4.set("badfieldname", 0);
fail ("must fail");
}catch (NotFoundException&) {}
row4.set("field0", 0);
row4.set("field1", 1);
row4.set("field2", 2);
row4.set("field3", 3);
row4.set("field4", 4);
assert (row3 == row4);
try
{
row4.set(5, 0);
fail ("must fail");
}catch (RangeException&) {}
row4.set("field0", 1);
assert (row3 != row4);
assert (row3 < row4);
}