contentstorage/cautils/src/cainnerquery.cpp
changeset 61 8e5041d13c84
parent 60 f62f87b200ec
child 104 9b022b1f357c
--- a/contentstorage/cautils/src/cainnerquery.cpp	Fri Mar 19 09:35:23 2010 +0200
+++ b/contentstorage/cautils/src/cainnerquery.cpp	Fri Apr 16 15:16:09 2010 +0300
@@ -30,6 +30,7 @@
     {
     delete iEntryTypeNames;
     iIds.Close();
+    iAttributes.ResetAndDestroy();
     }
 
 // ---------------------------------------------------------------------------
@@ -81,6 +82,8 @@
         aStream.WriteL( iEntryTypeNames->MdcaPoint( i ),
                 iEntryTypeNames->MdcaPoint( i ).Length() );
         }
+    iAttributes.ExternalizeL( aStream );
+    aStream.CommitL();
     }
 
 // ---------------------------------------------------------------------------
@@ -114,6 +117,7 @@
         iEntryTypeNames->AppendL( buf );
         CleanupStack::PopAndDestroy( &buf );
         }
+    iAttributes.InternalizeL( aStream );
     }
 
 // ---------------------------------------------------------------------------
@@ -124,8 +128,7 @@
     {
     iEntryTypeNames = new ( ELeave ) CDesC16ArrayFlat( KDefaultGranularity );
     iParentId = -1;
-    //    TODO Item | Group
-    iRole = CCaInnerQuery::Item | CCaInnerQuery::Group;
+    iRole = Item | Group;
     }
 
 // ---------------------------------------------------------------------------
@@ -190,7 +193,6 @@
 //
 EXPORT_C void CCaInnerQuery::SetEntryTypeNames( CDesC16ArrayFlat* aArray )
     {
-    //TODO: Quickt setter for now, probably sth more convinient needed
     ASSERT( aArray );
     delete iEntryTypeNames;
     iEntryTypeNames = aArray;
@@ -302,3 +304,30 @@
     {
     return iCount;
     }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCaInnerQuery::AddAttributeL( const TDesC& aKey,
+        const TDesC& aValue )
+    {
+    // to avoid duplicated attribute
+    if( iAttributes.Exist( aKey ) )
+        {
+        iAttributes.RemoveAttribute( aKey );
+        }
+    CCaEntryAttribute* attr = CCaEntryAttribute::NewLC( aKey );
+    attr->SetValueL( aValue );
+    iAttributes.AppendL( attr );
+    CleanupStack::Pop( attr );
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const RCaEntryAttrArray& CCaInnerQuery::GetAttributes() const
+    {
+    return iAttributes;
+    }