CMdELogicCondition Class Reference

class CMdELogicCondition

Logic conditions are used for combining other conditions with boolean AND or OR operators. Each logic condition can have an unlimited number of child conditions. The same operator is applied to all of the child conditions: (X and Y and Z), (X or Y or Z).

CMdELogicCondition provides a number of factory methods for creating and adding new nodes as children of the logic condition node. Always use the factory methods when constructing a query condition tree.

A logic condition node owns all of its children.

Public Member Functions
~CMdELogicCondition()
IMPORT_C CMdEEventCondition &AddEventConditionL()
IMPORT_C CMdEEventCondition &AddEventConditionL(TItemId)
IMPORT_C CMdEEventCondition &AddEventConditionL(const CMdEEventDef &)
IMPORT_C CMdEEventCondition &AddEventConditionL(const TMdETimeRange &)
IMPORT_C CMdEEventCondition &AddEventConditionL(TEventConditionCompareMethod, const TDesC &)
IMPORT_C CMdEEventCondition &AddEventConditionL(const TMdETimeRange &, TEventConditionCompareMethod, const TDesC &)
IMPORT_C CMdELogicCondition &AddLogicConditionL(TLogicConditionOperator)
IMPORT_C CMdEObjectCondition &AddObjectConditionL(const CMdEObjectDef &)
IMPORT_C CMdEObjectCondition &AddObjectConditionL(TItemId)
IMPORT_C CMdEObjectCondition &AddObjectConditionL(const RArray< TItemId > &)
IMPORT_C CMdEObjectCondition &AddObjectConditionL(TInt64, TInt64)
IMPORT_C CMdEObjectCondition &AddObjectConditionL(TObjectConditionCompareMethod, const TDesC &)
IMPORT_C CMdEObjectCondition &AddObjectConditionL(const TMdEUintRange &)
IMPORT_C CMdEPropertyCondition &AddPropertyConditionL(const CMdEPropertyDef &)
IMPORT_C CMdEBoolPropertyCondition &AddPropertyConditionL(const CMdEPropertyDef &, TBool)
IMPORT_C CMdEIntRangePropertyCondition &AddPropertyConditionL(const CMdEPropertyDef &, const TMdEIntRange &)
IMPORT_C CMdEInt64RangePropertyCondition &AddPropertyConditionL(const CMdEPropertyDef &, const TMdEInt64Range &)
IMPORT_C CMdEUintRangePropertyCondition &AddPropertyConditionL(const CMdEPropertyDef &, const TMdEUintRange &)
IMPORT_C CMdERealRangePropertyCondition &AddPropertyConditionL(const CMdEPropertyDef &, const TMdERealRange &)
IMPORT_C CMdETimeRangePropertyCondition &AddPropertyConditionL(const CMdEPropertyDef &, const TMdETimeRange &)
IMPORT_C CMdETextPropertyCondition &AddPropertyConditionL(const CMdEPropertyDef &, TTextPropertyConditionCompareMethod, const TDesC &)
IMPORT_C CMdERelationCondition &AddRelationConditionL(TItemId, TRelationConditionSide)
IMPORT_C CMdERelationCondition &AddRelationConditionL(RArray< TItemId > &, TRelationConditionSide)
IMPORT_C CMdERelationCondition &AddRelationConditionL(TRelationConditionSide)
IMPORT_C CMdERelationCondition &AddRelationConditionL(const CMdERelationDef &, TRelationConditionSide)
IMPORT_C CMdERelationCondition &AddRelationConditionL(const CMdERelationDef &, const TMdEIntRange &, TRelationConditionSide)
IMPORT_C CMdECondition &Condition(TInt)
IMPORT_C TIntCount()
TUint32 InternalQueryOptimizationFlags(TUint32 &)
IMPORT_C CMdELogicCondition *NewL(TLogicConditionOperator)
IMPORT_C CMdELogicCondition *NewLC(TLogicConditionOperator)
IMPORT_C TLogicConditionOperatorOperator()
IMPORT_C voidRemove(TInt)
TUint32 RequiredBufferSize()
voidSerializeL(CMdCSerializationBuffer &, TMdCOffset &)
voidSetLocked(TBool)
IMPORT_C voidSetOperator(TLogicConditionOperator)
Protected Member Functions
CMdELogicCondition(TLogicConditionOperator)
CMdECondition &AddL(CMdECondition *)
voidConstructL()
Private Attributes
RPointerArray< CMdECondition >iChildren
TLogicConditionOperatoriOperator
TUint32 iOptimizationFlags

Constructor & Destructor Documentation

CMdELogicCondition(TLogicConditionOperator)

CMdELogicCondition(TLogicConditionOperatoraOperator)[protected]

Constructor.

Parameters

TLogicConditionOperator aOperatorLogic operator.

~CMdELogicCondition()

~CMdELogicCondition()[virtual]

Destructor.

Member Functions Documentation

AddEventConditionL()

IMPORT_C CMdEEventCondition &AddEventConditionL()

Creates a new event condition and makes it a child condition of this logic condition node. The new event condition contains no parameters by default. It is assumed that the event condition is augmented with further conditions for the object to which the event is attached.

panic
TMdEPanic::EConditionLocked Condition node is locked.

AddEventConditionL(TItemId)

IMPORT_C CMdEEventCondition &AddEventConditionL(TItemIdaEventId)

Creates a new event condition and makes it a child condition of this logic condition node. The new event condition tests the event's type. The event condition can be augmented with further conditions for the object to which the event is attached.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

TItemId aEventIdEvent ID.

AddEventConditionL(const CMdEEventDef &)

IMPORT_C CMdEEventCondition &AddEventConditionL(const CMdEEventDef &aEventDef)

Creates a new event condition and makes it a child condition of this logic condition node. The new event condition tests the event's type. The event condition can be augmented with further conditions for the object to which the event is attached.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

const CMdEEventDef & aEventDefEvent definition.

AddEventConditionL(const TMdETimeRange &)

IMPORT_C CMdEEventCondition &AddEventConditionL(const TMdETimeRange &aCreationTimeRange)

Creates a new event condition and makes it a child condition of this logic condition node. The new event condition tests the event's creation time. The event condition can be augmented with further conditions for the object to which the event is attached.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

const TMdETimeRange & aCreationTimeRangeTime range.

AddEventConditionL(TEventConditionCompareMethod, const TDesC &)

IMPORT_C CMdEEventCondition &AddEventConditionL(TEventConditionCompareMethodaCompareMethod,
const TDesC &aString
)

Creates a new event condition and makes it a child condition of this logic condition node. The new event condition tests the event's source or participant. The event condition can be augmented with further conditions for the object to which the event is attached.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

TEventConditionCompareMethod aCompareMethodComparison method.
const TDesC & aStringText string to look for.

AddEventConditionL(const TMdETimeRange &, TEventConditionCompareMethod, const TDesC &)

IMPORT_C CMdEEventCondition &AddEventConditionL(const TMdETimeRange &aCreationTimeRange,
TEventConditionCompareMethodaCompareMethod,
const TDesC &aString
)

Creates a new event condition and makes it a child condition of this logic condition node. The new event condition tests the event's creation time. The new event condition also tests the event's source or participant. The event condition can be augmented with further conditions for the object to which the event is attached.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

const TMdETimeRange & aCreationTimeRangeTime range.
TEventConditionCompareMethod aCompareMethodComparison method.
const TDesC & aStringText string to look for.

AddL(CMdECondition *)

CMdECondition &AddL(CMdECondition *aCondition)[protected]

Makes an existing condition node a child node of this logic condition. The logic condition takes ownership of the node.

Parameters

CMdECondition * aConditionCondition node.

AddLogicConditionL(TLogicConditionOperator)

IMPORT_C CMdELogicCondition &AddLogicConditionL(TLogicConditionOperatoraLogicOperator)

Creates a new logic condition and makes it a child condition of this logic condition node.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

TLogicConditionOperator aLogicOperatorOperator of the new logic condition.

AddObjectConditionL(const CMdEObjectDef &)

IMPORT_C CMdEObjectCondition &AddObjectConditionL(const CMdEObjectDef &aObjectDef)

Creates a new object condition and makes it a child condition of this logic condition node. The object condition node sets a requirement for the object class.

Example: // We want the condition to match with image objects. CMdELogicCondition* condition = CMdELogicCondition::NewL( ELogicConditionOperatorAnd ); CleanupStack::PushL( condition );

CMdENamespaceDef& defaultNamespace = iMdeSession->GetDefaultNamespaceDefL(); CMdEObjectDef& imageDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject ); condition->AddObjectConditionL( imageDef );

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

const CMdEObjectDef & aObjectDefObject definition.

AddObjectConditionL(TItemId)

IMPORT_C CMdEObjectCondition &AddObjectConditionL(TItemIdaObjectId)

Creates a new object condition and makes it a child condition of this logic condition node. The object condition node sets a requirement for the object's ID number.

Example: CMdERelationQuery* relationQuery = iMdeSession->NewRelationQueryL( defNamespace, this ); CMdERelationCondition& filterCond = relationQuery->Conditions(). AddRelationConditionL( ERelationConditionSideRight ); // Left object in relation must have this ID. filterCond.LeftL().AddObjectConditionL( aObjectId );

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

TItemId aObjectIdID number of the object.

AddObjectConditionL(const RArray< TItemId > &)

IMPORT_C CMdEObjectCondition &AddObjectConditionL(const RArray< TItemId > &aObjectIds)

Creates a new object condition and makes it a child condition of this logic condition node. The object condition node sets a requirement for the objects' ID numbers.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

const RArray< TItemId > & aObjectIds

AddObjectConditionL(TInt64, TInt64)

IMPORT_C CMdEObjectCondition &AddObjectConditionL(TInt64aObjectGuidHigh,
TInt64aObjectGuidLow
)

Creates a new object condition and makes it a child condition of this logic condition node. The object condition node sets a requirement for the object's GUID.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

TInt64 aObjectGuidHighGUID high part of the object.
TInt64 aObjectGuidLowGUID low part of the object.

AddObjectConditionL(TObjectConditionCompareMethod, const TDesC &)

IMPORT_C CMdEObjectCondition &AddObjectConditionL(TObjectConditionCompareMethodaCompareMethod,
const TDesC &aString
)

Creates a new object condition and makes it a child condition of this logic condition node.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

TObjectConditionCompareMethod aCompareMethodComparison method.
const TDesC & aStringText string to look for.

AddObjectConditionL(const TMdEUintRange &)

IMPORT_C CMdEObjectCondition &AddObjectConditionL(const TMdEUintRange &aRange)

Creates a new object condition and makes it a child condition of this logic condition node.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

const TMdEUintRange & aRangerange for usage count

AddPropertyConditionL(const CMdEPropertyDef &)

IMPORT_C CMdEPropertyCondition &AddPropertyConditionL(const CMdEPropertyDef &aPropertyDef)

Creates a new property condition and makes it a child condition of this logic condition node. The property condition tests if a property exists in an object.

Example: CMdEPropertyDef& commentDef = objDef.GetPropertyDefL( MdeConstants::MediaObject::KCommentProperty ); iQuery->Conditions().AddPropertyConditionL( commentDef );

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

const CMdEPropertyDef & aPropertyDefThe property to look for.

AddPropertyConditionL(const CMdEPropertyDef &, TBool)

IMPORT_C CMdEBoolPropertyCondition &AddPropertyConditionL(const CMdEPropertyDef &aPropertyDef,
TBoolaBoolValue
)

Creates a new boolean property condition and makes it a child condition of this logic condition node. The property condition tests the value of a boolean property.

Example: CMdEPropertyDef& commentDef = objDef.GetPropertyDefL( MdeConstants::MediaObject::KProtectedProperty ); iQuery->Conditions().AddPropertyConditionL( commentDef, ETrue );

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

const CMdEPropertyDef & aPropertyDefProperty definition.
TBool aBoolValueBoolean value.

AddPropertyConditionL(const CMdEPropertyDef &, const TMdEIntRange &)

IMPORT_C CMdEIntRangePropertyCondition &AddPropertyConditionL(const CMdEPropertyDef &aPropertyDef,
const TMdEIntRange &aIntRange
)

Creates a new integer property condition and makes it a child condition of this logic condition node. The property condition defines a range of integer values. If the property's value is within the range the condition evaluates to True.

Example: CMdEPropertyDef& frameCountDef = objDef.GetPropertyDefL( MdeConstants::Image::FrameCount ); iQuery->Conditions().AddPropertyConditionL( frameCountDef, TMdEIntRange(0, 5, rangeType) );

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

const CMdEPropertyDef & aPropertyDefProperty definition.
const TMdEIntRange & aIntRangeRange of integer values.

AddPropertyConditionL(const CMdEPropertyDef &, const TMdEInt64Range &)

IMPORT_C CMdEInt64RangePropertyCondition &AddPropertyConditionL(const CMdEPropertyDef &aPropertyDef,
const TMdEInt64Range &aIntRange
)

Creates a new 64 bit integer property condition and makes it a child condition of this logic condition node. The property condition defines a range of integer values. If the property's value is within the range the condition evaluates to True.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

const CMdEPropertyDef & aPropertyDefProperty definition.
const TMdEInt64Range & aIntRange

AddPropertyConditionL(const CMdEPropertyDef &, const TMdEUintRange &)

IMPORT_C CMdEUintRangePropertyCondition &AddPropertyConditionL(const CMdEPropertyDef &aPropertyDef,
const TMdEUintRange &aUintRange
)

Creates a new unsigned integer property condition and makes it a child condition of this logic condition node. The property condition defines a range of unsigned integer values. If the property's value is within the range the condition evaluates to True.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

const CMdEPropertyDef & aPropertyDefProperty definition.
const TMdEUintRange & aUintRangeRange of unsigned integer values.

AddPropertyConditionL(const CMdEPropertyDef &, const TMdERealRange &)

IMPORT_C CMdERealRangePropertyCondition &AddPropertyConditionL(const CMdEPropertyDef &aPropertyDef,
const TMdERealRange &aRealRange
)

Creates a new floating-point property condition and makes it a child condition of this logic condition node. The property condition defines a range of floating-point values. If the property's value is within the range the condition evaluates to True.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

const CMdEPropertyDef & aPropertyDefProperty definition.
const TMdERealRange & aRealRangeRange of floating-point values.

AddPropertyConditionL(const CMdEPropertyDef &, const TMdETimeRange &)

IMPORT_C CMdETimeRangePropertyCondition &AddPropertyConditionL(const CMdEPropertyDef &aPropertyDef,
const TMdETimeRange &aTimeRange
)

Creates a new time property condition and makes it a child condition of this logic condition node. The property condition defines a range of time values. If the property's value is within the range the condition evaluates to True.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

const CMdEPropertyDef & aPropertyDefProperty definition.
const TMdETimeRange & aTimeRangeRange of time values.

AddPropertyConditionL(const CMdEPropertyDef &, TTextPropertyConditionCompareMethod, const TDesC &)

IMPORT_C CMdETextPropertyCondition &AddPropertyConditionL(const CMdEPropertyDef &aPropertyDef,
TTextPropertyConditionCompareMethodaCompareMethod,
const TDesC &aText
)

Creates a new text property condition and makes it a child condition of this logic condition node.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

const CMdEPropertyDef & aPropertyDefProperty definition.
TTextPropertyConditionCompareMethod aCompareMethodComparison method.
const TDesC & aTextText string to look for.

AddRelationConditionL(TItemId, TRelationConditionSide)

IMPORT_C CMdERelationCondition &AddRelationConditionL(TItemIdaRelationId,
TRelationConditionSideaSide = ERelationConditionSideEither
)

Creates a new relation condition and makes it a child condition of this logic condition node. The new relation condition contains no parameters by default. It is assumed that the relation condition is augmented with further conditions for the objects to which the relation is attached.

Example: TItemId relationId( 1 ); CMdERelationCondition& relationCond = relationQuery->Conditions(). AddRelationConditionL( relationId, ERelationConditionSideRight );

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

TItemId aRelationIdRelation ID.
TRelationConditionSide aSide = ERelationConditionSideEitherThe side on which an object must be.

AddRelationConditionL(RArray< TItemId > &, TRelationConditionSide)

IMPORT_C CMdERelationCondition &AddRelationConditionL(RArray< TItemId > &aRelationIds,
TRelationConditionSideaSide = ERelationConditionSideEither
)

Creates a new relation condition and makes it a child condition of this logic condition node. The new relation condition contains no parameters by default. It is assumed that the relation condition is augmented with further conditions for the objects to which the relation is attached.

Example: RArray<TItemId> arrayOfIds; arrayOfIds.Append( TItemId( 1 ) ); arrayOfIds.Append( TItemId( 2 ) ); CMdERelationCondition& relationCond = relationQuery->Conditions(). AddRelationConditionL( arrayOfIds, ERelationConditionSideRight );

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

RArray< TItemId > & aRelationIdsArray of Relation IDs.
TRelationConditionSide aSide = ERelationConditionSideEitherThe side on which an object must be.

AddRelationConditionL(TRelationConditionSide)

IMPORT_C CMdERelationCondition &AddRelationConditionL(TRelationConditionSideaSide = ERelationConditionSideEither)

Creates a new relation condition and makes it a child condition of this logic condition node. The new relation condition contains no parameters by default. It is assumed that the relation condition is augmented with further conditions for the objects to which the relation is attached.

Example: CMdERelationCondition& relationCond = relationQuery->Conditions(). AddRelationConditionL( ERelationConditionSideRight );

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

TRelationConditionSide aSide = ERelationConditionSideEitherThe side on which an object must be.

AddRelationConditionL(const CMdERelationDef &, TRelationConditionSide)

IMPORT_C CMdERelationCondition &AddRelationConditionL(const CMdERelationDef &aRelationDef,
TRelationConditionSideaSide = ERelationConditionSideEither
)

Creates a new relation condition and makes it a child condition of this logic condition node. The new relation condition tests the relation's type. The relation condition can be augmented with further conditions for the objects to which the relation is attached.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

const CMdERelationDef & aRelationDefrelation definition
TRelationConditionSide aSide = ERelationConditionSideEitherThe side on which an object must be. Defaults to ERelationConditionSideEither.

AddRelationConditionL(const CMdERelationDef &, const TMdEIntRange &, TRelationConditionSide)

IMPORT_C CMdERelationCondition &AddRelationConditionL(const CMdERelationDef &aRelationDef,
const TMdEIntRange &aIntRange,
TRelationConditionSideaSide = ERelationConditionSideEither
)

Creates a new relation condition and makes it a child condition of this logic condition node. The new relation condition tests the relation's type. The relation condition can be augmented with further conditions for the objects to which the relation is attached.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

const CMdERelationDef & aRelationDefrelation definition
const TMdEIntRange & aIntRangeparameter range conditions
TRelationConditionSide aSide = ERelationConditionSideEitherThe side on which an object must be.

Condition(TInt)

IMPORT_C CMdECondition &Condition(TIntaIndex)const

Returns a child condition node.

Parameters

TInt aIndexIndex of the condition to return.

ConstructL()

voidConstructL()[protected]

Second-phase constructor.

Count()

IMPORT_C TIntCount()const

Determines the number of child conditions.

InternalQueryOptimizationFlags(TUint32 &)

TUint32 InternalQueryOptimizationFlags(TUint32 &aFlags)

Get possible query's internal optimization flags from condition.

Parameters

TUint32 & aFlags

NewL(TLogicConditionOperator)

IMPORT_C CMdELogicCondition *NewL(TLogicConditionOperatoraOperator)[static]

Constructs a new logic condition node.

Parameters

TLogicConditionOperator aOperatorOperator to use for the child conditions.

NewLC(TLogicConditionOperator)

IMPORT_C CMdELogicCondition *NewLC(TLogicConditionOperatoraOperator)[static]

Constructs a new logic condition node, leaving the node on the cleanup stack.

Parameters

TLogicConditionOperator aOperatorOperator to use for the child conditions.

Operator()

IMPORT_C TLogicConditionOperatorOperator()const

Returns the operator of the logic condition.

Remove(TInt)

IMPORT_C voidRemove(TIntaIndex)

Removes a condition node from the logic condition.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

TInt aIndexIndex of the condition to remove.

RequiredBufferSize()

TUint32 RequiredBufferSize()const

Get required size of serialized buffer when this is serialized.

SerializeL(CMdCSerializationBuffer &, TMdCOffset &)

voidSerializeL(CMdCSerializationBuffer &aBuffer,
TMdCOffset &aFreespaceOffset
)const

Serialize own data to serialized buffer (correct position must be set before calling).

Parameters

CMdCSerializationBuffer & aBufferserialized buffer.
TMdCOffset & aFreespaceOffset

SetLocked(TBool)

voidSetLocked(TBoolaLocked = ETrue)

Locking a logic condition causes all children to be locked as well. Attempting to modify a locked condition causes a panic.

Parameters

TBool aLocked = ETrueETrue to lock; EFalse to unlock.

SetOperator(TLogicConditionOperator)

IMPORT_C voidSetOperator(TLogicConditionOperatoraLogicOperator)

Changes the operator of the logic condition.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

TLogicConditionOperator aLogicOperatorThe new logic operator for the condition.

Member Data Documentation

RPointerArray< CMdECondition > iChildren

RPointerArray< CMdECondition >iChildren[private]

Children of the condition. The logic condition owns all the child nodes.

TLogicConditionOperator iOperator

TLogicConditionOperatoriOperator[private]

Type of the condition.

TUint32 iOptimizationFlags

TUint32 iOptimizationFlags[private]