mmuifw_plat/mul_datamodel_api/inc/mul/mulmodelutility.h
branchRCL_3
changeset 26 0e9bb658ef58
parent 0 e83bab7cf002
equal deleted inserted replaced
25:4ea6f81c838a 26:0e9bb658ef58
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  Utility class for data model
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MULMODELUTILITY_H_
       
    20 #define MULMODELUTILITY_H_
       
    21 
       
    22 #include <alf/alfvarianttype.h>
       
    23 #include <osn/osndefines.h>
       
    24 #include <e32cmn.h>
       
    25 #include <osn/ustring.h>
       
    26 
       
    27 #include "mul/imulwidget.h"
       
    28 
       
    29 namespace osncore
       
    30     {
       
    31     class UString;
       
    32     }
       
    33 using namespace osncore;
       
    34 
       
    35 namespace Alf
       
    36 	{
       
    37 	
       
    38 //Forward Declaration
       
    39 class MulVisualItem;
       
    40 class MulModelUtility
       
    41     {
       
    42 public:
       
    43 
       
    44 	/**
       
    45 	 * Create new Variant data from existing variant data.
       
    46 	 * 
       
    47 	 * @param aValue Existing variant data;
       
    48 	 * 
       
    49 	 * @reutrn new variant data, Ownership is transferred
       
    50 	 */
       
    51     OSN_IMPORT static IAlfVariantType* CreateVariantType( IAlfVariantType& aValue );
       
    52     
       
    53     /**
       
    54 	 * Convert map of visual item to map of alf map.
       
    55 	 * Ite create new Map and while returning new map owner ship of map is transfered
       
    56 	 * 
       
    57 	 * @param aVisualItem Map of visual item
       
    58 	 * @return Map
       
    59 	 */
       
    60      OSN_IMPORT static std::auto_ptr<IAlfMap> ConvertVisualItemToMap( MulVisualItem& aVisualItem );
       
    61 	
       
    62 	/**
       
    63      * 
       
    64      * Convert AlfMap to visual item
       
    65      * 
       
    66      * @param aMap IAlfMAP
       
    67      * @return MulVisualItem ownership is trsnaferred
       
    68      */
       
    69     OSN_IMPORT static std::auto_ptr<MulVisualItem> ConvertMapToVisualItem( IAlfMap& aMap );
       
    70     
       
    71 	/**
       
    72 	 * Check the prefix of the name to see whether they can be added in alfmodel
       
    73 	 * 
       
    74 	 * @param aName Name whose prefix is to be checked
       
    75 	 */
       
    76 	static bool CheckNamePrefix( UString aName ) ;
       
    77     
       
    78     /**
       
    79      * Convert UString to CAlfString
       
    80      * 
       
    81      * @param aUString UString instance to convert to CAlfSTring
       
    82 
       
    83      * @return Converted CAlfString
       
    84      */
       
    85     OSN_IMPORT static UString UStringToAlfString(const UString& aUString);
       
    86     
       
    87     /**
       
    88     * Convsert CAlfString to UString
       
    89     * 
       
    90     * @param aUString CAlfSTring instance to convert to UString
       
    91 
       
    92     * @return Converted UString
       
    93     */
       
    94     OSN_IMPORT static UString AlfStringToUString(const UString& aAlfString);
       
    95     
       
    96     /**
       
    97      * Covert integer to AlfString
       
    98      * 
       
    99      * @param aNumber number to convert
       
   100      * @return AlfString
       
   101      */
       
   102     OSN_IMPORT static UString IntToUString( int aNumber );
       
   103     
       
   104     /**
       
   105      * Convert TDes to UString
       
   106      *
       
   107      * @param aDes a TDes type string to be converted
       
   108      * @param aString the converted Ustring
       
   109      */
       
   110     OSN_IMPORT static void ConvertTDesToUString (const TDesC& aDes, UString& aString);
       
   111     
       
   112     /**
       
   113      * Convert TDes8 to UString
       
   114      *
       
   115      * @param aDes a TDes8 type string to be converted
       
   116      * @param aString the converted Ustring
       
   117      */
       
   118     OSN_IMPORT static void ConvertTDes8ToUString (const TDesC8& aDes, UString& aString);
       
   119     
       
   120     /**
       
   121      * Convert UString to TDes
       
   122      *     
       
   123      * @param aString a UString type string to be converted
       
   124      * @param aDes the TDes type converted string
       
   125      */
       
   126     OSN_IMPORT static void ConvertUStringToTDes (const UString& aString, TDes& aDes);    
       
   127     
       
   128     /**
       
   129      * Convert UString to TDes8
       
   130      *     
       
   131      * @param aString a UString type string to be converted
       
   132      * @param aDes the TDes8 type converted string
       
   133      */
       
   134      OSN_IMPORT static void ConvertUStringToTDes8 (const UString& aString, TDes8& aDes);    
       
   135     
       
   136     /**
       
   137      * Create a visualitem and set its default template
       
   138      *     
       
   139      * @param aDefaultTemplate defaultTemplate for that visual item
       
   140      */
       
   141     OSN_IMPORT static std::auto_ptr<MulVisualItem> CreateVisualItem( mulwidget::TLogicalTemplate aDefaultTemplate ); 
       
   142     
       
   143                    
       
   144     };
       
   145 	    
       
   146     } //namespace Alf
       
   147 
       
   148 #endif /*MULMODELUTILITY_H_*/
       
   149 
       
   150 //End of file
       
   151 
       
   152