voipplugins/ipapputils/voipeventlog/src/voiperrorentry.cpp
branchRCL_3
changeset 21 f742655b05bf
parent 20 65a3ef1d5bd0
child 22 d38647835c2e
equal deleted inserted replaced
20:65a3ef1d5bd0 21:f742655b05bf
     1 /*
       
     2 * Copyright (c) 2007-2007 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 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <centralrepository.h>
       
    20 #include "voiperrorentry.h"
       
    21 
       
    22 
       
    23 // ======== MEMBER FUNCTIONS ========
       
    24 
       
    25 // ---------------------------------------------------------------------------
       
    26 // Constructor
       
    27 // ---------------------------------------------------------------------------
       
    28 //
       
    29 CVoipErrorEntry::CVoipErrorEntry()
       
    30     {
       
    31     }
       
    32 
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // Constructor
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 void CVoipErrorEntry::ConstructL()
       
    39     {
       
    40     }
       
    41 
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // Constructor
       
    45 // ---------------------------------------------------------------------------
       
    46 //
       
    47 EXPORT_C CVoipErrorEntry* CVoipErrorEntry::NewL()
       
    48     {
       
    49     CVoipErrorEntry* self = CVoipErrorEntry::NewLC();
       
    50     CleanupStack::Pop( self );
       
    51     return self;
       
    52     }
       
    53 
       
    54 
       
    55 // ---------------------------------------------------------------------------
       
    56 // Constructor
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 EXPORT_C CVoipErrorEntry* CVoipErrorEntry::NewLC()
       
    60     {
       
    61     CVoipErrorEntry* self = new( ELeave ) CVoipErrorEntry;
       
    62     CleanupStack::PushL( self );
       
    63     self->ConstructL();
       
    64     return self;
       
    65     }
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // Constructor
       
    69 // ---------------------------------------------------------------------------
       
    70 //
       
    71 EXPORT_C CVoipErrorEntry* CVoipErrorEntry::NewLC( TInt aErrorCode, const TDesC& aErrorText )
       
    72     {
       
    73     CVoipErrorEntry* self = new( ELeave ) CVoipErrorEntry;
       
    74     CleanupStack::PushL( self );
       
    75     self->ConstructL();
       
    76     self->SetErrorCode( aErrorCode );
       
    77     self->SetErrorText( aErrorText );
       
    78     return self;
       
    79     }
       
    80 
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // Destructor
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 EXPORT_C CVoipErrorEntry::~CVoipErrorEntry()
       
    87     {
       
    88     iErrorText.Close();
       
    89     iTimeStamp.Close();
       
    90     }
       
    91 
       
    92 
       
    93 // ---------------------------------------------------------------------------
       
    94 // Returns error VoIP code.
       
    95 // ---------------------------------------------------------------------------
       
    96 //
       
    97 EXPORT_C TInt CVoipErrorEntry::ErrorCode() const
       
    98 	{
       
    99 	return iErrorCode;
       
   100 	}
       
   101 
       
   102 // ---------------------------------------------------------------------------
       
   103 // Sets VoIP error code.
       
   104 // ---------------------------------------------------------------------------
       
   105 //
       
   106 EXPORT_C void CVoipErrorEntry::SetErrorCode( TInt aErrorCode )
       
   107 	{
       
   108 	iErrorCode = aErrorCode;
       
   109 	}
       
   110 
       
   111 // ---------------------------------------------------------------------------
       
   112 // Returns error text
       
   113 // ---------------------------------------------------------------------------
       
   114 //
       
   115 EXPORT_C const TDesC& CVoipErrorEntry::ErrorText() const
       
   116 	{
       
   117 	return iErrorText;
       
   118 	}
       
   119 
       
   120 // ---------------------------------------------------------------------------
       
   121 // Sets error text
       
   122 // ---------------------------------------------------------------------------
       
   123 //
       
   124 EXPORT_C TInt CVoipErrorEntry::SetErrorText( const TDesC& aErrorText )
       
   125 	{
       
   126     TInt err( KErrNone );
       
   127     TInt length( aErrorText.Length() );
       
   128 
       
   129     if ( NCentralRepositoryConstants::KMaxBinaryLength < length )
       
   130         {
       
   131         err = KErrArgument;
       
   132         }
       
   133     else
       
   134         {
       
   135         iErrorText.Close();
       
   136         err = iErrorText.Create( aErrorText );
       
   137         }
       
   138 
       
   139     return err;
       
   140 	
       
   141 	}
       
   142 
       
   143 // ---------------------------------------------------------------------------
       
   144 // Returns time stamp
       
   145 // ---------------------------------------------------------------------------
       
   146 //
       
   147 EXPORT_C const TDesC& CVoipErrorEntry::TimeStamp() const
       
   148 	{
       
   149 	return iTimeStamp;
       
   150 	}
       
   151 	
       
   152 
       
   153 // ---------------------------------------------------------------------------
       
   154 // Sets time stamp
       
   155 // ---------------------------------------------------------------------------
       
   156 //
       
   157 TInt CVoipErrorEntry::SetTimeStamp( const TDesC& aTimeStamp )
       
   158 	{
       
   159     TInt err( KErrNone );
       
   160     TInt length( aTimeStamp.Length() );
       
   161 
       
   162     if ( NCentralRepositoryConstants::KMaxBinaryLength < length )
       
   163         {
       
   164         err = KErrArgument;
       
   165         }
       
   166     else
       
   167         {
       
   168         iTimeStamp.Close();
       
   169         err = iTimeStamp.Create( aTimeStamp );
       
   170         }
       
   171 
       
   172     return err;
       
   173 	}
       
   174