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


C++ DBObjRecord::Flags方法代码示例

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


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

示例1: SelectObject

DBInt DBObjData::SelectObject(DBObjRecord *record, DBInt select) {
    DBObjTable *items = TablesPTR->Item(DBrNItems);

    if (record == (DBObjRecord *) NULL) return (false);
    if (items->Item(record->RowID()) != record) return (false);

    record->Flags(DBObjectFlagSelected, select);
    if (Type() == DBTypeNetwork) {
        DBInt cellID;
        DBObjRecord *cellRec;
        DBNetworkIF *netIF = new DBNetworkIF(this);

        for (cellID = 0; cellID < netIF->CellNum(); ++cellID) {
            cellRec = netIF->Cell(cellID);
            if (netIF->CellBasinID(cellRec) == record->RowID() + 1)
                cellRec->Flags(DBObjectFlagSelected, select);
        }
        delete netIF;
    }
    return (DBSuccess);
}
开发者ID:bmfekete,项目名称:RGIS,代码行数:21,代码来源:DBObjData.C

示例2: main

int main (int argc,char *argv [])

	{
	int argPos, argNum = argc, ret, verbose = false;
	DBInt fromSelection = false, recID;
	char *tableName = (char *) NULL;
	char *expr = (char *) NULL;
	DBMathOperand *operand;
	DBObjectLIST<DBObject> *variables = new DBObjectLIST<DBObject> ("Variables");
	DBObjData *data;
	DBObjTable *table, *saveTable, *groups = (DBObjTable *) NULL, *saveGroups;
	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],"-c","--condition"))
			{
			if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos)
				{ CMmsgPrint (CMmsgUsrError,"Missing expression!");   return (CMfailed); }
			if (expr != (char *) NULL) { CMmsgPrint (CMmsgUsrError,"Expression is already set"); return (CMfailed); }
			expr = argv [argPos];
			if ((argNum = CMargShiftLeft (argPos,argv,argNum)) <= argPos) break;
			continue;
			}
		if (CMargTest (argv [argPos],"-s","--selection"))
			{
			fromSelection = true;
			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"))
			{
			CMmsgPrint (CMmsgInfo,"%s [options] <input file> <output file>",CMfileName(argv[0]));
			CMmsgPrint (CMmsgInfo,"     -a,--table     [table name]");
			CMmsgPrint (CMmsgInfo,"     -c,--condition [expression]");
			CMmsgPrint (CMmsgInfo,"     -s,--selection");
			CMmsgPrint (CMmsgInfo,"     -V,--verbose");
			CMmsgPrint (CMmsgInfo,"     -h,--help");
			return (DBSuccess);
			}
		if ((argv [argPos][0] == '-') && ((int) strlen (argv [argPos]) > 1))
			{ CMmsgPrint (CMmsgUsrError,"Unknown option: %s!",argv [argPos]); return (CMfailed); }
		argPos++;
		}

	if (argNum > 3) { CMmsgPrint (CMmsgUsrError,"Extra arguments!"); return (CMfailed); }
	if (verbose) RGlibPauseOpen (argv[0]);

	if (expr != (char *) NULL)
		{
		operand = new DBMathOperand (expr);
		if (operand->Expand (variables) == DBFault) return (CMfailed);
		}

	data = new DBObjData ();
	if (((argNum > 1) && (strcmp (argv [1],"-") != 0) ? data->Read (argv [1]) : data->Read (stdin)) == DBFault)
		{ delete data; delete operand; return (CMfailed); }

	if (tableName == (char *) NULL) tableName = DBrNItems;

	if ((table = data->Table (tableName)) == (DBObjTable *) NULL)
		{ CMmsgPrint (CMmsgUsrError,"Invalid table!"); delete data; delete operand; return (CMfailed); }

	saveTable = new DBObjTable (*table);
	table->DeleteAll ();
	if ((strcmp (tableName,DBrNItems) == 0) && ((groups = data->Table (DBrNGroups)) != (DBObjTable *) NULL))
		{
		saveGroups = new DBObjTable (*groups);
		groups->DeleteAll ();
		}

	if (expr != (char *) NULL)
		{
		if (operand->Configure (saveTable->Fields()) == DBFault)
			{ delete data; delete operand; return (CMfailed); }
	
		for (recID = 0;recID < saveTable->ItemNum ();++recID)
			{
			record = saveTable->Item (recID);
			if ((ret = operand->Int (record)) == true)
				{
				if (!fromSelection) continue;
				if ((record->Flags () & DBObjectFlagSelected) == DBObjectFlagSelected) continue;
				}
			table->Add (new DBObjRecord (*record));
			if (groups != (DBObjTable *) NULL) groups->Add (new DBObjRecord (*(saveGroups->Item (recID))));
//.........这里部分代码省略.........
开发者ID:gyelnats,项目名称:RGIS,代码行数:101,代码来源:CMDtblDeleteRec.C

示例3: RGlibGenFuncFieldCalculate

DBInt RGlibGenFuncFieldCalculate (DBObjTable *table,char *f0Text,char *f1Text,char *rText,DBInt oper)

	{
	DBInt intVal, ret = false, i, rowID;
	DBFloat val [2];
	DBObjTableField *field [2];
	DBObjTableField *result;
	DBObjRecord *record;
		
	field [0] = table->Field (f0Text);
	field [1] = table->Field (f1Text);
	result = table->Field (rText);

	if ((field [0] == (DBObjTableField *) NULL) && (sscanf (f0Text,"%lf",val) != 1)) 		return (DBFault);
	if ((field [1] == (DBObjTableField *) NULL) && (sscanf (f1Text,"%lf",val + 1) != 1))	return (DBFault);
	 
	if (result == (DBObjTableField *) NULL)
		table->AddField (result = new DBObjTableField (rText,DBTableFieldFloat,"%10.3f",sizeof (DBFloat4)));
	if (field [0] != (DBObjTableField *) NULL)
		result->Format (field [0]->Format ());
	else if (field [1] != (DBObjTableField *) NULL)
		result->Format (field [1]->Format ());

	for (rowID = 0;rowID < table->ItemNum ();++rowID)
		{
		record = table->Item (rowID);
		if ((record->Flags () & DBObjectFlagIdle) == DBObjectFlagIdle)
			result->Float (record,result->FloatNoData ());
		else
			{
			for (i = 0;i < 2;++i)
				if (field [i] != (DBObjTableField *) NULL)
					{
					ret = false;
					if (field [i]->Type () == DBTableFieldInt) 
						{
						intVal = field [i]->Int (record);
						val [i] = (DBFloat) intVal;
						ret = intVal == field [i]->IntNoData ();
						}
					else
						{
						val [i] = field [i]->Float (record);
						ret = CMmathEqualValues (val [i],field [i]->FloatNoData ());
						}
					if (ret)
						{
						result->Float (record,result->FloatNoData ());
						goto Continue;
						}
					}
			if ((oper == DBMathOperatorDiv) && (val [1] == 0))
				result->Float (record,result->FloatNoData ());
			else
				switch (oper)
					{
					case DBMathOperatorAdd:	result->Float (record, val [0] + val [1]);	break;
					case DBMathOperatorSub:	result->Float (record, val [0] - val [1]);	break;
					case DBMathOperatorMul:	result->Float (record, val [0] * val [1]);	break;
					case DBMathOperatorDiv:	result->Float (record, val [0] / val [1]);	break;
					default:	CMmsgPrint (CMmsgAppError, "Invalid Operand in: %s %d",__FILE__,__LINE__);	break;
					}
Continue:
			continue;
			}
		}
	return (DBSuccess);
	}
开发者ID:bandi13,项目名称:RGIS,代码行数:68,代码来源:RGlibGenFuncs.C

示例4: main

int main(int argc, char *argv[]) {
    int argPos, argNum = argc, ret, idleMode, verbose = false;
    char *tableName = (char *) NULL;
    DBInt recID;
    DBObjData *data;
    DBObjTable *table;
    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], "-m", "--mode")) {
            int modeCodes[] = {true, false};
            const char *modes[] = {"set", "clear"};

            if ((argNum = CMargShiftLeft(argPos, argv, argNum)) <= argPos) {
                CMmsgPrint(CMmsgUsrError, "Missing selection mode!");
                return (CMfailed);
            }
            if ((idleMode = CMoptLookup(modes, argv[argPos], true)) == DBFault) {
                CMmsgPrint(CMmsgUsrError, "Invalid selection mode!");
                return (CMfailed);
            }
            idleMode = modeCodes[idleMode];
            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")) {
            CMmsgPrint(CMmsgInfo, "%s [options] <input file> <output file>", CMfileName(argv[0]));
            CMmsgPrint(CMmsgInfo, "     -a,--table     [table name]");
            CMmsgPrint(CMmsgInfo, "     -m,--mode      [set|clear]");
            CMmsgPrint(CMmsgInfo, "     -V,--verbose");
            CMmsgPrint(CMmsgInfo, "     -h,--help");
            return (DBSuccess);
        }
        if ((argv[argPos][0] == '-') && (strlen(argv[argPos]) > 1)) {
            CMmsgPrint(CMmsgUsrError, "Unknown option: %s!", argv[argPos]);
            return (CMfailed);
        }
        argPos++;
    }

    if (argNum > 3) {
        CMmsgPrint(CMmsgUsrError, "Extra arguments!");
        return (CMfailed);
    }
    if (verbose) RGlibPauseOpen(argv[0]);

    data = new DBObjData();
    if (((argNum > 1) && (strcmp(argv[1], "-") != 0) ? data->Read(argv[1]) : data->Read(stdin)) == DBFault) {
        delete data;
        return (CMfailed);
    }

    if (tableName == (char *) NULL) tableName = DBrNItems;

    if ((table = data->Table(tableName)) == (DBObjTable *) NULL) {
        CMmsgPrint(CMmsgUsrError, "Invalid table!");
        delete data;
        return (CMfailed);
    }

    if (idleMode)
        for (recID = 0; recID < table->ItemNum(); ++recID) {
            record = table->Item(recID);
            if ((record->Flags() & DBObjectFlagSelected) == DBObjectFlagSelected)
                record->Flags(DBObjectFlagIdle, DBSet);
            else
                record->Flags(DBObjectFlagIdle, DBClear);
        }
    else
        for (recID = 0; recID < table->ItemNum(); ++recID) {
            record = table->Item(recID);
            record->Flags(DBObjectFlagIdle, DBClear);
        }

    ret = (argNum > 2) && (strcmp(argv[2], "-") != 0) ? data->Write(argv[2]) : data->Write(stdout);

    delete data;
    if (verbose) RGlibPauseClose();
    return (ret);
}
开发者ID:bmfekete,项目名称:RGIS,代码行数:94,代码来源:CMDtblIdleRec.C

示例5: RGISAnGNUXYPlotCBK


//.........这里部分代码省略.........
								XmNrightOffset,			10,
								XmNbottomAttachment,		XmATTACH_OPPOSITE_WIDGET,
								XmNbottomWidget,			button,
								XmNlabelString,			string,
								NULL);
		XmStringFree (string);
		string = XmStringCreate ((char *) "Logarithmic Scale",UICharSetBold);
		toggle = XtVaCreateManagedWidget ("RGISEditCompLogScaleToggle",xmToggleButtonWidgetClass,mainForm,
								XmNtopAttachment,			XmATTACH_WIDGET,
								XmNtopWidget,				button,
								XmNtopOffset,				10,
								XmNrightAttachment,		XmATTACH_FORM,
								XmNrightOffset,			10,
								XmNbottomAttachment,		XmATTACH_FORM,
								XmNbottomOffset,			10,
								XmNlabelString,			string,
								XmNhighlightThickness,	0,
								XmNshadowThickness,		0,
								XmNmarginWidth,			5,
								XmNset,						False,
								NULL);
 		XmStringFree (string);
 		XtAddCallback (toggle,XmNvalueChangedCallback,(XtCallbackProc) UIAuxSetToggleCBK, (XtPointer) &logScale);

		XtAddCallback (UIDialogFormGetOkButton (dShell),XmNactivateCallback,(XtCallbackProc) UIAuxSetBooleanTrueCBK,&plot);
		}
	plot = false;
	XtVaSetValues (field0TextF,XmNuserData, itemTable->Fields (), NULL);
	XtVaSetValues (field1TextF,XmNuserData, itemTable->Fields (), NULL);
	UIDialogFormPopup (dShell);
	while (UILoop ())
		{
		f0Text = XmTextFieldGetString (field0TextF);
		f1Text = XmTextFieldGetString (field1TextF);
		allowOk = (strlen (f0Text) > 0) && (strlen (f1Text) > 0);
		XtFree (f0Text);	XtFree (f1Text);
		XtSetSensitive (UIDialogFormGetOkButton (dShell),allowOk);
		}
	UIDialogFormPopdown (dShell);

	if (plot)
		{
		char buffer [256];
		DBInt intVal, rowID;
		DBFloat val;
		DBObjTableField *field0 = itemTable->Field (f0Text = XmTextFieldGetString (field0TextF));
		DBObjTableField *field1 = itemTable->Field (f1Text = XmTextFieldGetString (field1TextF));
		DBObjRecord *record;

		XtFree (f0Text);	XtFree (f1Text);
		if ((field0 == (DBObjTableField *) NULL) || (field1 == (DBObjTableField *) NULL))
			{ CMmsgPrint (CMmsgAppError, "Invalid Compare Fields in: %s %d",__FILE__,__LINE__);	return; }

		strcpy (fileName,"ghaasXXXXXX");
		if ((fd = mkstemp (fileName)) == DBFault)
			{ CMmsgPrint (CMmsgSysError, "File Opening Error in: %s %d",__FILE__,__LINE__); return; }

		if ((file = fdopen (fd,"w")) == (FILE *) NULL)
			{ CMmsgPrint (CMmsgSysError, "File Opening Error in: %s %d",__FILE__,__LINE__); return; }

		fprintf (file,"\"GHAASId\"\t\"RecordName\"\t\"Selected\"\t\"%s\"\t\"%s\"\n",field0->Name (),field1->Name ());
		for (rowID = 0;rowID < itemTable->ItemNum ();++rowID)
			{
			record = itemTable->Item (rowID);
			if ((record->Flags () & DBObjectFlagIdle) == DBObjectFlagIdle) continue;
			sprintf (buffer,"%d\t\"%s\"\t%d",record->RowID () + 1,record->Name (),
						(record->Flags () & DBObjectFlagSelected) == DBObjectFlagSelected ? true : false);
			if (field0->Type () == DBTableFieldInt)
				{
				intVal = field0->Int (record);
				if (intVal == field0->IntNoData ()) continue;
				sprintf (buffer + strlen (buffer),"\t%d",intVal);
				}
			else
				{
				val = field0->Float (record);
				if (CMmathEqualValues (val,field0->FloatNoData ())) continue;
				sprintf (buffer + strlen (buffer),"\t%f",val);
				}
			if (field1->Type () == DBTableFieldInt)
				{
				intVal = field1->Int (record);
				if (intVal == field1->IntNoData ()) continue;
				sprintf (buffer + strlen (buffer),"\t%d",intVal);
				}
			else
				{
				val = field1->Float (record);
				if (CMmathEqualValues (val,field1->FloatNoData ())) continue;
				sprintf (buffer + strlen (buffer),"\t%f",val);
				}
			fprintf (file,"%s\n",buffer);
			}
		fclose (file);
		ghaasDir = getenv ("GHAAS_DIR");
		sprintf (command,"%s/Scripts/xy-plot.sh %s %s",ghaasDir != (const char *) NULL ? ghaasDir : ".",fileName,logScale ? "log" : "normal");
		system (command);
		unlink (fileName);
		}
	}
开发者ID:bandi13,项目名称:RGIS,代码行数:101,代码来源:RGISAnGNUXYPlot.C

示例6: RGISAnalysePointSTNPointsCBK


//.........这里部分代码省略.........
								XmNbottomAttachment,		XmATTACH_FORM,
								XmNbottomOffset,			10,
								XmNrowColumnType,			XmMENU_OPTION,
								XmNlabelString,			string,
								XmNsubMenuId,				menu,
								NULL);
		XmStringFree (string);
		XtAddCallback (UIDialogFormGetOkButton (dShell),XmNactivateCallback,(XtCallbackProc) UIAuxSetBooleanTrueCBK,&cont);
		XtSetSensitive (UIDialogFormGetOkButton (dShell),true);
		}

	dataset = UIDataset ();
	dbData = dataset->Data ();
	table = dbData->Table (DBrNItems);
	XtVaSetValues (srcTextF,XmNuserData,table->Fields (),NULL);
	XtVaSetValues (dstTextF,XmNuserData,table->Fields (),NULL);
	XtVaSetValues (cmpTextF,XmNuserData,table->Fields (),NULL);
	XtVaSetValues (errTextF,XmNuserData,table->Fields (),NULL);
	UIDialogFormPopup (dShell);
	cont = false;
	while (UILoop ())
		{
		if ((strlen (srcText = XmTextFieldGetString (srcTextF)) > 0) &&
			 ((field = table->Field (srcText)) != (DBObjTableField *) NULL))
				XtSetSensitive (UIDialogFormGetOkButton (dShell),True);
		else	XtSetSensitive (UIDialogFormGetOkButton (dShell),False);
		XtFree (srcText);
		if ((strlen (srcText = XmTextFieldGetString (cmpTextF)) > 0) &&
			 ((field = table->Field (srcText)) != (DBObjTableField *) NULL))
			{
			XtSetSensitive (button,True);
			XtSetSensitive (errTextF,True);
			XtSetSensitive (menu,True);
			}
		else
			{
			XmTextFieldSetString (errTextF,(char *) "");
			XtSetSensitive (button,False);
			XtSetSensitive (errTextF,False);
			XtSetSensitive (menu,False);
			}
		XtFree (srcText);
		}
	UIDialogFormPopdown (dShell);
	if (cont)
		{
		char dataName [DBDataNameLen + 5];
		DBObjData *netData = dbData->LinkedData ();

		sprintf (dataName,"%s STN",dbData->Name ());
		dbData = new DBObjData (*dbData);
		dbData->Name (dataName);
		if (UIDataHeaderForm (dbData))
			{
			char *dstText;
			DBObjTable *groups;
			DBObjRecord *pointRec;

			srcText = XmTextFieldGetString (srcTextF);
			dbData->LinkedData (netData);
			table = dbData->Table (DBrNItems);
			groups = dbData->Table (DBrNGroups);
			for (pointRec = table->First ();pointRec != (DBObjRecord *) NULL;pointRec = table->Next ())
				if ((pointRec->Flags () & DBObjectFlagIdle) == DBObjectFlagIdle)
					{
					if (groups != (DBObjTable *) NULL)
						groups->Delete (groups->Item (pointRec->RowID ()));
					table->Delete (pointRec);
					pointRec = table->Next (DBBackward);
					}

			field = table->Field (srcText);
			XtFree (srcText);
			RGlibPointSTNCoordinates (dbData,field);
			UIPauseDialogOpen ((char *) "Moving Points");
			RGlibPointSTNCharacteristics (dbData);
			UIPauseDialogClose ();
			srcText = XmTextFieldGetString (srcTextF);
			if (strlen (dstText = XmTextFieldGetString (dstTextF)) > 0)
				{
				srcText = XmTextFieldGetString (srcTextF);
				RGlibGenFuncTopoSubtract (table,RGlibNextStation,srcText,dstText);
				XtFree (dstText);
				}
			if (strlen (dstText = XmTextFieldGetString (errTextF)) > 0)
				{
				char *cmpText;
				srcText = XmTextFieldGetString (srcTextF);
				cmpText = XmTextFieldGetString (cmpTextF);
				RGlibGenFuncFieldCompare (table,srcText,cmpText,dstText,diffMethod);
				XtFree (dstText);
				XtFree (cmpText);
				}
			XtFree (srcText);
			UI2DViewRedrawAll ();
			workspace->CurrentData (dbData);
			}
		else delete dbData;
		}
	}
开发者ID:gyelnats,项目名称:RGIS,代码行数:101,代码来源:RGISAnPoint.C


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