void HWInformation::parseOperationPossibility (const xmlpp::Node *node)
{
	//Recurse through child nodes:
	xmlpp::Node::NodeList list = node->get_children ();

	for (xmlpp::Node::NodeList::iterator iter = list.begin (); iter != list.end (); ++iter)
	{
		const xmlpp::Node *tmp = *iter;

		assert (tmp != NULL);

		if (verifyCanGetName (tmp))
		{
			if (verifyNodeName (tmp, "load"))
				parseOperation (tmp, "load");
			else
				if (verifyNodeName (tmp, "store"))
					parseOperation (tmp, "store");
				else
					if (verifyNodeName (tmp, "add"))
						parseOperation (tmp, "add");
					else
						if (verifyNodeName (tmp, "mul"))
							parseOperation (tmp, "mul");
						else
							if (verifyNodeName (tmp, "random"))
								parseOperation (tmp, "random");
							else
							{
								Logging::log (1, "HWInformation: Warning: Unsupported name '", extractNodeName (tmp).c_str (), "' in description_mdl node at: ", getLine (tmp).c_str (), NULL);
							}
		}
	}
}
示例#2
0
文件: mdb.c 项目: doghell/appweb-4
static EdiGrid *mdbReadWhere(Edi *edi, cchar *tableName, cchar *columnName, cchar *operation, cchar *value)
{
    Mdb         *mdb;
    EdiGrid     *grid;
    MdbTable    *table;
    MdbCol      *col;
    MdbRow      *row;
    int         nrows, next, op, r, count;

    assert(edi);
    assert(tableName && *tableName);

    mdb = (Mdb*) edi;
    lock(mdb);
    if ((table = lookupTable(mdb, tableName)) == 0) {
        unlock(mdb);
        return 0;
    }
    nrows = mprGetListLength(table->rows);
    if ((grid = ediCreateBareGrid(edi, tableName, nrows)) == 0) {
        unlock(mdb);
        return 0;
    }
    grid->flags = EDI_GRID_READ_ONLY;
    if (columnName) {
        if ((col = lookupColumn(table, columnName)) == 0) {
            unlock(mdb);
            return 0;
        }
        if ((op = parseOperation(operation)) < 0) {
            unlock(mdb);
            return 0;
        }
        if (col->flags & EDI_INDEX && (op & OP_EQ)) {
            if ((r = lookupRow(table, value)) != 0) {
                row = getRow(table, r);
                grid->records[0] = createRecFromRow(edi, row);
                grid->nrecords = 1;
            }
        } else {
            grid->nrecords = count = 0;
            for (ITERATE_ITEMS(table->rows, row, next)) {
                if (!matchRow(col, row->fields[col->cid], op, value)) {
                    continue;
                }
                grid->records[count++] = createRecFromRow(edi, row);
                grid->nrecords = count;
            }
        }
    } else {
        for (ITERATE_ITEMS(table->rows, row, next)) {