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 TInt Count ()
TUint32 InternalQueryOptimizationFlags ( TUint32 &)
IMPORT_C CMdELogicCondition * NewL (TLogicConditionOperator)
IMPORT_C CMdELogicCondition * NewLC (TLogicConditionOperator)
IMPORT_C TLogicConditionOperator Operator ()
IMPORT_C void Remove ( TInt )
TUint32 RequiredBufferSize ()
void SerializeL (CMdCSerializationBuffer &, TMdCOffset &)
void SetLocked ( TBool )
IMPORT_C void SetOperator (TLogicConditionOperator)
Protected Member Functions
CMdELogicCondition (TLogicConditionOperator)
CMdECondition & AddL (CMdECondition *)
void ConstructL ()
Private Attributes
RPointerArray < CMdECondition > iChildren
TLogicConditionOperator iOperator
TUint32 iOptimizationFlags

Constructor & Destructor Documentation

CMdELogicCondition(TLogicConditionOperator)

CMdELogicCondition ( TLogicConditionOperator aOperator ) [protected]

Constructor.

Parameters

TLogicConditionOperator aOperator Logic 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 ( TItemId aEventId )

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 aEventId Event 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 & aEventDef Event 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 & aCreationTimeRange Time range.

AddEventConditionL(TEventConditionCompareMethod, const TDesC &)

IMPORT_C CMdEEventCondition & AddEventConditionL ( TEventConditionCompareMethod aCompareMethod,
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 aCompareMethod Comparison method.
const TDesC & aString Text string to look for.

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

IMPORT_C CMdEEventCondition & AddEventConditionL ( const TMdETimeRange & aCreationTimeRange,
TEventConditionCompareMethod aCompareMethod,
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 & aCreationTimeRange Time range.
TEventConditionCompareMethod aCompareMethod Comparison method.
const TDesC & aString Text 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 * aCondition Condition node.

AddLogicConditionL(TLogicConditionOperator)

IMPORT_C CMdELogicCondition & AddLogicConditionL ( TLogicConditionOperator aLogicOperator )

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 aLogicOperator Operator 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 & aObjectDef Object definition.

AddObjectConditionL(TItemId)

IMPORT_C CMdEObjectCondition & AddObjectConditionL ( TItemId aObjectId )

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 aObjectId ID 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 ( TInt64 aObjectGuidHigh,
TInt64 aObjectGuidLow
)

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 aObjectGuidHigh GUID high part of the object.
TInt64 aObjectGuidLow GUID low part of the object.

AddObjectConditionL(TObjectConditionCompareMethod, const TDesC &)

IMPORT_C CMdEObjectCondition & AddObjectConditionL ( TObjectConditionCompareMethod aCompareMethod,
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 aCompareMethod Comparison method.
const TDesC & aString Text 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 & aRange range 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 & aPropertyDef The property to look for.

AddPropertyConditionL(const CMdEPropertyDef &, TBool)

IMPORT_C CMdEBoolPropertyCondition & AddPropertyConditionL ( const CMdEPropertyDef & aPropertyDef,
TBool aBoolValue
)

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 & aPropertyDef Property definition.
TBool aBoolValue Boolean 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 & aPropertyDef Property definition.
const TMdEIntRange & aIntRange Range 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 & aPropertyDef Property 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 & aPropertyDef Property definition.
const TMdEUintRange & aUintRange Range 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 & aPropertyDef Property definition.
const TMdERealRange & aRealRange Range 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 & aPropertyDef Property definition.
const TMdETimeRange & aTimeRange Range of time values.

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

IMPORT_C CMdETextPropertyCondition & AddPropertyConditionL ( const CMdEPropertyDef & aPropertyDef,
TTextPropertyConditionCompareMethod aCompareMethod,
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 & aPropertyDef Property definition.
TTextPropertyConditionCompareMethod aCompareMethod Comparison method.
const TDesC & aText Text string to look for.

AddRelationConditionL(TItemId, TRelationConditionSide)

IMPORT_C CMdERelationCondition & AddRelationConditionL ( TItemId aRelationId,
TRelationConditionSide aSide = 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 aRelationId Relation ID.
TRelationConditionSide aSide = ERelationConditionSideEither The side on which an object must be.

AddRelationConditionL(RArray< TItemId > &, TRelationConditionSide)

IMPORT_C CMdERelationCondition & AddRelationConditionL ( RArray < TItemId > & aRelationIds,
TRelationConditionSide aSide = 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 > & aRelationIds Array of Relation IDs.
TRelationConditionSide aSide = ERelationConditionSideEither The side on which an object must be.

AddRelationConditionL(TRelationConditionSide)

IMPORT_C CMdERelationCondition & AddRelationConditionL ( TRelationConditionSide aSide = 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 = ERelationConditionSideEither The side on which an object must be.

AddRelationConditionL(const CMdERelationDef &, TRelationConditionSide)

IMPORT_C CMdERelationCondition & AddRelationConditionL ( const CMdERelationDef & aRelationDef,
TRelationConditionSide aSide = 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 & aRelationDef relation definition
TRelationConditionSide aSide = ERelationConditionSideEither The 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,
TRelationConditionSide aSide = 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 & aRelationDef relation definition
const TMdEIntRange & aIntRange parameter range conditions
TRelationConditionSide aSide = ERelationConditionSideEither The side on which an object must be.

Condition(TInt)

IMPORT_C CMdECondition & Condition ( TInt aIndex ) const

Returns a child condition node.

Parameters

TInt aIndex Index of the condition to return.

ConstructL()

void ConstructL ( ) [protected]

Second-phase constructor.

Count()

IMPORT_C TInt Count ( ) 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 ( TLogicConditionOperator aOperator ) [static]

Constructs a new logic condition node.

Parameters

TLogicConditionOperator aOperator Operator to use for the child conditions.

NewLC(TLogicConditionOperator)

IMPORT_C CMdELogicCondition * NewLC ( TLogicConditionOperator aOperator ) [static]

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

Parameters

TLogicConditionOperator aOperator Operator to use for the child conditions.

Operator()

IMPORT_C TLogicConditionOperator Operator ( ) const

Returns the operator of the logic condition.

Remove(TInt)

IMPORT_C void Remove ( TInt aIndex )

Removes a condition node from the logic condition.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

TInt aIndex Index of the condition to remove.

RequiredBufferSize()

TUint32 RequiredBufferSize ( ) const

Get required size of serialized buffer when this is serialized.

SerializeL(CMdCSerializationBuffer &, TMdCOffset &)

void SerializeL ( CMdCSerializationBuffer & aBuffer,
TMdCOffset & aFreespaceOffset
) const

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

Parameters

CMdCSerializationBuffer & aBuffer serialized buffer.
TMdCOffset & aFreespaceOffset

SetLocked(TBool)

void SetLocked ( TBool aLocked = 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 = ETrue ETrue to lock; EFalse to unlock.

SetOperator(TLogicConditionOperator)

IMPORT_C void SetOperator ( TLogicConditionOperator aLogicOperator )

Changes the operator of the logic condition.

panic
TMdEPanic::EConditionLocked Condition node is locked.

Parameters

TLogicConditionOperator aLogicOperator The 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

TLogicConditionOperator iOperator [private]

Type of the condition.

TUint32 iOptimizationFlags

TUint32 iOptimizationFlags [private]