本文整理汇总了C++中ConditionList类的典型用法代码示例。如果您正苦于以下问题:C++ ConditionList类的具体用法?C++ ConditionList怎么用?C++ ConditionList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConditionList类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConditionList
// Return a relation of tuples that satisfy the conditions. The new relation
// is stored in the result data member.
Relation Database::selection( vector<Condition> conditions,
Relation* targetRelation ) {
result.clear( );
// Set up the list of conditions.
ConditionList cl = ConditionList( conditions, targetRelation );
// Find the tuples in the relation that satisfy the conditions and add
// them to the new relation.
for ( int i = 0; i < targetRelation->getNumTuples( ); i++ ){
if ( cl.evalOnTuple( i ) ){
vector<Entry*> newRow;
// Find the columns that satify the conditions and create
// a tuple out of them
for ( int j = 0; j < targetRelation->attributeSize( ); j++ ){
newRow.push_back( new Entry( *targetRelation->getRow( i ).at( j ) ) );
}
// Add the newly created tuple to the new relation.
result.addRow( newRow );
}
}
result.setAttributes( targetRelation->getAttributes( ) );
result.setKeys( targetRelation->getKeys() );
return result;
}
示例2: removeCondition
void Creature::removeCondition(const Creature* attacker, ConditionType_t type)
{
ConditionList tmpList = conditions;
for(ConditionList::iterator it = tmpList.begin(); it != tmpList.end(); ++it)
{
if((*it)->getType() == type)
onCombatRemoveCondition(attacker, *it);
}
}
示例3: removeCondition
void Creature::removeCondition(const std::string& name, const CombatSource& combatSource)
{
ConditionList tmpList = conditions;
for(ConditionList::iterator it = tmpList.begin(); it != tmpList.end(); ++it){
if((*it)->getName() == name){
onCombatRemoveCondition(combatSource, *it);
}
}
}
示例4: NeedsPhaseUpdateWithData
bool PhaseMgr::NeedsPhaseUpdateWithData(PhaseUpdateData const updateData) const
{
PhaseDefinitionStore::const_iterator itr = _PhaseDefinitionStore->find(player->GetZoneId());
if (itr != _PhaseDefinitionStore->end())
{
for (PhaseDefinitionContainer::const_iterator phase = itr->second.begin(); phase != itr->second.end(); ++phase)
{
ConditionList conditionList = sConditionMgr->GetConditionsForPhaseDefinition(phase->zoneId, phase->entry);
for (ConditionList::const_iterator condition = conditionList.begin(); condition != conditionList.end(); ++condition)
if (updateData.IsConditionRelated(*condition))
return true;
}
}
return false;
}
示例5: GetProto
bool Item::IsTargetValidForItemUse(Unit* pUnitTarget)
{
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_ITEM_REQUIRED_TARGET, GetProto()->ItemId);
if (conditions.empty())
return true;
if (!pUnitTarget)
return false;
for (ConditionList::const_iterator itr = conditions.begin(); itr != conditions.end(); ++itr)
{
ACE_Auto_Ptr<ItemRequiredTarget> irt(new ItemRequiredTarget((ItemRequiredTargetType)(*itr)->mConditionValue1, (*itr)->mConditionValue2));
if (irt->IsFitToRequirements(pUnitTarget))
return true;
}
return false;
}
示例6: GetTemplate
bool Item::IsTargetValidForItemUse(Unit* pUnitTarget)
{
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_ITEM_REQUIRED_TARGET, GetTemplate()->ItemId);
if (conditions.empty())
return true;
if (!pUnitTarget)
return false;
for (ConditionList::const_iterator itr = conditions.begin(); itr != conditions.end(); ++itr)
{
ItemRequiredTarget irt(ItemRequiredTargetType((*itr)->ConditionValue1), (*itr)->ConditionValue2);
if (irt.IsFitToRequirements(pUnitTarget))
return true;
}
return false;
}
示例7: findRelation
// Updates all of the entries in a relation that meet the specified condition
Relation* Database::update( string relationName, vector<string> attributeNames,
vector<Entry> newVals, vector<Condition> conditions ) {
Relation* targetRelation = findRelation( relationName );
vector<string> targetAttNames = targetRelation->getAttributeNames( );
vector<int> targetIndeces;
for ( unsigned i = 0; i < attributeNames.size( ); i++ ){
for ( unsigned j = 0; j < targetAttNames.size( ); j++ ){
if ( attributeNames.at( i ) == targetAttNames.at( j ) ){
targetIndeces.push_back( j );
}
}
}
ConditionList cl = ConditionList( conditions, targetRelation );
for ( int i = 0; i < targetRelation->getNumTuples( ); i++ ){
if ( cl.evalOnTuple( i ) ){
vector<Entry*> targetRow = targetRelation->getRow( i );
for ( unsigned j = 0; j < targetIndeces.size( ); j++ ){
delete targetRow.at( targetIndeces.at( j ) );
targetRow.at( targetIndeces.at( j ) ) = new Entry( newVals.at( j ) );
}
targetRelation->updateRow( targetRow, i );
}
}
return targetRelation;
}
示例8: InvalidConditionException
BinaryLogicalCondition::BinaryLogicalCondition(ConditionList& conditions):
Condition(Condition::BinLogicCon),
conditions(conditions)
{
if(conditions.size() ==0){
throw InvalidConditionException("Sorry bud, but you gotta at least give me one condition "
"when you're constructing a BinaryLogicalCondition. Looks like you didn't. I'm just gonna "
"chalk it up a silly little mistake though. Take a look over your conditions again and make sure "
"you don't ever give any of your BinaryLogicConditions and empty condition list.\n\n"
"Error: Empty condition list given to a BinaryLogicalCondition constructor.");
}
}