remotestoragefw/remotefileengine/src/rsfwdirentattr.cpp
branchRCL_3
changeset 19 88ee4cf65e19
parent 16 87c71b25c937
child 20 1aa8c82cb4cb
equal deleted inserted replaced
16:87c71b25c937 19:88ee4cf65e19
     1 /*
       
     2 * Copyright (c) 2002-2004 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:  Directory entry container
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "rsfwdirentattr.h"
       
    21 
       
    22 // ====================== CRsfwDirEntAttr MEMBER FUNCTIONS ========================
       
    23 
       
    24 // ----------------------------------------------------------------------------
       
    25 // CRsfwDirEntAttr::NewLC
       
    26 // ----------------------------------------------------------------------------
       
    27 //
       
    28 EXPORT_C CRsfwDirEntAttr* CRsfwDirEntAttr::NewLC()
       
    29     {
       
    30     CRsfwDirEntAttr* self = new (ELeave) CRsfwDirEntAttr();
       
    31     CleanupStack::PushL(self);
       
    32     self->ConstructL();
       
    33     return self;
       
    34     }
       
    35 
       
    36 // ----------------------------------------------------------------------------
       
    37 // CRsfwDirEntAttr::NewL
       
    38 // ----------------------------------------------------------------------------
       
    39 //
       
    40 EXPORT_C CRsfwDirEntAttr* CRsfwDirEntAttr::NewL()
       
    41     {
       
    42     CRsfwDirEntAttr* self = NewLC();
       
    43     CleanupStack::Pop(self);
       
    44     return self;
       
    45     }
       
    46 
       
    47 // ----------------------------------------------------------------------------
       
    48 // CRsfwDirEntAttr::CRsfwDirEntAttr
       
    49 // ----------------------------------------------------------------------------
       
    50 //
       
    51 CRsfwDirEntAttr::CRsfwDirEntAttr()
       
    52     {
       
    53     }
       
    54 
       
    55 // ----------------------------------------------------------------------------
       
    56 // CRsfwDirEntAttr::ConstructL
       
    57 // ----------------------------------------------------------------------------
       
    58 //
       
    59 void CRsfwDirEntAttr::ConstructL()
       
    60     {
       
    61     }
       
    62 
       
    63 // ----------------------------------------------------------------------------
       
    64 // CRsfwDirEntAttr::~CRsfwDirEntAttr
       
    65 // ----------------------------------------------------------------------------
       
    66 //
       
    67 EXPORT_C CRsfwDirEntAttr::~CRsfwDirEntAttr()
       
    68     {
       
    69     TInt i;
       
    70     for (i = 0; i < EDirEntAttrStringCount; i ++)
       
    71         {
       
    72         delete iStringValues[i];
       
    73         }
       
    74     }
       
    75 
       
    76 // ----------------------------------------------------------------------------
       
    77 // CRsfwDirEntAttr::Att
       
    78 // ----------------------------------------------------------------------------
       
    79 //
       
    80 EXPORT_C TUint CRsfwDirEntAttr::Att() const
       
    81     {
       
    82     return iAtt;
       
    83     }
       
    84 
       
    85 // ----------------------------------------------------------------------------
       
    86 // CRsfwDirEntAttr::SetAtt
       
    87 // ----------------------------------------------------------------------------
       
    88 //
       
    89 EXPORT_C void CRsfwDirEntAttr::SetAtt(TUint aAtt)
       
    90     {
       
    91     iAtt = aAtt;
       
    92     }
       
    93 
       
    94 // ----------------------------------------------------------------------------
       
    95 // CRsfwDirEntAttr::SetAttFlags
       
    96 // ----------------------------------------------------------------------------
       
    97 //    
       
    98 EXPORT_C void CRsfwDirEntAttr::SetAttFlags(TUint aFlags)
       
    99     {
       
   100     iAtt |= aFlags;
       
   101     }
       
   102 
       
   103 // ----------------------------------------------------------------------------
       
   104 // CRsfwDirEntAttr::ResetAttFlags
       
   105 // ----------------------------------------------------------------------------
       
   106 //    
       
   107 EXPORT_C void CRsfwDirEntAttr::ResetAttFlags(TUint aFlags)
       
   108     {
       
   109     iAtt &= ~aFlags;
       
   110     }
       
   111 
       
   112 // ----------------------------------------------------------------------------
       
   113 // CRsfwDirEntAttr::Size
       
   114 // ----------------------------------------------------------------------------
       
   115 //    
       
   116 EXPORT_C TInt CRsfwDirEntAttr::Size() const
       
   117     {
       
   118     return iSize;
       
   119     }
       
   120 
       
   121 // ----------------------------------------------------------------------------
       
   122 // CRsfwDirEntAttr::SetSize
       
   123 // ----------------------------------------------------------------------------
       
   124 //
       
   125 EXPORT_C void CRsfwDirEntAttr::SetSize(TInt aSize)
       
   126     {
       
   127     iSize = aSize;
       
   128     }
       
   129 
       
   130 // ----------------------------------------------------------------------------
       
   131 // CRsfwDirEntAttr::Modified
       
   132 // ----------------------------------------------------------------------------
       
   133 //
       
   134 EXPORT_C TTime CRsfwDirEntAttr::Modified() const
       
   135     {
       
   136     return iModified;
       
   137     }
       
   138 
       
   139 // ----------------------------------------------------------------------------
       
   140 // CRsfwDirEntAttr::SetModified
       
   141 // ----------------------------------------------------------------------------
       
   142 //
       
   143 EXPORT_C void CRsfwDirEntAttr::SetModified(const TTime& aModified)
       
   144     {
       
   145     iModified = aModified;
       
   146     }
       
   147 
       
   148 // ----------------------------------------------------------------------------
       
   149 // CRsfwDirEntAttr::Uid
       
   150 // ----------------------------------------------------------------------------
       
   151 //
       
   152 EXPORT_C const TUid& CRsfwDirEntAttr::Uid() 
       
   153     {
       
   154     return iUid;
       
   155     }
       
   156 
       
   157 // ----------------------------------------------------------------------------
       
   158 // CRsfwDirEntAttr::SetUid
       
   159 // ----------------------------------------------------------------------------
       
   160 //
       
   161 EXPORT_C void CRsfwDirEntAttr::SetUid(TUid aUid) 
       
   162     {
       
   163     iUid = aUid;
       
   164     }
       
   165 
       
   166 // ----------------------------------------------------------------------------
       
   167 // CRsfwDirEntAttr::StringValue
       
   168 // ----------------------------------------------------------------------------
       
   169 //
       
   170 EXPORT_C const TDesC8* CRsfwDirEntAttr::StringValue(TInt aIndex) const
       
   171     {
       
   172     if ((aIndex < 0) || (aIndex >= EDirEntAttrStringCount))
       
   173         {
       
   174         return NULL;
       
   175         }
       
   176     return iStringValues[aIndex];
       
   177     }
       
   178 
       
   179 // ----------------------------------------------------------------------------
       
   180 // CRsfwDirEntAttr::SetStringValueL
       
   181 // ----------------------------------------------------------------------------
       
   182 //
       
   183 EXPORT_C void CRsfwDirEntAttr::SetStringValueL(TInt aIndex, const TDesC8& aString) 
       
   184     {
       
   185     if ((aIndex < 0) || (aIndex >= EDirEntAttrStringCount))
       
   186         {
       
   187         User::Leave(KErrArgument);
       
   188         }
       
   189     HBufC8** s = &iStringValues[aIndex];
       
   190     if (*s)
       
   191         {
       
   192         delete *s;
       
   193         *s = NULL;
       
   194         }
       
   195     if (aString.Length())
       
   196         {
       
   197         *s = aString.AllocL();
       
   198         }
       
   199     }
       
   200 
       
   201 // ----------------------------------------------------------------------------
       
   202 // CRsfwDirEntAttr::MimeType
       
   203 // ----------------------------------------------------------------------------
       
   204 //
       
   205 EXPORT_C const TDesC8* CRsfwDirEntAttr::MimeType() const
       
   206     {
       
   207     return StringValue(EDirEntAttrStringMimeType);
       
   208     }
       
   209 
       
   210 // ----------------------------------------------------------------------------
       
   211 // CRsfwDirEntAttr::SetMimeTypeL
       
   212 // ----------------------------------------------------------------------------
       
   213 //
       
   214 EXPORT_C void CRsfwDirEntAttr::SetMimeTypeL(const TDesC8& aMimeType) 
       
   215     {
       
   216     SetStringValueL(EDirEntAttrStringMimeType, aMimeType);
       
   217     }
       
   218 
       
   219 // ----------------------------------------------------------------------------
       
   220 // CRsfwDirEntAttr::ETag
       
   221 // ----------------------------------------------------------------------------
       
   222 //
       
   223 EXPORT_C const TDesC8* CRsfwDirEntAttr::ETag() const
       
   224     {
       
   225     return StringValue(EDirEntAttrStringETag);
       
   226     }
       
   227 
       
   228 // ----------------------------------------------------------------------------
       
   229 // CRsfwDirEntAttr::SetETagL
       
   230 // ----------------------------------------------------------------------------
       
   231 //
       
   232 EXPORT_C void CRsfwDirEntAttr::SetETagL(const TDesC8& aETag) 
       
   233     {
       
   234     SetStringValueL(EDirEntAttrStringETag, aETag);
       
   235     }
       
   236 
       
   237 
       
   238 // End of File