当前位置: 首页>>代码示例>>C++>>正文


C++ Row类代码示例

本文整理汇总了C++中Row的典型用法代码示例。如果您正苦于以下问题:C++ Row类的具体用法?C++ Row怎么用?C++ Row使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Row类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

/**
Parses the specified row to a valid CSV line.
@return CSV string containing row data
*/
std::string csv::Row::to_csv_string(Row& _row)
{
	string csv_string;
	for (unsigned i = 0; i < _row.length(); i++)
	{
		csv_string += _row.get_cell(i) + ";";
	}
	return csv_string;
}
开发者ID:lnsp,项目名称:csvpp,代码行数:13,代码来源:Row.cpp

示例2: Status

Status YARAEventSubscriber::Callback(const FileEventContextRef& ec,
                                     const void* user_data) {
  if (user_data == nullptr) {
    return Status(1, "No YARA category string provided");
  }

  if (ec->action != "UPDATED" && ec->action != "CREATED") {
    return Status(1, "Invalid action");
  }

  Row r;
  r["action"] = ec->action;
  r["target_path"] = ec->path;
  r["category"] = *(std::string*)user_data;

  // Only FSEvents transactions updates (inotify is a no-op).
  r["transaction_id"] = INTEGER(ec->transaction_id);

  // These are default values, to be updated in YARACallback.
  r["count"] = INTEGER(0);
  r["matches"] = std::string("");
  r["strings"] = std::string("");
  r["tags"] = std::string("");

  ConfigDataInstance config;
  const auto& parser = config.getParser("yara");
  if (parser == nullptr)
    return Status(1, "ConfigParser unknown.");
  const auto& yaraParser = std::static_pointer_cast<YARAConfigParserPlugin>(parser);
  auto rules = yaraParser->rules();

  // Use the category as a lookup into the yara file_paths. The value will be
  // a list of signature groups to scan with.
  auto category = r.at("category");
  const auto& yara_config = config.getParsedData("yara");
  const auto& yara_paths = yara_config.get_child("file_paths");
  const auto& sig_groups = yara_paths.find(category);
  for (const auto& rule : sig_groups->second) {
    const std::string group = rule.second.data();
    int result = yr_rules_scan_file(rules[group],
                                    ec->path.c_str(),
                                    SCAN_FLAGS_FAST_MODE,
                                    YARACallback,
                                    (void*)&r,
                                    0);

    if (result != ERROR_SUCCESS) {
      return Status(1, "YARA error: " + std::to_string(result));
    }
  }

  if (ec->action != "" && r.at("matches").size() > 0) {
    add(r, ec->time);
  }

  return Status(0, "OK");
}
开发者ID:eastebry,项目名称:osquery,代码行数:57,代码来源:yara_events.cpp

示例3: equal

bool Compatible::equal(const Row& r1, const Row& r2) {
	if (disjoint != "")
		return false;

	for (Fields cols = allcols; !nil(cols); ++cols)
		if (r1.getraw(hdr1, *cols) != r2.getraw(hdr2, *cols))
			return false;
	return true;
}
开发者ID:apmckinlay,项目名称:csuneido,代码行数:9,代码来源:qcompatible.cpp

示例4: Q_Q

void TablePrivate::deleteRow(int id)
{
    Q_Q(Table);
    int index = rows.indexOf(rowsById.value(id));
    q->removeRow(index);
    Row *row = rows.takeAt(index);
    rowsById.remove(id);
    row->deleteLater();
}
开发者ID:lbproductions,项目名称:ExampleProject,代码行数:9,代码来源:table.cpp

示例5: initializeTable

int DeleteDMLPackage::buildFromBuffer(std::string& buffer, int columns, int rows)
{
#ifdef DML_PACKAGE_DEBUG
    //cout << "The data buffer received: " << buffer << endl;
#endif

    int retval = 1;

    initializeTable();

    std::vector<std::string> dataList;
    typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
    boost::char_separator<char> sep(":");
    tokenizer tokens(buffer, sep);
    for (tokenizer::iterator tok_iter = tokens.begin(); tok_iter != tokens.end(); ++tok_iter)
    {
        dataList.push_back(StripLeadingWhitespace(*tok_iter));

    }

    int n = 0;
    for (int i=0; i < rows; i++)
    {
        //get a new row
        Row aRow;
        //Row *aRowPtr = new Row();
        //std::string colName;
        //std::string colValue;
        //get row ID from the buffer
        std::string rowid  = dataList[n++];
        aRow.set_RowID(atoll(rowid.c_str()));
        //aRowPtr->set_RowID(atol(rowid.c_str()));
#ifdef DML_PACKAGE_DEBUG

        //cout << "The row ID is " << rowid << endl;
#endif
        /*
                for (int j = 0; j < columns; j++)
                {
                    //Build a column list
                    colName = dataList[n++];
                    colValue = dataList[n++];
        #ifdef DML_PACKAGE_DEBUG
                    cout << "The column data: " << colName << " " << colValue << endl;
        #endif
                    DMLColumn* aColumn = new DMLColumn(colName, colValue);
                    (aRowPtr->get_ColumnList()).push_back(aColumn);
        }
        //build a row list for a table
        fTable->get_RowList().push_back(aRowPtr);
        */
    }

    return retval;

}
开发者ID:DYFeng,项目名称:infinidb,代码行数:56,代码来源:deletedmlpackage.cpp

示例6: Get

Row DSSelect  :: Get() {
	Row r = SourceAt(0)->Get();
	for ( unsigned int i = 1; i < SourceCount(); i++ ) {
		DSCase * cs = dynamic_cast <DSCase *>( SourceAt(i) );
		if ( cs->Match( r ) ) {
			return Order( r.AppendRow( cs->Get() ) );
		}
	}
	throw Exception( "No default case" );
}
开发者ID:akki9c,项目名称:csvtest,代码行数:10,代码来源:dmk_select.cpp

示例7: variance

// / Calculates the variance for a row in a matrix.
double variance(Row < double >&row)
{
    double sum = 0.;

    double average = mean(row);

    for (int r = 0; r < row.size(); r++)
        sum += (row[r] - average) * (row[r] - average);
    return sum / double (row.size() - 1);
}
开发者ID:bkloppenborg,项目名称:oifits-sim,代码行数:11,代码来源:Matrix.cpp

示例8: while

void SMTPData::AddressFinder::execute()
{
    Row * r = q->nextRow();
    while ( r ) {
        a->append( new Address( "",
                                r->getEString( "localpart" ),
                                r->getEString( "domain" ) ) );
        r = q->nextRow();
    }
}
开发者ID:netconstructor,项目名称:aox,代码行数:10,代码来源:smtp.cpp

示例9: getNewID

int BookingDatabase::Passengers::add(std::string pName)
{
    Passenger passenger;
    passenger.mName = pName;
    passenger.mPID = getNewID();
    Row<Passenger>* row = new Row<Passenger>(this, passenger);
    addRow(row);
    //if (mDataConsoleOutput) std::cout << "Passenger " << row->getData().mPID << " " << pName << std::endl;
    return row->getData().mPID;
}
开发者ID:Fibonacho,项目名称:Concurrency-Control-Manager,代码行数:10,代码来源:Passengers.cpp

示例10: xmlize_row

YBORM_DECL ElementTree::ElementPtr
xmlize_row(const Row &row, const String &entry_name)
{
    ElementTree::ElementPtr entry = ElementTree::new_element(entry_name);
    Row::const_iterator it = row.begin(), end = row.end();
    for (; it != end; ++it)
        entry->sub_element(mk_xml_name(it->first, _T("")),
                it->second.nvl(Value(String(_T("")))).as_string());
    return entry;
}
开发者ID:Skydreamer,项目名称:yb-orm,代码行数:10,代码来源:xmlizer.cpp

示例11: LOG_DEBUG

/**
 * Execute a SQL query.
 */
const RecordSet &MySqlDataProvider::execSql(const std::string& sql,
                                            const bool refresh)
{
    if (!mIsConnected)
        throw std::runtime_error("not connected to database");

    LOG_DEBUG("MySqlDataProvider::execSql Performing SQL query: " << sql);

    // do something only if the query is different from the previous
    // or if the cache must be refreshed
    // otherwise just return the recordset from cache.
    if (refresh || (sql != mSql))
    {
        mRecordSet.clear();

        // actually execute the query.
        if (mysql_query(mDb, sql.c_str()) != 0)
            throw DbSqlQueryExecFailure(mysql_error(mDb));

        if (mysql_field_count(mDb) > 0)
        {
            MYSQL_RES* res;

            // get the result of the query.
            if (!(res = mysql_store_result(mDb)))
                throw DbSqlQueryExecFailure(mysql_error(mDb));

            // set the field names.
            unsigned nFields = mysql_num_fields(res);
            MYSQL_FIELD* fields = mysql_fetch_fields(res);
            Row fieldNames;
            for (unsigned i = 0; i < nFields; ++i)
                fieldNames.push_back(fields[i].name);

            mRecordSet.setColumnHeaders(fieldNames);

            // populate the RecordSet.
            MYSQL_ROW row;
            while ((row = mysql_fetch_row(res)))
            {
                Row r;

                for (unsigned i = 0; i < nFields; ++i)
                    r.push_back(static_cast<char *>(row[i]));

                mRecordSet.add(r);
            }

            // free memory
            mysql_free_result(res);
        }
    }

    return mRecordSet;
}
开发者ID:BornHunter,项目名称:CGSF,代码行数:58,代码来源:mysqldataprovider.cpp

示例12: checkCols

	bool checkCols(const Sudoku &s)
	{
		for(unsigned int c = 0; c < 9; ++c) {
			Row l;
			for(const auto &row : s)
				l.push_back(row[c]);
			if (!checkList(l, "in col"))
				return false;
		}
		return true;
	}
开发者ID:Aethrias,项目名称:udvl,代码行数:11,代码来源:cv04test.cpp

示例13: checkRow

bool PuzzleMaker::checkRow(int num, int row, int xpos)
{
	Row* toCheck = a->getRow(row);
	for(int i = 0; i < 9; i++)
	{
		int check = toCheck->getTile(i)->getNum();
		if( num == check && i != xpos)
			return false;
	}
	return true;
}
开发者ID:RanjithSelvan,项目名称:Sudoku,代码行数:11,代码来源:PuzzleMaker.cpp

示例14: readMemberID

size_t IRCBot::readMemberID( string memberName) {
	size_t memberID = 0;
	
	Row Smoking = _db->memberRead(memberName);
	if(Smoking.empty())
		return 0;

	memberID = ((size_t) Smoking["memberID"]);

	return memberID;
}
开发者ID:segrax,项目名称:KiLLARMY,代码行数:11,代码来源:IRCBot.cpp

示例15: while

void MailboxReader::execute() {
    while ( q->hasResults() ) {
        Row * r = q->nextRow();

        UString n = r->getUString( "name" );
        uint id = r->getInt( "id" );
        Mailbox * m = ::mailboxes->find( id );
        if ( !m || m->name() != n ) {
            m = Mailbox::obtain( n );
            if ( n != m->d->name )
                m->d->name = n;
            m->setId( id );
            ::mailboxes->insert( id, m );
        }

        if ( r->getBoolean( "deleted" ) )
            m->setType( Mailbox::Deleted );
        else
            m->setType( Mailbox::Ordinary );

        uint uidvalidity = r->getInt( "uidvalidity" );
        if ( m->d->uidvalidity != uidvalidity ) {
            m->d->uidvalidity = uidvalidity;
            m->abortSessions();
        }
        if ( !r->isNull( "owner" ) )
            m->setOwner( r->getInt( "owner" ) );

        m->setUidnextAndNextModSeq( r->getInt( "uidnext" ),
                                    r->getBigint( "nextmodseq" ),
                                    q->transaction() );

        m->setFlag( r->getEString( "flag" ) );
    }

    if ( !q->done() || done )
        return;

    done = true;
    if ( q->transaction() )
        q->transaction()->commit();
    ::readers->remove( this );
    ::wiped = false;
    if ( q->failed() && !EventLoop::global()->inShutdown() ) {
        List<Mailbox> * c = Mailbox::root()->children();
        if ( c && !c->isEmpty() )
            log( "Couldn't update mailbox tree: " + q->error() );
        else
            log( "Couldn't create mailbox tree: " + q->error(),
                 Log::Disaster );
    }
    if ( owner )
        owner->execute();
};
开发者ID:aox,项目名称:aox,代码行数:54,代码来源:mailbox.cpp


注:本文中的Row类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。