xdmprotocols/LocalProtocol/src/LocalDirectoryEntry.cpp
branchRCL_3
changeset 17 2669f8761a99
parent 16 2580314736af
child 18 fbd2e7cec7ef
equal deleted inserted replaced
16:2580314736af 17:2669f8761a99
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: CLocalDirectoryEntry
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include "LocalProtocol.h"
       
    22 #include "LocalDocument.h"
       
    23 #include "LocalDirectoryEntry.h"
       
    24 
       
    25 // ----------------------------------------------------
       
    26 // CLocalDirectoryEntry::CLocalDirectoryEntry
       
    27 // 
       
    28 // ----------------------------------------------------
       
    29 //
       
    30 CLocalDirectoryEntry::CLocalDirectoryEntry()
       
    31     {
       
    32     }
       
    33 
       
    34 // ----------------------------------------------------
       
    35 // CLocalDirectoryEntry::CLocalDirectoryEntry
       
    36 // 
       
    37 // ----------------------------------------------------
       
    38 //
       
    39 CLocalDirectoryEntry* CLocalDirectoryEntry::NewL( const TDesC& aFileName )
       
    40     {
       
    41     CLocalDirectoryEntry* self = new ( ELeave ) CLocalDirectoryEntry();
       
    42     CleanupStack::PushL( self );
       
    43     self->ConstructL( aFileName );
       
    44     CleanupStack::Pop();
       
    45     return self;
       
    46     }
       
    47 
       
    48 // ----------------------------------------------------
       
    49 // CLocalDirectoryEntry::ConstructL
       
    50 // 
       
    51 // ----------------------------------------------------
       
    52 //
       
    53 void CLocalDirectoryEntry::ConstructL( const TDesC& aFileName )
       
    54     {
       
    55     TChar comma = 46;
       
    56     TInt index = aFileName.LocateReverse( comma );
       
    57     TPtrC temp = aFileName.Left( index );
       
    58     iTimeStampEntryName = HBufC::NewL( temp.Length() );
       
    59     iTimeStampEntryName->Des().Copy( temp );
       
    60     }
       
    61 
       
    62 // ----------------------------------------------------
       
    63 // CLocalDirectoryEntry::EntryName
       
    64 // 
       
    65 // ----------------------------------------------------
       
    66 //   
       
    67 TPtrC CLocalDirectoryEntry::EntryName() const
       
    68     {
       
    69     return iXmlEntryName != NULL ? iXmlEntryName->Des() : TPtrC();
       
    70     }
       
    71 
       
    72 // ----------------------------------------------------
       
    73 // CLocalDirectoryEntry::CLocalDirectoryEntry
       
    74 // 
       
    75 // ----------------------------------------------------
       
    76 //       
       
    77 TBool CLocalDirectoryEntry::OfferEntryL( const TDesC& aEntryName )
       
    78     {
       
    79     TChar comma = 46;
       
    80     TInt index = aEntryName.LocateReverse( comma );
       
    81     TPtrC name( index > 0 ? aEntryName.Left( index ) : aEntryName );
       
    82     if( iTimeStampEntryName->Des().Compare( name ) == 0 )
       
    83         {
       
    84         iXmlEntryName = HBufC::NewL( aEntryName.Length() );
       
    85         iXmlEntryName->Des().Copy( aEntryName );
       
    86         return ETrue;
       
    87         }
       
    88     else return EFalse;
       
    89     }
       
    90 
       
    91 // ----------------------------------------------------
       
    92 // CLocalDirectoryEntry::CLocalDirectoryEntry
       
    93 // 
       
    94 // ----------------------------------------------------
       
    95 //
       
    96 CLocalDirectoryEntry::~CLocalDirectoryEntry()
       
    97     {
       
    98     delete iXmlEntryName;
       
    99     delete iTimeStampEntryName;
       
   100     }
       
   101              
       
   102 // End of File
       
   103