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