vpnengine/dmadengine/inc/dmadutil.h
changeset 0 33413c0669b9
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     1 /*
       
     2 * Copyright (c) 2002-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: Class definition of TDmAdUtil.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __DMADUTIL_H__
       
    21 #define __DMADUTIL_H__
       
    22 
       
    23 #include <smldmadapter.h>
       
    24 #include "dmadengineexportdef.h"
       
    25 #include "dmadcallback.h"
       
    26 #include "dmadstoreapi.h"
       
    27 
       
    28 _LIT8(KDmAdUriDotSlash, "./");
       
    29 _LIT8(KDmAdSeparator, "/");
       
    30 _LIT8(KDmAdMimeTypeTextPlain, "text/plain");
       
    31 _LIT8(KDmAdLocallyCreatedRtNodeUriSegPrefix, "cli");
       
    32 
       
    33 //------------------------------------------------------------------------------------------------
       
    34 // TDmAdUtil
       
    35 //------------------------------------------------------------------------------------------------
       
    36 class TDmAdUtil
       
    37     {
       
    38 public:
       
    39     DMAD_IMPORT_C static TInt DesToInt(const TDesC& aDes);
       
    40     DMAD_IMPORT_C static TInt DesToInt(const TDesC8& aDes);
       
    41     DMAD_IMPORT_C static HBufC* IntToDesLC(const TInt aInt);
       
    42     DMAD_IMPORT_C static HBufC8* IntToDes8LC(const TInt aInt);
       
    43     DMAD_IMPORT_C static HBufC* IntToDesLC(const TInt32 aInt32);
       
    44     DMAD_IMPORT_C static HBufC8* IntToDes8LC(const TInt32 aInt32);
       
    45     DMAD_IMPORT_C static TUint DesToUint(const TDesC& aDes);
       
    46     DMAD_IMPORT_C static TUint DesToUint(const TDesC8& aDes);
       
    47     DMAD_IMPORT_C static HBufC* IntToDesLC(const TUint aUint);
       
    48     DMAD_IMPORT_C static HBufC8* IntToDes8LC(const TUint aUint);
       
    49     DMAD_IMPORT_C static HBufC* IntToDesLC(const TUint32 aUint32);
       
    50     DMAD_IMPORT_C static HBufC8* IntToDes8LC(const TUint32 aUint32);
       
    51     DMAD_IMPORT_C static TPtrC8 LastUriSeg(const TDesC8& aUri);
       
    52     DMAD_IMPORT_C static TPtrC8 FirstUriSeg(const TDesC8& aUri);
       
    53     DMAD_IMPORT_C static TPtrC8 RemoveLastUriSeg(const TDesC8& aUri);
       
    54     DMAD_IMPORT_C static TInt NumOfURISegs(const TDesC8& aUri);
       
    55     DMAD_IMPORT_C static TPtrC8 RemoveDotSlash(const TDesC8& aUri);
       
    56     DMAD_IMPORT_C static TInt CompareUris(const TDesC8& aUri1, const TDesC8& aUri2);
       
    57     DMAD_IMPORT_C static HBufC8* BuildUriLC(const TDesC8& aUriPath, const TDesC8& aUriSeg);
       
    58     DMAD_IMPORT_C static HBufC8* BuildUriL(const TDesC8& aUriPath, const TDesC8& aUriSeg);
       
    59     DMAD_IMPORT_C static MSmlDmAdapter::TError MapStatusCode(TInt aStatus);
       
    60     DMAD_IMPORT_C static void ParseUriLC(const TDesC8& aUri, CArrayFix<TPtrC8>*& aUriSegList);
       
    61     DMAD_IMPORT_C static HBufC8* LuidTo8L(const TDesC& aLuid16);
       
    62     DMAD_IMPORT_C static HBufC* LuidTo16L(const TDesC8& aLuid8);
       
    63     DMAD_IMPORT_C static void FillNodeInfoL(MSmlDmDDFObject&             aNode,
       
    64                                             TSmlDmAccessTypes            aAccTypes,
       
    65                                             MSmlDmDDFObject::TOccurence  aOccurrence,
       
    66                                             MSmlDmDDFObject::TScope      aScope,
       
    67                                             MSmlDmDDFObject::TDFFormat   aFormat,
       
    68                                             const TDesC8&                aDescription,
       
    69                                             TBool                        aObjectGroup,
       
    70                                             const TDesC8&                aMimeType=KDmAdMimeTypeTextPlain);
       
    71     DMAD_IMPORT_C static MSmlDmDDFObject& AddChildObjectL(MSmlDmDDFObject& aNode, const TDesC8& aNodeName);
       
    72     DMAD_IMPORT_C static HBufC8* BuildLocallyCreatedRtNodeUriSegLC(TInt& aLargest);    
       
    73     DMAD_IMPORT_C static void BuildRtNodeChildUriListL(MDmAdCallBack*                          aDmAdCallBack,
       
    74                                                        MDmAdStoreApi*                          aStoreApi,
       
    75                                                        const TDesC8&                           aUri,
       
    76                                                        const TDesC8&                           aParentLuid,
       
    77                                                        const CArrayFix<TSmlDmMappingInfo>&     aPreviousUriSegmentList,
       
    78                                                        CBufBase&                               aCurrentList);
       
    79 
       
    80 
       
    81 private:
       
    82     static TInt FindLargestLocallyCreated(const CArrayFix<TSmlDmMappingInfo>& aPreviousUriSegmentList);
       
    83                                                        
       
    84     };
       
    85 
       
    86 #endif