homescreenpluginsrv/hspsresult/src/hspsresult.cpp
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     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:  Class ChspsResult is a Xuikon utility class that defines Additional 
       
    15 *                Return Code for Xuikon Application Theme Management Services on service
       
    16 *                request return.
       
    17 *                It is quaranteed that ChspsResult-object is always accessible after
       
    18 *                client request whether the result was successful or not.
       
    19 *                ChspsResult-class has attributes that informs the result as follows:
       
    20 *                - iSystemError - Symbian OS returned error code
       
    21 *                - iXuikonError - Xuikon defined error code in Xuikon error space
       
    22 *                - iIntValue1   - additional information relevant in the result. 
       
    23 *                - iIntValue2   - additional information relevant in the result.   
       
    24 *                
       
    25 *
       
    26 */
       
    27 
       
    28 
       
    29 #include "hspsresult.h"
       
    30 
       
    31 #include <s32mem.h>
       
    32 
       
    33 // ============================ MEMBER FUNCTIONS ===============================
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // ChspsResult::ChspsResult()
       
    37 // C++ default constructor can NOT contain any code, that
       
    38 // might leave.
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 ChspsResult::ChspsResult()
       
    42     {
       
    43     }
       
    44 
       
    45 // -----------------------------------------------------------------------------
       
    46 // ChspsResult::ConstructL
       
    47 // Symbian 2nd phase constructor can leave.
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 void ChspsResult::ConstructL()
       
    51     {
       
    52     ResetData();
       
    53     }
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // ChspsResult::NewL
       
    57 // Two-phased constructor.
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 EXPORT_C ChspsResult* ChspsResult::NewL()
       
    61     {
       
    62     ChspsResult* self = new( ELeave ) ChspsResult;
       
    63     
       
    64     CleanupStack::PushL( self );
       
    65     self->ConstructL();
       
    66     CleanupStack::Pop();
       
    67 
       
    68     return self;
       
    69     }
       
    70 
       
    71 // Destructor
       
    72 ChspsResult::~ChspsResult()
       
    73     {
       
    74     }
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // ChspsResult::ExternalizeL()
       
    78 // (other items were commented in a header).
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 EXPORT_C void ChspsResult::ExternalizeL( RDesWriteStream& aStream ) const
       
    82     {
       
    83     aStream.WriteUint32L( (TUint)iSystemError );
       
    84     aStream.WriteUint32L( (TUint)iXuikonError );
       
    85     aStream.WriteUint32L( (TUint)iIntValue1 );
       
    86     aStream.WriteUint32L( (TUint)iIntValue2 );
       
    87     }
       
    88        
       
    89 // -----------------------------------------------------------------------------
       
    90 // ChspsResult::InternalizeL()
       
    91 // (other items were commented in a header).
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 EXPORT_C void ChspsResult::InternalizeL( RDesReadStream& aStream )
       
    95     {
       
    96     iSystemError = (TInt)aStream.ReadUint32L();
       
    97     iXuikonError = (TInt)aStream.ReadUint32L();
       
    98     iIntValue1 = (TInt)aStream.ReadUint32L();
       
    99     iIntValue2 = (TInt)aStream.ReadUint32L();
       
   100     }
       
   101     
       
   102 // -----------------------------------------------------------------------------
       
   103 // ChspsResult::GetDataLength()
       
   104 // Returns data length of ChspsResult-object for streamin functions.
       
   105 // (other items were commented in a header).
       
   106 // -----------------------------------------------------------------------------
       
   107 //
       
   108 EXPORT_C TInt ChspsResult::GetDataLength() const
       
   109     {
       
   110     TInt len = sizeof( iSystemError );
       
   111     len += sizeof(iXuikonError);
       
   112     len += sizeof(iIntValue1);
       
   113     len += sizeof(iIntValue2);
       
   114     return len;
       
   115     }
       
   116   
       
   117 // -----------------------------------------------------------------------------
       
   118 // ChspsResult::ResetData()
       
   119 // Resets ChspsResult's data members.
       
   120 // (other items were commented in a header).
       
   121 // -----------------------------------------------------------------------------
       
   122 //
       
   123 EXPORT_C void ChspsResult::ResetData()
       
   124     {
       
   125     iSystemError = 0;
       
   126     iXuikonError = 0;
       
   127     iIntValue1 = 0;
       
   128     iIntValue2 = 0;
       
   129     }
       
   130     
       
   131 
       
   132 //  End of File