tsrc/propertystub/inc/e32property.h
changeset 15 ccd8e69b5392
parent 2 b31261fd4e04
child 20 e8be2c2e049d
child 22 496ad160a278
equal deleted inserted replaced
2:b31261fd4e04 15:ccd8e69b5392
     1 /*
       
     2 * Copyright (c) 2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __E32PROPERTY_H__
       
    19 #define __E32PROPERTY_H__
       
    20 
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 class RProperty
       
    25     {
       
    26     
       
    27 public:
       
    28 
       
    29     inline RProperty() { iRequestStatus = NULL; }
       
    30 
       
    31     /**
       
    32     The largest supported property value, in bytes, for byte-array (binary)
       
    33     types and text types.
       
    34     */
       
    35     enum { KMaxPropertySize = 512 };
       
    36     /**
       
    37     The largest supported property value, in bytes, for large byte-array (binary)
       
    38     types and large text types.
       
    39     */
       
    40     enum { KMaxLargePropertySize = 65535 };
       
    41 
       
    42 
       
    43     /**
       
    44     Property type attribute.
       
    45     */
       
    46     enum TType
       
    47         {
       
    48         /**
       
    49         Integral property type.
       
    50         */
       
    51         EInt,
       
    52 
       
    53 
       
    54         /**
       
    55         Byte-array (binary data) property type.
       
    56         This type provides real-time guarantees but is limited to a maximum size
       
    57         of 512 bytes.
       
    58 
       
    59         @see KMaxPropertySize
       
    60         */
       
    61         EByteArray,
       
    62 
       
    63 
       
    64         /**
       
    65         Text property type.
       
    66         This is just a programmer friendly view of a byte-array property, and
       
    67         is implemented in the same way as EByteArray.
       
    68         */
       
    69         EText = EByteArray,
       
    70 
       
    71 
       
    72         /**
       
    73         Large byte-array (binary data) property type.
       
    74         This type provides no real-time guarantees but supports properties
       
    75         of up to 65536 bytes.
       
    76 
       
    77         @see KMaxLargePropertySize
       
    78         */
       
    79         ELargeByteArray,
       
    80 
       
    81 
       
    82         /**
       
    83         Large text property type.
       
    84         This is just a programmer friendly view of a byte-array property, and
       
    85         is implemented in the same way as EByteArray.
       
    86         */
       
    87         ELargeText = ELargeByteArray,
       
    88 
       
    89 
       
    90         /**
       
    91         Upper limit for TType values.
       
    92         It is the maximal legal TType value plus 1.
       
    93         */
       
    94         ETypeLimit,
       
    95 
       
    96 
       
    97         /**
       
    98         Bitmask for TType values coded within TInt attributes.
       
    99         */
       
   100         ETypeMask = 0xff
       
   101         };
       
   102 
       
   103 
       
   104 public:    // Maintain the same order as in original header!
       
   105 
       
   106     static TInt Define(TUid aCategory, TUint aKey, TInt aAttr ,TInt aPreallocate=0 );
       
   107     //IMPORT_C static TInt Define(TUid aCategory, TUint aKey, TInt aAttr, const TSecurityPolicy& aReadPolicy, const TSecurityPolicy& aWritePolicy, TInt aPreallocated=0);
       
   108     //IMPORT_C static TInt Define(TUint aKey, TInt aAttr, const TSecurityPolicy& aReadPolicy, const TSecurityPolicy& aWritePolicy, TInt aPreallocated=0);
       
   109     static TInt Delete(TUid aCategory, TUint aKey);
       
   110     //IMPORT_C static TInt Delete(TUint aKey);
       
   111     static TInt Get(TUid aCategory, TUint aKey, TInt& aValue);
       
   112     static TInt Get(TUid aCategory, TUint aKey, TDes8& aValue);
       
   113     static TInt Get(TUid aCategory, TUint aKey, TDes16& aValue);
       
   114     static TInt Set(TUid aCategory, TUint aKey, TInt aValue);
       
   115     static TInt Set(TUid aCategory, TUint aKey, const TDesC8& aValue);
       
   116     static TInt Set(TUid aCategory, TUint aKey, const TDesC& aValue);
       
   117     TInt Get(TInt& aValue);
       
   118 
       
   119     TInt Attach( TUid aCategory, TUint aKey );//, TOwnerType aType = EOwnerProcess)
       
   120     void Subscribe(TRequestStatus& aRequest);
       
   121     void Cancel();
       
   122     
       
   123     //TInt Get(TInt& aValue);
       
   124 	//TInt Get(TDes8& aValue);
       
   125 
       
   126 	//TInt Get(TDes16& aValue);
       
   127     
       
   128     
       
   129 	TInt Set(TInt aValue);
       
   130 	//TInt Set(const TDesC8& aValue);
       
   131 
       
   132 	//TInt Set(const TDesC16& aValue);
       
   133 
       
   134 
       
   135 public: // Stub functions which is not in original e32property	
       
   136     void Close(); // in original header this is inherited from RHandleBase  
       
   137     static TInt Get(TUint& aKey,TInt& aVal);
       
   138 
       
   139 public: // Stub data's   
       
   140     enum TPropertyCalledFunctions
       
   141         {
       
   142         ENone,
       
   143         ECancel,
       
   144         EClose,
       
   145         EDefine
       
   146         };
       
   147     
       
   148     TRequestStatus* iRequestStatus;
       
   149     TInt iPValue;
       
   150     
       
   151     };
       
   152 
       
   153 class PropertyHelper
       
   154     {
       
   155     public :
       
   156     static void SetErrorCode(TInt aVal); 
       
   157     static RProperty::TPropertyCalledFunctions GetCalledFunction();   
       
   158     static void Close(); 
       
   159     
       
   160     };
       
   161 
       
   162 
       
   163 #endif