本文整理汇总了C++中DBObjTableField::Type方法的典型用法代码示例。如果您正苦于以下问题:C++ DBObjTableField::Type方法的具体用法?C++ DBObjTableField::Type怎么用?C++ DBObjTableField::Type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBObjTableField
的用法示例。
在下文中一共展示了DBObjTableField::Type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RGlibGenFuncSymbolField
int RGlibGenFuncSymbolField (DBObjData *data, const char *fieldName)
{
DBInt recID;
char symbolName [DBStringLength + 1];
DBObjTable *table = data->Table (DBrNItems);
DBObjTable *symbols = data->Table (DBrNSymbols);
DBObjRecord *record, *symbolRec;
DBObjTableField *field;
DBObjTableField *symbolFLD;
DBObjTableField *symbolIDFLD;
DBObjTableField *foregroundFLD;
DBObjTableField *backgroundFLD;
DBObjTableField *styleFLD;
if (table == (DBObjTable *) NULL) return (DBFault);
if ((field = table->Field (fieldName)) == (DBObjTableField *) NULL)
{ CMmsgPrint (CMmsgAppError, "Invalid field name in: %s %d",__FILE__,__LINE__); return (DBFault); }
if ((symbolFLD = table->Field (DBrNSymbol)) == (DBObjTableField *) NULL)
{ CMmsgPrint (CMmsgAppError, "Missing symbol field in: %s %d",__FILE__,__LINE__); return (DBFault); }
if (symbols == (DBObjTable *) NULL)
{ CMmsgPrint (CMmsgAppError, "Missing symbol table in: %s %d",__FILE__,__LINE__); return (DBFault); }
if ((symbolIDFLD = symbols->Field (DBrNSymbolID)) == (DBObjTableField *) NULL)
{ CMmsgPrint (CMmsgAppError, "Missing symbolID field in: %s %d",__FILE__,__LINE__); return (DBFault); }
if ((foregroundFLD = symbols->Field (DBrNForeground)) == (DBObjTableField *) NULL)
{ CMmsgPrint (CMmsgAppError, "Missing foreground field in: %s %d",__FILE__,__LINE__); return (DBFault); }
if ((backgroundFLD = symbols->Field (DBrNBackground)) == (DBObjTableField *) NULL)
{ CMmsgPrint (CMmsgAppError, "Missing background field in: %s %d",__FILE__,__LINE__); return (DBFault); }
if ((styleFLD = symbols->Field (DBrNStyle)) == (DBObjTableField *) NULL)
{ CMmsgPrint (CMmsgAppError, "Missing style field in: %s %d",__FILE__,__LINE__); return (DBFault); }
symbols->DeleteAll ();
for (recID = 0;recID < table->ItemNum (); ++recID)
{
record = table->Item (recID);
DBPause (record->RowID () * 100 / table->ItemNum ());
if (field->Type () == DBTableFieldString) sprintf (symbolName,"%s",field->String (record));
else sprintf (symbolName,"Symbol:%03d",field->Int (record));
if ((symbolRec = (DBObjRecord *) symbols->Item (symbolName)) == (DBObjRecord *) NULL)
{
if ((symbolRec = symbols->Add (symbolName)) == NULL)
{ CMmsgPrint (CMmsgAppError, "Symbol Object Creation Error in: %s %d",__FILE__,__LINE__); return (DBFault); }
symbolIDFLD->Int (symbolRec,field->Type () == DBTableFieldString ? symbolRec->RowID () : field->Int (record));
foregroundFLD->Int (symbolRec,1);
backgroundFLD->Int (symbolRec,0);
styleFLD->Int (symbolRec,0);
}
symbolFLD->Record (record,symbolRec);
}
return (DBSuccess);
}
示例2: DBObject
DBObjData::DBObjData(DBObjData &data) : DBObject(data), DBDataHeader(data._Header()) {
DBObjTable *table;
DBObjRecord *record, *obj;
DBObjTableField *field;
DBObjectLIST<DBObjTableField> *fields;
strcpy(FileNameSTR, "");
TablesPTR = new DBObjectLIST<DBObjTable>(*data.TablesPTR);
DocsPTR = new DBObjectLIST<DBObjRecord>(*data.DocsPTR);
ArraysPTR = new DBObjectLIST<DBObjRecord>(*data.ArraysPTR);
DispPTR = new DBObjectLIST<DBObject>("Data Display");
LinkedDataPTR = (DBObjData *) NULL;
for (table = TablesPTR->First(); table != (DBObjTable *) NULL; table = TablesPTR->Next()) {
fields = table->Fields();
for (record = table->First(); record != (DBObjRecord *) NULL; record = table->Next()) {
for (field = fields->First(); field != (DBObjTableField *) NULL; field = fields->Next())
switch (field->Type()) {
case DBTableFieldTableRec:
case DBTableFieldDataRec:
if ((obj = field->Record(record)) != NULL)
field->Record(record, (DBObjRecord *) ((char *) NULL + obj->RowID()));
else field->Record(record, (DBObjRecord *) DBFault);
break;
}
}
}
BuildFields();
}
示例3: DBTableFieldIsOptional
DBInt DBTableFieldIsOptional(const DBObject *obj) {
DBObjTableField *tableField = (DBObjTableField *) obj;
switch (tableField->Type()) {
case DBTableFieldString:
case DBTableFieldInt:
case DBTableFieldFloat:
case DBTableFieldDate:
return (tableField->Required() ? false : true);
default:
return (false);
}
}
示例4: DBTableFieldIsVisible
DBInt DBTableFieldIsVisible(const DBObject *obj) {
DBObjTableField *tableField = (DBObjTableField *) obj;
switch (tableField->Type()) {
case DBTableFieldString:
case DBTableFieldInt:
case DBTableFieldFloat:
case DBTableFieldDate:
return (strlen(tableField->Format()) > 0 ? true : false);
default:
return (false);
}
}
示例5: _DBObjTableListSort
static int _DBObjTableListSort(const DBObjRecord **obj0, const DBObjRecord **obj1) {
DBInt ret = 0;
DBObjTableField *field;
DBDate date0, date1;
for (field = _DBObjTableSortFields->First();
field != (DBObjTableField *) NULL;
field = _DBObjTableSortFields->Next()) {
switch (field->Type()) {
case DBTableFieldString:
ret = strcmp(field->String(*obj0), field->String(*obj1));
break;
case DBTableFieldInt:
ret = field->Int(*obj0) - field->Int(*obj1);
break;
case DBTableFieldFloat:
if (field->Float(*obj0) - field->Float(*obj1) > 0.0) ret = 1;
else if (field->Float(*obj0) - field->Float(*obj1) < 0.0) ret = -1;
else ret = 0;
break;
case DBTableFieldDate:
date0 = field->Date(*obj0);
date1 = field->Date(*obj1);
if (date0 > date1) ret = 1;
else if (date0 < date1) ret = -1;
else ret = 0;
break;
case DBTableFieldTableRec:
ret = strcmp((*obj0)->Name(), (*obj1)->Name());
break;
case DBTableFieldDataRec:
ret = (*obj0)->RowID() - (*obj1)->RowID();
break;
}
if ((field->Flags() & DBObjectFlagSortReversed) == DBObjectFlagSortReversed) ret *= -1;
if (ret != 0) return (ret);
}
if (ret == 0) ret = (*obj0)->ListPos() - (*obj1)->ListPos();
return (ret);
}
示例6: RGISAnalyseLineSSampleGridCBK
void RGISAnalyseLineSSampleGridCBK (Widget widget, RGISWorkspace *workspace,XmAnyCallbackStruct *callData)
{
char *fText;
int allowOk;
static int sample;
DBDataset *dataset = UIDataset ();
DBObjData *dbData = dataset->Data (), *grdData = dbData->LinkedData ();
DBObjTable *itemTable = dbData->Table (DBrNItems);
static Widget dShell = (Widget) NULL, mainForm;
static Widget fromNameTextF, toNameTextF;
XmString string;
widget = widget; workspace = workspace; callData = callData;
_RGISAnLineSampleGridFields = itemTable->Fields ();
if (dShell == (Widget) NULL)
{
Widget button;
dShell = UIDialogForm ((char *) "Single Layer Grid Sampling",false);
mainForm = UIDialogFormGetMainForm (dShell);
string = XmStringCreate ((char *) "Select",UICharSetBold);
button = XtVaCreateManagedWidget ("RGISAnalyseLineSSampleNameButton",xmPushButtonWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_FORM,
XmNtopOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNmarginHeight, 5,
XmNtraversalOn, False,
XmNlabelString, string,
XmNuserData, grdData->Type () == DBTypeGridContinuous ? DBTableFieldIsNumeric : DBTableFieldIsCategory,
NULL);
XmStringFree (string);
fromNameTextF = XtVaCreateManagedWidget ("RGISAnalyseLineSSampleNameTextF",xmTextFieldWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNtopWidget, button,
XmNrightAttachment, XmATTACH_WIDGET,
XmNrightWidget, button,
XmNrightOffset, 10,
XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNbottomWidget, button,
XmNmaxLength, DBStringLength,
XmNcolumns, DBStringLength / 2,
NULL);
XtAddCallback (button,XmNactivateCallback,(XtCallbackProc) _RGIAnalyseLineSSampleGridSSelectCBK,fromNameTextF);
string = XmStringCreate ((char *) "From Field:",UICharSetBold);
XtVaCreateManagedWidget ("RGISAnalyseLineSSampleNameLabel",xmLabelWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNtopWidget, button,
XmNleftAttachment, XmATTACH_FORM,
XmNleftOffset, 10,
XmNrightAttachment, XmATTACH_WIDGET,
XmNrightWidget, fromNameTextF,
XmNrightOffset, 10,
XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNbottomWidget, button,
XmNlabelString, string,
NULL);
XmStringFree (string);
string = XmStringCreate ((char *) "Select",UICharSetBold);
button = XtVaCreateManagedWidget ("RGISAnalyseLineSSampleNameButton",xmPushButtonWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_WIDGET,
XmNtopWidget, button,
XmNtopOffset, 10,
XmNrightAttachment, XmATTACH_FORM,
XmNrightOffset, 10,
XmNbottomAttachment, XmATTACH_FORM,
XmNbottomOffset, 10,
XmNmarginHeight, 5,
XmNtraversalOn, False,
XmNlabelString, string,
XmNuserData, grdData->Type () == DBTypeGridContinuous ? DBTableFieldIsNumeric : DBTableFieldIsCategory,
NULL);
XmStringFree (string);
toNameTextF = XtVaCreateManagedWidget ("RGISAnalyseLineSSampleNameTextF",xmTextFieldWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNtopWidget, button,
XmNrightAttachment, XmATTACH_WIDGET,
XmNrightWidget, button,
XmNrightOffset, 10,
XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNbottomWidget, button,
XmNmaxLength, DBStringLength,
XmNcolumns, DBStringLength / 2,
NULL);
XtAddCallback (button,XmNactivateCallback,(XtCallbackProc) _RGIAnalyseLineSSampleGridSSelectCBK,toNameTextF);
string = XmStringCreate ((char *) "To Field:",UICharSetBold);
XtVaCreateManagedWidget ("RGISAnalyseLineSSampleNameLabel",xmLabelWidgetClass,mainForm,
XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNtopWidget, button,
XmNleftAttachment, XmATTACH_FORM,
XmNleftOffset, 10,
XmNrightAttachment, XmATTACH_WIDGET,
XmNrightWidget, toNameTextF,
XmNrightOffset, 10,
XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
XmNbottomWidget, button,
XmNlabelString, string,
//.........这里部分代码省略.........
示例7: main
int main (int argc,char *argv [])
{
int argPos, argNum = argc, ret, verbose = false;
DBInt recID;
bool padding = false;
char *tableName = (char *) NULL;
char *fieldName = (char *) NULL;
char *yearFieldName = (char *) NULL;
char *monthFieldName = (char *) NULL;
char *dayFieldName = (char *) NULL;
char *hourFieldName = (char *) NULL;
char *minFieldName = (char *) NULL;
char *tmp = (char *) NULL;
DBObjData *data;
DBObjTable *table;
DBObjTableField *srcField;
DBObjTableField *yearField = (DBObjTableField *) NULL;
DBObjTableField *monthField= (DBObjTableField *) NULL;
DBObjTableField *dayField = (DBObjTableField *) NULL;
DBObjTableField *hourField = (DBObjTableField *) NULL;
DBObjTableField *minField = (DBObjTableField *) NULL;
DBInt dbInputType = DBTableFieldInt;
DBInt dbInputSize = sizeof(DBShort);
DBDate date;
DBObjRecord *record;
for (argPos = 1;argPos < argNum; )
{
if (CMargTest (argv [argPos],"-a","--table"))
{
if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos)
{ CMmsgPrint (CMmsgUsrError,"Missing table name!"); return (CMfailed); }
tableName = argv [argPos];
if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) break;
continue;
}
if (CMargTest (argv [argPos],"-f","--field"))
{
if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos)
{ CMmsgPrint (CMmsgUsrError,"Missing field name!"); return (CMfailed); }
fieldName = argv [argPos];
if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) break;
continue;
}
if (CMargTest (argv [argPos],"-y","--year"))
{
if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos)
{ CMmsgPrint (CMmsgUsrError,"Missing year field name!"); return (CMfailed); }
yearFieldName = argv [argPos];
if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) break;
continue;
}
if (CMargTest (argv [argPos],"-m","--month"))
{
if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos)
{ CMmsgPrint (CMmsgUsrError,"Missing month field name!"); return (CMfailed); }
monthFieldName = argv [argPos];
if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) break;
continue;
}
if (CMargTest (argv [argPos],"-d","--day"))
{
if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos)
{ CMmsgPrint (CMmsgUsrError,"Missing day field name!"); return (CMfailed); }
dayFieldName = argv [argPos];
if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) break;
continue;
}
if (CMargTest (argv [argPos],"-o","--hour"))
{
if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos)
{ CMmsgPrint (CMmsgUsrError,"Missing hour field name!"); return (CMfailed); }
hourFieldName = argv [argPos];
if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) break;
continue;
}
if (CMargTest (argv [argPos],"-i","--minute"))
{
if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos)
{ CMmsgPrint (CMmsgUsrError,"Missing minute field name!"); return (CMfailed); }
minFieldName = argv [argPos];
if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) break;
continue;
}
if (CMargTest (argv [argPos],"-p","--padding"))
{
padding = true;
dbInputType = DBTableFieldString;
dbInputSize = sizeof(DBByte) * 3;
if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) break;
continue;
}
if (CMargTest (argv [argPos],"-V","--verbose"))
{
verbose = true;
if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) break;
continue;
}
if (CMargTest (argv [argPos],"-h","--help"))
//.........这里部分代码省略.........
示例8: DBTableFieldIsSimple
DBInt DBTableFieldIsSimple(const DBObject *obj) {
DBObjTableField *tableField = (DBObjTableField *) obj;
return ((tableField->Type() == DBTableFieldInt) ||
(tableField->Type() == DBTableFieldString) ||
(tableField->Type() == DBTableFieldFloat) ? true : false);
}
示例9: DBTableFieldIsFloat
DBInt DBTableFieldIsFloat(const DBObject *obj) {
DBObjTableField *tableField = (DBObjTableField *) obj;
return (tableField->Type() == DBTableFieldFloat ? true : false);
}
示例10: DBTableFieldIsDate
DBInt DBTableFieldIsDate(const DBObject *obj) {
DBObjTableField *tableField = (DBObjTableField *) obj;
return (tableField->Type() == DBTableFieldDate ? true : false);
}
示例11: DBTableFieldIsAxisVal
DBInt DBTableFieldIsAxisVal(const DBObject *obj) {
DBObjTableField *tableField = (DBObjTableField *) obj;
return ((tableField->Type() == DBTableFieldInt) ||
(tableField->Type() == DBTableFieldFloat) ||
(tableField->Type() == DBTableFieldDate) ? true : false);
}
示例12: DBTableFieldIsNumeric
DBInt DBTableFieldIsNumeric(const DBObject *obj) {
DBObjTableField *tableField = (DBObjTableField *) obj;
return ((tableField->Type() == DBTableFieldInt) ||
(tableField->Type() == DBTableFieldFloat) ? true : false);
}
示例13: RGlibPointInterStationTS
DBInt RGlibPointInterStationTS(DBObjData *pntData, DBObjData *tsData, char *relateFldName, char *joinFldName) {
DBInt first = true, tsIndex, tsRowNum = 0;
DBObjTable *pntTBL = pntData->Table(DBrNItems), *tsTBL;
DBObjectLIST<DBObjTableField> *fields;
DBObjTableField *pntNextFLD = pntTBL->Field(RGlibNextStation);
DBObjTableField *pntAreaFLD = pntTBL->Field(RGlibArea);
DBObjTableField *pntInterStnFLD = pntTBL->Field(RGlibInterStation);
DBObjTableField *pntRelateFLD;
DBObjTableField *pntNewNextFLD;
DBObjTableField *pntNewInterStnFLD;
DBObjTableField *tsTimeFLD;
DBObjTableField *tsJoinFLD;
DBObjTableField *tsNextStnFLD, *tsInterStnFLD;
DBObjRecord *pntRec, *nextPntRec, *tsRec, *tsIndexRec;
DBDate curDate, date;
if (pntNextFLD == (DBObjTableField *) NULL) {
CMmsgPrint(CMmsgUsrError, "Missing Next Station Field!");
return (DBFault);
}
if (pntAreaFLD == (DBObjTableField *) NULL) {
CMmsgPrint(CMmsgUsrError, "Missing STN Area Field!");
return (DBFault);
}
if (pntInterStnFLD == (DBObjTableField *) NULL) {
CMmsgPrint(CMmsgUsrError, "Missing Interfluvial Area Field!");
return (DBFault);
}
tsTBL = tsData->Table(DBrNItems);
tsNextStnFLD = new DBObjTableField(RGlibNextStation, DBTableFieldInt, "%8d", sizeof(DBInt));
tsTBL->AddField(tsNextStnFLD);
tsInterStnFLD = new DBObjTableField(RGlibInterStation, DBTableFieldFloat, "%9.1f", sizeof(DBFloat4));
tsTBL->AddField(tsInterStnFLD);
fields = tsTBL->Fields();
for (tsTimeFLD = fields->First(); tsTimeFLD != (DBObjTableField *) NULL; tsTimeFLD = fields->Next())
if (tsTimeFLD->Type() == DBTableFieldDate) break;
if (tsTimeFLD == (DBObjTableField *) NULL) {
CMmsgPrint(CMmsgUsrError, "Missing Date Field!");
return (DBFault);
}
if ((tsJoinFLD = tsTBL->Field(joinFldName)) == (DBObjTableField *) NULL) {
CMmsgPrint(CMmsgUsrError, "Missing Join Field!");
return (DBFault);
}
fields = new DBObjectLIST<DBObjTableField>("Field List");
fields->Add(new DBObjTableField(*tsTimeFLD));
fields->Add(new DBObjTableField(*tsJoinFLD));
tsTBL->ListSort(fields);
delete fields;
pntTBL = new DBObjTable(*pntTBL);
pntNextFLD = pntTBL->Field(RGlibNextStation);
pntAreaFLD = pntTBL->Field(RGlibArea);
pntInterStnFLD = pntTBL->Field(RGlibInterStation);
pntNewNextFLD = new DBObjTableField("NextStnTS", pntNextFLD->Type(), pntNextFLD->Format(), pntNextFLD->Length());
pntNewInterStnFLD = new DBObjTableField("InterFluTS", pntInterStnFLD->Type(), pntInterStnFLD->Format(),
pntInterStnFLD->Length());
pntRelateFLD = pntTBL->Field(relateFldName);
pntTBL->AddField(pntNewNextFLD);
pntTBL->AddField(pntNewInterStnFLD);
pntTBL->ListSort(pntRelateFLD);
tsIndexRec = tsTBL->First(&tsIndex);
for (tsRec = tsTBL->First(); tsRec != (DBObjRecord *) NULL; tsRec = tsTBL->Next()) {
DBPause(tsRowNum++ * 100 / tsTBL->ItemNum());
date = tsTimeFLD->Date(tsRec);
if (date != curDate) {
if (first) first = false;
else {
for (pntRec = pntTBL->First(); pntRec != (DBObjRecord *) NULL; pntRec = pntTBL->Next()) {
if ((pntRec->Flags() & DBObjectFlagLocked) != DBObjectFlagLocked) continue;
for (nextPntRec = pntTBL->Item(pntNextFLD->Int(pntRec) - 1);
(nextPntRec != (DBObjRecord *) NULL) &&
((nextPntRec->Flags() & DBObjectFlagLocked) != DBObjectFlagLocked);
nextPntRec = pntTBL->Item(pntNextFLD->Int(nextPntRec) - 1));
if (nextPntRec != (DBObjRecord *) NULL) {
pntNewNextFLD->Int(pntRec, nextPntRec->RowID() + 1);
pntNewInterStnFLD->Float(nextPntRec,
pntNewInterStnFLD->Float(nextPntRec) - pntAreaFLD->Float(pntRec));
}
}
pntRec = pntTBL->First();
for (; tsIndexRec != (DBObjRecord *) NULL; tsIndexRec = tsTBL->Next(&tsIndex)) {
if (tsRec == tsIndexRec) break;
for (; pntRec != (DBObjRecord *) NULL; pntRec = pntTBL->Next())
if (pntRelateFLD->Int(pntRec) == tsJoinFLD->Int(tsIndexRec)) {
tsNextStnFLD->Int(tsIndexRec, pntNewNextFLD->Int(pntRec));
tsInterStnFLD->Float(tsIndexRec, pntNewInterStnFLD->Float(pntRec));
break;
}
if (pntRec == (DBObjRecord *) NULL) pntRec = pntTBL->First();
}
}
for (pntRec = pntTBL->First(); pntRec != (DBObjRecord *) NULL; pntRec = pntTBL->Next()) {
pntNewNextFLD->Int(pntRec, 0);
pntNewInterStnFLD->Float(pntRec, pntAreaFLD->Float(pntRec));
pntRec->Flags(DBObjectFlagLocked, DBClear);
}
curDate = date;
//.........这里部分代码省略.........
示例14: DBTableFieldIsString
DBInt DBTableFieldIsString(const DBObject *obj) {
DBObjTableField *tableField = (DBObjTableField *) obj;
return (tableField->Type() == DBTableFieldString ? true : false);
}
示例15: main
int main (int argc,char *argv [])
{
int argPos, argNum = argc, numGrpNames = 0, i = 0;
char **groupnames, *rename = (char *) NULL, *tableName = (char *) NULL;
bool ascii = false;
FieldOptions *head = (FieldOptions *) NULL, *p = (FieldOptions *) NULL, *temp = (FieldOptions *) NULL;
Groups **groups = (Groups **) NULL;
FILE *outFile = (FILE *) NULL;
DBObjData *inData, *outData;
DBObjTable *inTable, *outTable;
DBObjTableField *field;
DBObjRecord *inRecord, *outRecord;
DBObjectLIST<DBObjTableField> *fields;
if(argc <= 2) { doHelp(false,argv[0]); return(DBSuccess); }
outData = new DBObjData("Untitled", DBTypeTable);
outTable = outData->Table(DBrNItems);
head = new FieldOptions(BAD,"","", (FieldOptions *) NULL);
groupnames = (char **) malloc(sizeof(char *));
for (argPos = 1;argPos < argNum;)
{
if (CMargTest(argv[argPos],"-f","--field"))
{
if ((argNum = CMargShiftLeft(argPos,argv,argNum)) <= argPos)
{ CMmsgPrint (CMmsgUsrError,"Missing operation and field after -f!"); return (CMfailed); }
if(!strcmp(argv[argPos],"pct"))
{
if (argNum <= argPos + 2)
{ CMmsgPrint (CMmsgUsrError,"Missing field and/or percentage after -f pct!"); return (CMfailed); }
p = FOHierarchy(argv[argPos],argv[argPos+1],rename,atoi(argv[argPos+2]),head);
argNum = CMargShiftLeft(argPos,argv,argNum);
argNum = CMargShiftLeft(argPos,argv,argNum);
}
else if(!strcmp(argv[argPos],"num"))
{
char *num = new char[4];
strcpy(num,"Num");
p = FOHierarchy(argv[argPos],num,rename,-1,head);
}
else
{
if (argNum < argPos + 1)
{ CMmsgPrint (CMmsgUsrError,"Missing operation or field after -f %s!",argv[argPos]); return (CMfailed); }
p = FOHierarchy(argv[argPos],argv[argPos+1],rename,-1,head);
argNum = CMargShiftLeft(argPos,argv,argNum);
}
p->setPrint(true);
rename = (char *) NULL;
if ((argNum = CMargShiftLeft(argPos,argv,argNum)) <= argPos) break;
continue;
}
if (CMargTest(argv[argPos],"-g","--group"))
{
if ((argNum = CMargShiftLeft(argPos,argv,argNum)) <= argPos)
{ CMmsgPrint (CMmsgUsrError,"Missing groupname!"); return (CMfailed); }
if((groupnames = (char **) realloc(groupnames,(numGrpNames + 1) * sizeof(char *))) == (char **) NULL)
{ CMmsgPrint (CMmsgSysError, "Memory allocation error in: %s %d",__FILE__,__LINE__); return(DBFault); }
groupnames[numGrpNames] = argv[argPos];
numGrpNames++;
if ((argNum = CMargShiftLeft(argPos,argv,argNum)) <= argPos) break;
continue;
}
if (CMargTest(argv[argPos],"-h","--help"))
{
argNum = CMargShiftLeft (argPos,argv,argNum);
if(CMargTest(argv[argPos],"e","extend"))
{
doHelp(true,argv[0]);
argNum = CMargShiftLeft (argPos,argv,argNum);
}
else doHelp(false,argv[0]);
}
if (CMargTest(argv[argPos],"-c","--ascii"))
{
ascii = true;
if ((argNum = CMargShiftLeft(argPos,argv,argNum)) <= argPos) break;
continue;
}
if (CMargTest(argv[argPos],"-a","--table"))
{
if ((argNum = CMargShiftLeft(argPos,argv,argNum)) <= argPos)
{ CMmsgPrint (CMmsgUsrError,"Missing table name!"); return (CMfailed); }
tableName = argv[argPos];
if ((argNum = CMargShiftLeft(argPos,argv,argNum)) <= argPos) break;
continue;
}
if (CMargTest(argv[argPos],"-r","--rename"))
{
if ((argNum = CMargShiftLeft(argPos,argv,argNum)) <= argPos)
{ CMmsgPrint (CMmsgUsrError,"Missing field after -r!"); return (CMfailed); }
rename = argv[argPos];
if ((argNum = CMargShiftLeft(argPos,argv,argNum)) <= argPos) break;
continue;
}
if (CMargTest(argv[argPos],"-o","--output"))
{
if ((argNum = CMargShiftLeft(argPos,argv,argNum)) <= argPos)
{ CMmsgPrint (CMmsgUsrError,"Missing output filename!"); return (CMfailed); }
//.........这里部分代码省略.........