contentstorage/cautils/src/cainnerquery.cpp
changeset 61 8e5041d13c84
parent 60 f62f87b200ec
child 104 9b022b1f357c
equal deleted inserted replaced
60:f62f87b200ec 61:8e5041d13c84
    28 //
    28 //
    29 CCaInnerQuery::~CCaInnerQuery()
    29 CCaInnerQuery::~CCaInnerQuery()
    30     {
    30     {
    31     delete iEntryTypeNames;
    31     delete iEntryTypeNames;
    32     iIds.Close();
    32     iIds.Close();
       
    33     iAttributes.ResetAndDestroy();
    33     }
    34     }
    34 
    35 
    35 // ---------------------------------------------------------------------------
    36 // ---------------------------------------------------------------------------
    36 //
    37 //
    37 // ---------------------------------------------------------------------------
    38 // ---------------------------------------------------------------------------
    79         {
    80         {
    80         aStream.WriteInt32L( iEntryTypeNames->MdcaPoint( i ).Length() );
    81         aStream.WriteInt32L( iEntryTypeNames->MdcaPoint( i ).Length() );
    81         aStream.WriteL( iEntryTypeNames->MdcaPoint( i ),
    82         aStream.WriteL( iEntryTypeNames->MdcaPoint( i ),
    82                 iEntryTypeNames->MdcaPoint( i ).Length() );
    83                 iEntryTypeNames->MdcaPoint( i ).Length() );
    83         }
    84         }
       
    85     iAttributes.ExternalizeL( aStream );
       
    86     aStream.CommitL();
    84     }
    87     }
    85 
    88 
    86 // ---------------------------------------------------------------------------
    89 // ---------------------------------------------------------------------------
    87 //
    90 //
    88 // ---------------------------------------------------------------------------
    91 // ---------------------------------------------------------------------------
   112         buf.CreateL( length );
   115         buf.CreateL( length );
   113         aStream.ReadL( buf, length );
   116         aStream.ReadL( buf, length );
   114         iEntryTypeNames->AppendL( buf );
   117         iEntryTypeNames->AppendL( buf );
   115         CleanupStack::PopAndDestroy( &buf );
   118         CleanupStack::PopAndDestroy( &buf );
   116         }
   119         }
       
   120     iAttributes.InternalizeL( aStream );
   117     }
   121     }
   118 
   122 
   119 // ---------------------------------------------------------------------------
   123 // ---------------------------------------------------------------------------
   120 //
   124 //
   121 // ---------------------------------------------------------------------------
   125 // ---------------------------------------------------------------------------
   122 //
   126 //
   123 void CCaInnerQuery::ConstructL()
   127 void CCaInnerQuery::ConstructL()
   124     {
   128     {
   125     iEntryTypeNames = new ( ELeave ) CDesC16ArrayFlat( KDefaultGranularity );
   129     iEntryTypeNames = new ( ELeave ) CDesC16ArrayFlat( KDefaultGranularity );
   126     iParentId = -1;
   130     iParentId = -1;
   127     //    TODO Item | Group
   131     iRole = Item | Group;
   128     iRole = CCaInnerQuery::Item | CCaInnerQuery::Group;
       
   129     }
   132     }
   130 
   133 
   131 // ---------------------------------------------------------------------------
   134 // ---------------------------------------------------------------------------
   132 //
   135 //
   133 // ---------------------------------------------------------------------------
   136 // ---------------------------------------------------------------------------
   188 //
   191 //
   189 // ---------------------------------------------------------------------------
   192 // ---------------------------------------------------------------------------
   190 //
   193 //
   191 EXPORT_C void CCaInnerQuery::SetEntryTypeNames( CDesC16ArrayFlat* aArray )
   194 EXPORT_C void CCaInnerQuery::SetEntryTypeNames( CDesC16ArrayFlat* aArray )
   192     {
   195     {
   193     //TODO: Quickt setter for now, probably sth more convinient needed
       
   194     ASSERT( aArray );
   196     ASSERT( aArray );
   195     delete iEntryTypeNames;
   197     delete iEntryTypeNames;
   196     iEntryTypeNames = aArray;
   198     iEntryTypeNames = aArray;
   197     }
   199     }
   198 
   200 
   300 //
   302 //
   301 EXPORT_C TUint CCaInnerQuery::GetCount() const
   303 EXPORT_C TUint CCaInnerQuery::GetCount() const
   302     {
   304     {
   303     return iCount;
   305     return iCount;
   304     }
   306     }
       
   307 
       
   308 // ---------------------------------------------------------------------------
       
   309 //
       
   310 // ---------------------------------------------------------------------------
       
   311 //
       
   312 EXPORT_C void CCaInnerQuery::AddAttributeL( const TDesC& aKey,
       
   313         const TDesC& aValue )
       
   314     {
       
   315     // to avoid duplicated attribute
       
   316     if( iAttributes.Exist( aKey ) )
       
   317         {
       
   318         iAttributes.RemoveAttribute( aKey );
       
   319         }
       
   320     CCaEntryAttribute* attr = CCaEntryAttribute::NewLC( aKey );
       
   321     attr->SetValueL( aValue );
       
   322     iAttributes.AppendL( attr );
       
   323     CleanupStack::Pop( attr );
       
   324     }
       
   325 
       
   326 // ---------------------------------------------------------------------------
       
   327 //
       
   328 // ---------------------------------------------------------------------------
       
   329 //
       
   330 EXPORT_C const RCaEntryAttrArray& CCaInnerQuery::GetAttributes() const
       
   331     {
       
   332     return iAttributes;
       
   333     }