Esempio n. 1
0
bool DSCase :: Match( const Row & r ) const {
	if ( mValues.Size() == 0 ) {
		return true;
	}

	for ( unsigned int i = 0; i < mValues.Size(); i++ ) {
		if ( r.At(0) == mValues.At(i) ) {
			return true;
		}
	}

	return false;
}
Esempio n. 2
0
void PadCommand :: ProcessRow( CSVRow & row, unsigned int ncols,
									const ALib::CommaList & cl  ) {
	unsigned int sz = row.size();
	for ( unsigned int i = sz; i < ncols; i++ ) {
		if ( cl.Size() == 0 ) {
			row.push_back( "" );
		}
		else {
			unsigned int ci = i - sz;
			if ( ci >= cl.Size() ) {
				row.push_back( cl.At( cl.Size() - 1 ) );
			}
			else {
				row.push_back( cl.At( ci ) );
			}
		}
	}
}
Esempio n. 3
0
void GeneratorTag :: Generate( Model * model ) {

	std::ostream & os = FileManager::Instance().GetStream( mOutFile );
	int nrows = mCount < 0 ? GetSize() : mCount;
	bool debug = false; // model->Debug() || Debug();

	if ( debug ) {
		std::cerr << "----- begin " << Name() << "\n";
	}

	if ( mFields.Size() ) {
		Row r;
		for ( unsigned int i = 0; i < mFields.Size(); i++ ) {
			r.AppendValue( mFields.At( i ) );
		}
		if ( debug ) {
			DebugRow( r, std::cerr );
		}
		os << r.AsCSV() << "\n";
	}

	while( nrows-- ) {
		Row r = Get();
		if ( debug ) {
			DebugRow( r, std::cerr );
		}
		if ( ! HasGroup() ) {
			os << r.AsCSV() << "\n";
		}
		AddRow( r );
	}

	if ( HasGroup() ) {
		DoGroup();
		for ( int i = 0; i < Size(); i++ ) {
			os << RowAt(i).AsCSV() << "\n";
		}
	}

	if ( debug ) {
		std::cerr << "----- end   " << Name() << "\n";
	}
}