本文整理汇总了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] );
}
示例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 ) );
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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] );
}
}
}
示例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 ) );
}
示例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;
}
}
}
示例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;
}
}
示例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;
}
示例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 );
}
}
示例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;
};
示例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 );
}
}
}