mmsengine/genutils/src/mmsmsventry.cpp
changeset 31 ebfee66fde93
parent 0 72b543305e3a
equal deleted inserted replaced
30:6a20128ce557 31:ebfee66fde93
       
     1 /*
       
     2 * Copyright (c) 2002, 2003 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:  
       
    15 *     Wrapper for MMS specials in TMsvEntry.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include    "mmsmsventry.h"
       
    24 #include    "mmsconst.h"
       
    25 
       
    26 // EXTERNAL DATA STRUCTURES
       
    27 
       
    28 // EXTERNAL FUNCTION PROTOTYPES  
       
    29 extern void gPanic( TMmsPanic aPanic );
       
    30 
       
    31 // CONSTANTS
       
    32 
       
    33 // MACROS
       
    34 
       
    35 // LOCAL CONSTANTS AND MACROS
       
    36 
       
    37 // MODULE DATA STRUCTURES
       
    38 
       
    39 // LOCAL FUNCTION PROTOTYPES
       
    40 
       
    41 // ==================== LOCAL FUNCTIONS ====================
       
    42 
       
    43 
       
    44 // ================= MEMBER FUNCTIONS =======================
       
    45 
       
    46 
       
    47 
       
    48 // ---------------------------------------------------------
       
    49 // TMmsMsvEntry::TMmsMsvEntry
       
    50 // ---------------------------------------------------------
       
    51 //
       
    52 EXPORT_C TMmsMsvEntry::TMmsMsvEntry()
       
    53     : TMsvEntry()
       
    54     {
       
    55     iMtm = KUidMsgTypeMultimedia;
       
    56     iMtmData1 = 0;
       
    57     iMtmData2 = 0;
       
    58     iMtmData3 = 0;
       
    59     iSize = 0;
       
    60     }
       
    61 
       
    62 // ---------------------------------------------------------
       
    63 // TMmsMsvEntry::TMmsMsvEntry
       
    64 // Note that this does not copy the contents of iDetails and iDescriptor.
       
    65 // The destructor of the original CMsvEntry entry deletes the
       
    66 // buffers pointed to by the TPtrC members.
       
    67 // ---------------------------------------------------------
       
    68 EXPORT_C TMmsMsvEntry::TMmsMsvEntry( const TMsvEntry& aGenericEntry ) 
       
    69     : TMsvEntry()
       
    70     {
       
    71     Mem::Copy( this, &aGenericEntry, sizeof( *this ) );
       
    72     }
       
    73 
       
    74 // ----------------------------------------------------
       
    75 // TMmsMsvEntry::==
       
    76 // ----------------------------------------------------
       
    77 //
       
    78 EXPORT_C TBool TMmsMsvEntry::operator==( const TMsvEntry& aEntry ) const
       
    79     {
       
    80     TInt size = sizeof(*this) - 2 * sizeof( TPtrC );
       
    81     TBool equal = !(Mem::Compare(( TUint8* )&aEntry, size, 
       
    82                                  ( TUint8* )this, size ));
       
    83     equal &= ( aEntry.iDescription == this->iDescription );
       
    84     equal &= ( aEntry.iDetails == this->iDetails );
       
    85     return equal;
       
    86     }
       
    87 
       
    88 // ----------------------------------------------------
       
    89 // TMmsMsvEntry::==
       
    90 // ----------------------------------------------------
       
    91 //
       
    92 EXPORT_C TBool TMmsMsvEntry::operator==( const TMmsMsvEntry& aEntry ) const
       
    93     {
       
    94     TInt size = sizeof(*this) - 2 * sizeof( TPtrC );
       
    95     TBool equal = !(Mem::Compare(( TUint8* )&aEntry, size, 
       
    96                                  ( TUint8* )this, size ));
       
    97     equal &= ( aEntry.iDescription == this->iDescription );
       
    98     equal &= ( aEntry.iDetails == this->iDetails );
       
    99     return equal;
       
   100     }
       
   101 
       
   102 // ----------------------------------------------------
       
   103 // TMmsMsvEntry::SetSubject
       
   104 // ----------------------------------------------------
       
   105 //
       
   106 EXPORT_C void TMmsMsvEntry::SetSubject( const TDesC& aSubject )
       
   107     {
       
   108     __ASSERT_ALWAYS( iType == KUidMsvMessageEntry,
       
   109         gPanic( EMmsEntryTypeNotSupported ) );
       
   110     this->iDescription.Set( aSubject );
       
   111     }
       
   112 
       
   113 // ----------------------------------------------------
       
   114 // TMmsMsvEntry::Subject
       
   115 // ----------------------------------------------------
       
   116 //
       
   117 EXPORT_C const TDesC& TMmsMsvEntry::Subject() const
       
   118     {
       
   119     __ASSERT_ALWAYS( iType == KUidMsvMessageEntry,
       
   120         gPanic( EMmsEntryTypeNotSupported ) );
       
   121     return this->iDescription;
       
   122     }
       
   123 
       
   124 // ----------------------------------------------------
       
   125 // TMmsMsvEntry::SetAttachmentFile
       
   126 // ----------------------------------------------------
       
   127 //
       
   128 EXPORT_C void TMmsMsvEntry::SetAttachmentFile( const TDesC& aFile )
       
   129     {
       
   130     __ASSERT_ALWAYS( iType == KUidMsvAttachmentEntry,
       
   131         gPanic( EMmsEntryTypeNotSupported ) );
       
   132     this->iDetails.Set( aFile );
       
   133     }
       
   134 
       
   135 // ----------------------------------------------------
       
   136 // TMmsMsvEntry::AttachmentFile
       
   137 // ----------------------------------------------------
       
   138 //
       
   139 EXPORT_C const TDesC& TMmsMsvEntry::AttachmentFile() const
       
   140     {
       
   141     __ASSERT_ALWAYS( iType == KUidMsvAttachmentEntry,
       
   142         gPanic( EMmsEntryTypeNotSupported ));
       
   143     return this->iDetails;
       
   144     }
       
   145 
       
   146 // ================= OTHER EXPORTED FUNCTIONS ==============
       
   147 
       
   148 
       
   149 //  End of File  
       
   150