xdmprotocols/XcapProtocol/XcapAppUsage/XcapCapabilityUsage/src/XcapCapabilityUsage.cpp
branchRCL_3
changeset 35 fbd2e7cec7ef
parent 0 c8caa15ef882
equal deleted inserted replaced
34:2669f8761a99 35:fbd2e7cec7ef
       
     1 /*
       
     2 * Copyright (c) 2005 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:  CXcapCapabilityUsage
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include <XdmDocumentNode.h>
       
    22 #include "XcapCapabilityUsage.h"
       
    23 
       
    24 // Used specification
       
    25 // OMA-TS-XDM_Core-V1_0-20051103-C, 03 November 2005
       
    26 
       
    27 // ----------------------------------------------------
       
    28 // CXcapCapabilityUsage::CXcapCapabilityUsage
       
    29 // 
       
    30 // ----------------------------------------------------
       
    31 //
       
    32 CXcapCapabilityUsage::CXcapCapabilityUsage( const CXdmEngine& aXdmEngine ) :
       
    33                                             CXcapAppUsage( aXdmEngine )
       
    34     {
       
    35     }
       
    36 
       
    37 // ----------------------------------------------------
       
    38 // CXcapCapabilityUsage::NewL
       
    39 // 
       
    40 // ----------------------------------------------------
       
    41 //
       
    42 CXcapCapabilityUsage* CXcapCapabilityUsage::NewL( const TXcapAppUsageParams& aParameters )
       
    43     {
       
    44     CXcapCapabilityUsage* self = new ( ELeave ) CXcapCapabilityUsage( aParameters.iXdmEngine );
       
    45     CleanupStack::PushL( self );    // << self
       
    46     self->ConstructL();
       
    47     CleanupStack::Pop( self );      // >> self
       
    48     return self;
       
    49     }
       
    50 
       
    51 // ----------------------------------------------------
       
    52 // CXcapCapabilityUsage::~CXcapCapabilityUsage
       
    53 // 
       
    54 // ----------------------------------------------------
       
    55 //
       
    56 CXcapCapabilityUsage::~CXcapCapabilityUsage()
       
    57     {
       
    58     }
       
    59         
       
    60 // ----------------------------------------------------
       
    61 // CXcapCapabilityUsage::ConstructL
       
    62 // 
       
    63 // ----------------------------------------------------
       
    64 //
       
    65 void CXcapCapabilityUsage::ConstructL()
       
    66     {
       
    67     }
       
    68 
       
    69 // ----------------------------------------------------
       
    70 // CXcapCapabilityUsage::AUID
       
    71 // 
       
    72 // ----------------------------------------------------
       
    73 //
       
    74 TPtrC8 CXcapCapabilityUsage::AUID() const
       
    75     {
       
    76     return TPtrC8( KXdmCapabilityUsageAUID );
       
    77     }
       
    78 
       
    79 // ----------------------------------------------------
       
    80 // CXcapCapabilityUsage::ContentType
       
    81 // 
       
    82 // ----------------------------------------------------
       
    83 //
       
    84 TPtrC8 CXcapCapabilityUsage::ContentType() const
       
    85     {
       
    86     return TPtrC8( KXdmCapabilityUsageContType );
       
    87     }
       
    88 
       
    89 // ----------------------------------------------------
       
    90 // CXcapCapabilityUsage::DefaultNamespace
       
    91 // 
       
    92 // ----------------------------------------------------
       
    93 //
       
    94 TPtrC8 CXcapCapabilityUsage::DefaultNamespace() const
       
    95     {
       
    96     return TPtrC8( KXdmCapabilityNamespace );
       
    97     }    
       
    98 
       
    99 // ----------------------------------------------------
       
   100 // CXcapCapabilityUsage::ValidateNodeL
       
   101 // 
       
   102 // ----------------------------------------------------
       
   103 //
       
   104 TBool CXcapCapabilityUsage::ValidateNodeL( CXdmDocumentNode& aXdmNode )
       
   105     {
       
   106     // This method is called by base class for each element
       
   107     // in document, here we have to declare every element, check element 
       
   108     // datatype, restrictions for values and also do all checking that concerns  
       
   109     // the structure of the element. If the datatype is some of
       
   110     // the common datatypes defined in xcapappusage.h, the node
       
   111     // can pe passed to the base class for value validation.
       
   112     // If the node belongs to this namespace, the return value
       
   113     // should be true, false otherwise.
       
   114     
       
   115     TBool found ( EFalse );
       
   116     TDataType dataType ( EDataTypeUndefined );
       
   117     TPtrC element = aXdmNode.NodeName();
       
   118     
       
   119     // <auids>
       
   120     if ( Match( element, KXdmAuids ) )
       
   121         {
       
   122         found = ETrue;
       
   123         } 
       
   124     // <auid>
       
   125     else if ( Match( element, KXdmAuid ) )
       
   126         {
       
   127         dataType = EDataTypeString;
       
   128         found = ETrue;
       
   129         }
       
   130     // <extensions>
       
   131     else if ( Match( element, KXdmExtensions ) )
       
   132         {
       
   133         found = ETrue;
       
   134         }
       
   135     // <extension>
       
   136     else if ( Match( element, KXdmExtension ) )
       
   137         {
       
   138         dataType = EDataTypeString;
       
   139         found = ETrue;
       
   140         }
       
   141     // <namespaces>
       
   142     else if ( Match( element, KXdmNamespace ) )
       
   143         {
       
   144         found = ETrue;
       
   145         }
       
   146     // <namespace>
       
   147     else if ( Match( element, KXdmNamespace ) )
       
   148         {
       
   149         dataType = EDataTypeAnyURI;
       
   150         found = ETrue;
       
   151         }
       
   152         
       
   153     if ( dataType != EDataTypeUndefined )
       
   154         {
       
   155         // pass to the base class for data validation
       
   156         ValidateDataL( dataType, aXdmNode );
       
   157         }
       
   158     return found;
       
   159     }
       
   160 
       
   161 // ----------------------------------------------------
       
   162 // CXcapCapabilityUsage::ValidateAttributeL
       
   163 // 
       
   164 // ----------------------------------------------------
       
   165 //
       
   166 void CXcapCapabilityUsage::ValidateAttributeL( const CXdmNodeAttribute& /*aXdmNodeAttr*/ )
       
   167     {
       
   168     // This method is called by base class for each attribute
       
   169     // in document, here we have to define data types
       
   170     // for attributes, and pass them to the base class
       
   171     // for the actual data checking.
       
   172     
       
   173     // There aren't any attributes in
       
   174     // capability usage schema.
       
   175     }
       
   176     
       
   177 // ----------------------------------------------------
       
   178 // CXcapCapabilityUsage::AddNamespaceInformationL
       
   179 // 
       
   180 // ----------------------------------------------------
       
   181 //
       
   182 void CXcapCapabilityUsage::AddNamespaceInformationL( CXdmDocument& aXdmDocument )
       
   183     {
       
   184     aXdmDocument.AppendNamespaceL( KXdmCapabilityNamespace, KNullDesC8 );
       
   185     }
       
   186 
       
   187 // End of File
       
   188