upnpsharing/upnpcontentserver/src/upnpselectionwriter.cpp
branchnew development branch with rendering state machine and other goodies
changeset 38 5360b7ddc251
parent 0 7f85d04be362
equal deleted inserted replaced
32:3785f754ee62 38:5360b7ddc251
    68     {
    68     {
    69     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
    69     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
    70     iMediaType = aMediaType;
    70     iMediaType = aMediaType;
    71 
    71 
    72     iFileArray = new (ELeave) CDesCArrayFlat(4);
    72     iFileArray = new (ELeave) CDesCArrayFlat(4);
    73     iOkItems.Reset();
       
    74 
    73 
    75     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
    74     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
    76     }
    75     }
    77 
    76 
    78 
    77 
    96 CUpnpSelectionWriter::~CUpnpSelectionWriter()
    95 CUpnpSelectionWriter::~CUpnpSelectionWriter()
    97     {
    96     {
    98     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
    97     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
    99 
    98 
   100     delete iFileArray;
    99     delete iFileArray;
   101     iOkItems.Reset();
       
   102     delete iRepository;
   100     delete iRepository;
   103 
   101 
   104     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
   102     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
   105     }
   103     }
   106 
   104 
   111 //
   109 //
   112 void CUpnpSelectionWriter::AppendItemL( const TPtrC aNewObject)
   110 void CUpnpSelectionWriter::AppendItemL( const TPtrC aNewObject)
   113     {
   111     {
   114     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
   112     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
   115     iFileArray->AppendL( aNewObject  );
   113     iFileArray->AppendL( aNewObject  );
   116     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
       
   117     }
       
   118 
       
   119 // --------------------------------------------------------------------------
       
   120 // CUpnpSelectionWriter::AppendStatusL
       
   121 // ( other items were commented in header )
       
   122 // --------------------------------------------------------------------------
       
   123 //
       
   124 void CUpnpSelectionWriter::AppendStatusL( TInt aIndex )
       
   125     {
       
   126     __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
       
   127     iOkItems.AppendL( aIndex  );
       
   128     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
   114     __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
   129     }
   115     }
   130 
   116 
   131 // --------------------------------------------------------------------------
   117 // --------------------------------------------------------------------------
   132 // CUpnpSelectionWriter::SaveSharingState
   118 // CUpnpSelectionWriter::SaveSharingState
   231             RFileWriteStream writeStream(file);
   217             RFileWriteStream writeStream(file);
   232             CleanupClosePushL( writeStream );
   218             CleanupClosePushL( writeStream );
   233 
   219 
   234             for (TInt index = 0; index < iFileArray->Count(); index++)
   220             for (TInt index = 0; index < iFileArray->Count(); index++)
   235                 {
   221                 {
   236                 // check that sharing of the container was succesful
   222                 writeStream << iFileArray->MdcaPoint(index);
   237                 if ( iOkItems.Find( index ) != KErrNotFound )
       
   238                     {
       
   239                     // Write identifiers to the file
       
   240                     writeStream << iFileArray->MdcaPoint(index);
       
   241                     }
       
   242                 }
   223                 }
   243 
   224 
   244             // Clean up
   225             // Clean up
   245             CleanupStack::PopAndDestroy(&writeStream); // Close writeStream
   226             CleanupStack::PopAndDestroy(&writeStream); // Close writeStream
   246             CleanupStack::PopAndDestroy(&file); // Close file
   227             CleanupStack::PopAndDestroy(&file); // Close file