double CAln::GetMax(int nVar, int nRegion) const { const ALNCONSTRAINT* pConstr = GetConstraint(nVar, nRegion); ASSERT(pConstr != NULL); return pConstr->dblMax; }
void CAln::SetMax(double dblMax, int nVar, int nRegion) { ALNCONSTRAINT* pConstr = GetConstraint(nVar, nRegion); ASSERT(pConstr != NULL); pConstr->dblMax = dblMax; }
void nsTableColFrame::Dump(PRInt32 aIndent) { char* indent = new char[aIndent + 1]; if (!indent) return; for (PRInt32 i = 0; i < aIndent + 1; i++) { indent[i] = ' '; } indent[aIndent] = 0; printf("%s**START COL DUMP**\n%s colIndex=%d constraint=%d coltype=", indent, indent, mColIndex, GetConstraint()); nsTableColType colType = GetColType(); switch (colType) { case eColContent: printf(" content "); break; case eColAnonymousCol: printf(" anonymous-column "); break; case eColAnonymousColGroup: printf(" anonymous-colgroup "); break; case eColAnonymousCell: printf(" anonymous-cell "); break; } printf("\n%s widths=", indent); for (PRInt32 widthX = 0; widthX < NUM_WIDTHS; widthX++) { printf("%d ", mWidths[widthX]); } printf("\n%s**END COL DUMP** ", indent); delete [] indent; }
static void KeepServerPromise(struct Promise *pp) { char *sp = NULL; if (!IsDefinedClass(pp->classes)) { CfOut(cf_verbose,"","Skipping whole promise, as context is %s\n",pp->classes); return; } if (VarClassExcluded(pp,&sp)) { CfOut(cf_verbose,"","\n"); CfOut(cf_verbose,"",". . . . . . . . . . . . . . . . . . . . . . . . . . . . \n"); CfOut(cf_verbose,"","Skipping whole next promise (%s), as var-context %s is not relevant\n",pp->promiser,sp); CfOut(cf_verbose,"",". . . . . . . . . . . . . . . . . . . . . . . . . . . . \n"); return; } if (strcmp(pp->agentsubtype,"classes") == 0) { KeepClassContextPromise(pp); return; } sp = (char *)GetConstraint("resource_type",pp,CF_SCALAR); if (strcmp(pp->agentsubtype,"access") == 0 && sp && strcmp(sp,"literal") == 0) { KeepLiteralAccessPromise(pp,"literal"); return; } if (strcmp(pp->agentsubtype,"access") == 0 && sp && strcmp(sp,"query") == 0) { KeepQueryAccessPromise(pp,"query"); return; } if (strcmp(pp->agentsubtype,"access") == 0 && sp && strcmp(sp,"context") == 0) { KeepLiteralAccessPromise(pp,"context"); return; } /* Default behaviour is file access */ if (strcmp(pp->agentsubtype,"access") == 0) { KeepFileAccessPromise(pp); return; } if (strcmp(pp->agentsubtype,"roles") == 0) { KeepServerRolePromise(pp); return; } }
void CAln::SetEpsilon(double dblEpsilon, int nVar, int nRegion) { ALNCONSTRAINT* pConstr = GetConstraint(nVar, nRegion); ASSERT(pConstr != NULL); pConstr->dblEpsilon = dblEpsilon; pConstr->dblSqEpsilon = dblEpsilon * dblEpsilon; }
void CAln::SetWeightMax(double dblWMax, int nVar, int nRegion) { ALNCONSTRAINT* pConstr = GetConstraint(nVar, nRegion); ASSERT(pConstr != NULL); ASSERT(nVar != m_pALN->nOutput); // can't change output var weight! if (nVar != m_pALN->nOutput) pConstr->dblWMax = dblWMax; }
wxString pgForeignKey::GetSql(ctlTree *browser) { if (sql.IsNull()) { sql = wxT("-- Foreign Key: ") + GetQuotedFullIdentifier() + wxT("\n\n") + wxT("-- ALTER TABLE ") + GetQuotedSchemaPrefix(fkSchema) + qtIdent(fkTable) + wxT(" DROP CONSTRAINT ") + GetQuotedIdentifier() + wxT(";") + wxT("\n\nALTER TABLE ") + GetQuotedSchemaPrefix(fkSchema) + qtIdent(fkTable) + wxT("\n ADD CONSTRAINT ") + GetConstraint() + wxT(";\n"); if (!GetComment().IsEmpty()) sql += wxT("COMMENT ON CONSTRAINT ") + GetQuotedIdentifier() + wxT(" ON ") + GetQuotedSchemaPrefix(fkSchema) + qtIdent(fkTable) + wxT(" IS ") + qtDbString(GetComment()) + wxT(";\n"); } return sql; }
void PromiseBanner(struct Promise *pp) { char *sp,handle[CF_MAXVARSIZE]; if ((sp = GetConstraint("handle",pp,CF_SCALAR)) || (sp = PromiseID(pp))) { strncpy(handle,sp,CF_MAXVARSIZE-1); } else { strcpy(handle,"(enterprise only)"); } CfOut(cf_verbose,"","\n"); CfOut(cf_verbose,""," .........................................................\n"); if (VERBOSE||DEBUG) { printf ("%s> Promise handle: %s\n",VPREFIX,handle); printf ("%s> Promise made by: %s",VPREFIX,pp->promiser); } if (pp->promisee) { if (VERBOSE) { printf(" -> "); ShowRval(stdout,pp->promisee,pp->petype); } } if (VERBOSE) { printf("\n"); } if (pp->ref) { CfOut(cf_verbose,"","\n"); CfOut(cf_verbose,""," Comment: %s\n",pp->ref); } CfOut(cf_verbose,""," .........................................................\n"); CfOut(cf_verbose,"","\n"); }
wxString pgCheck::GetSql(ctlTree *browser) { if (sql.IsNull()) { sql = wxT("-- Check: ") + GetQuotedFullIdentifier() + wxT("\n\n") + wxT("-- ALTER ") + objectKind + wxT(" ") + GetQuotedSchemaPrefix(objectSchema) + qtIdent(objectName) + wxT(" DROP CONSTRAINT ") + GetQuotedIdentifier() + wxT(";\n\nALTER ") + objectKind + wxT(" ") + GetQuotedSchemaPrefix(objectSchema) + qtIdent(objectName) + wxT("\n ADD CONSTRAINT ") + GetConstraint() + wxT(";\n"); if (!GetComment().IsNull()) { sql += wxT("COMMENT ON CONSTRAINT ") + GetQuotedIdentifier() + wxT(" ON ") + GetQuotedSchemaPrefix(objectSchema) + qtIdent(objectName) + wxT(" IS ") + qtDbString(GetComment()) + wxT(";\n"); } } return sql; }
void CWeaponHL2MPBase::FallInit( void ) { #ifndef CLIENT_DLL SetModel( GetWorldModel() ); VPhysicsDestroyObject(); if ( HasSpawnFlags( SF_NORESPAWN ) == false ) { SetMoveType( MOVETYPE_NONE ); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_TRIGGER ); UTIL_DropToFloor( this, MASK_SOLID ); } else { if ( !VPhysicsInitNormal( SOLID_BBOX, GetSolidFlags() | FSOLID_TRIGGER, false ) ) { SetMoveType( MOVETYPE_NONE ); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_TRIGGER ); } else { #if !defined( CLIENT_DLL ) // Constrained start? if ( HasSpawnFlags( SF_WEAPON_START_CONSTRAINED ) ) { //Constrain the weapon in place IPhysicsObject *pReferenceObject, *pAttachedObject; pReferenceObject = g_PhysWorldObject; pAttachedObject = VPhysicsGetObject(); if ( pReferenceObject && pAttachedObject ) { constraint_fixedparams_t fixed; fixed.Defaults(); fixed.InitWithCurrentObjectState( pReferenceObject, pAttachedObject ); fixed.constraint.forceLimit = lbs2kg( 10000 ); fixed.constraint.torqueLimit = lbs2kg( 10000 ); IPhysicsConstraint *pConstraint = GetConstraint(); pConstraint = physenv->CreateFixedConstraint( pReferenceObject, pAttachedObject, NULL, fixed ); pConstraint->SetGameData( (void *) this ); } } #endif //CLIENT_DLL } } SetPickupTouch(); SetThink( &CBaseCombatWeapon::FallThink ); SetNextThink( gpGlobals->curtime + 0.1f ); #endif }
void TableSettings::OnColumnChanged(wxDataViewEvent& event) { Column *col = reinterpret_cast<Column*>(m_dvColumns->GetItemData( event.GetItem() ) ); if( col ) { wxVariant val; event.GetModel()->GetValue( val, event.GetItem(), event.GetColumn() ); if( ! val.IsNull() ) { switch( event.GetColumn() ) { case 0: { // rename local columns in keys SerializableList keys; GetConstraints( keys, col->GetName() ); for(SerializableList::iterator it = keys.begin(); it != keys.end(); ++it ) { Constraint *key = (Constraint*) *it; if( key->GetType() == Constraint::primaryKey ) key->SetName( wxT("PK_") + val.GetString() ); key->SetLocalColumn( val.GetString() ); } // rename table column col->SetName( val.GetString() ); break; } case 1: { col->SetType( m_pDbAdapter->GetDbTypeByName( val.GetString() ) ); break; } case 2: { long s1, s2; s1 = s2 = 0; wxSscanf( val.GetString(), wxT("%ld,%ld"), &s1, &s2 ); IDbType *type = col->GetType(); if( type->HaveSize() ) type->SetSize( s1 ); else { m_infobar->ShowMessage( wxT("This data type doesn't support size definition."), wxICON_WARNING ); Refresh(); } if( type->HaveSize2() ) type->SetSize2( s1 ); else { m_infobar->ShowMessage( wxT("This data type doesn't support size definition."), wxICON_WARNING ); Refresh(); } break; } case 3: { IDbType *type = col->GetType(); if( type->HaveNotNull() ) type->SetNotNull( val.GetBool() ); else { m_infobar->ShowMessage( wxT("This data type doesn't support NOT NULL feature."), wxICON_WARNING ); Refresh(); } break; } case 4: { IDbType *type = col->GetType(); if( type->HaveAutoIncrement() ) type->SetAutoIncrement( val.GetBool() ); else { m_infobar->ShowMessage( wxT("This data type doesn't support AUTOINCREMENT feature."), wxICON_WARNING ); Refresh(); } break; } case 5: { Constraint *key = GetConstraint( Constraint::primaryKey, col->GetName() ); if( key ) { // remove primary key if exists m_lstKeys.DeleteObject( key ); delete key; } else { // create new primary key key = new Constraint( wxT("PK_") + col->GetName(), col->GetName(), Constraint::primaryKey, Constraint::noAction, Constraint::noAction ); m_lstKeys.Append( key ); } break; } } } } event.Skip(); UpdateView(); }
void KeepLiteralAccessPromise(struct Promise *pp,char *type) { struct Constraint *cp; struct Rlist *rp; struct Auth *ap,*dp; char *handle = GetConstraint("handle",pp,CF_SCALAR); char *val; if (handle == NULL) { CfOut(cf_error,"","Access to literal server data requires you to define a promise handle for reference"); return; } if (!GetAuthPath(handle,VARADMIT)) { InstallServerAuthPath(handle,&VARADMIT,&VARADMITTOP); } RegisterLiteralServerData(handle,pp); if (!GetAuthPath(handle,VARDENY)) { InstallServerAuthPath(handle,&VARDENY,&VARDENYTOP); } ap = GetAuthPath(handle,VARADMIT); dp = GetAuthPath(handle,VARDENY); if (strcmp(type,"literal") == 0) { ap->literal = true; } if (strcmp(type,"context") == 0) { ap->classpattern = true; } for (cp = pp->conlist; cp != NULL; cp = cp->next) { if (!IsDefinedClass(cp->classes)) { continue; } switch (cp->type) { case CF_SCALAR: val = (char *)cp->rval; if (strcmp(cp->lval,CF_REMACCESS_BODIES[cfs_encrypted].lval) == 0) { ap->encrypt = true; } break; case CF_LIST: for (rp = (struct Rlist *)cp->rval; rp != NULL; rp=rp->next) { if (strcmp(cp->lval,CF_REMACCESS_BODIES[cfs_admit].lval) == 0) { PrependItem(&(ap->accesslist),rp->item,NULL); continue; } if (strcmp(cp->lval,CF_REMACCESS_BODIES[cfs_deny].lval) == 0) { PrependItem(&(dp->accesslist),rp->item,NULL); continue; } if (strcmp(cp->lval,CF_REMACCESS_BODIES[cfs_maproot].lval) == 0) { PrependItem(&(ap->maproot),rp->item,NULL); continue; } } break; case CF_FNCALL: /* Shouldn't happen */ break; } } }