telutils/phoneparser/src/CPhoneGsmParserResult.cpp
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2002 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:  Encapsulates results of parsing.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    <featmgr.h>
       
    21 
       
    22 #include    "cphonegsmparserresult.h" 
       
    23 #include    "cphonegsmparserbase.h" 
       
    24 #include    "phonegsmparser.h" 
       
    25 
       
    26 // CONSTANTS
       
    27 const TInt KPhoneParserResultParameterGranularity = 10;
       
    28 
       
    29 // ============================ MEMBER FUNCTIONS ===============================
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // CPhoneGsmParserResult::CPhoneGsmParserResult
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CPhoneGsmParserResult::CPhoneGsmParserResult()
       
    36     {
       
    37     }
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 // CPhoneGsmParserResult::ConstructL
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 void CPhoneGsmParserResult::ConstructL()
       
    44     {
       
    45     iParameters = 
       
    46         new ( ELeave ) 
       
    47             CArrayFixFlat< TPtrC >( KPhoneParserResultParameterGranularity );
       
    48     }
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // CPhoneGsmParserResult::NewL
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 CPhoneGsmParserResult* CPhoneGsmParserResult::NewL()
       
    55     {
       
    56     CPhoneGsmParserResult* self = new (ELeave) CPhoneGsmParserResult;
       
    57     
       
    58     CleanupStack::PushL( self );
       
    59     self->ConstructL();
       
    60     CleanupStack::Pop( self );
       
    61 
       
    62     return self;
       
    63     }
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CPhoneGsmParserResult::~CPhoneGsmParserResult
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 CPhoneGsmParserResult::~CPhoneGsmParserResult()
       
    70     {
       
    71     delete iParameters;
       
    72     }
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 // CPhoneGsmParserResult::ReserveParametersL
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 void CPhoneGsmParserResult::ReserveParametersL( 
       
    79         TUint aAmount )
       
    80     {
       
    81     iParameters->SetReserveL( aAmount );
       
    82     }
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // CPhoneGsmParserResult::ClearL
       
    86 //
       
    87 // Zero all information.
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 void CPhoneGsmParserResult::ClearL()
       
    91     {
       
    92     iUid = KPhoneGsmUidInvalid;
       
    93     iAuxInformation = 0;
       
    94 
       
    95     if ( iParameters->Count() )
       
    96         {
       
    97         iParameters->ResizeL( 0 ); // Doesn't leave
       
    98         }
       
    99     }
       
   100 
       
   101 // -----------------------------------------------------------------------------
       
   102 // CPhoneGsmParserResult::ParameterAt
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 const TDesC& CPhoneGsmParserResult::ParameterAt( 
       
   106         TInt aIndex ) const
       
   107     {
       
   108     __ASSERT_ALWAYS( aIndex >= 0 &&
       
   109                      aIndex < iParameters->Count(),
       
   110                      PhoneGsmParser::Panic( PhoneGsmParser::EIncorrectUse ) );
       
   111     
       
   112     return iParameters->At( aIndex );
       
   113     }
       
   114 
       
   115 // -----------------------------------------------------------------------------
       
   116 // CPhoneGsmParserResult::SetUid
       
   117 // -----------------------------------------------------------------------------
       
   118 //
       
   119 void CPhoneGsmParserResult::SetUid( 
       
   120         TUint aUid )
       
   121     {
       
   122     iUid = aUid;
       
   123     }
       
   124 
       
   125 // -----------------------------------------------------------------------------
       
   126 // CPhoneGsmParserResult::SetAuxInformation
       
   127 // -----------------------------------------------------------------------------
       
   128 //
       
   129 void CPhoneGsmParserResult::SetAuxInformation( 
       
   130         TUint aAuxInformation )
       
   131     {
       
   132     iAuxInformation = aAuxInformation;
       
   133     }
       
   134 
       
   135 // -----------------------------------------------------------------------------
       
   136 // CPhoneGsmParserResult::AddParameterL
       
   137 // -----------------------------------------------------------------------------
       
   138 //
       
   139 void CPhoneGsmParserResult::AddParameterL( 
       
   140         const TDesC& aParameter )
       
   141     {
       
   142     iParameters->AppendL( aParameter );
       
   143     }           
       
   144 
       
   145 //  End of File