bluetoothengine/bteng/btengdiscovery/src/btengsdpattrparser.cpp
changeset 0 f63038272f30
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Helper class for parsing SDP attribute query results.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 //#include <?include_file>
       
    21 
       
    22 #include "btengsdpattrparser.h"
       
    23 
       
    24 //const ?type ?constant_var = ?constant;
       
    25 
       
    26 
       
    27 // ======== MEMBER FUNCTIONS ========
       
    28 
       
    29 // ---------------------------------------------------------------------------
       
    30 // C++ default constructor
       
    31 // ---------------------------------------------------------------------------
       
    32 //
       
    33 CBTEngSdpAttrParser::CBTEngSdpAttrParser( RSdpResultArray* aResultArray )
       
    34     : iResultArray( aResultArray )
       
    35     {
       
    36     }
       
    37 
       
    38 
       
    39 // ---------------------------------------------------------------------------
       
    40 // Symbian 2nd-phase constructor
       
    41 // ---------------------------------------------------------------------------
       
    42 //
       
    43 void CBTEngSdpAttrParser::ConstructL()
       
    44     {
       
    45     }
       
    46 
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // NewL
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 CBTEngSdpAttrParser* CBTEngSdpAttrParser::NewL( RSdpResultArray* aResultArray )
       
    53     {
       
    54     CBTEngSdpAttrParser* self = new( ELeave ) CBTEngSdpAttrParser( aResultArray );
       
    55     CleanupStack::PushL( self );
       
    56     self->ConstructL();
       
    57     CleanupStack::Pop( self );
       
    58     return self;
       
    59     }
       
    60 
       
    61 
       
    62 // ---------------------------------------------------------------------------
       
    63 // Destructor
       
    64 // ---------------------------------------------------------------------------
       
    65 //
       
    66 CBTEngSdpAttrParser::~CBTEngSdpAttrParser()
       
    67     {
       
    68     }
       
    69 
       
    70 
       
    71 // ---------------------------------------------------------------------------
       
    72 // Set the current attribute ID, to add to the result array.
       
    73 // ---------------------------------------------------------------------------
       
    74 //
       
    75 void CBTEngSdpAttrParser::SetAttributeID( TSdpAttributeID aAttrId )
       
    76     {
       
    77     iAttrId = aAttrId;
       
    78     }
       
    79 
       
    80 
       
    81 // ---------------------------------------------------------------------------
       
    82 // From class MSdpAttributeValueVisitor.
       
    83 // ?implementation_description
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 void CBTEngSdpAttrParser::VisitAttributeValueL( CSdpAttrValue& aValue, 
       
    87     TSdpElementType aType )
       
    88     {
       
    89     TBTEngSdpAttrValue attrValue;
       
    90     attrValue.iAttrId = iAttrId;
       
    91     attrValue.iAttrType = aType;
       
    92     switch( aType )
       
    93         {
       
    94         case ETypeNil:
       
    95             {
       
    96             attrValue.iAttrValue.iValNumeric = 0;   // To be checked
       
    97             }
       
    98             break;
       
    99         case ETypeUint:
       
   100             {
       
   101             attrValue.iAttrValue.iValNumeric = aValue.Uint();
       
   102             }
       
   103             break;
       
   104         case ETypeInt:
       
   105             {
       
   106             attrValue.iAttrValue.iValNumeric = aValue.Int();
       
   107             }
       
   108             break;
       
   109         case ETypeUUID:
       
   110             {
       
   111             attrValue.iAttrValue.iValString.Set( aValue.UUID().Des() );
       
   112             }
       
   113             break;
       
   114         case ETypeString:
       
   115             {
       
   116             attrValue.iAttrValue.iValString.Set( aValue.Des() );
       
   117             }
       
   118             break;
       
   119         case ETypeBoolean:
       
   120             {
       
   121             attrValue.iAttrValue.iValNumeric = aValue.Bool();
       
   122             }
       
   123             break;
       
   124         case ETypeURL:
       
   125             {
       
   126             attrValue.iAttrValue.iValString.Set( aValue.Des() );
       
   127             }
       
   128             break;
       
   129         case ETypeDES:
       
   130         case ETypeDEA:
       
   131         case ETypeEncoded:
       
   132         default:
       
   133                 // Don't add any value
       
   134             break;
       
   135         }
       
   136     iResultArray->Append( attrValue );
       
   137     }
       
   138 
       
   139 
       
   140 // ---------------------------------------------------------------------------
       
   141 // From class MSdpAttributeValueVisitor.
       
   142 // ?implementation_description
       
   143 // ---------------------------------------------------------------------------
       
   144 //
       
   145 void CBTEngSdpAttrParser::StartListL( CSdpAttrValueList& aList )
       
   146     {
       
   147         // Increase counter to check the nested lists
       
   148     iNestingLevel++;
       
   149     (void) aList;
       
   150     }
       
   151 
       
   152 
       
   153 // ---------------------------------------------------------------------------
       
   154 // From class MSdpAttributeValueVisitor.
       
   155 // ?implementation_description
       
   156 // ---------------------------------------------------------------------------
       
   157 //
       
   158 void CBTEngSdpAttrParser::EndListL()
       
   159     {
       
   160         // Decrease counter to check the nested lists and signal completion.
       
   161     iNestingLevel--;
       
   162     if( iNestingLevel == 0 )
       
   163         {
       
   164         ;   // Parsing completed
       
   165         }
       
   166     }