next up previous contents
Next: FillRow Up: Row methods Previous: AddRow

InsertRow

NAME InsertRow

PROTOTYPE

#include "SSTable.h"
int SSTable::InsertRow(int rowIndex);
int SSTable::InsertRow(ReVarCifArray<CifString> & theRow,
                       int rowIndex);

EXAMPLE

#include "SSTable.h"
#include "FileNavigator.h"

FileNavigator * pFileNavigator = NULL;

... // FileNavigator and tokenizer initialization

SSTable * pTable = new SSTable();
ReVarCifArray<CifString> some_row;
CifString cs;
int errCode = 0;

while (tokenizer.hasMoreTokens()) {
  cs = (char *) tokenizer.GetNextToken();
  some_row.Add(cs);
  cs.Clear();
}

pTable->GetObject(objectIndex, pFileNavigator);
pTable->InsertRow(0); // Insert an empty 1st row
 // Insert a filled up middle row
pTable->InsertRow(some_row, pTable->GetNumRows()/2);
...
PURPOSE

InsertRow inserts a row into the table at a specified location. The second form of this method adds data into this row. The first form of the method requires calling another method, such as FillColumn, to add data to the table.

RECEIVES

InsertRow(int)
rowIndex The index where the row is to be inserted. Keep in mind that the first row is row 0.

InsertRow(ReVarCifArray<CifString>&, int)
theRow An array of CifStrings to add as the data of the row.
rowIndex The index where the row is to be inserted. Keep in mind that the first row is row 0.

RETURN VALUE

A negative value indicates an error or warning.

REMARKS

See also: AddRow



Olivera Tosic
12/17/1999