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


C++ CSVRow::size方法代码示例

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


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

示例1: ColRow

PivotCommand::ColRow PivotCommand:: MakeColRow( const CSVRow & row ) const {

    if ( mCol >= row.size() || mRow >= row.size() ) {
        CSVTHROW( "Invalid row/column index" );
    }

    return PivotCommand::ColRow( row[mCol], row[mRow] );
}
开发者ID:bminossi,项目名称:csvfix,代码行数:8,代码来源:csved_pivot.cpp

示例2: AddVars

void AddVars( ALib::Expression & e, const IOManager & io, const CSVRow & row ) {
	e.ClearPosParams();
	e.AddVar( LINE_VAR, ALib::Str( io.CurrentLine() ));
	e.AddVar( FILE_VAR, ALib::Str( io.CurrentFileName()));
	e.AddVar( FIELD_VAR, ALib::Str( row.size()));
	for ( unsigned int j = 0; j < row.size(); j++ ) {
		e.AddPosParam( row.at( j ) );
	}
}
开发者ID:bminossi,项目名称:csvfix,代码行数:9,代码来源:csved_evalvars.cpp

示例3: compare_rows

bool Test::compare_rows(CSVRow r1, CSVRow r2) {
    if (r1.size() != r2.size() ) {
        return false;
    }

    for (int i = 0; i < r1.size(); i++ ) {
        if (r1[i] != r2[i]) {
            return false;
        }
    }

    return true;
}
开发者ID:pinetrees,项目名称:csv-reader,代码行数:13,代码来源:test.cpp

示例4: Cmp

int SummaryCommand :: Cmp( const CSVRow & r1, const CSVRow & r2 ) const {
	for ( unsigned int i = 0; i < mFields.size(); i++ ) {
		unsigned int fi = mFields[i];
		if ( fi >= r1.size() || fi >= r2.size() ) {
			CSVTHROW( "Bad field index" );
		}
		int cmp = NSCmp( r1[fi], r2[fi] );

		if ( cmp != 0 ) {
			return cmp;
		}
	}
	return 0;
}
开发者ID:bminossi,项目名称:csvfix,代码行数:14,代码来源:csved_sum.cpp

示例5: MakeDSV

string DSVWriteCommand :: MakeDSV( const CSVRow & in )  {

    CSVRow row;
    BuildCSVRow( in, row );

    string line;
    for ( unsigned int i = 0; i < row.size(); i++ ) {
        line += MakeField( row[i] );
        if ( i != row.size() - 1 ) {
            line += Delim();
        }
    }
    return line;
}
开发者ID:purinda,项目名称:csvfix,代码行数:14,代码来源:csved_dsv.cpp

示例6: operator

	bool operator()( const CSVRow & r1, const CSVRow & r2 ) const {
		if ( mCol >= r1.size() || mCol >= r2.size() ) {
			CSVTHROW( "Invalid field index " << (mCol + 1) );
		}
		double d1 = ALib::ToReal( r1[mCol] );
		double d2 = ALib::ToReal( r2[mCol] );
		if ( d1 < d2 ) {
			return true;
		}
		else if ( d1 > d2 ) {
			return false;
		}
		return false;
	}
开发者ID:bminossi,项目名称:csvfix,代码行数:14,代码来源:csved_sum.cpp

示例7: MakeSetClause

string SQLUpdateCommand :: MakeSetClause( const CSVRow & row ) const {

	string sc;

	for ( unsigned int i = 0; i < DataCols().size(); i++ ) {

		unsigned int fi = DataCols().at( i ).mField;
		if ( fi >= row.size() ) {
			CSVTHROW( "Required field " << fi + 1 << " missing from input" );
		}

		if ( sc != "" ) {
			sc += ", ";
		}

		string field = EmptyToNull( row[fi] );

		sc +=  DataCols().at(i).mColName
				+ " = "
				+ (( DoSQLQuote( i ) && ! NoNullQuote( field ) )
					? ALib::SQuote( ALib::SQLQuote( field ) )
					: field );

	}

	return "SET " + sc;
}
开发者ID:darrennolan,项目名称:csvfix,代码行数:27,代码来源:csved_sql.cpp

示例8: EditRow

void EditCommand :: EditRow( CSVRow & row ) {
	for ( unsigned int i = 0; i < row.size(); i++ ) {
		if ( mCols.size() == 0 || ALib::Contains( mCols, i ) ) {
			EditField( row[i] );
		}
	}
}
开发者ID:bminossi,项目名称:csvfix,代码行数:7,代码来源:csved_edit.cpp

示例9: Eval

string TemplateCommand :: Eval( const CSVRow & row, const string & expr ) {
	ALib::Expression ex;
	for( unsigned int i = 0; i < row.size(); i++ ) {
		ex.AddPosParam( row[i] );
	}
	return ex.Evaluate( expr.substr( 1 ) );
}
开发者ID:darrennolan,项目名称:csvfix,代码行数:7,代码来源:csved_template.cpp

示例10:

void EvalCommand ::	Evaluate( CSVRow & row ) {

	bool skipelse = false;

	for ( unsigned int i = 0; i < mFieldExprs.size() ; i++ ) {
		if ( mIsIf[i] ) {
			if ( i < mFieldExprs.size() - 1  && mIsIf[i+2] ) {
				CSVTHROW( "Cannot have consecutive -if options" );
			}
			if ( i >= mFieldExprs.size() - 2 ) {
				CSVTHROW( "Need two -e options after -if" );
			}
			string r = mFieldExprs[i].mExpr.Evaluate();
			if ( ALib::Expression::ToBool( r ) ) {
				skipelse = true;
			} else {
				i++;
			}
			continue;
		}

		string r = mFieldExprs[i].mExpr.Evaluate();
		if ( mFieldExprs[i].mField < 0 || mFieldExprs[i].mField >= (int) row.size() ) {
			row.push_back( r );
		}
		else {
			row[ mFieldExprs[i].mField ] = r;
		}

		if ( skipelse ) {
			i++;
			skipelse = false;
		}
	}
}
开发者ID:bminossi,项目名称:csvfix,代码行数:35,代码来源:csved_eval.cpp

示例11: ConvertDates

bool DateReadCommand :: ConvertDates( CSVRow & row ) {

    bool havebad = false;
    for ( unsigned int i = 0; i < row.size(); i++ ) {
        if ( ALib::Contains( mFields, i ) ) {
            string ds = row[i];
            ALib::Date dt;
            bool ok = mReader->Read( ds, dt );
            if ( ok ) {
                row[i] = dt.Str();
            }
            else {
                havebad = true;
                // error handling not yet
            }
        }
    }

    if ( havebad ) {
        return mWriteAction == WriteAll || mWriteAction == WriteBad;
    }
    else {
        return  mWriteAction == WriteAll || mWriteAction == WriteGood;
    }
}
开发者ID:moissinac,项目名称:csvfix,代码行数:25,代码来源:csved_date.cpp

示例12: MakeWhereClause

string SQLCommand :: MakeWhereClause( const CSVRow & row  ) const {

	string wc;

	for ( unsigned int i = 0; i < WhereCols().size(); i++ ) {

		unsigned int wi = WhereCols().at( i ).mField;
		if ( wi >= row.size()  ) {
			CSVTHROW( "Required field " << wi + 1 << " missing in input" );
		}

		if ( wc != "" ) {
			wc += " AND ";
		}

		string field = EmptyToNull( row[wi] );

		wc +=  WhereCols().at(i).mColName
				+ (field == "NULL"  ? " IS " : " = " )
				+ ( (DoSQLQuote( i ) && ! NoNullQuote( field ))
					? ALib::SQuote( ALib::SQLQuote( field ) )
					: field );
	}

	return "WHERE " + wc;
}
开发者ID:darrennolan,项目名称:csvfix,代码行数:26,代码来源:csved_sql.cpp

示例13: nrow

void TruncCommand :: ProcessRow( CSVRow & row, unsigned int ncols,
									const ALib::CommaList &  ) {
	if ( ncols < row.size() ) {
		CSVRow nrow( ncols );
		std::copy( row.begin(), row.begin() + ncols, nrow.begin() );
		row.swap( nrow );
	}
}
开发者ID:bminossi,项目名称:csvfix,代码行数:8,代码来源:csved_truncpad.cpp

示例14: display

void AbstractFileSource::display(const CSVRow& row) {
	if(!row.size())
		return;
	CSVRowCI i=row.begin();
	std::cout<<*(i++);
	for(;i != row.end();++i)
		std::cout<<','<<*i;
};
开发者ID:haoyuli,项目名称:DymonRepo,代码行数:8,代码来源:AbstractFileSource.cpp

示例15: FormatDates

void DateFormatCommand :: FormatDates( CSVRow & row ) {
    for ( unsigned int i = 0; i < row.size(); i++ ) {
        if ( ALib::Contains( mFields, i ) ) {
            string ds = row[i];
            row[i] = FormatDate( ds );
        }
    }
}
开发者ID:moissinac,项目名称:csvfix,代码行数:8,代码来源:csved_date.cpp


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