phonesrv_plat/service_provider_settings_api/inc/spproperty.h
changeset 0 ff3b6d0fd310
child 19 7d48bed6ce0c
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     1 /*
       
     2 * Copyright (c)  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:  Header file of service provider settings property class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_SPPROPERTY_H
       
    20 #define C_SPPROPERTY_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 #include "spdefinitions.h"
       
    25 
       
    26 /**
       
    27  *  Service provider settings property class
       
    28  *
       
    29  *  This class represent one property of Sevice Provider settings
       
    30  *
       
    31  *  @lib serviceprovidersettings.lib
       
    32  *  @since S60 V3.2
       
    33  */
       
    34 NONSHARABLE_CLASS( CSPProperty ): public CBase
       
    35     {
       
    36 
       
    37 	public: // Constructor and destructor
       
    38 
       
    39 	    /**
       
    40 	    * Two-phased constructor.
       
    41 	    */
       
    42 	    IMPORT_C static CSPProperty* NewL();
       
    43 
       
    44 	    /**
       
    45 	    * Two-phased constructor.
       
    46 	    */
       
    47 	    IMPORT_C static CSPProperty* NewLC();
       
    48 
       
    49 	    /**
       
    50 	    * Destructors.
       
    51 	    */
       
    52 	    IMPORT_C virtual ~CSPProperty();
       
    53 
       
    54 	public: // member functions
       
    55 	    /**
       
    56 	     * Returns the name of this property
       
    57 	     *
       
    58 	     * @since S60 V3.2
       
    59 	     * @return Name of property
       
    60 	     */
       
    61 	    IMPORT_C TServicePropertyName GetName() const;
       
    62 
       
    63 	    /**
       
    64 	     * Sets the name for this property
       
    65 	     *
       
    66 	     * @since S60 V3.2
       
    67 	     * @param aPropertyname new property name
       
    68 	     */
       
    69 	    IMPORT_C TInt SetName( TServicePropertyName aPropertyname );
       
    70 
       
    71 	    /**
       
    72 	     * Returns the type of this property
       
    73 	     *
       
    74 	     * @since S60 V3.2
       
    75 	     * @return Type of property
       
    76 	     */
       
    77 		IMPORT_C TSPItemType GetPropertyType() const;
       
    78 
       
    79 	    /**
       
    80 	     * Sets the type for this property
       
    81 	     *
       
    82 	     * @since S60 V3.2
       
    83 	     * @param aPropertyType property type
       
    84 	     */
       
    85 		TInt SetPropertyType( TSPItemType aPropertyType );
       
    86 
       
    87 
       
    88 	    /**
       
    89 	     * Returns the datatype of this property
       
    90 	     * No imported, set automatically.
       
    91 	     *
       
    92 	     * @since S60 V3.2
       
    93 	     * @return Datatype of property
       
    94 	     */
       
    95 	    IMPORT_C TPropertyDataType GetDataType() const;
       
    96 
       
    97 	    /**
       
    98 	     * Sets the datatype of this property
       
    99 	     *
       
   100 	     * @since S60 V3.2
       
   101 	     * @param aDataType new data type
       
   102 	     */
       
   103 	    void SetDataType( TPropertyDataType aDataType );
       
   104 
       
   105 	    /**
       
   106 	     * Returns value of property
       
   107 	     *
       
   108 	     * @since S60 V3.2
       
   109 	     * @param aValue on return, TInt value
       
   110 	     * @return Error code
       
   111 	     */
       
   112 	    IMPORT_C TInt GetValue( TInt& aValue ) const;
       
   113 
       
   114 	    /**
       
   115 	     * Sets value of property. Value must match to datatype.
       
   116 	     *
       
   117 	     * @since S60 V3.2
       
   118 	     * @param aValue new TInt value to be set
       
   119 	     * @return Error code
       
   120 	     */
       
   121 	    IMPORT_C TInt SetValue( TInt aValue );
       
   122 
       
   123 	    /**
       
   124 	     * Returns value of property
       
   125 	     *
       
   126 	     * @since S60 V3.2
       
   127 	     * @param aValue on return, descriptor value
       
   128 	     * @return Error code
       
   129 	     */
       
   130 	    IMPORT_C TInt GetValue( TDes& aValue ) const;
       
   131 
       
   132 	    /**
       
   133 	     * Sets the value of property. Value must match to datatype.
       
   134 	     *
       
   135 	     * @since S60 V3.2
       
   136 	     * @param aValue new descriptor
       
   137 	     * @return Error code
       
   138 	     */
       
   139 	    IMPORT_C TInt SetValue( const TDesC& aValue );
       
   140 
       
   141 
       
   142 	    /**
       
   143 	     * Returns value of property
       
   144 	     *
       
   145 	     * @since S60 V3.2
       
   146 	     * @param aValue on return, On/Off value
       
   147 	     * @return Error code
       
   148 	     */
       
   149 	    IMPORT_C TInt GetValue( TOnOff& aValue ) const;
       
   150 
       
   151 	    /**
       
   152 	     * Sets the value of property. Value must match to datatype.
       
   153 	     *
       
   154 	     * @since S60 V3.2
       
   155 	     * @param aValue new On/Off value
       
   156 	     * @return Error code
       
   157 	     */
       
   158 	    IMPORT_C TInt SetValue( TOnOff aValue );
       
   159 
       
   160 	    /**
       
   161 	     * Sets the value of this property without datatype check
       
   162 	     *
       
   163 	     * @since S60 V3.2
       
   164 	     * @param aValue new value
       
   165 	     * @return Error code
       
   166 	     */
       
   167 	    TInt SetValueNoDataTypeCheck( const TDesC& aValue );
       
   168 
       
   169 	    /**
       
   170 	     * Returns datatype of given property
       
   171 	     *
       
   172 	     * @since S60 V3.2
       
   173 	     * @param aProperty property name
       
   174 	     * @return Datatype of given property
       
   175 	     */
       
   176 	    IMPORT_C static TPropertyDataType DataType( TServicePropertyName aProperty );
       
   177 	    
       
   178 	    /**
       
   179 	     * Returns property type of given property
       
   180 	     *
       
   181 	     * @since S60 V3.2
       
   182 	     * @param aProperty property name
       
   183 	     * @return property type of given property
       
   184 	     */
       
   185 	    IMPORT_C static TSPItemType PropertyType( TServicePropertyName aProperty );
       
   186 
       
   187 	    /**
       
   188 	     * Copies data from source property // to be removed?
       
   189 	     *
       
   190 	     * @since S60 V3.2
       
   191 	     * @param aSource source property
       
   192 	     */
       
   193 	    IMPORT_C void CopyL( const CSPProperty& aSource );
       
   194 
       
   195 	    /**
       
   196 	     * Compares data of this property to another.
       
   197 	     *
       
   198 	     * @since S60 V3.2
       
   199 	     * @param aProperty property to be compared
       
   200 	     * @return ETrue if properties have same data
       
   201 	     */
       
   202 	    IMPORT_C TBool operator==( 
       
   203 	                const CSPProperty& aProperty ) const;
       
   204 
       
   205 	private:
       
   206 
       
   207 	    /**
       
   208 	    * C++ default constructor.
       
   209 	    */
       
   210 	    CSPProperty();
       
   211 	    
       
   212 	    /**
       
   213 	    * By default Symbian 2nd phase constructor is private.
       
   214 	    */
       
   215 	    void ConstructL();
       
   216 
       
   217 	    /**
       
   218 	     * Sets default value of property if defined
       
   219 	     *
       
   220 	     * @since S60 V3.2
       
   221 	     * @param aProperty property name
       
   222 	     * @return An error code
       
   223 	     */
       
   224 	    TInt SetDefaultValue( TServicePropertyName aProperty );
       
   225 
       
   226 	private: // data
       
   227 
       
   228 	    /**
       
   229 	     * Descriptor of property value
       
   230 	     * Own.
       
   231 	     */
       
   232 	    RBuf               iPropertyValue;
       
   233 
       
   234 	    /**
       
   235 	     * Name of property
       
   236 	     */
       
   237 	    TServicePropertyName        iPropertyName;
       
   238 
       
   239 	    /**
       
   240 	     * Datatype of property
       
   241 	     */
       
   242 	    TPropertyDataType        iDataType;
       
   243 	    
       
   244 	    /**
       
   245 	     * Property type
       
   246 	     */
       
   247 	    TSPItemType        		iPropertyType;
       
   248     
       
   249     };
       
   250 
       
   251 
       
   252 #endif // C_SPPROPERTY_H